From 641fadb3e911ffc4c4fc3f9c2177f360f03bc259 Mon Sep 17 00:00:00 2001 From: Benjamin Lamowski Date: Mon, 16 Jan 2023 17:11:35 +0100 Subject: [PATCH] base-hw: remove memory hole in bootstrap page table Tests on qemu would fail when started with RAM sizes from 1025MiB to 2048MiB, because the the mapping hole in the page table from 1GiB to 2GiB would interfere with qemu's mapping addresses for ACPI. Identity-map the complete first 4GiB of memory to catch all early memory accesses during bootstrap. Fixes #4724. --- .../bootstrap/spec/x86_64/crt0_translation_table.s | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/repos/base-hw/src/bootstrap/spec/x86_64/crt0_translation_table.s b/repos/base-hw/src/bootstrap/spec/x86_64/crt0_translation_table.s index 6fbde692ce..9a374a4d28 100644 --- a/repos/base-hw/src/bootstrap/spec/x86_64/crt0_translation_table.s +++ b/repos/base-hw/src/bootstrap/spec/x86_64/crt0_translation_table.s @@ -18,7 +18,7 @@ .data /******************************************** - ** Identity mapping from 4KiB to 1GiB ** + ** Identity mapping from 4KiB to 4GiB ** ** plus mappings for LAPIC, I/O APIC MMIO ** ** Page 0 containing the Bios Data Area ** ** gets mapped to 2MiB - 4KiB readonly. ** @@ -35,7 +35,7 @@ .p2align MIN_PAGE_SIZE_LOG2 _kernel_pdp: .quad _kernel_pd_0 + 0xf - .fill 1, 8, 0x0 + .quad _kernel_pd_1 + 0xf .quad _kernel_pd_2 + 0xf .quad _kernel_pd_3 + 0xf .fill 508, 8, 0x0 @@ -50,6 +50,15 @@ .set entry, entry + 0x200000 .endr + /* PD [1G-2G) */ + .p2align MIN_PAGE_SIZE_LOG2 + _kernel_pd_1: + .set entry, 0x4000018f + .rept 512 + .quad entry + .set entry, entry + 0x200000 + .endr + /* PD [2G-3G) */ .p2align MIN_PAGE_SIZE_LOG2 _kernel_pd_2: