diff options
Diffstat (limited to 'kernel/src/lib.rs')
-rw-r--r-- | kernel/src/lib.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index f03ef36..a8be053 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -1,3 +1,4 @@ +#![allow(unused_attributes)] #![no_main] #![feature(custom_test_frameworks)] #![feature(abi_x86_interrupt)] @@ -21,6 +22,7 @@ pub use qemu::*; pub extern "C" fn _start() -> ! { init(); test_main(); + #[allow(clippy::empty_loop)] loop {} } @@ -33,4 +35,16 @@ fn panic(info: &core::panic::PanicInfo) -> ! { pub fn init() { interrupts::gdt::init(); interrupts::idt::init(); + let apic = unsafe { + interrupts::apic::try_initialize_local_apic() + .as_mut() + .expect("no APIC support") + }; + + apic.set_timer_interrupt_handler( + interrupts::apic::TimerDivideConfig::Div16, + interrupts::InterruptType::Timer, + ); + + x86_64::instructions::interrupts::enable(); } |