Merge branches 'x86/acpi', 'x86/apic', 'x86/cpudetect', 'x86/headers', 'x86/paravirt...
[sfrench/cifs-2.6.git] / arch / x86 / kernel / traps.c
index 0d032d2d8a184e8b8d6921306f2b2041e2f4b23c..acb8c0585ab9f04a2d79457822d083e7de78f8b3 100644 (file)
@@ -98,6 +98,12 @@ static inline void preempt_conditional_sti(struct pt_regs *regs)
                local_irq_enable();
 }
 
+static inline void conditional_cli(struct pt_regs *regs)
+{
+       if (regs->flags & X86_EFLAGS_IF)
+               local_irq_disable();
+}
+
 static inline void preempt_conditional_cli(struct pt_regs *regs)
 {
        if (regs->flags & X86_EFLAGS_IF)
@@ -625,8 +631,10 @@ clear_dr7:
 
 #ifdef CONFIG_X86_32
 debug_vm86:
+       /* reenable preemption: handle_vm86_trap() might sleep */
+       dec_preempt_count();
        handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1);
-       preempt_conditional_cli(regs);
+       conditional_cli(regs);
        return;
 #endif
 
@@ -905,19 +913,20 @@ void math_emulate(struct math_emu_info *info)
 }
 #endif /* CONFIG_MATH_EMULATION */
 
-dotraplinkage void __kprobes do_device_not_available(struct pt_regs regs)
+dotraplinkage void __kprobes
+do_device_not_available(struct pt_regs *regs, long error_code)
 {
 #ifdef CONFIG_X86_32
        if (read_cr0() & X86_CR0_EM) {
                struct math_emu_info info = { };
 
-               conditional_sti(&regs);
+               conditional_sti(regs);
 
-               info.regs = &regs;
+               info.regs = regs;
                math_emulate(&info);
        } else {
                math_state_restore(); /* interrupts still off */
-               conditional_sti(&regs);
+               conditional_sti(regs);
        }
 #else
        math_state_restore();