Kernel: Add shutdown commands for other virtualizers

Source: https://wiki.osdev.org/Shutdown
This commit is contained in:
Luke 2020-08-26 03:51:05 +01:00 committed by Andreas Kling
parent 1a0c11cea2
commit 453affb101
Notes: sideshowbarker 2024-07-19 03:00:28 +09:00

View file

@ -63,7 +63,13 @@ int Process::sys$halt()
dbg() << "syncing mounted filesystems...";
FS::sync();
dbg() << "attempting system shutdown...";
// QEMU Shutdown
IO::out16(0x604, 0x2000);
// If we're here, the shutdown failed. Try VirtualBox shutdown.
IO::out16(0x4004, 0x3400);
// VirtualBox shutdown failed. Try Bochs/Old QEMU shutdown.
IO::out16(0xb004, 0x2000);
dbg() << "shutdown attempts failed, applications will stop responding.";
return 0;
}