summaryrefslogtreecommitdiff
path: root/kernel/src/lib.rs
diff options
context:
space:
mode:
authorDennis Kobert <dennis@kobert.dev>2021-04-18 19:01:54 +0200
committerDennis Kobert <dennis@kobert.dev>2021-04-18 19:01:54 +0200
commit496ccaaf750a4ec1c537c463eff56108e1cc0bb4 (patch)
treef0ccffc3fd823cc4016c29d45408c033c973e5d5 /kernel/src/lib.rs
parent8b810a009f8d29ba61a3c377fdeac06a3bbb151d (diff)
Further cleanupfurther-cleanup
* Bump x86_64 dep to version 0.1.14 * Rewrite LOCAL_APIC handling * Remove warnings
Diffstat (limited to 'kernel/src/lib.rs')
-rw-r--r--kernel/src/lib.rs14
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();
}