1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 12:17:44 +00:00

Kernel: Print failed attempt to shutdown the machine

Because we don't parse ACPI AML yet, If we are not able to shut down
the machine with "hacky" emulation methods - halt and print this state
to the users so they know they can shutdown the machine by themselves.
This commit is contained in:
Liav A 2021-05-17 01:57:34 +03:00 committed by Linus Groh
parent 02b73cb93d
commit e6f333ae00

View file

@ -8,6 +8,7 @@
#include <Kernel/FileSystem/FileSystem.h>
#include <Kernel/IO.h>
#include <Kernel/Process.h>
#include <Kernel/TTY/ConsoleManagement.h>
namespace Kernel {
@ -37,6 +38,7 @@ KResultOr<int> Process::sys$halt()
return EPERM;
REQUIRE_NO_PROMISES;
ConsoleManagement::the().switch_to_debug();
dbgln("acquiring FS locks...");
FS::lock_all();
@ -50,8 +52,8 @@ KResultOr<int> Process::sys$halt()
// VirtualBox shutdown failed. Try Bochs/Old QEMU shutdown.
IO::out16(0xb004, 0x2000);
dbgln("shutdown attempts failed, applications will stop responding.");
return 0;
dmesgln("Shutdown can't be completed. It's safe to turn off the computer!");
Processor::halt();
}
}