Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * Copyright (C) 1994 Linus Torvalds |
| 3 | * |
| 4 | * Pentium III FXSR, SSE support |
| 5 | * General FPU state handling cleanups |
| 6 | * Gareth Hughes <gareth@valinux.com>, May 2000 |
| 7 | */ |
Alexey Dobriyan | 129f694 | 2005-06-23 00:08:33 -0700 | [diff] [blame] | 8 | #include <linux/module.h> |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 9 | #include <linux/regset.h> |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 10 | #include <linux/sched.h> |
| 11 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <asm/sigcontext.h> |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 13 | #include <asm/processor.h> |
| 14 | #include <asm/math_emu.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <asm/uaccess.h> |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 16 | #include <asm/ptrace.h> |
| 17 | #include <asm/i387.h> |
| 18 | #include <asm/user.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 20 | #ifdef CONFIG_X86_64 |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 21 | # include <asm/sigcontext32.h> |
| 22 | # include <asm/user32.h> |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 23 | #else |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 24 | # define save_i387_ia32 save_i387 |
| 25 | # define restore_i387_ia32 restore_i387 |
| 26 | # define _fpstate_ia32 _fpstate |
Suresh Siddha | 3c1c7f1 | 2008-07-29 10:29:21 -0700 | [diff] [blame^] | 27 | # define sig_xstate_ia32_size sig_xstate_size |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 28 | # define user_i387_ia32_struct user_i387_struct |
| 29 | # define user32_fxsr_struct user_fxsr_struct |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 30 | #endif |
| 31 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #ifdef CONFIG_MATH_EMULATION |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 33 | # define HAVE_HWFP (boot_cpu_data.hard_math) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #else |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 35 | # define HAVE_HWFP 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #endif |
| 37 | |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 38 | static unsigned int mxcsr_feature_mask __read_mostly = 0xffffffffu; |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 39 | unsigned int xstate_size; |
Suresh Siddha | 3c1c7f1 | 2008-07-29 10:29:21 -0700 | [diff] [blame^] | 40 | unsigned int sig_xstate_ia32_size = sizeof(struct _fpstate_ia32); |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 41 | static struct i387_fxsave_struct fx_scratch __cpuinitdata; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 43 | void __cpuinit mxcsr_feature_mask_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | { |
| 45 | unsigned long mask = 0; |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 46 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | clts(); |
| 48 | if (cpu_has_fxsr) { |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 49 | memset(&fx_scratch, 0, sizeof(struct i387_fxsave_struct)); |
| 50 | asm volatile("fxsave %0" : : "m" (fx_scratch)); |
| 51 | mask = fx_scratch.mxcsr_mask; |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 52 | if (mask == 0) |
| 53 | mask = 0x0000ffbf; |
| 54 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | mxcsr_feature_mask &= mask; |
| 56 | stts(); |
| 57 | } |
| 58 | |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 59 | void __init init_thread_xstate(void) |
| 60 | { |
Suresh Siddha | e8a496a | 2008-05-23 16:26:37 -0700 | [diff] [blame] | 61 | if (!HAVE_HWFP) { |
| 62 | xstate_size = sizeof(struct i387_soft_struct); |
| 63 | return; |
| 64 | } |
| 65 | |
Suresh Siddha | dc1e35c | 2008-07-29 10:29:19 -0700 | [diff] [blame] | 66 | if (cpu_has_xsave) { |
| 67 | xsave_cntxt_init(); |
| 68 | return; |
| 69 | } |
| 70 | |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 71 | if (cpu_has_fxsr) |
| 72 | xstate_size = sizeof(struct i387_fxsave_struct); |
| 73 | #ifdef CONFIG_X86_32 |
| 74 | else |
| 75 | xstate_size = sizeof(struct i387_fsave_struct); |
| 76 | #endif |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 79 | #ifdef CONFIG_X86_64 |
| 80 | /* |
| 81 | * Called at bootup to set up the initial FPU state that is later cloned |
| 82 | * into all processes. |
| 83 | */ |
| 84 | void __cpuinit fpu_init(void) |
| 85 | { |
| 86 | unsigned long oldcr0 = read_cr0(); |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 87 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 88 | set_in_cr4(X86_CR4_OSFXSR); |
| 89 | set_in_cr4(X86_CR4_OSXMMEXCPT); |
| 90 | |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 91 | write_cr0(oldcr0 & ~(X86_CR0_TS|X86_CR0_EM)); /* clear TS and EM */ |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 92 | |
Suresh Siddha | dc1e35c | 2008-07-29 10:29:19 -0700 | [diff] [blame] | 93 | /* |
| 94 | * Boot processor to setup the FP and extended state context info. |
| 95 | */ |
| 96 | if (!smp_processor_id()) |
| 97 | init_thread_xstate(); |
| 98 | xsave_init(); |
| 99 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 100 | mxcsr_feature_mask_init(); |
| 101 | /* clean state in init */ |
Suresh Siddha | b359e8a | 2008-07-29 10:29:20 -0700 | [diff] [blame] | 102 | if (cpu_has_xsave) |
| 103 | current_thread_info()->status = TS_XSAVE; |
| 104 | else |
| 105 | current_thread_info()->status = 0; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 106 | clear_used_math(); |
| 107 | } |
| 108 | #endif /* CONFIG_X86_64 */ |
| 109 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | /* |
| 111 | * The _current_ task is using the FPU for the first time |
| 112 | * so initialize it and set the mxcsr to its default |
| 113 | * value at reset if we support XMM instructions and then |
| 114 | * remeber the current task has used the FPU. |
| 115 | */ |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 116 | int init_fpu(struct task_struct *tsk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | { |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 118 | if (tsk_used_math(tsk)) { |
Suresh Siddha | e8a496a | 2008-05-23 16:26:37 -0700 | [diff] [blame] | 119 | if (HAVE_HWFP && tsk == current) |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 120 | unlazy_fpu(tsk); |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 121 | return 0; |
| 122 | } |
| 123 | |
| 124 | /* |
| 125 | * Memory allocation at the first usage of the FPU and other state. |
| 126 | */ |
| 127 | if (!tsk->thread.xstate) { |
| 128 | tsk->thread.xstate = kmem_cache_alloc(task_xstate_cachep, |
| 129 | GFP_KERNEL); |
| 130 | if (!tsk->thread.xstate) |
| 131 | return -ENOMEM; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 132 | } |
| 133 | |
Suresh Siddha | e8a496a | 2008-05-23 16:26:37 -0700 | [diff] [blame] | 134 | #ifdef CONFIG_X86_32 |
| 135 | if (!HAVE_HWFP) { |
| 136 | memset(tsk->thread.xstate, 0, xstate_size); |
| 137 | finit(); |
| 138 | set_stopped_child_used_math(tsk); |
| 139 | return 0; |
| 140 | } |
| 141 | #endif |
| 142 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | if (cpu_has_fxsr) { |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 144 | struct i387_fxsave_struct *fx = &tsk->thread.xstate->fxsave; |
| 145 | |
| 146 | memset(fx, 0, xstate_size); |
| 147 | fx->cwd = 0x37f; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | if (cpu_has_xmm) |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 149 | fx->mxcsr = MXCSR_DEFAULT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | } else { |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 151 | struct i387_fsave_struct *fp = &tsk->thread.xstate->fsave; |
| 152 | memset(fp, 0, xstate_size); |
| 153 | fp->cwd = 0xffff037fu; |
| 154 | fp->swd = 0xffff0000u; |
| 155 | fp->twd = 0xffffffffu; |
| 156 | fp->fos = 0xffff0000u; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | } |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 158 | /* |
| 159 | * Only the device not available exception or ptrace can call init_fpu. |
| 160 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | set_stopped_child_used_math(tsk); |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 162 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | } |
| 164 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 165 | int fpregs_active(struct task_struct *target, const struct user_regset *regset) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | { |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 167 | return tsk_used_math(target) ? regset->n : 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | } |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 169 | |
| 170 | int xfpregs_active(struct task_struct *target, const struct user_regset *regset) |
| 171 | { |
| 172 | return (cpu_has_fxsr && tsk_used_math(target)) ? regset->n : 0; |
| 173 | } |
| 174 | |
| 175 | int xfpregs_get(struct task_struct *target, const struct user_regset *regset, |
| 176 | unsigned int pos, unsigned int count, |
| 177 | void *kbuf, void __user *ubuf) |
| 178 | { |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 179 | int ret; |
| 180 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 181 | if (!cpu_has_fxsr) |
| 182 | return -ENODEV; |
| 183 | |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 184 | ret = init_fpu(target); |
| 185 | if (ret) |
| 186 | return ret; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 187 | |
| 188 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 189 | &target->thread.xstate->fxsave, 0, -1); |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | int xfpregs_set(struct task_struct *target, const struct user_regset *regset, |
| 193 | unsigned int pos, unsigned int count, |
| 194 | const void *kbuf, const void __user *ubuf) |
| 195 | { |
| 196 | int ret; |
| 197 | |
| 198 | if (!cpu_has_fxsr) |
| 199 | return -ENODEV; |
| 200 | |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 201 | ret = init_fpu(target); |
| 202 | if (ret) |
| 203 | return ret; |
| 204 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 205 | set_stopped_child_used_math(target); |
| 206 | |
| 207 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 208 | &target->thread.xstate->fxsave, 0, -1); |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 209 | |
| 210 | /* |
| 211 | * mxcsr reserved bits must be masked to zero for security reasons. |
| 212 | */ |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 213 | target->thread.xstate->fxsave.mxcsr &= mxcsr_feature_mask; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 214 | |
| 215 | return ret; |
| 216 | } |
| 217 | |
| 218 | #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | /* |
| 221 | * FPU tag word conversions. |
| 222 | */ |
| 223 | |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 224 | static inline unsigned short twd_i387_to_fxsr(unsigned short twd) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | { |
| 226 | unsigned int tmp; /* to avoid 16 bit prefixes in the code */ |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 227 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | /* Transform each pair of bits into 01 (valid) or 00 (empty) */ |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 229 | tmp = ~twd; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 230 | tmp = (tmp | (tmp>>1)) & 0x5555; /* 0V0V0V0V0V0V0V0V */ |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 231 | /* and move the valid bits to the lower byte. */ |
| 232 | tmp = (tmp | (tmp >> 1)) & 0x3333; /* 00VV00VV00VV00VV */ |
| 233 | tmp = (tmp | (tmp >> 2)) & 0x0f0f; /* 0000VVVV0000VVVV */ |
| 234 | tmp = (tmp | (tmp >> 4)) & 0x00ff; /* 00000000VVVVVVVV */ |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 235 | |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 236 | return tmp; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | } |
| 238 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 239 | #define FPREG_ADDR(f, n) ((void *)&(f)->st_space + (n) * 16); |
| 240 | #define FP_EXP_TAG_VALID 0 |
| 241 | #define FP_EXP_TAG_ZERO 1 |
| 242 | #define FP_EXP_TAG_SPECIAL 2 |
| 243 | #define FP_EXP_TAG_EMPTY 3 |
| 244 | |
| 245 | static inline u32 twd_fxsr_to_i387(struct i387_fxsave_struct *fxsave) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | { |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 247 | struct _fpxreg *st; |
| 248 | u32 tos = (fxsave->swd >> 11) & 7; |
| 249 | u32 twd = (unsigned long) fxsave->twd; |
| 250 | u32 tag; |
| 251 | u32 ret = 0xffff0000u; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | int i; |
| 253 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 254 | for (i = 0; i < 8; i++, twd >>= 1) { |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 255 | if (twd & 0x1) { |
| 256 | st = FPREG_ADDR(fxsave, (i - tos) & 7); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 258 | switch (st->exponent & 0x7fff) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | case 0x7fff: |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 260 | tag = FP_EXP_TAG_SPECIAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | break; |
| 262 | case 0x0000: |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 263 | if (!st->significand[0] && |
| 264 | !st->significand[1] && |
| 265 | !st->significand[2] && |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 266 | !st->significand[3]) |
| 267 | tag = FP_EXP_TAG_ZERO; |
| 268 | else |
| 269 | tag = FP_EXP_TAG_SPECIAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 270 | break; |
| 271 | default: |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 272 | if (st->significand[3] & 0x8000) |
| 273 | tag = FP_EXP_TAG_VALID; |
| 274 | else |
| 275 | tag = FP_EXP_TAG_SPECIAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | break; |
| 277 | } |
| 278 | } else { |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 279 | tag = FP_EXP_TAG_EMPTY; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 280 | } |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 281 | ret |= tag << (2 * i); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | } |
| 283 | return ret; |
| 284 | } |
| 285 | |
| 286 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 287 | * FXSR floating point environment conversions. |
| 288 | */ |
| 289 | |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 290 | static void |
| 291 | convert_from_fxsr(struct user_i387_ia32_struct *env, struct task_struct *tsk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | { |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 293 | struct i387_fxsave_struct *fxsave = &tsk->thread.xstate->fxsave; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 294 | struct _fpreg *to = (struct _fpreg *) &env->st_space[0]; |
| 295 | struct _fpxreg *from = (struct _fpxreg *) &fxsave->st_space[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | int i; |
| 297 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 298 | env->cwd = fxsave->cwd | 0xffff0000u; |
| 299 | env->swd = fxsave->swd | 0xffff0000u; |
| 300 | env->twd = twd_fxsr_to_i387(fxsave); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 301 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 302 | #ifdef CONFIG_X86_64 |
| 303 | env->fip = fxsave->rip; |
| 304 | env->foo = fxsave->rdp; |
| 305 | if (tsk == current) { |
| 306 | /* |
| 307 | * should be actually ds/cs at fpu exception time, but |
| 308 | * that information is not available in 64bit mode. |
| 309 | */ |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 310 | asm("mov %%ds, %[fos]" : [fos] "=r" (env->fos)); |
| 311 | asm("mov %%cs, %[fcs]" : [fcs] "=r" (env->fcs)); |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 312 | } else { |
| 313 | struct pt_regs *regs = task_pt_regs(tsk); |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 314 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 315 | env->fos = 0xffff0000 | tsk->thread.ds; |
| 316 | env->fcs = regs->cs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | } |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 318 | #else |
| 319 | env->fip = fxsave->fip; |
Jan Beulich | 609b529 | 2008-03-05 08:35:14 +0000 | [diff] [blame] | 320 | env->fcs = (u16) fxsave->fcs | ((u32) fxsave->fop << 16); |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 321 | env->foo = fxsave->foo; |
| 322 | env->fos = fxsave->fos; |
| 323 | #endif |
| 324 | |
| 325 | for (i = 0; i < 8; ++i) |
| 326 | memcpy(&to[i], &from[i], sizeof(to[0])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | } |
| 328 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 329 | static void convert_to_fxsr(struct task_struct *tsk, |
| 330 | const struct user_i387_ia32_struct *env) |
| 331 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | { |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 333 | struct i387_fxsave_struct *fxsave = &tsk->thread.xstate->fxsave; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 334 | struct _fpreg *from = (struct _fpreg *) &env->st_space[0]; |
| 335 | struct _fpxreg *to = (struct _fpxreg *) &fxsave->st_space[0]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | int i; |
| 337 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 338 | fxsave->cwd = env->cwd; |
| 339 | fxsave->swd = env->swd; |
| 340 | fxsave->twd = twd_i387_to_fxsr(env->twd); |
| 341 | fxsave->fop = (u16) ((u32) env->fcs >> 16); |
| 342 | #ifdef CONFIG_X86_64 |
| 343 | fxsave->rip = env->fip; |
| 344 | fxsave->rdp = env->foo; |
| 345 | /* cs and ds ignored */ |
| 346 | #else |
| 347 | fxsave->fip = env->fip; |
| 348 | fxsave->fcs = (env->fcs & 0xffff); |
| 349 | fxsave->foo = env->foo; |
| 350 | fxsave->fos = env->fos; |
| 351 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 353 | for (i = 0; i < 8; ++i) |
| 354 | memcpy(&to[i], &from[i], sizeof(from[0])); |
| 355 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 357 | int fpregs_get(struct task_struct *target, const struct user_regset *regset, |
| 358 | unsigned int pos, unsigned int count, |
| 359 | void *kbuf, void __user *ubuf) |
| 360 | { |
| 361 | struct user_i387_ia32_struct env; |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 362 | int ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 364 | ret = init_fpu(target); |
| 365 | if (ret) |
| 366 | return ret; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 367 | |
Suresh Siddha | e8a496a | 2008-05-23 16:26:37 -0700 | [diff] [blame] | 368 | if (!HAVE_HWFP) |
| 369 | return fpregs_soft_get(target, regset, pos, count, kbuf, ubuf); |
| 370 | |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 371 | if (!cpu_has_fxsr) { |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 372 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 373 | &target->thread.xstate->fsave, 0, |
| 374 | -1); |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 375 | } |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 376 | |
| 377 | if (kbuf && pos == 0 && count == sizeof(env)) { |
| 378 | convert_from_fxsr(kbuf, target); |
| 379 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | } |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 381 | |
| 382 | convert_from_fxsr(&env, target); |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 383 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 384 | return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &env, 0, -1); |
| 385 | } |
| 386 | |
| 387 | int fpregs_set(struct task_struct *target, const struct user_regset *regset, |
| 388 | unsigned int pos, unsigned int count, |
| 389 | const void *kbuf, const void __user *ubuf) |
| 390 | { |
| 391 | struct user_i387_ia32_struct env; |
| 392 | int ret; |
| 393 | |
Suresh Siddha | aa283f4 | 2008-03-10 15:28:05 -0700 | [diff] [blame] | 394 | ret = init_fpu(target); |
| 395 | if (ret) |
| 396 | return ret; |
| 397 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 398 | set_stopped_child_used_math(target); |
| 399 | |
Suresh Siddha | e8a496a | 2008-05-23 16:26:37 -0700 | [diff] [blame] | 400 | if (!HAVE_HWFP) |
| 401 | return fpregs_soft_set(target, regset, pos, count, kbuf, ubuf); |
| 402 | |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 403 | if (!cpu_has_fxsr) { |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 404 | return user_regset_copyin(&pos, &count, &kbuf, &ubuf, |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 405 | &target->thread.xstate->fsave, 0, -1); |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 406 | } |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 407 | |
| 408 | if (pos > 0 || count < sizeof(env)) |
| 409 | convert_from_fxsr(&env, target); |
| 410 | |
| 411 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &env, 0, -1); |
| 412 | if (!ret) |
| 413 | convert_to_fxsr(target, &env); |
| 414 | |
| 415 | return ret; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | } |
| 417 | |
| 418 | /* |
| 419 | * Signal frame handlers. |
| 420 | */ |
| 421 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 422 | static inline int save_i387_fsave(struct _fpstate_ia32 __user *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | { |
| 424 | struct task_struct *tsk = current; |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 425 | struct i387_fsave_struct *fp = &tsk->thread.xstate->fsave; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 426 | |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 427 | unlazy_fpu(tsk); |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 428 | fp->status = fp->swd; |
| 429 | if (__copy_to_user(buf, fp, sizeof(struct i387_fsave_struct))) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | return -1; |
| 431 | return 1; |
| 432 | } |
| 433 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 434 | static int save_i387_fxsave(struct _fpstate_ia32 __user *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | { |
| 436 | struct task_struct *tsk = current; |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 437 | struct i387_fxsave_struct *fx = &tsk->thread.xstate->fxsave; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 438 | struct user_i387_ia32_struct env; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | int err = 0; |
| 440 | |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 441 | unlazy_fpu(tsk); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 443 | convert_from_fxsr(&env, tsk); |
| 444 | if (__copy_to_user(buf, &env, sizeof(env))) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 445 | return -1; |
| 446 | |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 447 | err |= __put_user(fx->swd, &buf->status); |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 448 | err |= __put_user(X86_FXSR_MAGIC, &buf->magic); |
| 449 | if (err) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | return -1; |
| 451 | |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 452 | if (__copy_to_user(&buf->_fxsr_env[0], fx, |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 453 | sizeof(struct i387_fxsave_struct))) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | return -1; |
| 455 | return 1; |
| 456 | } |
| 457 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 458 | int save_i387_ia32(struct _fpstate_ia32 __user *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | { |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 460 | if (!used_math()) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | return 0; |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 462 | /* |
| 463 | * This will cause a "finit" to be triggered by the next |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | * attempted FPU operation by the 'current' process. |
| 465 | */ |
| 466 | clear_used_math(); |
| 467 | |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 468 | if (!HAVE_HWFP) { |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 469 | return fpregs_soft_get(current, NULL, |
| 470 | 0, sizeof(struct user_i387_ia32_struct), |
| 471 | NULL, buf) ? -1 : 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 472 | } |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 473 | |
| 474 | if (cpu_has_fxsr) |
| 475 | return save_i387_fxsave(buf); |
| 476 | else |
| 477 | return save_i387_fsave(buf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | } |
| 479 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 480 | static inline int restore_i387_fsave(struct _fpstate_ia32 __user *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 481 | { |
| 482 | struct task_struct *tsk = current; |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 483 | |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 484 | return __copy_from_user(&tsk->thread.xstate->fsave, buf, |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 485 | sizeof(struct i387_fsave_struct)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 486 | } |
| 487 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 488 | static int restore_i387_fxsave(struct _fpstate_ia32 __user *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 489 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 490 | struct task_struct *tsk = current; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 491 | struct user_i387_ia32_struct env; |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 492 | int err; |
| 493 | |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 494 | err = __copy_from_user(&tsk->thread.xstate->fxsave, &buf->_fxsr_env[0], |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 495 | sizeof(struct i387_fxsave_struct)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 496 | /* mxcsr reserved bits must be masked to zero for security reasons */ |
Suresh Siddha | 61c4628 | 2008-03-10 15:28:04 -0700 | [diff] [blame] | 497 | tsk->thread.xstate->fxsave.mxcsr &= mxcsr_feature_mask; |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 498 | if (err || __copy_from_user(&env, buf, sizeof(env))) |
| 499 | return 1; |
| 500 | convert_to_fxsr(tsk, &env); |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 501 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 502 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | } |
| 504 | |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 505 | int restore_i387_ia32(struct _fpstate_ia32 __user *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | { |
| 507 | int err; |
Suresh Siddha | e8a496a | 2008-05-23 16:26:37 -0700 | [diff] [blame] | 508 | struct task_struct *tsk = current; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | |
Suresh Siddha | e8a496a | 2008-05-23 16:26:37 -0700 | [diff] [blame] | 510 | if (HAVE_HWFP) |
Suresh Siddha | fd3c3ed | 2008-05-07 12:09:52 -0700 | [diff] [blame] | 511 | clear_fpu(tsk); |
| 512 | |
Suresh Siddha | e8a496a | 2008-05-23 16:26:37 -0700 | [diff] [blame] | 513 | if (!used_math()) { |
| 514 | err = init_fpu(tsk); |
| 515 | if (err) |
| 516 | return err; |
| 517 | } |
Suresh Siddha | fd3c3ed | 2008-05-07 12:09:52 -0700 | [diff] [blame] | 518 | |
Suresh Siddha | e8a496a | 2008-05-23 16:26:37 -0700 | [diff] [blame] | 519 | if (HAVE_HWFP) { |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 520 | if (cpu_has_fxsr) |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 521 | err = restore_i387_fxsave(buf); |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 522 | else |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 523 | err = restore_i387_fsave(buf); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 524 | } else { |
Roland McGrath | 4421011 | 2008-01-30 13:31:50 +0100 | [diff] [blame] | 525 | err = fpregs_soft_set(current, NULL, |
| 526 | 0, sizeof(struct user_i387_ia32_struct), |
| 527 | NULL, buf) != 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 528 | } |
| 529 | set_used_math(); |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 530 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 531 | return err; |
| 532 | } |
| 533 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | /* |
| 535 | * FPU state for core dumps. |
Roland McGrath | 60b3b9a | 2008-01-30 13:31:55 +0100 | [diff] [blame] | 536 | * This is only used for a.out dumps now. |
| 537 | * It is declared generically using elf_fpregset_t (which is |
| 538 | * struct user_i387_struct) but is in fact only used for 32-bit |
| 539 | * dumps, so on 64-bit it is really struct user_i387_ia32_struct. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | */ |
Cyrill Gorcunov | 3b095a0 | 2008-01-30 13:31:26 +0100 | [diff] [blame] | 541 | int dump_fpu(struct pt_regs *regs, struct user_i387_struct *fpu) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 542 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 543 | struct task_struct *tsk = current; |
Ingo Molnar | f668964 | 2008-03-05 15:37:32 +0100 | [diff] [blame] | 544 | int fpvalid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | |
| 546 | fpvalid = !!used_math(); |
Roland McGrath | 60b3b9a | 2008-01-30 13:31:55 +0100 | [diff] [blame] | 547 | if (fpvalid) |
| 548 | fpvalid = !fpregs_get(tsk, NULL, |
| 549 | 0, sizeof(struct user_i387_ia32_struct), |
| 550 | fpu, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | |
| 552 | return fpvalid; |
| 553 | } |
Alexey Dobriyan | 129f694 | 2005-06-23 00:08:33 -0700 | [diff] [blame] | 554 | EXPORT_SYMBOL(dump_fpu); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 555 | |
Roland McGrath | 60b3b9a | 2008-01-30 13:31:55 +0100 | [diff] [blame] | 556 | #endif /* CONFIG_X86_32 || CONFIG_IA32_EMULATION */ |