diff --git a/src/arch/x86_64/driver/console.rs b/src/arch/x86_64/driver/console.rs index c4325dc..1d088cc 100644 --- a/src/arch/x86_64/driver/console.rs +++ b/src/arch/x86_64/driver/console.rs @@ -1,6 +1,6 @@ pub fn init() { use consts::irq::IRQ_KBD; // TODO set irq handler - super::pic::enable_irq(IRQ_KBD); + // super::pic::enable_irq(IRQ_KBD); super::apic::IOAPIC.lock().enable(IRQ_KBD, 0); } \ No newline at end of file diff --git a/src/arch/x86_64/driver/pic.rs b/src/arch/x86_64/driver/pic.rs index 5da828e..6241c40 100644 --- a/src/arch/x86_64/driver/pic.rs +++ b/src/arch/x86_64/driver/pic.rs @@ -1,9 +1,18 @@ +// Copy from Redox + use syscall::io::*; use spin::Mutex; static MASTER: Mutex = Mutex::new(Pic::new(0x20)); static SLAVE: Mutex = Mutex::new(Pic::new(0xA0)); +pub fn disable() { + // Mask all interrupts (Copy from xv6 x86_64) + MASTER.lock().cmd.write(0xFF); + SLAVE.lock().cmd.write(0xFF); + debug!("pic: disabled"); +} + pub fn init() { assert_has_not_been_called!("pic::init must be called only once"); @@ -33,6 +42,8 @@ pub fn init() { // Ack remaining interrupts master.ack(); slave.ack(); + + debug!("pic: init end"); } pub fn enable_irq(irq: u8) diff --git a/src/lib.rs b/src/lib.rs index 6c4971c..417ddb4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -76,12 +76,12 @@ pub extern "C" fn rust_main(multiboot_information_address: usize) { let acpi = arch::driver::acpi::init().expect("Failed to init ACPI"); debug!("{:?}", acpi); + arch::driver::pic::disable(); + memory_controller.map_page_identity(acpi.lapic_addr as usize); // LAPIC memory_controller.map_page_identity(0xFEC00000); // IOAPIC arch::driver::apic::init(acpi.lapic_addr, acpi.ioapic_id); - arch::driver::pic::init(); - test_end!(); }