Gracefully fail if QEMU does not exit
This commit is contained in:
parent
fcf672a969
commit
dcf82e0b32
@ -1,6 +1,6 @@
|
|||||||
use x86_64::instructions::port::Port;
|
use x86_64::instructions::port::Port;
|
||||||
|
|
||||||
use crate::{kernel_heap::HEAP, physical_memory::PHYSICAL_MEMORY};
|
use crate::{kernel_heap::HEAP, physical_memory::PHYSICAL_MEMORY, println};
|
||||||
|
|
||||||
pub fn exit_qemu() -> ! {
|
pub fn exit_qemu() -> ! {
|
||||||
PHYSICAL_MEMORY.lock().print_stats();
|
PHYSICAL_MEMORY.lock().print_stats();
|
||||||
@ -8,5 +8,9 @@ pub fn exit_qemu() -> ! {
|
|||||||
unsafe {
|
unsafe {
|
||||||
Port::new(0xf4).write(0u32);
|
Port::new(0xf4).write(0u32);
|
||||||
}
|
}
|
||||||
unreachable!();
|
println!("Failed to quit QEMU! Disabling interupts and halting CPU!");
|
||||||
|
x86_64::instructions::interrupts::disable();
|
||||||
|
loop {
|
||||||
|
x86_64::instructions::hlt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user