From 4fb9742639217942a84dfb25269c810ec90f2834 Mon Sep 17 00:00:00 2001 From: Pawel Wieczorkiewicz Date: Fri, 30 Jul 2021 15:35:47 +0200 Subject: [PATCH] acpi, pmm: add get_bios_ebda_addr() helper function Signed-off-by: Pawel Wieczorkiewicz --- common/acpi.c | 2 +- include/mm/pmm.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/common/acpi.c b/common/acpi.c index 997ff244..6eb573c3 100644 --- a/common/acpi.c +++ b/common/acpi.c @@ -103,7 +103,7 @@ static rsdp_rev1_t *acpi_find_rsdp(void) { uint32_t ebda_addr; rsdp_rev1_t *rsdp; - ebda_addr = (*(uint16_t *) paddr_to_virt_kern(EBDA_ADDR_ENTRY)) << 4; + ebda_addr = get_bios_ebda_addr(); rsdp = find_rsdp(paddr_to_virt_kern(ebda_addr), paddr_to_virt_kern(ebda_addr + KB(1))); if (rsdp) diff --git a/include/mm/pmm.h b/include/mm/pmm.h index d5dbf287..7f880f60 100644 --- a/include/mm/pmm.h +++ b/include/mm/pmm.h @@ -135,6 +135,10 @@ static inline bool in_kernel_section(const void *addr) { (addr >= _ptr(__start_rodata) && addr < _ptr(__end_rodata)); } +static inline uint32_t get_bios_ebda_addr(void) { + return (*(uint16_t *) paddr_to_virt_kern(EBDA_ADDR_ENTRY)) << 4; +} + #endif /* __ASSEMBLY__ */ #endif /* KTF_PMM_H */