#include <oskit/x86/pc/base_multiboot.h>void base_multiboot_init_mem(void);
This function finds all physical memory available for general use and adds it to the malloc_lmm pool, as described in Section 10.14.3. It is normally called automatically during initialization by multiboot_main (see Section 10.14.8).This function uses the lower and upper memory size fields in the MultiBoot information structure to determine the total amount of physical memory available; it then adds all of this memory to the malloc_lmm pool except for the following ``special'' areas:
- The first 0x500 bytes of physical memory are left untouched, since this area contains BIOS data structures which the OS might want to access (or the BIOS itself, if the OS makes any BIOS calls).
- The area from 0xa0000 to 0x100000 is the I/O and ROM area, and therefore does not contain usable physical memory.
- The memory occupied by the kernel itself is skipped, so that the kernel will not trash its own code, data, or bss.
- All interesting boot loader data structures, which can be found through the MultiBoot information structure, are skipped, so that the OS can examine them later. This includes the kernel command line, the boot module information array, the boot modules themselves, and the strings associated with the boot modules.
This function uses phys_lmm_init to initialize the malloc_lmm, and phys_lmm_add to add available physical memory to it (see Section 10.11.1); as a consequence, this causes the physical memory found to be split up automatically according to the three main functional ``classes'' of PC memory: low 1MB memory accessible to real-mode software, low 16MB memory accessible to the built-in DMA controller, and ``all other'' memory. This division allows the OS to allocate ``special'' memory when needed for device access or for calls to real-mode BIOS routines, simply by specifying the appropriate flags in the LMM allocation calls.
XXX currently doesn't use the memory range array.
- phystokv
- 10.6.2
- boot_info
- 10.14.7
- phys_lmm_init
- 10.11.3
- phys_lmm_add
- 10.11.4
- strlen
- 9.4.18