Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ HOST_ONLY_TEST_SRCS := \
tests/host/tmpfs_test.cpp \
tests/host/stack_builder_test.cpp \
tests/host/fdt_test.cpp \
tests/host/log_test.cpp \
tests/host/fw_cfg_test.cpp \
tests/host/ramfb_test.cpp \
tests/host/virtio_ring_test.cpp \
Expand Down
23 changes: 11 additions & 12 deletions arch/aarch64-linux-gnu/trap_aarch64.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
// Copyright (c) 2026 Marco Buschini <marco.buschini@gmail.com>

#include "core/log.hpp"
#include "cpu_context.hpp"
#include "hal/console.hpp"
#include "hal/cpu.hpp"
Expand Down Expand Up @@ -274,17 +275,15 @@ void aarch64_handle_sync_exception(HAL::CpuContext* ctx, uint64_t esr, uint64_t
}
}

print_str("\r\n[TRAP] Data/Instruction Abort Trap Captured!\r\n");
print_str(" Faulting Virtual Address (FAR_EL1): ");
print_hex64(far);
print_str("\r\n Syndrome Register (ESR_EL1): ");
print_hex64(esr);
print_str("\r\n");
Kernel::Log::warn("trap", "Data/Instruction Abort Trap Captured! FAR={:x} ESR={:x}",
Kernel::Log::hex(far), Kernel::Log::hex(esr));

dump_registers(arch_ctx);
if (!Kernel::Log::is_console_muted()) {
dump_registers(arch_ctx);
}

if (arch_ctx != nullptr && (arch_ctx->spsr_el1 & 0x0FU) == 0U) {
print_str("[TRAP] Terminating faulting EL0 process.\r\n");
Kernel::Log::warn("trap", "Terminating faulting EL0 process.");
if (Kernel::Process::Process::current() != nullptr) {
Kernel::Process::exit_current_process(-1);
}
Expand All @@ -293,14 +292,14 @@ void aarch64_handle_sync_exception(HAL::CpuContext* ctx, uint64_t esr, uint64_t

if (arch_ctx != nullptr) {
if (eclass == 0x21U) {
print_str(
"[TRAP] EL1 Instruction Fault detected! Returning to caller via LR...\r\n");
Kernel::Log::warn("trap",
"EL1 Instruction Fault detected! Returning to caller via LR...");
arch_ctx->elr_el1 = arch_ctx->x[30];
return;
}

print_str(
"[TRAP] EL1 Fault detected! Advancing ELR_EL1 past faulting instruction...\r\n");
Kernel::Log::warn("trap",
"EL1 Fault detected! Advancing ELR_EL1 past faulting instruction...");
arch_ctx->elr_el1 += 4U;
}
return;
Expand Down
Loading
Loading