diff options
author | Timon Kruiper <timonkruiper@gmail.com> | 2022-05-03 01:39:47 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-05-03 21:53:36 +0200 |
commit | e81e1fa9c87197c643d3af8345af8499ecd3ea02 (patch) | |
tree | 15f77e2ca7fc4c946492ca652f68b7fec6325ee5 | |
parent | e7cf591ec066cc2a8475387dcae62b9b24f78764 (diff) | |
download | serenity-e81e1fa9c87197c643d3af8345af8499ecd3ea02.zip |
Kernel: Implement __panic() for the aarch64 Kernel
Now that dump_backtrace() works, we can actually print a helpful
backtrace when the Kernel panics.
-rw-r--r-- | Kernel/Arch/aarch64/Dummy.cpp | 10 | ||||
-rw-r--r-- | Kernel/Arch/aarch64/Panic.cpp | 23 | ||||
-rw-r--r-- | Kernel/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Kernel/Panic.h | 2 |
4 files changed, 26 insertions, 10 deletions
diff --git a/Kernel/Arch/aarch64/Dummy.cpp b/Kernel/Arch/aarch64/Dummy.cpp index 9c947b330a..ec9a1b117e 100644 --- a/Kernel/Arch/aarch64/Dummy.cpp +++ b/Kernel/Arch/aarch64/Dummy.cpp @@ -24,16 +24,6 @@ READONLY_AFTER_INIT Thread* g_finalizer; } -// Panic -namespace Kernel { - -void __panic(char const*, unsigned int, char const*) -{ - for (;;) { } -} - -} - // Random namespace Kernel { diff --git a/Kernel/Arch/aarch64/Panic.cpp b/Kernel/Arch/aarch64/Panic.cpp new file mode 100644 index 0000000000..6f929852ff --- /dev/null +++ b/Kernel/Arch/aarch64/Panic.cpp @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022, Timon Kruiper <timonkruiper@gmail.com> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include <Kernel/Arch/Processor.h> +#include <Kernel/KSyms.h> +#include <Kernel/Panic.h> + +// FIXME: Merge the code in this file with Kernel/Panic.cpp once the proper abstractions are in place. + +namespace Kernel { + +void __panic(char const* file, unsigned int line, char const* function) +{ + critical_dmesgln("at {}:{} in {}", file, line, function); + dump_backtrace(PrintToScreen::Yes); + + Processor::halt(); +} + +} diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 6619d410d0..6ef7641326 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -418,6 +418,7 @@ else() Arch/aarch64/kprintf.cpp Arch/aarch64/MainIdRegister.cpp Arch/aarch64/PageDirectory.cpp + Arch/aarch64/Panic.cpp Arch/aarch64/SafeMem.cpp Arch/aarch64/ScopedCritical.cpp Arch/aarch64/SmapDisabler.cpp diff --git a/Kernel/Panic.h b/Kernel/Panic.h index 152a41db55..0829964026 100644 --- a/Kernel/Panic.h +++ b/Kernel/Panic.h @@ -6,6 +6,8 @@ #pragma once +#include <AK/Format.h> + namespace Kernel { [[noreturn]] void __panic(char const* file, unsigned int line, char const* function); |