From 9bf9b8b93adeb4908712ae1f8c6877215b146188 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Tue, 4 Feb 2020 12:33:00 +0000 Subject: [PATCH] Print useful debug data on unhandled kernel fault on arm64 When panicing because of an unhandled data abort from the kernel it is useful to know the register state and faulting address to aid debugging. Print these registers before calling panic. Sponsored by: DARPA, AFRL --- sys/arm64/arm64/trap.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 079061cad56d..629f9114cc04 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -357,12 +357,15 @@ do_el1h_sync(struct thread *td, struct trapframe *frame) far = READ_SPECIALREG(far_el1); dfsc = esr & ISS_DATA_DFSC_MASK; if (dfsc < nitems(abort_handlers) && - abort_handlers[dfsc] != NULL) + abort_handlers[dfsc] != NULL) { abort_handlers[dfsc](td, frame, esr, far, 0); - else + } else { + print_registers(frame); + printf(" far: %16lx\n", far); panic("Unhandled EL1 %s abort: %x", exception == EXCP_INSN_ABORT ? "instruction" : "data", dfsc); + } break; case EXCP_BRK: #ifdef KDTRACE_HOOKS