mirror of
https://github.com/justinian/jsix.git
synced 2025-12-11 08:54:31 -08:00
[boot][kernel] Replace frame allocator with bitmap-based one
The previous frame allocator involved a lot of splitting and merging linked lists and lost all information about frames while they were allocated. The new allocator is based on an array of descriptor structures and a bitmap. Each memory map region of allocatable memory becomes one or more descriptors, each mapping up to 1GiB of physical memory. The descriptors implement two levels of a bitmap tree, and have a pointer into the large contiguous bitmap to track individual pages.
This commit is contained in:
@@ -35,11 +35,17 @@ namespace memory {
|
||||
constexpr uintptr_t stacks_start = heap_start - kernel_max_stacks;
|
||||
|
||||
/// Max size of kernel buffers area
|
||||
constexpr size_t kernel_max_buffers = 0x10000000000ull; // 1TiB
|
||||
constexpr size_t kernel_max_buffers = 0x8000000000ull; // 512GiB
|
||||
|
||||
/// Start of kernel buffers
|
||||
constexpr uintptr_t buffers_start = stacks_start - kernel_max_buffers;
|
||||
|
||||
/// Max size of kernel bitmap area
|
||||
constexpr size_t kernel_max_bitmap = 0x8000000000ull; // 512GiB
|
||||
|
||||
/// Start of kernel bitmap
|
||||
constexpr uintptr_t bitmap_start = buffers_start - kernel_max_bitmap;
|
||||
|
||||
/// First kernel space PML4 entry
|
||||
constexpr unsigned pml4e_kernel = 256;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user