ArvernOS
Loading...
Searching...
No Matches
memory.h File Reference
#include <stdint.h>
Include dependency graph for memory.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  memory_region_t
struct  memory_regions_t
 The physical memory map: a contiguous array of regions and its length. More...
struct  memory_reserved_areas_t
struct  memory_framebuffer_t

Macros

#define MEMORY_AVAILABLE   1
 Usable RAM.
#define MEMORY_RESERVED   2
 Memory reserved.
#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)

Functions

memory_regions_t memory_get_regions ()
memory_reserved_areas_t memory_get_reserved_areas ()
memory_framebuffer_t memory_get_framebuffer ()
void memory_map_kernel_sections (memory_section_map_fn map)

Detailed Description

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.

Typedef Documentation

◆ memory_section_map_fn

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.

Parameters
addrthe section start address
sizethe section size in bytes
flagsa combination of MEMORY_SECTION_*

Function Documentation

◆ memory_get_framebuffer()

memory_framebuffer_t memory_get_framebuffer ( )

Returns the description of the linear framebuffer.

Returns
the framebuffer description

◆ memory_get_regions()

memory_regions_t memory_get_regions ( )

Returns the physical memory map reported by the bootloader.

Returns
the regions and their count

◆ memory_get_reserved_areas()

memory_reserved_areas_t memory_get_reserved_areas ( )

Returns the physical address ranges reserved by the bootloader.

Returns
the reserved address ranges

◆ memory_map_kernel_sections()

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.

Parameters
mapthe callback to invoke for each section