From 64b32841a34b066406bdf21673f42f6f6e730359 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 9 Mar 2022 13:28:53 +0000 Subject: [PATCH] arch: x86_64: Write EBDA address to BIOS data area This allows ACPICA to find the EBDA and load the ACPI tables when scanning for them. Signed-off-by: Rob Bradford --- arch/src/x86_64/layout.rs | 3 +++ arch/src/x86_64/mod.rs | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/arch/src/x86_64/layout.rs b/arch/src/x86_64/layout.rs index 929387875..f48f8296c 100644 --- a/arch/src/x86_64/layout.rs +++ b/arch/src/x86_64/layout.rs @@ -24,6 +24,9 @@ pub const LOW_RAM_START: GuestAddress = GuestAddress(0x0); // == Fixed addresses within the "Low RAM" range: == +// Location of EBDA address +pub const EBDA_POINTER: GuestAddress = GuestAddress(0x40e); + // Initial GDT/IDT needed to boot kernel pub const BOOT_GDT_START: GuestAddress = GuestAddress(0x500); pub const BOOT_IDT_START: GuestAddress = GuestAddress(0x520); diff --git a/arch/src/x86_64/mod.rs b/arch/src/x86_64/mod.rs index 564dce1cf..04bb3bba8 100644 --- a/arch/src/x86_64/mod.rs +++ b/arch/src/x86_64/mod.rs @@ -186,6 +186,9 @@ pub enum Error { /// Error checking CPUID compatibility CpuidCheckCompatibility, + + // Error writing EBDA address + EbdaSetup(vm_memory::GuestMemoryError), } impl From for super::Error { @@ -802,6 +805,11 @@ pub fn configure_system( rsdp_addr: Option, sgx_epc_region: Option, ) -> super::Result<()> { + // Write EBDA address to location where ACPICA expects to find it + guest_mem + .write_obj((layout::EBDA_START.0 >> 4) as u16, layout::EBDA_POINTER) + .map_err(Error::EbdaSetup)?; + let size = smbios::setup_smbios(guest_mem).map_err(Error::SmbiosSetup)?; // Place the MP table after the SMIOS table aligned to 16 bytes