traps: x86_64: make math_state_restore more like i386
authorAlexander van Heukelum <heukelum@mailshack.com>
Fri, 3 Oct 2008 21:16:12 +0000 (23:16 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 13 Oct 2008 08:33:22 +0000 (10:33 +0200)
- rename variable me -> tsk
 - get thread and tsk like i386
 - expand used_math()
 - copy comment

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/traps_64.c

index ea091dfe0cd31a931279765be61985e4889b0221..00406c99aee4a79e3ee0c2dfba2abb12ca19251a 100644 (file)
@@ -604,14 +604,15 @@ asmlinkage void __attribute__((weak)) mce_threshold_interrupt(void)
  */
 asmlinkage void math_state_restore(void)
 {
-       struct task_struct *me = current;
+       struct thread_info *thread = current_thread_info();
+       struct task_struct *tsk = thread->task;
 
-       if (!used_math()) {
+       if (!tsk_used_math(tsk)) {
                local_irq_enable();
                /*
                 * does a slab alloc which can sleep
                 */
-               if (init_fpu(me)) {
+               if (init_fpu(tsk)) {
                        /*
                         * ran out of memory!
                         */
@@ -625,13 +626,13 @@ asmlinkage void math_state_restore(void)
        /*
         * Paranoid restore. send a SIGSEGV if we fail to restore the state.
         */
-       if (unlikely(restore_fpu_checking(me))) {
+       if (unlikely(restore_fpu_checking(tsk))) {
                stts();
-               force_sig(SIGSEGV, me);
+               force_sig(SIGSEGV, tsk);
                return;
        }
-       task_thread_info(me)->status |= TS_USEDFPU;
-       me->fpu_counter++;
+       thread->status |= TS_USEDFPU;   /* So we fnsave on switch_to() */
+       tsk->fpu_counter++;
 }
 EXPORT_SYMBOL_GPL(math_state_restore);