Avoid deadlock by disabling interrupts in print! and serial_print! macros

This commit is contained in:
Philipp Oppermann
2019-01-25 14:14:26 +01:00
parent 1a39774ead
commit 5efcecc2f2
2 changed files with 15 additions and 5 deletions

View File

@@ -13,10 +13,14 @@ lazy_static! {
#[doc(hidden)]
pub fn _print(args: ::core::fmt::Arguments) {
use core::fmt::Write;
SERIAL1
.lock()
.write_fmt(args)
.expect("Printing to serial failed");
use x86_64::instructions::interrupts;
interrupts::without_interrupts(|| {
SERIAL1
.lock()
.write_fmt(args)
.expect("Printing to serial failed");
});
}
/// Prints to the host through the serial interface.