mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-24 03:25:02 +00:00
Kernel: Make CrashHandler
more useful before init_stage2
Display some helpful information about crashes even before the first process is started.
This commit is contained in:
parent
466153e680
commit
e4019ba9dc
|
@ -16,8 +16,17 @@ namespace Kernel {
|
||||||
void handle_crash(Kernel::RegisterState const& regs, char const* description, int signal, bool out_of_memory)
|
void handle_crash(Kernel::RegisterState const& regs, char const* description, int signal, bool out_of_memory)
|
||||||
{
|
{
|
||||||
auto* current_thread = Thread::current();
|
auto* current_thread = Thread::current();
|
||||||
if (!current_thread)
|
if (!current_thread) {
|
||||||
PANIC("{} with !Thread::current()", description);
|
VERIFY(regs.previous_mode() == ExecutionMode::Kernel);
|
||||||
|
|
||||||
|
dbgln("CRASH: CPU #{} {} in kernel", Processor::current_id(), description);
|
||||||
|
|
||||||
|
dump_registers(regs);
|
||||||
|
if (Memory::MemoryManager::is_initialized())
|
||||||
|
MM.dump_kernel_regions();
|
||||||
|
|
||||||
|
PANIC("Crash in kernel with !Thread::current()");
|
||||||
|
}
|
||||||
|
|
||||||
auto crashed_in_kernel = regs.previous_mode() == ExecutionMode::Kernel;
|
auto crashed_in_kernel = regs.previous_mode() == ExecutionMode::Kernel;
|
||||||
if (!crashed_in_kernel && current_thread->has_signal_handler(signal) && !current_thread->should_ignore_signal(signal) && !current_thread->is_signal_masked(signal)) {
|
if (!crashed_in_kernel && current_thread->has_signal_handler(signal) && !current_thread->should_ignore_signal(signal) && !current_thread->is_signal_masked(signal)) {
|
||||||
|
|
Loading…
Reference in a new issue