|
|
@ -1,15 +1,10 @@
|
|
|
|
use core::ptr::Unique;
|
|
|
|
|
|
|
|
use core::fmt;
|
|
|
|
use core::fmt;
|
|
|
|
use spin::Mutex;
|
|
|
|
use spin::Mutex;
|
|
|
|
use volatile::Volatile;
|
|
|
|
use volatile::Volatile;
|
|
|
|
|
|
|
|
use lazy_static::lazy_static;
|
|
|
|
use x86_64::instructions::port::Port;
|
|
|
|
use x86_64::instructions::port::Port;
|
|
|
|
use crate::logging::Color;
|
|
|
|
use crate::logging::Color;
|
|
|
|
use crate::consts::KERNEL_OFFSET;
|
|
|
|
use crate::consts::KERNEL_OFFSET;
|
|
|
|
use lazy_static::lazy_static;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub const VGA_BUFFER: Unique<VgaBuffer> = unsafe {
|
|
|
|
|
|
|
|
Unique::new_unchecked((KERNEL_OFFSET + 0xb8000) as *mut _)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
|
|
struct ColorCode(u8);
|
|
|
|
struct ColorCode(u8);
|
|
|
@ -73,8 +68,7 @@ impl VgaBuffer {
|
|
|
|
|
|
|
|
|
|
|
|
lazy_static! {
|
|
|
|
lazy_static! {
|
|
|
|
pub static ref VGA_WRITER: Mutex<VgaWriter> = Mutex::new(
|
|
|
|
pub static ref VGA_WRITER: Mutex<VgaWriter> = Mutex::new(
|
|
|
|
// It is the only user of VGA_BUFFER. So it's safe.
|
|
|
|
VgaWriter::new(unsafe{ &mut *((KERNEL_OFFSET + 0xb8000) as *mut VgaBuffer) })
|
|
|
|
VgaWriter::new(unsafe{ &mut *VGA_BUFFER.as_ptr() })
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|