Pass the last exception trap frame to kdb_trap. This allows show registers

in ddb to show the traps registers, and not the registers from within the
panic call.

Sponsored by:	DARPA, AFRL
This commit is contained in:
Andrew Turner 2017-07-26 17:39:10 +00:00
parent ad89d783a6
commit ce793a529b

View File

@ -265,6 +265,7 @@ print_registers(struct trapframe *frame)
void
do_el1h_sync(struct thread *td, struct trapframe *frame)
{
struct trapframe *oframe;
uint32_t exception;
uint64_t esr, far;
@ -281,6 +282,18 @@ do_el1h_sync(struct thread *td, struct trapframe *frame)
"do_el1_sync: curthread: %p, esr %lx, elr: %lx, frame: %p", td,
esr, frame->tf_elr, frame);
oframe = td->td_frame;
switch (exception) {
case EXCP_BRK:
case EXCP_WATCHPT_EL1:
case EXCP_SOFTSTP_EL1:
break;
default:
td->td_frame = frame;
break;
}
switch(exception) {
case EXCP_FP_SIMD:
case EXCP_TRAP_FP:
@ -313,7 +326,8 @@ do_el1h_sync(struct thread *td, struct trapframe *frame)
case EXCP_WATCHPT_EL1:
case EXCP_SOFTSTP_EL1:
#ifdef KDB
kdb_trap(exception, 0, frame);
kdb_trap(exception, 0,
(td->td_frame != NULL) ? td->td_frame : frame);
#else
panic("No debugger in kernel.\n");
#endif
@ -323,6 +337,8 @@ do_el1h_sync(struct thread *td, struct trapframe *frame)
panic("Unknown kernel exception %x esr_el1 %lx\n", exception,
esr);
}
td->td_frame = oframe;
}
/*