2022-09-07 17:41:08 +00:00
|
|
|
#define MODULE "power"
|
|
|
|
|
2022-09-21 15:56:53 +00:00
|
|
|
#include "misc/shutdown.h"
|
2022-09-20 17:54:49 +00:00
|
|
|
#include "interrupts/Interrupts.h"
|
2022-09-06 10:13:43 +00:00
|
|
|
#include "io/IO.h"
|
|
|
|
#include "log/Log.h"
|
2022-09-21 15:56:53 +00:00
|
|
|
#include "misc/hang.h"
|
2022-09-06 10:13:43 +00:00
|
|
|
|
|
|
|
[[noreturn]] void shutdown()
|
|
|
|
{
|
2022-09-20 17:54:49 +00:00
|
|
|
Interrupts::disable();
|
2022-09-06 10:13:43 +00:00
|
|
|
kinfoln("Attempting shutdown using the Bochs method");
|
|
|
|
IO::outw(0xB004, 0x2000);
|
|
|
|
kinfoln("Attempting shutdown using the QEMU method");
|
|
|
|
IO::outw(0x604, 0x2000);
|
|
|
|
kinfoln("Attempting shutdown using the VirtualBox method");
|
|
|
|
IO::outw(0x4004, 0x3400);
|
|
|
|
kerrorln("Failed to shutdown, halting. It is now safe to turn off your computer manually, though.");
|
|
|
|
hang();
|
|
|
|
}
|