diff --git a/Cargo.toml b/Cargo.toml index 872dd9b8..46f8254b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,3 +8,4 @@ crate-type = ["staticlib"] [dependencies] rlibc = "*" +spin = "*" diff --git a/src/lib.rs b/src/lib.rs index 8cbf9724..1cd60a46 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,6 +17,7 @@ #![no_std] extern crate rlibc; +extern crate spin; mod vga_buffer; diff --git a/src/vga_buffer.rs b/src/vga_buffer.rs index 46c5f73a..d70e1859 100644 --- a/src/vga_buffer.rs +++ b/src/vga_buffer.rs @@ -1,8 +1,15 @@ use core::ptr::Unique; +use spin::Mutex; const BUFFER_HEIGHT: usize = 25; const BUFFER_WIDTH: usize = 80; +pub static WRITER: Mutex = Mutex::new(Writer { + column_position: 0, + color_code: ColorCode::new(Color::LightGreen, Color::Black), + buffer: unsafe{Unique::new(0xb8000 as *mut _)}, +}); + #[repr(u8)] pub enum Color { Black = 0,