aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/i387.c
diff options
context:
space:
mode:
authorBrian Gerst <brgerst@gmail.com>2010-09-03 21:17:13 -0400
committerH. Peter Anvin <hpa@linux.intel.com>2010-09-09 17:16:58 -0400
commit10c11f304986a1f84201c2261a428701f9d2dffc (patch)
tree619bed49fcd50d6eec3034436ae77b5c3c46f7cb /arch/x86/kernel/i387.c
parenta4d4fbc7735bba6654b20f859135f9d3f8fe7f76 (diff)
x86-64, fpu: Fix %cs value in convert_from_fxsr()
While %ds still contains the userspace selector, %cs is KERNEL_CS at this point. Always get %cs from pt_regs even for the current task. Signed-off-by: Brian Gerst <brgerst@gmail.com> Acked-by: Pekka Enberg <penberg@kernel.org> Cc: Suresh Siddha <suresh.b.siddha@intel.com> LKML-Reference: <1283563039-3466-7-git-send-email-brgerst@gmail.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/i387.c')
-rw-r--r--arch/x86/kernel/i387.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 82166519497a..f3775f5ef4ab 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -389,19 +389,17 @@ convert_from_fxsr(struct user_i387_ia32_struct *env, struct task_struct *tsk)
389#ifdef CONFIG_X86_64 389#ifdef CONFIG_X86_64
390 env->fip = fxsave->rip; 390 env->fip = fxsave->rip;
391 env->foo = fxsave->rdp; 391 env->foo = fxsave->rdp;
392 /*
393 * should be actually ds/cs at fpu exception time, but
394 * that information is not available in 64bit mode.
395 */
396 env->fcs = task_pt_regs(tsk)->cs;
392 if (tsk == current) { 397 if (tsk == current) {
393 /* 398 savesegment(ds, env->fos);
394 * should be actually ds/cs at fpu exception time, but
395 * that information is not available in 64bit mode.
396 */
397 asm("mov %%ds, %[fos]" : [fos] "=r" (env->fos));
398 asm("mov %%cs, %[fcs]" : [fcs] "=r" (env->fcs));
399 } else { 399 } else {
400 struct pt_regs *regs = task_pt_regs(tsk); 400 env->fos = tsk->thread.ds;
401
402 env->fos = 0xffff0000 | tsk->thread.ds;
403 env->fcs = regs->cs;
404 } 401 }
402 env->fos |= 0xffff0000;
405#else 403#else
406 env->fip = fxsave->fip; 404 env->fip = fxsave->fip;
407 env->fcs = (u16) fxsave->fcs | ((u32) fxsave->fop << 16); 405 env->fcs = (u16) fxsave->fcs | ((u32) fxsave->fop << 16);