Skip to content
Snippets Groups Projects
Commit ca511b98 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Add code to shut down QEMU with it's default ACPI settings, run cli hlt in loop

parent 504e93d1
No related branches found
No related tags found
No related merge requests found
...@@ -36,9 +36,17 @@ pub unsafe extern fn kstop() -> ! { ...@@ -36,9 +36,17 @@ pub unsafe extern fn kstop() -> ! {
Pio::<u8>::new(port).write(c); Pio::<u8>::new(port).write(c);
} }
// Magic shutdown using qemu default ACPI method
{
let port = 0x604;
let data = 0x2000;
println!("Shutdown with outb(0x{:X}, 0x{:X})", port, data);
Pio::<u16>::new(port).write(data);
}
// Magic code for VMWare. Also a hard lock. // Magic code for VMWare. Also a hard lock.
println!("Shutdown with cli hlt"); println!("Shutdown with cli hlt");
asm!("cli; hlt" : : : : "intel", "volatile"); loop {
asm!("cli; hlt" : : : : "intel", "volatile");
unreachable!(); }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment