aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/traps.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-12-25 13:39:01 -0500
committerH. Peter Anvin <hpa@zytor.com>2008-12-25 13:39:01 -0500
commita73ad3331fdbf4191cf99b83ea9ac7082b6757ba (patch)
tree32edbf588c7469b88291d4d801b40e3bd0f2acbe /arch/x86/kernel/traps.c
parent1fcccb008be12ea823aaa392758e1e41fb82de9a (diff)
x86: unify the implementation of FPU traps
On 32 bits, we may suffer IRQ 13, or supposedly we might have a buggy implementation which gives spurious trap 16. We did not check for this on 64 bits, but there is no reason we can't make the code the same in both cases. Furthermore, this is presumably rare, so do the spurious check last, instead of first. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/x86/kernel/traps.c')
-rw-r--r--arch/x86/kernel/traps.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index f37cee75ab58..f5a640ba04bc 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -689,12 +689,7 @@ void math_error(void __user *ip)
689 cwd = get_fpu_cwd(task); 689 cwd = get_fpu_cwd(task);
690 swd = get_fpu_swd(task); 690 swd = get_fpu_swd(task);
691 691
692 err = swd & ~cwd & 0x3f; 692 err = swd & ~cwd;
693
694#ifdef CONFIG_X86_32
695 if (!err)
696 return;
697#endif
698 693
699 if (err & 0x001) { /* Invalid op */ 694 if (err & 0x001) { /* Invalid op */
700 /* 695 /*
@@ -712,7 +707,9 @@ void math_error(void __user *ip)
712 } else if (err & 0x020) { /* Precision */ 707 } else if (err & 0x020) { /* Precision */
713 info.si_code = FPE_FLTRES; 708 info.si_code = FPE_FLTRES;
714 } else { 709 } else {
715 info.si_code = __SI_FAULT|SI_KERNEL; /* WTF? */ 710 /* If we're using IRQ 13, or supposedly even some trap 16
711 implementations, it's possible we get a spurious trap... */
712 return; /* Spurious trap, no error */
716 } 713 }
717 force_sig_info(SIGFPE, &info, task); 714 force_sig_info(SIGFPE, &info, task);
718} 715}