From 496ccaaf750a4ec1c537c463eff56108e1cc0bb4 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sun, 18 Apr 2021 19:01:54 +0200 Subject: Further cleanup * Bump x86_64 dep to version 0.1.14 * Rewrite LOCAL_APIC handling * Remove warnings --- kernel/src/lib.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'kernel/src/lib.rs') 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(); } -- cgit v1.2.3-54-g00ecf