diff --git a/headers/private/kernel/boot/kernel_args.h b/headers/private/kernel/boot/kernel_args.h index 87535eb4ef..5d226e5aa1 100644 --- a/headers/private/kernel/boot/kernel_args.h +++ b/headers/private/kernel/boot/kernel_args.h @@ -54,6 +54,7 @@ typedef struct kernel_args { addr_range virtual_allocated_range[MAX_VIRTUAL_ALLOCATED_RANGE]; uint32 num_kernel_args_ranges; addr_range kernel_args_range[MAX_KERNEL_ARGS_RANGE]; + uint64 ignored_physical_memory; uint32 num_cpus; addr_range cpu_kstack[MAX_BOOT_CPUS]; diff --git a/src/system/boot/platform/bios_ia32/mmu.cpp b/src/system/boot/platform/bios_ia32/mmu.cpp index f395da0ff6..aa25bc1e9a 100644 --- a/src/system/boot/platform/bios_ia32/mmu.cpp +++ b/src/system/boot/platform/bios_ia32/mmu.cpp @@ -653,7 +653,8 @@ mmu_init(void) // Type 1 is available memory if (extMemoryBlock[i].type == 1) { uint64 base = extMemoryBlock[i].base_addr; - uint64 end = base + extMemoryBlock[i].length; + uint64 length = extMemoryBlock[i].length; + uint64 end = base + length; // round everything up to page boundaries, exclusive of pages // it partially occupies @@ -675,6 +676,9 @@ mmu_init(void) if (base < 0x100000) base = 0x100000; + gKernelArgs.ignored_physical_memory + += length - (max_c(end, base) - base); + if (end <= base) continue; @@ -682,6 +686,9 @@ mmu_init(void) panic("mmu_init(): Failed to add physical memory range " "%#" B_PRIx64 " - %#" B_PRIx64 "\n", base, end); } + } else if (extMemoryBlock[i].type == 3) { + // ACPI reclaim -- physical memory we could actually use later + gKernelArgs.ignored_physical_memory += extMemoryBlock[i].length; } }