diff options
author | Timon Kruiper <timonkruiper@gmail.com> | 2022-05-12 22:53:44 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-05-12 23:14:05 +0200 |
commit | 9282e0db16b244a832db11078a4b3da91c5abdea (patch) | |
tree | 1dd08c4020de79e294240d7237ac9d29b054997f | |
parent | d451bdec6fd36f2ff0db9d8979dec7dd3f325061 (diff) | |
download | serenity-9282e0db16b244a832db11078a4b3da91c5abdea.zip |
Kernel: Move __assertion_failed to aarch64/Panic.cpp
This is for an upcoming change to add the Kernel namespace to the
init.cpp file.
-rw-r--r-- | Kernel/Arch/aarch64/Panic.cpp | 17 | ||||
-rw-r--r-- | Kernel/Arch/aarch64/init.cpp | 11 |
2 files changed, 13 insertions, 15 deletions
diff --git a/Kernel/Arch/aarch64/Panic.cpp b/Kernel/Arch/aarch64/Panic.cpp index 6f929852ff..88c86b1fcd 100644 --- a/Kernel/Arch/aarch64/Panic.cpp +++ b/Kernel/Arch/aarch64/Panic.cpp @@ -10,14 +10,23 @@ // FIXME: Merge the code in this file with Kernel/Panic.cpp once the proper abstractions are in place. -namespace Kernel { +// Note: This is required here, since __assertion_failed should be out of the Kernel namespace, +// but the PANIC macro uses functions that require the Kernel namespace. +using namespace Kernel; -void __panic(char const* file, unsigned int line, char const* function) +[[noreturn]] void __assertion_failed(char const* msg, char const* file, unsigned line, char const* func) +{ + critical_dmesgln("ASSERTION FAILED: {}", msg); + critical_dmesgln("{}:{} in {}", file, line, func); + + // Used for printing a nice backtrace! + PANIC("Aborted"); +} + +void Kernel::__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/Arch/aarch64/init.cpp b/Kernel/Arch/aarch64/init.cpp index c9b64ba5e4..34dd57a801 100644 --- a/Kernel/Arch/aarch64/init.cpp +++ b/Kernel/Arch/aarch64/init.cpp @@ -103,17 +103,6 @@ void __stack_chk_fail() Kernel::Processor::halt(); } -using namespace Kernel; - -[[noreturn]] void __assertion_failed(char const* msg, char const* file, unsigned line, char const* func) -{ - critical_dmesgln("ASSERTION FAILED: {}", msg); - critical_dmesgln("{}:{} in {}", file, line, func); - - // Used for printing a nice backtrace! - PANIC("Aborted"); -} - extern "C" void exception_common(TrapFrame const* const trap_frame) { constexpr bool print_stack_frame = true; |