diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-14 10:58:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-14 10:58:08 -0400 |
commit | 625037cc405eabbfd2a39e9297e583a94886225f (patch) | |
tree | c0a62f6cb2a565efb7cd494f558f0acbadcbabb0 /arch/x86/kernel/traps.c | |
parent | 8fafa0a789faaff4318cbfa9c2f827d2198505dc (diff) | |
parent | 17950c5b243f99cbabef173415ee988c52104d7e (diff) |
Merge branch 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86-64: move clts into batch cpu state updates when preloading fpu
x86-64: move unlazy_fpu() into lazy cpu state part of context switch
x86-32: make sure clts is batched during context switch
x86: split out core __math_state_restore
Diffstat (limited to 'arch/x86/kernel/traps.c')
-rw-r--r-- | arch/x86/kernel/traps.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 6fe85c272a2b..83264922a878 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -795,6 +795,28 @@ asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void) | |||
795 | } | 795 | } |
796 | 796 | ||
797 | /* | 797 | /* |
798 | * __math_state_restore assumes that cr0.TS is already clear and the | ||
799 | * fpu state is all ready for use. Used during context switch. | ||
800 | */ | ||
801 | void __math_state_restore(void) | ||
802 | { | ||
803 | struct thread_info *thread = current_thread_info(); | ||
804 | struct task_struct *tsk = thread->task; | ||
805 | |||
806 | /* | ||
807 | * Paranoid restore. send a SIGSEGV if we fail to restore the state. | ||
808 | */ | ||
809 | if (unlikely(restore_fpu_checking(tsk))) { | ||
810 | stts(); | ||
811 | force_sig(SIGSEGV, tsk); | ||
812 | return; | ||
813 | } | ||
814 | |||
815 | thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */ | ||
816 | tsk->fpu_counter++; | ||
817 | } | ||
818 | |||
819 | /* | ||
798 | * 'math_state_restore()' saves the current math information in the | 820 | * 'math_state_restore()' saves the current math information in the |
799 | * old math state array, and gets the new ones from the current task | 821 | * old math state array, and gets the new ones from the current task |
800 | * | 822 | * |
@@ -825,17 +847,8 @@ asmlinkage void math_state_restore(void) | |||
825 | } | 847 | } |
826 | 848 | ||
827 | clts(); /* Allow maths ops (or we recurse) */ | 849 | clts(); /* Allow maths ops (or we recurse) */ |
828 | /* | ||
829 | * Paranoid restore. send a SIGSEGV if we fail to restore the state. | ||
830 | */ | ||
831 | if (unlikely(restore_fpu_checking(tsk))) { | ||
832 | stts(); | ||
833 | force_sig(SIGSEGV, tsk); | ||
834 | return; | ||
835 | } | ||
836 | 850 | ||
837 | thread->status |= TS_USEDFPU; /* So we fnsave on switch_to() */ | 851 | __math_state_restore(); |
838 | tsk->fpu_counter++; | ||
839 | } | 852 | } |
840 | EXPORT_SYMBOL_GPL(math_state_restore); | 853 | EXPORT_SYMBOL_GPL(math_state_restore); |
841 | 854 | ||