diff options
author | jhibbits <jhibbits@FreeBSD.org> | 2014-09-05 15:13:41 +0000 |
---|---|---|
committer | jhibbits <jhibbits@FreeBSD.org> | 2014-09-05 15:13:41 +0000 |
commit | 7d1fd313b1130fe8268b9e749103786c69bd0f6f (patch) | |
tree | 4022e2e21563c8f565e845f914a25c8dfd0d1d75 /sys/powerpc | |
parent | db4159a95c99ba2e1d62e884a99c2e2688d0119e (diff) | |
download | FreeBSD-src-7d1fd313b1130fe8268b9e749103786c69bd0f6f.zip FreeBSD-src-7d1fd313b1130fe8268b9e749103786c69bd0f6f.tar.gz |
MFC r261095,r263464,r263752,r264189
r263464,r263752,r275189:
Mask out SRR1 bits that aren't exported to the MSR.
This appears to fix a strange condition with X on 32-bit PowerBooks I
observed, caused by one of these bits getting set in the mcontext, but
not set in the thread, which is a symptom of another problem, more
difficult to diagnose. Since these bits aren't exported anyway, this
change makes it more explicit that the bits aren't MSR-related in SRR1.
r261095:
Fix 32-bit signal handling on ppc64. This was broken when the
PSL_USERSTATIC macro was changed. Since copying 64-bit srr1 into
32-bit srr1 drops the upper 32 bits, any bits set in the context were
dropped, meaning the context check fails. Since 32-bit set_context()
can't change those bits anyway, copy the ones from the current context
(td->td_frame) before calling set_context().
Approved by: re
Relnotes: yes (Affects 10-stable, but not 10.0-release)
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/include/psl.h | 5 | ||||
-rw-r--r-- | sys/powerpc/powerpc/exec_machdep.c | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/sys/powerpc/include/psl.h b/sys/powerpc/include/psl.h index d09de52..86960e7 100644 --- a/sys/powerpc/include/psl.h +++ b/sys/powerpc/include/psl.h @@ -86,17 +86,20 @@ /* Initial kernel MSR, use IS=1 ad DS=1. */ #define PSL_KERNSET_INIT (PSL_IS | PSL_DS) #define PSL_KERNSET (PSL_CE | PSL_ME | PSL_EE) +#define PSL_SRR1_MASK 0x00000000UL /* No mask on Book-E */ #elif defined(BOOKE_PPC4XX) #define PSL_KERNSET (PSL_CE | PSL_ME | PSL_EE | PSL_FP) +#define PSL_SRR1_MASK 0x00000000UL /* No mask on Book-E */ #elif defined(AIM) #ifdef __powerpc64__ #define PSL_KERNSET (PSL_SF | PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI) #else #define PSL_KERNSET (PSL_EE | PSL_ME | PSL_IR | PSL_DR | PSL_RI) #endif +#define PSL_SRR1_MASK 0x783f0000UL /* Bits 1-4, 10-15 (ppc32), 33-36, 42-47 (ppc64) */ #endif #define PSL_USERSET (PSL_KERNSET | PSL_PR) -#define PSL_USERSTATIC ~(PSL_VEC | PSL_FP | PSL_FE0 | PSL_FE1) +#define PSL_USERSTATIC (~(PSL_VEC | PSL_FP | PSL_FE0 | PSL_FE1) & ~PSL_SRR1_MASK) #endif /* _MACHINE_PSL_H_ */ diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c index acacb3d..cc639fc 100644 --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -752,6 +752,7 @@ set_mcontext32(struct thread *td, const mcontext32_t *mcp) memcpy(mcp64.mc_av,mcp->mc_av,sizeof(mcp64.mc_av)); for (i = 0; i < 42; i++) mcp64.mc_frame[i] = mcp->mc_frame[i]; + mcp64.mc_srr1 |= (td->td_frame->srr1 & 0xFFFFFFFF00000000ULL); memcpy(mcp64.mc_fpreg,mcp->mc_fpreg,sizeof(mcp64.mc_fpreg)); error = set_mcontext(td, &mcp64); |