Add a minimal shutdown method, that only works on emulators (at least for now)
This commit is contained in:
parent
a8aca62771
commit
716974a916
3
kernel/include/power/shutdown.h
Normal file
3
kernel/include/power/shutdown.h
Normal file
@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
[[noreturn]] void shutdown();
|
@ -15,7 +15,7 @@
|
||||
#include "memory/KernelHeap.h"
|
||||
#include "memory/Memory.h"
|
||||
#include "panic/hang.h"
|
||||
#include "power/reboot.h"
|
||||
#include "power/shutdown.h"
|
||||
#include "render/BBRenderer.h"
|
||||
#include "render/Draw.h"
|
||||
#include "render/TextRenderer.h"
|
||||
@ -131,7 +131,7 @@ extern "C" void _start()
|
||||
}
|
||||
|
||||
sleep(2500);
|
||||
reboot();
|
||||
shutdown();
|
||||
|
||||
while (1) halt();
|
||||
loop:
|
||||
|
16
kernel/src/power/shutdown.cpp
Normal file
16
kernel/src/power/shutdown.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include "power/shutdown.h"
|
||||
#include "io/IO.h"
|
||||
#include "log/Log.h"
|
||||
#include "panic/hang.h"
|
||||
|
||||
[[noreturn]] void shutdown()
|
||||
{
|
||||
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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user