diff options
Diffstat (limited to 'include/asm-x86/i387.h')
| -rw-r--r-- | include/asm-x86/i387.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/include/asm-x86/i387.h b/include/asm-x86/i387.h index f377b76b2f34..54522b814f1c 100644 --- a/include/asm-x86/i387.h +++ b/include/asm-x86/i387.h | |||
| @@ -41,7 +41,7 @@ static inline void tolerant_fwait(void) | |||
| 41 | { | 41 | { |
| 42 | asm volatile("1: fwait\n" | 42 | asm volatile("1: fwait\n" |
| 43 | "2:\n" | 43 | "2:\n" |
| 44 | _ASM_EXTABLE(1b,2b)); | 44 | _ASM_EXTABLE(1b, 2b)); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) | 47 | static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) |
| @@ -54,7 +54,7 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) | |||
| 54 | "3: movl $-1,%[err]\n" | 54 | "3: movl $-1,%[err]\n" |
| 55 | " jmp 2b\n" | 55 | " jmp 2b\n" |
| 56 | ".previous\n" | 56 | ".previous\n" |
| 57 | _ASM_EXTABLE(1b,3b) | 57 | _ASM_EXTABLE(1b, 3b) |
| 58 | : [err] "=r" (err) | 58 | : [err] "=r" (err) |
| 59 | #if 0 /* See comment in __save_init_fpu() below. */ | 59 | #if 0 /* See comment in __save_init_fpu() below. */ |
| 60 | : [fx] "r" (fx), "m" (*fx), "0" (0)); | 60 | : [fx] "r" (fx), "m" (*fx), "0" (0)); |
| @@ -76,11 +76,11 @@ static inline int restore_fpu_checking(struct i387_fxsave_struct *fx) | |||
| 76 | static inline void clear_fpu_state(struct i387_fxsave_struct *fx) | 76 | static inline void clear_fpu_state(struct i387_fxsave_struct *fx) |
| 77 | { | 77 | { |
| 78 | if (unlikely(fx->swd & X87_FSW_ES)) | 78 | if (unlikely(fx->swd & X87_FSW_ES)) |
| 79 | asm volatile("fnclex"); | 79 | asm volatile("fnclex"); |
| 80 | alternative_input(ASM_NOP8 ASM_NOP2, | 80 | alternative_input(ASM_NOP8 ASM_NOP2, |
| 81 | " emms\n" /* clear stack tags */ | 81 | " emms\n" /* clear stack tags */ |
| 82 | " fildl %%gs:0", /* load to clear state */ | 82 | " fildl %%gs:0", /* load to clear state */ |
| 83 | X86_FEATURE_FXSAVE_LEAK); | 83 | X86_FEATURE_FXSAVE_LEAK); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) | 86 | static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) |
| @@ -93,14 +93,15 @@ static inline int save_i387_checking(struct i387_fxsave_struct __user *fx) | |||
| 93 | "3: movl $-1,%[err]\n" | 93 | "3: movl $-1,%[err]\n" |
| 94 | " jmp 2b\n" | 94 | " jmp 2b\n" |
| 95 | ".previous\n" | 95 | ".previous\n" |
| 96 | _ASM_EXTABLE(1b,3b) | 96 | _ASM_EXTABLE(1b, 3b) |
| 97 | : [err] "=r" (err), "=m" (*fx) | 97 | : [err] "=r" (err), "=m" (*fx) |
| 98 | #if 0 /* See comment in __fxsave_clear() below. */ | 98 | #if 0 /* See comment in __fxsave_clear() below. */ |
| 99 | : [fx] "r" (fx), "0" (0)); | 99 | : [fx] "r" (fx), "0" (0)); |
| 100 | #else | 100 | #else |
| 101 | : [fx] "cdaSDb" (fx), "0" (0)); | 101 | : [fx] "cdaSDb" (fx), "0" (0)); |
| 102 | #endif | 102 | #endif |
| 103 | if (unlikely(err) && __clear_user(fx, sizeof(struct i387_fxsave_struct))) | 103 | if (unlikely(err) && |
| 104 | __clear_user(fx, sizeof(struct i387_fxsave_struct))) | ||
| 104 | err = -EFAULT; | 105 | err = -EFAULT; |
| 105 | /* No need to clear here because the caller clears USED_MATH */ | 106 | /* No need to clear here because the caller clears USED_MATH */ |
| 106 | return err; | 107 | return err; |
| @@ -156,8 +157,10 @@ static inline int save_i387(struct _fpstate __user *buf) | |||
| 156 | return 0; | 157 | return 0; |
| 157 | clear_used_math(); /* trigger finit */ | 158 | clear_used_math(); /* trigger finit */ |
| 158 | if (task_thread_info(tsk)->status & TS_USEDFPU) { | 159 | if (task_thread_info(tsk)->status & TS_USEDFPU) { |
| 159 | err = save_i387_checking((struct i387_fxsave_struct __user *)buf); | 160 | err = save_i387_checking((struct i387_fxsave_struct __user *) |
| 160 | if (err) return err; | 161 | buf); |
| 162 | if (err) | ||
| 163 | return err; | ||
| 161 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | 164 | task_thread_info(tsk)->status &= ~TS_USEDFPU; |
| 162 | stts(); | 165 | stts(); |
| 163 | } else { | 166 | } else { |
