1.3 KiB
Memory subsystem
Introduction
The memory subsystem is responsible for handling tasks like physical pages allocations, virtual memory management, initial memory map analysis, pages mapping and unmapping and kernel heap management. Please note that, unless used with sh_malloc or sh_free, no object or function described in this subsystem is thread safe.
Summary
- Page subsystem
- Virtual memory layout
- Ring buffer
- Pages block allocator
- Slabs allocator
- Radix trees subsystem
- Pez plane manager
- Kernel heap manager
Memory subsystem
The memory subsystem is defined into shelter/lib/include/memory/memory.h and implemented into shelter/lib/include/memory/memory.c.
The entire memory subsystem is initialized with the sh_memory_init_subsystem() function. This function produces a sh_memory_MEMORY_SERVICES struct, which is stored in the main file and contains all the elements necessary for the memory subsystem initialization.
The memory subsystem also provides some higher level functions:
sh_memory_identity_map(sh_page_PHYSICAL_ADDRESS phys_start,sh_uint64 page_count,sh_uint64 flags): identity map a range of physical pages into the page table of the booting kernel. It is not thread safe.