Code for managing memory.
More...
|
file | mm.c |
| Implementation of basic memory functions.
|
|
file | mm.h |
| Definition of basic memory sizes and functions.
|
|
Code for managing memory.
◆ HIGH_MEMORY
Start of Memory Mapped Registers.
- See also
- MMIO_BASE
◆ LOW_MEMORY
4MB (First 4 MB of memory reserved for the kernel image and init task stack).
◆ PAGE_SHIFT
Bits to shift to define Page size.
◆ PAGE_SIZE
PAGE_SIZE: 4KB
- For kernel at address
0x0
: Start of stack, 4MB available for kernel (except stack).
- For kernel at address
0x8000
: 4064KB available for kernel till 4MB.
- For kernel at address
0x80000
: 3584KB available for kernel till 4MB.
2^12 = 4096 = 4KB
◆ PAGING_MEMORY
Available memory for paging
◆ PAGING_PAGES
◆ SECTION_SHIFT
Bits to shift to define Section size (= 21).
◆ SECTION_SIZE
◆ TABLE_SHIFT
Bits to shift to define Table size.
◆ free_page()
void free_page |
( |
uint64_t |
p | ) |
|
Function for deallocating memory pages.
- Parameters
-
p | 64-bit address of page to be deallocated. |
◆ get_free_page()
uint64_t get_free_page |
( |
| ) |
|
Function for allocating memory pages.
- Returns
- On success: Starting address (64-bit) of the allocated page.
- On failure: 0