|
ArvernOS
|
#include <stdint.h>Data Structures | |
| struct | memory_region_t |
| struct | memory_regions_t |
| struct | memory_area_t |
| struct | memory_reserved_areas_t |
| struct | memory_framebuffer_t |
Macros | |
| #define | KERNEL_LOAD_ADDRESS 0x00100000 |
| #define | MEMORY_AVAILABLE 1 |
| Usable RAM (E820 type 1). | |
| #define | MEMORY_RESERVED 2 |
| Memory reserved (E820 type 2). | |
| #define | MEMORY_AREA_NO_ALLOC (1 << 0) |
| The frame allocator must not hand out frames in this area. | |
| #define | MEMORY_AREA_IDENTITY (1 << 1) |
| This area must remain identity-mapped when paging is enabled. | |
| #define | MEMORY_SECTION_WRITABLE 0x1 |
| The kernel section is writable. | |
| #define | MEMORY_SECTION_EXECUTABLE 0x2 |
| The kernel section holds executable code. | |
Typedefs | |
| typedef void(*) | memory_section_map_fn(uint64_t addr, uint64_t size, uint32_t flags) |
Physical memory handoff between the board's bootloader and the MMU.
A board learns the physical memory layout from its bootloader and normalizes it here, so that the architecture's frame allocator and paging code stay board-agnostic.
| #define KERNEL_LOAD_ADDRESS 0x00100000 |
Address where the kernel image is loaded, i.e. the end of low memory. Must match the load address set by the board's linker script.
| typedef void(*) memory_section_map_fn(uint64_t addr, uint64_t size, uint32_t flags) |
Called by memory_map_kernel_sections() for every allocated section of the kernel image.
| addr | the section start address |
| size | the section size in bytes |
| flags | a combination of MEMORY_SECTION_* |
| memory_framebuffer_t memory_get_framebuffer | ( | ) |
Returns the description of the linear framebuffer.
| memory_regions_t memory_get_regions | ( | ) |
Returns the physical memory map reported by the bootloader.
| memory_reserved_areas_t memory_get_reserved_areas | ( | ) |
Returns the physical address ranges reserved by the bootloader: the kernel image and the areas populated on top of plain RAM around it.
The areas array is owned by the board and remains valid until the next call to this function.
| void memory_map_kernel_sections | ( | memory_section_map_fn | map | ) |
Invokes map for every allocated section of the kernel image, so that paging can identity map each section with the right permissions.
The implementation must report page-granular ranges and sections must not overlap each other.
| map | the callback to invoke for each section |