git: 65d1a4cfda73 - main - Handle KDB_WHY_TRAP return on arm and mips
Mitchell Horne
mhorne at FreeBSD.org
Sat Jan 2 23:07:20 UTC 2021
The branch main has been updated by mhorne:
URL: https://cgit.FreeBSD.org/src/commit/?id=65d1a4cfda73201e34768d881a0b9206d00d4a71
commit 65d1a4cfda73201e34768d881a0b9206d00d4a71
Author: Mitchell Horne <mhorne at FreeBSD.org>
AuthorDate: 2021-01-02 23:07:04 +0000
Commit: Mitchell Horne <mhorne at FreeBSD.org>
CommitDate: 2021-01-02 23:07:04 +0000
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
---
sys/arm/arm/trap-v6.c | 7 ++++++-
sys/mips/mips/trap.c | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/sys/arm/arm/trap-v6.c b/sys/arm/arm/trap-v6.c
index e35187da6d07..16f166e83114 100644
--- a/sys/arm/arm/trap-v6.c
+++ b/sys/arm/arm/trap-v6.c
@@ -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");
diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c
index 78e7c0ed8113..96a2de4ee817 100644
--- a/sys/mips/mips/trap.c
+++ b/sys/mips/mips/trap.c
@@ -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 @@ err:
#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");
More information about the dev-commits-src-main
mailing list