diff options
Diffstat (limited to 'arch/powerpc/kernel/signal_64.c')
-rw-r--r-- | arch/powerpc/kernel/signal_64.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index 5462bef898f6..7b9d999e2115 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -207,10 +207,20 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig, | |||
207 | 207 | ||
208 | if (!sig) | 208 | if (!sig) |
209 | regs->gpr[13] = save_r13; | 209 | regs->gpr[13] = save_r13; |
210 | err |= __copy_from_user(¤t->thread.fpr, &sc->fp_regs, FP_REGS_SIZE); | ||
211 | if (set != NULL) | 210 | if (set != NULL) |
212 | err |= __get_user(set->sig[0], &sc->oldmask); | 211 | err |= __get_user(set->sig[0], &sc->oldmask); |
213 | 212 | ||
213 | /* | ||
214 | * Do this before updating the thread state in | ||
215 | * current->thread.fpr/vr. That way, if we get preempted | ||
216 | * and another task grabs the FPU/Altivec, it won't be | ||
217 | * tempted to save the current CPU state into the thread_struct | ||
218 | * and corrupt what we are writing there. | ||
219 | */ | ||
220 | discard_lazy_cpu_state(); | ||
221 | |||
222 | err |= __copy_from_user(¤t->thread.fpr, &sc->fp_regs, FP_REGS_SIZE); | ||
223 | |||
214 | #ifdef CONFIG_ALTIVEC | 224 | #ifdef CONFIG_ALTIVEC |
215 | err |= __get_user(v_regs, &sc->v_regs); | 225 | err |= __get_user(v_regs, &sc->v_regs); |
216 | err |= __get_user(msr, &sc->gp_regs[PT_MSR]); | 226 | err |= __get_user(msr, &sc->gp_regs[PT_MSR]); |
@@ -229,14 +239,6 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig, | |||
229 | current->thread.vrsave = 0; | 239 | current->thread.vrsave = 0; |
230 | #endif /* CONFIG_ALTIVEC */ | 240 | #endif /* CONFIG_ALTIVEC */ |
231 | 241 | ||
232 | #ifndef CONFIG_SMP | ||
233 | preempt_disable(); | ||
234 | if (last_task_used_math == current) | ||
235 | last_task_used_math = NULL; | ||
236 | if (last_task_used_altivec == current) | ||
237 | last_task_used_altivec = NULL; | ||
238 | preempt_enable(); | ||
239 | #endif | ||
240 | /* Force reload of FP/VEC */ | 242 | /* Force reload of FP/VEC */ |
241 | regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC); | 243 | regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC); |
242 | 244 | ||