diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2009-04-08 07:31:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-08 07:46:01 -0400 |
commit | 34ba476a01e128aad51e02f9be854584e9ec73cf (patch) | |
tree | 1a4a39325155467025fdc17176c9d7ec32be3ea5 /arch/x86/include | |
parent | fcb2ac5bdfa3a7a04fb9749b916f64400f4c35a8 (diff) |
x86: unify restore_fpu_checking
Impact: cleanup
On x86_32, separate f*rstor to an inline function which makes
restore_fpu_checking the same on both platforms -> move it
outside the ifdefs.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
LKML-Reference: <1239190320-23952-2-git-send-email-jirislaby@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include')
-rw-r--r-- | arch/x86/include/asm/i387.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h index 09a2d6dfd85b..7a6f21d95cf4 100644 --- a/arch/x86/include/asm/i387.h +++ b/arch/x86/include/asm/i387.h | |||
@@ -75,14 +75,6 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx) | |||
75 | return err; | 75 | return err; |
76 | } | 76 | } |
77 | 77 | ||
78 | static inline int restore_fpu_checking(struct task_struct *tsk) | ||
79 | { | ||
80 | if (task_thread_info(tsk)->status & TS_XSAVE) | ||
81 | return xrstor_checking(&tsk->thread.xstate->xsave); | ||
82 | else | ||
83 | return fxrstor_checking(&tsk->thread.xstate->fxsave); | ||
84 | } | ||
85 | |||
86 | /* AMD CPUs don't save/restore FDP/FIP/FOP unless an exception | 78 | /* AMD CPUs don't save/restore FDP/FIP/FOP unless an exception |
87 | is pending. Clear the x87 state here by setting it to fixed | 79 | is pending. Clear the x87 state here by setting it to fixed |
88 | values. The kernel data segment can be sometimes 0 and sometimes | 80 | values. The kernel data segment can be sometimes 0 and sometimes |
@@ -185,10 +177,9 @@ static inline void tolerant_fwait(void) | |||
185 | asm volatile("fnclex ; fwait"); | 177 | asm volatile("fnclex ; fwait"); |
186 | } | 178 | } |
187 | 179 | ||
188 | static inline int restore_fpu_checking(struct task_struct *tsk) | 180 | /* perform fxrstor iff the processor has extended states, otherwise frstor */ |
181 | static inline int fxrstor_checking(struct i387_fxsave_struct *fx) | ||
189 | { | 182 | { |
190 | if (task_thread_info(tsk)->status & TS_XSAVE) | ||
191 | return xrstor_checking(&tsk->thread.xstate->xsave); | ||
192 | /* | 183 | /* |
193 | * The "nop" is needed to make the instructions the same | 184 | * The "nop" is needed to make the instructions the same |
194 | * length. | 185 | * length. |
@@ -197,7 +188,8 @@ static inline int restore_fpu_checking(struct task_struct *tsk) | |||
197 | "nop ; frstor %1", | 188 | "nop ; frstor %1", |
198 | "fxrstor %1", | 189 | "fxrstor %1", |
199 | X86_FEATURE_FXSR, | 190 | X86_FEATURE_FXSR, |
200 | "m" (tsk->thread.xstate->fxsave)); | 191 | "m" (*fx)); |
192 | |||
201 | return 0; | 193 | return 0; |
202 | } | 194 | } |
203 | 195 | ||
@@ -261,6 +253,14 @@ end: | |||
261 | 253 | ||
262 | #endif /* CONFIG_X86_64 */ | 254 | #endif /* CONFIG_X86_64 */ |
263 | 255 | ||
256 | static inline int restore_fpu_checking(struct task_struct *tsk) | ||
257 | { | ||
258 | if (task_thread_info(tsk)->status & TS_XSAVE) | ||
259 | return xrstor_checking(&tsk->thread.xstate->xsave); | ||
260 | else | ||
261 | return fxrstor_checking(&tsk->thread.xstate->fxsave); | ||
262 | } | ||
263 | |||
264 | /* | 264 | /* |
265 | * Signal frame handlers... | 265 | * Signal frame handlers... |
266 | */ | 266 | */ |