Avoid deadlock on nested `print!` invokation

master
Philipp Oppermann 8 years ago
parent 59b8133396
commit 9f448fbe0e

@ -126,9 +126,7 @@ impl fmt::Write for Writer {
macro_rules! print { macro_rules! print {
($($arg:tt)*) => ({ ($($arg:tt)*) => ({
use core::fmt::Write; $crate::vga_buffer::print(format_args!($($arg)*));
let mut writer = $crate::vga_buffer::WRITER.lock();
writer.write_fmt(format_args!($($arg)*)).unwrap();
}); });
} }
@ -137,6 +135,11 @@ macro_rules! println {
($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*)); ($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*));
} }
pub fn print(args: fmt::Arguments) {
use core::fmt::Write;
WRITER.lock().write_fmt(args).unwrap();
}
pub fn clear_screen() { pub fn clear_screen() {
for _ in 0..BUFFER_HEIGHT { for _ in 0..BUFFER_HEIGHT {
println!(""); println!("");

Loading…
Cancel
Save