diff options
Diffstat (limited to 'arch/x86/kernel/traps.c')
-rw-r--r-- | arch/x86/kernel/traps.c | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 482ec3af2067..4bbe04d96744 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -571,41 +571,18 @@ asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void) | |||
571 | } | 571 | } |
572 | 572 | ||
573 | /* | 573 | /* |
574 | * __math_state_restore assumes that cr0.TS is already clear and the | ||
575 | * fpu state is all ready for use. Used during context switch. | ||
576 | */ | ||
577 | void __math_state_restore(void) | ||
578 | { | ||
579 | struct thread_info *thread = current_thread_info(); | ||
580 | struct task_struct *tsk = thread->task; | ||
581 | |||
582 | /* | ||
583 | * Paranoid restore. send a SIGSEGV if we fail to restore the state. | ||
584 | */ | ||
585 | if (unlikely(restore_fpu_checking(tsk))) { | ||
586 | stts(); | ||
587 | force_sig(SIGSEGV, tsk); | ||
588 | return; | ||
589 | } | ||
590 | |||
591 | thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */ | ||
592 | tsk->fpu_counter++; | ||
593 | } | ||
594 | |||
595 | /* | ||
596 | * 'math_state_restore()' saves the current math information in the | 574 | * 'math_state_restore()' saves the current math information in the |
597 | * old math state array, and gets the new ones from the current task | 575 | * old math state array, and gets the new ones from the current task |
598 | * | 576 | * |
599 | * Careful.. There are problems with IBM-designed IRQ13 behaviour. | 577 | * Careful.. There are problems with IBM-designed IRQ13 behaviour. |
600 | * Don't touch unless you *really* know how it works. | 578 | * Don't touch unless you *really* know how it works. |
601 | * | 579 | * |
602 | * Must be called with kernel preemption disabled (in this case, | 580 | * Must be called with kernel preemption disabled (eg with local |
603 | * local interrupts are disabled at the call-site in entry.S). | 581 | * local interrupts as in the case of do_device_not_available). |
604 | */ | 582 | */ |
605 | asmlinkage void math_state_restore(void) | 583 | void math_state_restore(void) |
606 | { | 584 | { |
607 | struct thread_info *thread = current_thread_info(); | 585 | struct task_struct *tsk = current; |
608 | struct task_struct *tsk = thread->task; | ||
609 | 586 | ||
610 | if (!tsk_used_math(tsk)) { | 587 | if (!tsk_used_math(tsk)) { |
611 | local_irq_enable(); | 588 | local_irq_enable(); |
@@ -622,9 +599,17 @@ asmlinkage void math_state_restore(void) | |||
622 | local_irq_disable(); | 599 | local_irq_disable(); |
623 | } | 600 | } |
624 | 601 | ||
625 | clts(); /* Allow maths ops (or we recurse) */ | 602 | __thread_fpu_begin(tsk); |
603 | /* | ||
604 | * Paranoid restore. send a SIGSEGV if we fail to restore the state. | ||
605 | */ | ||
606 | if (unlikely(restore_fpu_checking(tsk))) { | ||
607 | __thread_fpu_end(tsk); | ||
608 | force_sig(SIGSEGV, tsk); | ||
609 | return; | ||
610 | } | ||
626 | 611 | ||
627 | __math_state_restore(); | 612 | tsk->fpu_counter++; |
628 | } | 613 | } |
629 | EXPORT_SYMBOL_GPL(math_state_restore); | 614 | EXPORT_SYMBOL_GPL(math_state_restore); |
630 | 615 | ||