Kernel: Panic when an assertion is failed in aarch64 Kernel

This in turn makes sure that we get a nice backtrace when an assertion
failed, or when a VERIFY_NOT_REACHED() is hit.
This commit is contained in:
Timon Kruiper 2022-05-03 02:08:47 +02:00 committed by Andreas Kling
parent 771d0719ea
commit 2cf36a1ca2
Notes: sideshowbarker 2024-07-17 11:21:11 +09:00

View file

@ -19,6 +19,7 @@
#include <Kernel/Arch/aarch64/RPi/Timer.h> #include <Kernel/Arch/aarch64/RPi/Timer.h>
#include <Kernel/Arch/aarch64/RPi/UART.h> #include <Kernel/Arch/aarch64/RPi/UART.h>
#include <Kernel/KSyms.h> #include <Kernel/KSyms.h>
#include <Kernel/Panic.h>
static void draw_logo(); static void draw_logo();
static u32 query_firmware_version(); static u32 query_firmware_version();
@ -91,12 +92,15 @@ void __stack_chk_fail()
Prekernel::halt(); Prekernel::halt();
} }
using namespace Kernel;
[[noreturn]] void __assertion_failed(char const* msg, char const* file, unsigned line, char const* func) [[noreturn]] void __assertion_failed(char const* msg, char const* file, unsigned line, char const* func)
{ {
critical_dmesgln("ASSERTION FAILED: {}", msg); critical_dmesgln("ASSERTION FAILED: {}", msg);
critical_dmesgln("{}:{} in {}", file, line, func); critical_dmesgln("{}:{} in {}", file, line, func);
Prekernel::halt(); // Used for printing a nice backtrace!
PANIC("Aborted");
} }
extern "C" void exception_common(TrapFrame const* const trap_frame) extern "C" void exception_common(TrapFrame const* const trap_frame)