From 0f1f56d4adddcc9d83f06a0d181645cbabcc0e03 Mon Sep 17 00:00:00 2001 From: Kent McLeod Date: Tue, 8 Oct 2019 11:17:02 +1100 Subject: [PATCH] ia32, boot: Create device frames for unused RAM The ia32 kernel is supposed to pass through type 1 memory that is outside of the kernel window as device untyped. In a previous refactor this memory stopped getting created as untypeds. This behaviour is fixed by pre-clamping the memory before being given to the free region list. --- src/arch/x86/kernel/boot_sys.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/arch/x86/kernel/boot_sys.c b/src/arch/x86/kernel/boot_sys.c index 79c6ba120..bb8598d84 100644 --- a/src/arch/x86/kernel/boot_sys.c +++ b/src/arch/x86/kernel/boot_sys.c @@ -210,6 +210,11 @@ static BOOT_CODE bool_t add_mem_p_regs(p_region_t reg) printf("Dropping memory region 0x%lx-0x%lx, try increasing MAX_NUM_FREEMEM_REG\n", reg.start, reg.end); return false; } + if (reg.end > PADDR_TOP) { + assert(reg.start <= PADDR_TOP); + /* Clamp a region to the top of the kernel window if it extends beyond */ + reg.end = PADDR_TOP; + } printf("Adding physical memory region 0x%lx-0x%lx\n", reg.start, reg.end); boot_state.mem_p_regs.list[boot_state.mem_p_regs.count] = reg; boot_state.mem_p_regs.count++;