svn commit: r314371 - head/sys/powerpc/powerpc
Justin Hibbits
jhibbits at FreeBSD.org
Tue Feb 28 04:31:30 UTC 2017
Author: jhibbits
Date: Tue Feb 28 04:31:28 2017
New Revision: 314371
URL: https://svnweb.freebsd.org/changeset/base/314371
Log:
Make kernel breakpoints work for book-e
Add the necessary bits to enable kernel breakpoints for Book-E. The entrypoint
for program exception is very trivial, so rather than expand it to be similar to
AIM, add it into the standard trap handler.
This wasn't blocked out as Book-E specific because it is only a minor redundancy
over AIM, which should have already called db_trap_glue() at this point. If
it's going to panic with a fatal trap anywya, it doesn't matter if it goes
through this path again.
Modified:
head/sys/powerpc/powerpc/trap.c
Modified: head/sys/powerpc/powerpc/trap.c
==============================================================================
--- head/sys/powerpc/powerpc/trap.c Tue Feb 28 04:13:20 2017 (r314370)
+++ head/sys/powerpc/powerpc/trap.c Tue Feb 28 04:31:28 2017 (r314371)
@@ -97,6 +97,10 @@ static int handle_user_slb_spill(pmap_t
extern int n_slbs;
#endif
+#ifdef KDB
+int db_trap_glue(struct trapframe *); /* Called from trap_subr.S */
+#endif
+
struct powerpc_exception {
u_int vector;
char *name;
@@ -338,9 +342,13 @@ trap(struct trapframe *frame)
KASSERT(cold || td->td_ucred != NULL,
("kernel trap doesn't have ucred"));
switch (type) {
-#ifdef KDTRACE_HOOKS
case EXC_PGM:
+#ifdef KDTRACE_HOOKS
+#ifdef AIM
if (frame->srr1 & EXC_PGM_TRAP) {
+#else
+ if (frame->cpu.booke.esr & ESR_PTR) {
+#endif
if (*(uint32_t *)frame->srr0 == EXC_DTRACE) {
if (dtrace_invop_jump_addr != NULL) {
dtrace_invop_jump_addr(frame);
@@ -348,8 +356,12 @@ trap(struct trapframe *frame)
}
}
}
- break;
#endif
+#ifdef KDB
+ if (db_trap_glue(frame))
+ return;
+#endif
+ break;
#if defined(__powerpc64__) && defined(AIM)
case EXC_DSE:
if ((frame->dar & SEGMENT_MASK) == USER_ADDR) {
@@ -833,11 +845,10 @@ fix_unaligned(struct thread *td, struct
}
#ifdef KDB
-int db_trap_glue(struct trapframe *); /* Called from trap_subr.S */
-
int
db_trap_glue(struct trapframe *frame)
{
+
if (!(frame->srr1 & PSL_PR)
&& (frame->exc == EXC_TRC || frame->exc == EXC_RUNMODETRC
#ifdef AIM
@@ -845,6 +856,7 @@ db_trap_glue(struct trapframe *frame)
&& (frame->srr1 & EXC_PGM_TRAP))
#else
|| (frame->exc == EXC_DEBUG)
+ || (frame->cpu.booke.esr & ESR_PTR)
#endif
|| frame->exc == EXC_BPT
|| frame->exc == EXC_DSI)) {
@@ -856,7 +868,8 @@ db_trap_glue(struct trapframe *frame)
#ifdef AIM
if (type == EXC_PGM && (frame->srr1 & EXC_PGM_TRAP)) {
#else
- if (frame->cpu.booke.esr & ESR_PTR) {
+ if (type == EXC_DEBUG ||
+ (frame->cpu.booke.esr & ESR_PTR)) {
#endif
type = T_BREAKPOINT;
}
More information about the svn-src-all
mailing list