mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:17:35 +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:
parent
02b73cb93d
commit
e6f333ae00
1 changed files with 4 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
||||||
#include <Kernel/FileSystem/FileSystem.h>
|
#include <Kernel/FileSystem/FileSystem.h>
|
||||||
#include <Kernel/IO.h>
|
#include <Kernel/IO.h>
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
|
#include <Kernel/TTY/ConsoleManagement.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ KResultOr<int> Process::sys$halt()
|
||||||
return EPERM;
|
return EPERM;
|
||||||
|
|
||||||
REQUIRE_NO_PROMISES;
|
REQUIRE_NO_PROMISES;
|
||||||
|
ConsoleManagement::the().switch_to_debug();
|
||||||
|
|
||||||
dbgln("acquiring FS locks...");
|
dbgln("acquiring FS locks...");
|
||||||
FS::lock_all();
|
FS::lock_all();
|
||||||
|
@ -50,8 +52,8 @@ KResultOr<int> Process::sys$halt()
|
||||||
// VirtualBox shutdown failed. Try Bochs/Old QEMU shutdown.
|
// VirtualBox shutdown failed. Try Bochs/Old QEMU shutdown.
|
||||||
IO::out16(0xb004, 0x2000);
|
IO::out16(0xb004, 0x2000);
|
||||||
dbgln("shutdown attempts failed, applications will stop responding.");
|
dbgln("shutdown attempts failed, applications will stop responding.");
|
||||||
|
dmesgln("Shutdown can't be completed. It's safe to turn off the computer!");
|
||||||
return 0;
|
Processor::halt();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue