From bd3910579388424d885d7d839cd53d213f51ae96 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 25 Jan 2019 13:44:04 +0100 Subject: [PATCH] Split crate into lib.rs and main.rs --- src/lib.rs | 11 +++++++++++ src/main.rs | 16 +--------------- 2 files changed, 12 insertions(+), 15 deletions(-) create mode 100644 src/lib.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 00000000..9d52b3be --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,11 @@ +#![cfg_attr(not(test), no_std)] + +pub mod serial; +pub mod vga_buffer; + +pub unsafe fn exit_qemu() { + use x86_64::instructions::port::Port; + + let mut port = Port::::new(0xf4); + port.write(0); +} diff --git a/src/main.rs b/src/main.rs index 5fcae60c..9a14d932 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,31 +2,17 @@ #![cfg_attr(not(test), no_main)] #![cfg_attr(test, allow(unused_imports))] +use blog_os::println; use core::panic::PanicInfo; -mod serial; -mod vga_buffer; - #[cfg(not(test))] #[no_mangle] pub extern "C" fn _start() -> ! { println!("Hello World{}", "!"); - serial_println!("Hello Host{}", "!"); - - unsafe { - exit_qemu(); - } loop {} } -pub unsafe fn exit_qemu() { - use x86_64::instructions::port::Port; - - let mut port = Port::::new(0xf4); - port.write(0); -} - /// This function is called on panic. #[cfg(not(test))] #[panic_handler]