blob: de07ba8c79c82fb6355a45ea279efed078190af6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
use crate::io::{qemu, serial, vga_text};
use core::fmt::Write;
use core::panic::PanicInfo;
use qemu::{exit_qemu, QemuExitCode};
use serial::SerialStream;
use vga_text::OStream;
use x86_64::instructions::interrupts;
pub fn serial_should_panic(info: &PanicInfo) -> ! {
interrupts::disable();
let mut stdout = SerialStream::new();
write!(stdout, "\nOK\nsuccessfully panicked\n").unwrap();
exit_qemu(QemuExitCode::Success);
loop {}
}
pub fn serial_panic(info: &PanicInfo) -> ! {
interrupts::disable();
crate::io::panic_screen::show(info.message());
let mut stdout = SerialStream::new();
write!(
stdout,
"\nERR\nPanicked execute without -serial for more details\n{}",
info
)
.unwrap();
exit_qemu(QemuExitCode::Failed);
loop {}
}
pub fn should_panic(_info: &PanicInfo) -> ! {
interrupts::disable();
exit_qemu(QemuExitCode::Success);
loop {}
}
pub fn panic(info: &PanicInfo) -> ! {
interrupts::disable();
crate::io::panic_screen::show(info.message());
loop {}
}
|