aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/fpu.S
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2009-04-01 14:02:42 -0400
committerPaul Mackerras <paulus@samba.org>2009-04-07 01:18:59 -0400
commit7e875e9dc8af70d126fa632446e967327ac3fdda (patch)
tree22757e6faff097d01931194c4af051017cb1c359 /arch/powerpc/kernel/fpu.S
parent4c6cf42843e924fd2f71439d87e85b739b2aa973 (diff)
powerpc: Disable VSX or current process in giveup_fpu/altivec
When we call giveup_fpu, we need to need to turn off VSX for the current process. If we don't, on return to userspace it may execute a VSX instruction before the next FP instruction, and not have its register state refreshed correctly from the thread_struct. Ditto for altivec. This caused a bug where an unaligned lfs or stfs results in fix_alignment calling giveup_fpu so it can use the FPRs (in order to do a single <-> double conversion), and then returning to userspace with FP off but VSX on. Then if a VSX instruction is executed, before another FP instruction, it will proceed without another exception and hence have the incorrect register state for VSX registers 0-31. lfs unaligned <- alignment exception turns FP off but leaves VSX on VSX instruction <- no exception since VSX on, hence we get the wrong VSX register values for VSX registers 0-31, which overlap the FPRs. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/fpu.S')
-rw-r--r--arch/powerpc/kernel/fpu.S5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index a088c064ae40..2436df33c6f4 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -145,6 +145,11 @@ END_FTR_SECTION_IFSET(CPU_FTR_VSX)
145 beq 1f 145 beq 1f
146 PPC_LL r4,_MSR-STACK_FRAME_OVERHEAD(r5) 146 PPC_LL r4,_MSR-STACK_FRAME_OVERHEAD(r5)
147 li r3,MSR_FP|MSR_FE0|MSR_FE1 147 li r3,MSR_FP|MSR_FE0|MSR_FE1
148#ifdef CONFIG_VSX
149BEGIN_FTR_SECTION
150 oris r3,r3,MSR_VSX@h
151END_FTR_SECTION_IFSET(CPU_FTR_VSX)
152#endif
148 andc r4,r4,r3 /* disable FP for previous task */ 153 andc r4,r4,r3 /* disable FP for previous task */
149 PPC_STL r4,_MSR-STACK_FRAME_OVERHEAD(r5) 154 PPC_STL r4,_MSR-STACK_FRAME_OVERHEAD(r5)
1501: 1551: