Print the arm64 registers in more exception handling panics

It can be useful to get a dump of all registers when investigating why we
received an exception that we are unable to handle. In these cases we
already call panic, however we don't always print the registers.

Add calls to print_registers and print esr and far when applicable.

Sponsored by:	Innovate UK
This commit is contained in:
Andrew Turner 2020-07-14 18:50:48 +00:00
parent 1791cad0a9
commit a7f1b0cac9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=363191

View File

@ -170,8 +170,12 @@ static void
align_abort(struct thread *td, struct trapframe *frame, uint64_t esr,
uint64_t far, int lower)
{
if (!lower)
if (!lower) {
print_registers(frame);
printf(" far: %16lx\n", far);
printf(" esr: %.8lx\n", esr);
panic("Misaligned access from kernel space!");
}
call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr);
userret(td, frame);
@ -361,6 +365,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame)
} else {
print_registers(frame);
printf(" far: %16lx\n", far);
printf(" esr: %.8lx\n", esr);
panic("Unhandled EL1 %s abort: %x",
exception == EXCP_INSN_ABORT ? "instruction" :
"data", dfsc);
@ -397,6 +402,7 @@ do_el1h_sync(struct thread *td, struct trapframe *frame)
/* FALLTHROUGH */
default:
print_registers(frame);
printf(" far: %16lx\n", READ_SPECIALREG(far_el1));
panic("Unknown kernel exception %x esr_el1 %lx\n", exception,
esr);
}
@ -466,10 +472,14 @@ do_el0_sync(struct thread *td, struct trapframe *frame)
if (dfsc < nitems(abort_handlers) &&
abort_handlers[dfsc] != NULL)
abort_handlers[dfsc](td, frame, esr, far, 1);
else
else {
print_registers(frame);
printf(" far: %16lx\n", far);
printf(" esr: %.8lx\n", esr);
panic("Unhandled EL0 %s abort: %x",
exception == EXCP_INSN_ABORT_L ? "instruction" :
"data", dfsc);
}
break;
case EXCP_UNKNOWN:
if (!undef_insn(0, frame))