mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-26 18:03:27 +04:00
47 lines
1003 B
Rust
47 lines
1003 B
Rust
use core::fmt;
|
|
|
|
mod vga_writer;
|
|
|
|
macro_rules! _debug {
|
|
($($arg:tt)*) => ({
|
|
$crate::io::debug(format_args!($($arg)*));
|
|
});
|
|
}
|
|
|
|
macro_rules! debug {
|
|
($fmt:expr) => (_debug!(concat!($fmt, "\n")));
|
|
($fmt:expr, $($arg:tt)*) => (_debug!(concat!($fmt, "\n"), $($arg)*));
|
|
}
|
|
|
|
macro_rules! print {
|
|
($($arg:tt)*) => ({
|
|
$crate::io::print(format_args!($($arg)*));
|
|
});
|
|
}
|
|
|
|
macro_rules! println {
|
|
($fmt:expr) => (print!(concat!($fmt, "\n")));
|
|
($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*));
|
|
}
|
|
|
|
use arch::driver::vga::Color;
|
|
|
|
fn print_in_color(args: fmt::Arguments, color: Color) {
|
|
use core::fmt::Write;
|
|
use arch::driver::vga::*;
|
|
let mut writer = vga_writer::VGA_WRITER.lock();
|
|
writer.set_color(color);
|
|
writer.write_fmt(args).unwrap();
|
|
}
|
|
|
|
pub fn print(args: fmt::Arguments) {
|
|
print_in_color(args, Color::LightGray);
|
|
}
|
|
|
|
pub fn debug(args: fmt::Arguments) {
|
|
print_in_color(args, Color::LightRed);
|
|
}
|
|
|
|
pub fn init() {
|
|
|
|
} |