x86_64: start the kernel bootstrap heap above 16MiB

this will keep the memory area below 16MiB free for DMA memory allocations.
This commit is contained in:
2026-02-21 11:24:36 +00:00
parent 6e39dd45a4
commit 9b2c2f6b29

View File

@@ -20,6 +20,19 @@
#define PTR32(x) ((void *)((uintptr_t)(x))) #define PTR32(x) ((void *)((uintptr_t)(x)))
/* the physical address of the start of the memblock heap.
* this is an arbirary value; the heap can start anywhere in memory.
* any reserved areas of memory (the kernel, bsp, bios data, etc) are
* automatically taken into account.
* HOWEVER, this value will dictate how much physical memory is required for
* the kernel to boot successfully.
* the value of 16MiB (0x1000000) means that all heap allocations will be
* above 16MiB, leaving the area below free for DMA operations.
* this value CAN be reduced all the way to zero to minimise the amount of
* memory required to boot, but this may leave you with no DMA memory available.
*/
#define MEMBLOCK_HEAP_START 0x1000000
static ml_cpu_block g_bootstrap_cpu = {0}; static ml_cpu_block g_bootstrap_cpu = {0};
/* start and end of kernel image (physical addresses) */ /* start and end of kernel image (physical addresses) */
@@ -33,7 +46,7 @@ static void bootstrap_cpu_init(void)
static void early_vm_init(uintptr_t reserve_end) static void early_vm_init(uintptr_t reserve_end)
{ {
uintptr_t alloc_start = VM_KERNEL_VOFFSET; uintptr_t alloc_start = VM_KERNEL_VOFFSET + MEMBLOCK_HEAP_START;
/* boot code mapped 2 GiB of memory from /* boot code mapped 2 GiB of memory from
VM_KERNEL_VOFFSET */ VM_KERNEL_VOFFSET */
uintptr_t alloc_end = VM_KERNEL_VOFFSET + 0x7fffffff; uintptr_t alloc_end = VM_KERNEL_VOFFSET + 0x7fffffff;