aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/traps_32.c
diff options
context:
space:
mode:
authorAlexander van Heukelum <heukelum@fastmail.fm>2008-09-09 15:56:02 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-13 04:20:17 -0400
commit7643e9b936b4af31ba4851eb7d5b3a3bfad52502 (patch)
tree1443d0d87a7d7c213253b5b46412fa467e21d6c1 /arch/x86/kernel/traps_32.c
parent12394cf567d509f6ab5d94544e1f414b35286d9e (diff)
i386: convert hardware exception 7 to an interrupt gate
Handle no coprocessor exception with interrupt initially off. device_not_available in entry_32.S calls either math_state_restore or math_emulate. This patch adds an extra indirection to be able to re-enable interrupts explicitly in traps_32.c Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/traps_32.c')
-rw-r--r--arch/x86/kernel/traps_32.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 39a6101a6123..5b15f75d0591 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -46,6 +46,7 @@
46#include <linux/edac.h> 46#include <linux/edac.h>
47#endif 47#endif
48 48
49#include <asm/processor-flags.h>
49#include <asm/arch_hooks.h> 50#include <asm/arch_hooks.h>
50#include <asm/stacktrace.h> 51#include <asm/stacktrace.h>
51#include <asm/processor.h> 52#include <asm/processor.h>
@@ -1236,6 +1237,17 @@ asmlinkage void math_emulate(long arg)
1236 1237
1237#endif /* CONFIG_MATH_EMULATION */ 1238#endif /* CONFIG_MATH_EMULATION */
1238 1239
1240void __kprobes do_device_not_available(struct pt_regs *regs, long error)
1241{
1242 if (read_cr0() & X86_CR0_EM) {
1243 conditional_sti(regs);
1244 math_emulate(0);
1245 } else {
1246 math_state_restore(); /* interrupts still off */
1247 conditional_sti(regs);
1248 }
1249}
1250
1239void __init trap_init(void) 1251void __init trap_init(void)
1240{ 1252{
1241 int i; 1253 int i;
@@ -1255,7 +1267,7 @@ void __init trap_init(void)
1255 set_system_intr_gate(4, &overflow); /* int4 can be called from all */ 1267 set_system_intr_gate(4, &overflow); /* int4 can be called from all */
1256 set_intr_gate(5, &bounds); 1268 set_intr_gate(5, &bounds);
1257 set_intr_gate(6, &invalid_op); 1269 set_intr_gate(6, &invalid_op);
1258 set_trap_gate(7, &device_not_available); 1270 set_intr_gate(7, &device_not_available);
1259 set_task_gate(8, GDT_ENTRY_DOUBLEFAULT_TSS); 1271 set_task_gate(8, GDT_ENTRY_DOUBLEFAULT_TSS);
1260 set_trap_gate(9, &coprocessor_segment_overrun); 1272 set_trap_gate(9, &coprocessor_segment_overrun);
1261 set_trap_gate(10, &invalid_TSS); 1273 set_trap_gate(10, &invalid_TSS);