Handle KDB_WHY_TRAP return on arm and mips

Upon exit from the debugger, checking the return code of kdb_trap()
allows one to retry the fatal page fault. This matches what is done on
all other architectures.

Reviewed by:	jhb (earlier version)
Differential Revision:	https://reviews.freebsd.org/D27535
This commit is contained in:
Mitchell Horne 2021-01-02 19:07:04 -04:00
parent a3479cfd22
commit 65d1a4cfda
2 changed files with 12 additions and 2 deletions

View File

@ -562,6 +562,9 @@ abort_fatal(struct trapframe *tf, u_int idx, u_int fsr, u_int far,
bool usermode;
const char *mode;
const char *rw_mode;
#ifdef KDB
bool handled;
#endif
usermode = TRAPF_USERMODE(tf);
#ifdef KDTRACE_HOOKS
@ -609,8 +612,10 @@ abort_fatal(struct trapframe *tf, u_int idx, u_int fsr, u_int far,
#ifdef KDB
if (debugger_on_trap) {
kdb_why = KDB_WHY_TRAP;
kdb_trap(fsr, 0, tf);
handled = kdb_trap(fsr, 0, tf);
kdb_why = KDB_WHY_UNSET;
if (handled)
return (0);
}
#endif
panic("Fatal abort");

View File

@ -524,6 +524,9 @@ trap(struct trapframe *trapframe)
register_t pc;
int cop, error;
register_t *frame_regs;
#ifdef KDB
bool handled;
#endif
trapdebug_enter(trapframe, 0);
#ifdef KDB
@ -1091,8 +1094,10 @@ trap(struct trapframe *trapframe)
#ifdef KDB
if (debugger_on_trap) {
kdb_why = KDB_WHY_TRAP;
kdb_trap(type, 0, trapframe);
handled = kdb_trap(type, 0, trapframe);
kdb_why = KDB_WHY_UNSET;
if (handled)
return (trapframe->pc);
}
#endif
panic("trap");