diff --git a/common/acpi.c b/common/acpi.c index 6eb573c3..62c5c130 100644 --- a/common/acpi.c +++ b/common/acpi.c @@ -33,9 +33,6 @@ #include #include -#define ACPI_RSDP_BIOS_ROM_START 0xE0000 -#define ACPI_RSDP_BIOS_ROM_STOP 0xFFFFF - acpi_table_t *acpi_tables[128]; unsigned max_acpi_tables; @@ -109,8 +106,8 @@ static rsdp_rev1_t *acpi_find_rsdp(void) { if (rsdp) return rsdp; - rsdp = find_rsdp(paddr_to_virt_kern(ACPI_RSDP_BIOS_ROM_START), - paddr_to_virt_kern(ACPI_RSDP_BIOS_ROM_STOP)); + rsdp = find_rsdp(paddr_to_virt_kern(BIOS_ACPI_ROM_START), + paddr_to_virt_kern(BIOS_ACPI_ROM_STOP)); if (rsdp) return rsdp; diff --git a/common/setup.c b/common/setup.c index b28b199d..d0cf7bb5 100644 --- a/common/setup.c +++ b/common/setup.c @@ -179,6 +179,19 @@ void zap_boot_mappings(void) { } } +static void map_bios_area(void) { + vmap_4k(paddr_to_virt(BDA_ADDR_START), paddr_to_mfn(BDA_ADDR_START), L1_PROT_RO); + kmap_4k(paddr_to_mfn(BDA_ADDR_START), L1_PROT_RO); + + uint32_t ebda_addr = get_bios_ebda_addr(); + vmap_4k(paddr_to_virt(ebda_addr), paddr_to_mfn(ebda_addr), L1_PROT_RO); + kmap_4k(paddr_to_mfn(ebda_addr), L1_PROT_RO); + + for (mfn_t bios_mfn = paddr_to_mfn(BIOS_ACPI_ROM_START); + bios_mfn < paddr_to_mfn(BIOS_ACPI_ROM_STOP); bios_mfn++) + kmap_4k(bios_mfn, L1_PROT_RO); +} + void __noreturn __text_init kernel_start(uint32_t multiboot_magic, multiboot_info_t *mbi) { /* Zero-out BSS sections */ @@ -220,6 +233,7 @@ void __noreturn __text_init kernel_start(uint32_t multiboot_magic, init_pagetables(); map_multiboot_areas(); + map_bios_area(); write_cr3(cr3.paddr); WRITE_SP(get_free_pages_top(PAGE_ORDER_2M, GFP_KERNEL)); diff --git a/include/mm/pmm.h b/include/mm/pmm.h index 7f880f60..cd585f7f 100644 --- a/include/mm/pmm.h +++ b/include/mm/pmm.h @@ -31,6 +31,9 @@ #define BDA_COM_PORTS_ENTRY 0x400 #define EBDA_ADDR_ENTRY 0x40E +#define BIOS_ACPI_ROM_START 0xE0000 +#define BIOS_ACPI_ROM_STOP 0xFFFFF + #define BIOS_ROM_ADDR_START 0xF0000 #ifndef __ASSEMBLY__