Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove obsolete function detect_from_uhyve #726

Merged
merged 1 commit into from
Apr 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions src/arch/x86_64/kernel/apic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ fn detect_from_acpi() -> Result<PhysAddr, ()> {
#[cfg(feature = "acpi")]
fn detect_from_acpi() -> Result<PhysAddr, ()> {
// Get the Multiple APIC Description Table (MADT) from the ACPI information and its specific table header.
let madt = acpi::get_madt().expect("HermitCore requires a MADT in the ACPI tables");
let madt = acpi::get_madt().ok_or(())?;
let madt_header = unsafe { &*(madt.table_start_address() as *const AcpiMadtHeader) };

// Jump to the actual table entries (after the table header).
Expand Down Expand Up @@ -429,33 +429,22 @@ fn default_apic() -> PhysAddr {

let default_address = PhysAddr(0xFEE0_0000);

init_ioapic_address(default_address);
// currently, uhyve doesn't support an IO-APIC
if !env::is_uhyve() {
init_ioapic_address(default_address);
}

default_address
}

fn detect_from_uhyve() -> Result<PhysAddr, ()> {
if env::is_uhyve() {
let default_address = PhysAddr(0xFEE0_0000);

// currently, uhyve doesn't support an IO-APIC
//init_ioapic_address(default_address);

Ok(default_address)
} else {
Err(())
}
}

#[no_mangle]
pub extern "C" fn eoi() {
local_apic_write(IA32_X2APIC_EOI, APIC_EOI_ACK);
}

pub fn init() {
// Detect CPUs and APICs.
let local_apic_physical_address = detect_from_uhyve()
.or_else(|_| detect_from_acpi())
let local_apic_physical_address = detect_from_acpi()
.or_else(|_| detect_from_mp())
.unwrap_or_else(|_| default_apic());

Expand Down