| .. | .. |
|---|
| 26 | 26 | #include <asm/fpu/api.h> |
|---|
| 27 | 27 | #include <asm/asm.h> |
|---|
| 28 | 28 | |
|---|
| 29 | +/* |
|---|
| 30 | + * Use KFPU_387. MMX instructions are not affected by MXCSR, |
|---|
| 31 | + * but both AMD and Intel documentation states that even integer MMX |
|---|
| 32 | + * operations will result in #MF if an exception is pending in FCW. |
|---|
| 33 | + * |
|---|
| 34 | + * EMMS is not needed afterwards because, after calling kernel_fpu_end(), |
|---|
| 35 | + * any subsequent user of the 387 stack will reinitialize it using |
|---|
| 36 | + * KFPU_387. |
|---|
| 37 | + */ |
|---|
| 38 | + |
|---|
| 29 | 39 | void *_mmx_memcpy(void *to, const void *from, size_t len) |
|---|
| 30 | 40 | { |
|---|
| 31 | 41 | void *p; |
|---|
| .. | .. |
|---|
| 37 | 47 | p = to; |
|---|
| 38 | 48 | i = len >> 6; /* len/64 */ |
|---|
| 39 | 49 | |
|---|
| 40 | | - kernel_fpu_begin(); |
|---|
| 50 | + kernel_fpu_begin_mask(KFPU_387); |
|---|
| 41 | 51 | |
|---|
| 42 | 52 | __asm__ __volatile__ ( |
|---|
| 43 | 53 | "1: prefetch (%0)\n" /* This set is 28 bytes */ |
|---|
| .. | .. |
|---|
| 127 | 137 | { |
|---|
| 128 | 138 | int i; |
|---|
| 129 | 139 | |
|---|
| 130 | | - kernel_fpu_begin(); |
|---|
| 140 | + kernel_fpu_begin_mask(KFPU_387); |
|---|
| 131 | 141 | |
|---|
| 132 | 142 | __asm__ __volatile__ ( |
|---|
| 133 | 143 | " pxor %%mm0, %%mm0\n" : : |
|---|
| .. | .. |
|---|
| 160 | 170 | { |
|---|
| 161 | 171 | int i; |
|---|
| 162 | 172 | |
|---|
| 163 | | - kernel_fpu_begin(); |
|---|
| 173 | + kernel_fpu_begin_mask(KFPU_387); |
|---|
| 164 | 174 | |
|---|
| 165 | 175 | /* |
|---|
| 166 | 176 | * maybe the prefetch stuff can go before the expensive fnsave... |
|---|
| .. | .. |
|---|
| 247 | 257 | { |
|---|
| 248 | 258 | int i; |
|---|
| 249 | 259 | |
|---|
| 250 | | - kernel_fpu_begin(); |
|---|
| 260 | + kernel_fpu_begin_mask(KFPU_387); |
|---|
| 251 | 261 | |
|---|
| 252 | 262 | __asm__ __volatile__ ( |
|---|
| 253 | 263 | " pxor %%mm0, %%mm0\n" : : |
|---|
| .. | .. |
|---|
| 282 | 292 | { |
|---|
| 283 | 293 | int i; |
|---|
| 284 | 294 | |
|---|
| 285 | | - kernel_fpu_begin(); |
|---|
| 295 | + kernel_fpu_begin_mask(KFPU_387); |
|---|
| 286 | 296 | |
|---|
| 287 | 297 | __asm__ __volatile__ ( |
|---|
| 288 | 298 | "1: prefetch (%0)\n" |
|---|