Basic memory managment.
More...
Basic memory managment.
Handles the loading of the UEFI memory map and setting up a basic memory allocator for after we have exited boot services but before we jump to the kernel as we cant use the normal memory allocator after exiting boot services.
◆ MEM_BASIC_ALLOCATOR_MIN_PAGES
| #define MEM_BASIC_ALLOCATOR_MIN_PAGES 8192 |
The minimum amount of pages that we will reserve for the basic allocator.
Definition at line 22 of file mem.h.
◆ MEM_BASIC_ALLOCATOR_RESERVE_PERCENTAGE
| #define MEM_BASIC_ALLOCATOR_RESERVE_PERCENTAGE 5 |
The percentage of available memory that we will reserve for the basic allocator.
This is rounded up to at least MEM_BASIC_ALLOCATOR_MIN_PAGES.
Definition at line 29 of file mem.h.
◆ mem_init()
| EFI_STATUS mem_init |
( |
void |
| ) |
|
Initializes the basic memory allocator.
- Returns
- On success,
EFI_SUCCESS. On failure, an error code.
Definition at line 22 of file mem.c.
◆ mem_map_init()
Initialize and load the memory map provided by the UEFI firmware.
- Parameters
-
| map | The boot memory map structure to initialize. |
- Returns
- On success,
EFI_SUCCESS. On failure, an error code.
Definition at line 64 of file mem.c.
◆ mem_map_deinit()
Deinitializes the memory map and frees any allocated resources.
- Parameters
-
| map | The boot memory map structure to deinitialize. |
Definition at line 83 of file mem.c.
◆ mem_page_table_init()
Initializes a page table for use by the kernel.
This function sets up a new page table and maps the memory regions specified in the boot memory map, the graphics output protocol (GOP) framebuffer, and the kernel itself.
It is intended to be used after exiting UEFI boot services and will fill the screen with a solid color and halt the CPU if it encounters an error, as there is very little we can do in that situation.
- Parameters
-
| table | The page table to initialize. |
| map | The boot memory map containing memory descriptors to be mapped. |
| gop | The graphics output protocol information for mapping the framebuffer. |
| kernel | The kernel information for mapping the kernel binary. |
Definition at line 125 of file mem.c.