Page MenuHomeFreeBSD

D62015.1795641405.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D62015.1795641405.diff

diff --git a/sys/powerpc/aim/aim_machdep.c b/sys/powerpc/aim/aim_machdep.c
--- a/sys/powerpc/aim/aim_machdep.c
+++ b/sys/powerpc/aim/aim_machdep.c
@@ -290,6 +290,13 @@
* Bits 1-4, 10-15 (ppc32), 33-36, 42-47 (ppc64)
*/
psl_userstatic &= ~0x783f0000UL;
+ /*
+ * MSR[SE] is the equivalent of the x86 trap flag: ptrace(2) sets it
+ * for PT_STEP and the trace trap clears it, so a context saved while
+ * it was set has to be able to put it back. Let it differ from the
+ * current frame, as amd64 does with PSL_T in PSL_USERCHANGE.
+ */
+ psl_userstatic &= ~PSL_SE;
/*
* Initialize the interrupt tables and figure out our cache line
diff --git a/sys/powerpc/booke/booke_machdep.c b/sys/powerpc/booke/booke_machdep.c
--- a/sys/powerpc/booke/booke_machdep.c
+++ b/sys/powerpc/booke/booke_machdep.c
@@ -235,6 +235,7 @@
* See the access control check in set_mcontext().
*/
psl_userstatic = ~(PSL_VEC | PSL_FP | PSL_FE0 | PSL_FE1);
+ psl_userstatic &= ~PSL_SE;
pmap_mmu_install(MMU_TYPE_BOOKE, BUS_PROBE_GENERIC);
}
diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c
--- a/sys/powerpc/powerpc/exec_machdep.c
+++ b/sys/powerpc/powerpc/exec_machdep.c
@@ -267,6 +267,13 @@
if (td->td_pcb->pcb_flags & PCB_FPU)
tf->srr1 = tf->srr1 & ~(PSL_FE0 | PSL_FE1);
+ /*
+ * The debugger asked to step the interrupted instruction stream, not
+ * the handler: run the handler at full speed. The context saved
+ * above still has MSR[SE], so sigreturn(2) resumes stepping.
+ */
+ tf->srr1 &= ~PSL_SE;
+
/*
* Set up the registers to return to sigcode.
*
diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c
--- a/sys/powerpc/powerpc/vm_machdep.c
+++ b/sys/powerpc/powerpc/vm_machdep.c
@@ -90,6 +90,7 @@
#include <machine/frame.h>
#include <machine/md_var.h>
#include <machine/pcb.h>
+#include <machine/psl.h>
#include <machine/reg.h>
#include <dev/ofw/openfirm.h>
@@ -146,6 +147,13 @@
tf->fixreg[FIRSTARG + 1] = 0;
tf->cr &= ~0x10000000;
+ /*
+ * The child is not being traced, even if the parent is: leaving
+ * MSR[SE] set would make its very first instruction raise a trace
+ * trap, which is a fatal SIGTRAP with no debugger to take it.
+ */
+ tf->srr1 &= ~PSL_SE;
+
cf = (struct callframe *)tf - 1;
memset(cf, 0, sizeof(struct callframe));
#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 25, 9:16 PM (7 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41999485
Default Alt Text
D62015.1795641405.diff (2 KB)

Event Timeline