From b8206b895f56ca94931dabaa82206ddab49b6014 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 26 Oct 2018 16:44:42 +0200 Subject: [PATCH] Move PICS import into _start function --- .../second-edition/posts/08-hardware-interrupts/index.md | 4 +++- src/main.rs | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/blog/content/second-edition/posts/08-hardware-interrupts/index.md b/blog/content/second-edition/posts/08-hardware-interrupts/index.md index d228cc7d..e2fdcfaf 100644 --- a/blog/content/second-edition/posts/08-hardware-interrupts/index.md +++ b/blog/content/second-edition/posts/08-hardware-interrupts/index.md @@ -147,12 +147,14 @@ Until now nothing happened because interrupts are still disabled in the CPU conf #[cfg(not(test))] #[no_mangle] pub extern "C" fn _start() -> ! { + use blog_os::interrupts::PICS; // new + println!("Hello World{}", "!"); blog_os::gdt::init(); blog_os::interrupts::init_idt(); unsafe { PICS.lock().initialize() }; - x86_64::instructions::interrupts::enable(); // new + x86_64::instructions::interrupts::enable(); // new println!("It did not crash!"); loop {} diff --git a/src/main.rs b/src/main.rs index 71dfc701..c9890b1b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,6 @@ extern crate blog_os; extern crate x86_64; -use blog_os::interrupts::PICS; use core::panic::PanicInfo; /// This function is the entry point, since the linker looks for a function @@ -14,6 +13,8 @@ use core::panic::PanicInfo; #[cfg(not(test))] #[no_mangle] // don't mangle the name of this function pub extern "C" fn _start() -> ! { + use blog_os::interrupts::PICS; + println!("Hello World{}", "!"); blog_os::gdt::init();