#include <oskit/x86/pc/phys_lmm.h>
There are three priority values assigned to regions of physical memory as they are made available at boot time (via lmm_add_region). In increasing order of priority (i.e., increasing preference for allocation):These priorities prevent the simple memory allocation interfaces from handing out the more precious low-address memory. To enable savvy applications to explicitly allocate memory of a given type, the following flag values are assigned at boot time and can be passed to LMM allocation routines:
- LMM_PRI_1MB
- For physical memory below 1MB.
- LMM_PRI_16MB
- For physical memory below 16MB.
- LMM_PRI_HIGH
- For physical memory above 16MB.
Thus, if neither flag is set, memory can be allocated from any of the three regions with preference given to LMM_PRI_HIGH, followed by LMM_PRI_16MB and LMM_PRI_1MB. If just LMMF_16MB is set, memory can be allocated from either LMM_PRI_16MB or LMM_PRI_1MB in that order. If both flags are set, memory can only be allocated from the LMM_PRI_1MB region.
- LMMF_1MB
- Set on memory below 1MB; i.e., the LMM_PRI_1MB region.
- LMMF_16MB
- Set on memory below 16MB; i.e., the LMM_PRI_1MB and LMM_PRI_16MB regions.