1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:07:34 +00:00

Kernel/aarch64: Move exception handler to Interrupts.cpp

Also dump the registers in a nicer format.
This commit is contained in:
Timon Kruiper 2023-01-08 13:23:55 +01:00 committed by Andreas Kling
parent 22b1e1076a
commit 05659debd1
2 changed files with 55 additions and 35 deletions

View file

@ -31,41 +31,6 @@
#include <Kernel/Panic.h>
#include <Kernel/Scheduler.h>
extern "C" void exception_common(Kernel::TrapFrame const* const trap_frame);
extern "C" void exception_common(Kernel::TrapFrame const* const trap_frame)
{
constexpr bool print_stack_frame = true;
if constexpr (print_stack_frame) {
dbgln("Exception Generated by processor!");
auto* regs = trap_frame->regs;
for (auto reg = 0; reg < 31; reg++) {
dbgln("x{}: {:x}", reg, regs->x[reg]);
}
// Special registers
dbgln("spsr_el1: {:x}", regs->spsr_el1);
dbgln("elr_el1: {:x}", regs->elr_el1);
dbgln("tpidr_el0: {:x}", regs->tpidr_el0);
dbgln("sp_el0: {:x}", regs->sp_el0);
auto esr_el1 = Kernel::Aarch64::ESR_EL1::read();
dbgln("esr_el1: EC({:#b}) IL({:#b}) ISS({:#b}) ISS2({:#b})", esr_el1.EC, esr_el1.IL, esr_el1.ISS, esr_el1.ISS2);
dbgln("Exception Class: {}", Aarch64::exception_class_to_string(esr_el1.EC));
if (Aarch64::exception_class_has_set_far(esr_el1.EC))
dbgln("Faulting Virtual Address: 0x{:x}", Aarch64::FAR_EL1::read().virtual_address);
if (Aarch64::exception_class_is_data_abort(esr_el1.EC))
dbgln("Data Fault Status Code: {}", Aarch64::data_fault_status_code_to_string(esr_el1.ISS));
dump_backtrace_from_base_pointer(regs->x[29]);
}
Kernel::Processor::halt();
}
typedef void (*ctor_func_t)();
extern ctor_func_t start_heap_ctors[];
extern ctor_func_t end_heap_ctors[];