31 lines
692 B
Rust
31 lines
692 B
Rust
use core::fmt;
|
|
use x86_64::instructions::interrupts;
|
|
|
|
use crate::logger::vga::Writer;
|
|
|
|
impl fmt::Write for Writer {
|
|
fn write_str(&mut self, s: &str) -> fmt::Result {
|
|
self.write_string(s);
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! print {
|
|
($($arg:tt)*) => ($crate::logger::vga::macros::_print(format_args!($($arg)*)));
|
|
}
|
|
|
|
#[macro_export]
|
|
macro_rules! println {
|
|
() => ($crate::print!("\n"));
|
|
($($arg:tt)*) => ($crate::print!("{}\n", format_args!($($arg)*)));
|
|
}
|
|
|
|
#[doc(hidden)]
|
|
pub fn _print(args: fmt::Arguments) {
|
|
use core::fmt::Write;
|
|
interrupts::without_interrupts(|| {
|
|
crate::logger::vga::WRITER.lock().write_fmt(args).unwrap();
|
|
});
|
|
}
|