next up previous contents index
Next: 15.2.2 Allocation priority Up: 15.2 Memory regions Previous: 15.2 Memory regions

15.2.1 Region flags

The region flags, of type lmm_flags_t, generally indicate certain features or capabilities of a particular range of memory. Allocation requests can specify a mask of flag bits that indicate which region(s) the allocation may be made from. For each flag bit set in the allocation request, the corresponding bit must be set in the region in order for the region to be considered for satisfying the allocation.

For example, on PCs, the lowest 1MB of physical memory is ``special'' in that only it can be accessed from real mode, and the lowest 16MB of physical memory is special in that only it can be accessed by the built-in DMA controller. Thus, typical behavior on a PC would be to create three LMM regions: one covering the lowest 1MB of physical memory, one covering the next 15MB, and one covering all other physical memory. The first region would have the ``1MB memory'' and ``16MB memory'' bits set in its associated flags word, the second region would have only the ``16MB memory'' bit set, and the third region would have neither. Normal allocations would be done with a flags word of zero, which allows the allocation to be satisfied from any region, but, for example, allocations of DMA buffers would be done with the ``16MB memory'' flag set, which will force the LMM to allocate from either the first or second region. (In fact, this is the default arrangement used by the libkern library when setting up physical memory for an OS running on a PC; see Section 10.11 for more details.)



University of Utah Flux Research Group