Better vga buffer

This commit is contained in:
greg 2019-07-10 23:39:12 -07:00
parent df27e7c2ee
commit 0c0a53f1be
2 changed files with 10 additions and 7 deletions

View File

@ -13,7 +13,9 @@ fn panic(_info: &PanicInfo) -> !{
#[no_mangle]
pub extern "C" fn _start() -> ! {
vga_buffer::yolo();
use core::fmt::Write;
vga_buffer::WRITER.lock().write_str("Gamarjoba, munde").unwrap();
write!(vga_buffer::WRITER.lock(), ", hella {} bro", 2).unwrap();
loop {}
}

View File

@ -1,6 +1,7 @@
use volatile::Volatile;
use core::fmt;
use core::fmt::Write;
use spin::Mutex;
use lazy_static::lazy_static;
#[allow(dead_code)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@ -95,11 +96,11 @@ impl fmt::Write for Writer {
}
}
pub fn yolo() {
let mut writer = Writer {
lazy_static! {
pub static ref WRITER: Mutex<Writer> = Mutex::new(Writer {
column_position: 0, color_code: ColorCode::new(Color::Yellow, Color::Black),
buffer: unsafe { &mut *(0xb8000 as *mut Buffer) },
};
write!(writer, "Gamarjoba munde {}", 34);
});
}