Move lapic to kernel virtual

master
WangRunji 7 years ago
parent f4b9308f2c
commit 932e2fc290

@ -14,7 +14,6 @@ pub fn init(mut page_map: impl FnMut(usize, usize)) -> acpi::AcpiResult {
page_map(0, 1); // EBDA page_map(0, 1); // EBDA
page_map(0xe0_000, 0x100 - 0xe0); page_map(0xe0_000, 0x100 - 0xe0);
page_map(0x07fe1000, 1); // RSDT page_map(0x07fe1000, 1); // RSDT
page_map(0xfee00000, 1); // LAPIC
page_map(0xfec00000, 1); // IOAPIC page_map(0xfec00000, 1); // IOAPIC
let acpi = acpi::init().expect("Failed to init ACPI"); let acpi = acpi::init().expect("Failed to init ACPI");
@ -23,7 +22,8 @@ pub fn init(mut page_map: impl FnMut(usize, usize)) -> acpi::AcpiResult {
if cfg!(feature = "use_apic") { if cfg!(feature = "use_apic") {
pic::disable(); pic::disable();
apic::init(acpi.lapic_addr, acpi.ioapic_id); use consts::KERNEL_OFFSET;
apic::init((KERNEL_OFFSET + 0xfee00000) as *const (), acpi.ioapic_id);
} else { } else {
pic::init(); pic::init();
} }

@ -235,7 +235,6 @@ fn new_page_table_with_kernel() -> InactivePageTable {
active_table.with(&mut page_table, |pt: &mut ActivePageTable| { active_table.with(&mut page_table, |pt: &mut ActivePageTable| {
table[KERNEL_PML4] = e510; table[KERNEL_PML4] = e510;
table[KERNEL_HEAP_PML4] = e509; table[KERNEL_HEAP_PML4] = e509;
pt.identity_map(Frame::of_addr(0xfee00000), EntryFlags::PRESENT | EntryFlags::WRITABLE, &mut frame_allocator()).unwrap().flush(); // LAPIC
}); });
page_table page_table
} }

@ -135,6 +135,7 @@ fn remap_the_kernel(boot_info: BootInformation) -> MemorySet {
use consts::{KERNEL_OFFSET, KERNEL_HEAP_OFFSET, KERNEL_HEAP_SIZE}; use consts::{KERNEL_OFFSET, KERNEL_HEAP_OFFSET, KERNEL_HEAP_SIZE};
memory_set.push(MemoryArea::new_kernel(KERNEL_OFFSET + 0xb8000, KERNEL_OFFSET + 0xb9000, MemoryAttr::default(), "VGA")); memory_set.push(MemoryArea::new_kernel(KERNEL_OFFSET + 0xb8000, KERNEL_OFFSET + 0xb9000, MemoryAttr::default(), "VGA"));
memory_set.push(MemoryArea::new_kernel(KERNEL_OFFSET + 0xfee00000, KERNEL_OFFSET + 0xfee01000, MemoryAttr::default(), "LAPIC"));
memory_set.push(MemoryArea::new(KERNEL_HEAP_OFFSET, KERNEL_HEAP_OFFSET + KERNEL_HEAP_SIZE, MemoryAttr::default(), "kernel_heap")); memory_set.push(MemoryArea::new(KERNEL_HEAP_OFFSET, KERNEL_HEAP_OFFSET + KERNEL_HEAP_SIZE, MemoryAttr::default(), "kernel_heap"));
debug!("{:#x?}", memory_set); debug!("{:#x?}", memory_set);

Loading…
Cancel
Save