diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-29 17:49:12 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-29 17:49:12 -0400 |
commit | b0c4e148bd591629749d02a8fbc8d81c26d548cf (patch) | |
tree | 3e2142635f3dc2ceeae870ead2dceab7b9c6def1 /arch/mips/math-emu | |
parent | 5615ca7906aefbdc3318604c89db5931d0a25910 (diff) | |
parent | be15cd72d256e5eb3261a781b8507fac83ab33f6 (diff) |
Merge branch 'master'
Diffstat (limited to 'arch/mips/math-emu')
-rw-r--r-- | arch/mips/math-emu/cp1emu.c | 229 | ||||
-rw-r--r-- | arch/mips/math-emu/dp_sqrt.c | 2 | ||||
-rw-r--r-- | arch/mips/math-emu/dsemul.c | 17 | ||||
-rw-r--r-- | arch/mips/math-emu/dsemul.h | 10 | ||||
-rw-r--r-- | arch/mips/math-emu/ieee754.c | 16 | ||||
-rw-r--r-- | arch/mips/math-emu/ieee754.h | 180 | ||||
-rw-r--r-- | arch/mips/math-emu/kernel_linkage.c | 6 |
7 files changed, 187 insertions, 273 deletions
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 99c550632d44..aa5818a0d884 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -70,7 +70,7 @@ static int fpux_emu(struct pt_regs *, | |||
70 | 70 | ||
71 | /* Further private data for which no space exists in mips_fpu_soft_struct */ | 71 | /* Further private data for which no space exists in mips_fpu_soft_struct */ |
72 | 72 | ||
73 | struct mips_fpu_emulator_private fpuemuprivate; | 73 | struct mips_fpu_emulator_stats fpuemustats; |
74 | 74 | ||
75 | /* Control registers */ | 75 | /* Control registers */ |
76 | 76 | ||
@@ -79,7 +79,17 @@ struct mips_fpu_emulator_private fpuemuprivate; | |||
79 | 79 | ||
80 | /* Convert Mips rounding mode (0..3) to IEEE library modes. */ | 80 | /* Convert Mips rounding mode (0..3) to IEEE library modes. */ |
81 | static const unsigned char ieee_rm[4] = { | 81 | static const unsigned char ieee_rm[4] = { |
82 | IEEE754_RN, IEEE754_RZ, IEEE754_RU, IEEE754_RD | 82 | [FPU_CSR_RN] = IEEE754_RN, |
83 | [FPU_CSR_RZ] = IEEE754_RZ, | ||
84 | [FPU_CSR_RU] = IEEE754_RU, | ||
85 | [FPU_CSR_RD] = IEEE754_RD, | ||
86 | }; | ||
87 | /* Convert IEEE library modes to Mips rounding mode (0..3). */ | ||
88 | static const unsigned char mips_rm[4] = { | ||
89 | [IEEE754_RN] = FPU_CSR_RN, | ||
90 | [IEEE754_RZ] = FPU_CSR_RZ, | ||
91 | [IEEE754_RD] = FPU_CSR_RD, | ||
92 | [IEEE754_RU] = FPU_CSR_RU, | ||
83 | }; | 93 | }; |
84 | 94 | ||
85 | #if __mips >= 4 | 95 | #if __mips >= 4 |
@@ -196,11 +206,11 @@ static int isBranchInstr(mips_instruction * i) | |||
196 | static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | 206 | static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) |
197 | { | 207 | { |
198 | mips_instruction ir; | 208 | mips_instruction ir; |
199 | vaddr_t emulpc, contpc; | 209 | void * emulpc, *contpc; |
200 | unsigned int cond; | 210 | unsigned int cond; |
201 | 211 | ||
202 | if (get_user(ir, (mips_instruction *) xcp->cp0_epc)) { | 212 | if (get_user(ir, (mips_instruction __user *) xcp->cp0_epc)) { |
203 | fpuemuprivate.stats.errors++; | 213 | fpuemustats.errors++; |
204 | return SIGBUS; | 214 | return SIGBUS; |
205 | } | 215 | } |
206 | 216 | ||
@@ -221,41 +231,39 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | |||
221 | * Linux MIPS branch emulator operates on context, updating the | 231 | * Linux MIPS branch emulator operates on context, updating the |
222 | * cp0_epc. | 232 | * cp0_epc. |
223 | */ | 233 | */ |
224 | emulpc = REG_TO_VA(xcp->cp0_epc + 4); /* Snapshot emulation target */ | 234 | emulpc = (void *) (xcp->cp0_epc + 4); /* Snapshot emulation target */ |
225 | 235 | ||
226 | if (__compute_return_epc(xcp)) { | 236 | if (__compute_return_epc(xcp)) { |
227 | #ifdef CP1DBG | 237 | #ifdef CP1DBG |
228 | printk("failed to emulate branch at %p\n", | 238 | printk("failed to emulate branch at %p\n", |
229 | REG_TO_VA(xcp->cp0_epc)); | 239 | (void *) (xcp->cp0_epc)); |
230 | #endif | 240 | #endif |
231 | return SIGILL; | 241 | return SIGILL; |
232 | } | 242 | } |
233 | if (get_user(ir, (mips_instruction *) emulpc)) { | 243 | if (get_user(ir, (mips_instruction __user *) emulpc)) { |
234 | fpuemuprivate.stats.errors++; | 244 | fpuemustats.errors++; |
235 | return SIGBUS; | 245 | return SIGBUS; |
236 | } | 246 | } |
237 | /* __compute_return_epc() will have updated cp0_epc */ | 247 | /* __compute_return_epc() will have updated cp0_epc */ |
238 | contpc = REG_TO_VA xcp->cp0_epc; | 248 | contpc = (void *) xcp->cp0_epc; |
239 | /* In order not to confuse ptrace() et al, tweak context */ | 249 | /* In order not to confuse ptrace() et al, tweak context */ |
240 | xcp->cp0_epc = VA_TO_REG emulpc - 4; | 250 | xcp->cp0_epc = (unsigned long) emulpc - 4; |
241 | } | 251 | } else { |
242 | else { | 252 | emulpc = (void *) xcp->cp0_epc; |
243 | emulpc = REG_TO_VA xcp->cp0_epc; | 253 | contpc = (void *) (xcp->cp0_epc + 4); |
244 | contpc = REG_TO_VA(xcp->cp0_epc + 4); | ||
245 | } | 254 | } |
246 | 255 | ||
247 | emul: | 256 | emul: |
248 | fpuemuprivate.stats.emulated++; | 257 | fpuemustats.emulated++; |
249 | switch (MIPSInst_OPCODE(ir)) { | 258 | switch (MIPSInst_OPCODE(ir)) { |
250 | #ifndef SINGLE_ONLY_FPU | ||
251 | case ldc1_op:{ | 259 | case ldc1_op:{ |
252 | u64 *va = REG_TO_VA(xcp->regs[MIPSInst_RS(ir)] + | 260 | u64 __user *va = (u64 __user *) (xcp->regs[MIPSInst_RS(ir)] + |
253 | MIPSInst_SIMM(ir)); | 261 | MIPSInst_SIMM(ir)); |
254 | u64 val; | 262 | u64 val; |
255 | 263 | ||
256 | fpuemuprivate.stats.loads++; | 264 | fpuemustats.loads++; |
257 | if (get_user(val, va)) { | 265 | if (get_user(val, va)) { |
258 | fpuemuprivate.stats.errors++; | 266 | fpuemustats.errors++; |
259 | return SIGBUS; | 267 | return SIGBUS; |
260 | } | 268 | } |
261 | DITOREG(val, MIPSInst_RT(ir)); | 269 | DITOREG(val, MIPSInst_RT(ir)); |
@@ -263,55 +271,42 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | |||
263 | } | 271 | } |
264 | 272 | ||
265 | case sdc1_op:{ | 273 | case sdc1_op:{ |
266 | u64 *va = REG_TO_VA(xcp->regs[MIPSInst_RS(ir)] + | 274 | u64 __user *va = (u64 __user *) (xcp->regs[MIPSInst_RS(ir)] + |
267 | MIPSInst_SIMM(ir)); | 275 | MIPSInst_SIMM(ir)); |
268 | u64 val; | 276 | u64 val; |
269 | 277 | ||
270 | fpuemuprivate.stats.stores++; | 278 | fpuemustats.stores++; |
271 | DIFROMREG(val, MIPSInst_RT(ir)); | 279 | DIFROMREG(val, MIPSInst_RT(ir)); |
272 | if (put_user(val, va)) { | 280 | if (put_user(val, va)) { |
273 | fpuemuprivate.stats.errors++; | 281 | fpuemustats.errors++; |
274 | return SIGBUS; | 282 | return SIGBUS; |
275 | } | 283 | } |
276 | break; | 284 | break; |
277 | } | 285 | } |
278 | #endif | ||
279 | 286 | ||
280 | case lwc1_op:{ | 287 | case lwc1_op:{ |
281 | u32 *va = REG_TO_VA(xcp->regs[MIPSInst_RS(ir)] + | 288 | u32 __user *va = (u32 __user *) (xcp->regs[MIPSInst_RS(ir)] + |
282 | MIPSInst_SIMM(ir)); | 289 | MIPSInst_SIMM(ir)); |
283 | u32 val; | 290 | u32 val; |
284 | 291 | ||
285 | fpuemuprivate.stats.loads++; | 292 | fpuemustats.loads++; |
286 | if (get_user(val, va)) { | 293 | if (get_user(val, va)) { |
287 | fpuemuprivate.stats.errors++; | 294 | fpuemustats.errors++; |
288 | return SIGBUS; | 295 | return SIGBUS; |
289 | } | 296 | } |
290 | #ifdef SINGLE_ONLY_FPU | ||
291 | if (MIPSInst_RT(ir) & 1) { | ||
292 | /* illegal register in single-float mode */ | ||
293 | return SIGILL; | ||
294 | } | ||
295 | #endif | ||
296 | SITOREG(val, MIPSInst_RT(ir)); | 297 | SITOREG(val, MIPSInst_RT(ir)); |
297 | break; | 298 | break; |
298 | } | 299 | } |
299 | 300 | ||
300 | case swc1_op:{ | 301 | case swc1_op:{ |
301 | u32 *va = REG_TO_VA(xcp->regs[MIPSInst_RS(ir)] + | 302 | u32 __user *va = (u32 __user *) (xcp->regs[MIPSInst_RS(ir)] + |
302 | MIPSInst_SIMM(ir)); | 303 | MIPSInst_SIMM(ir)); |
303 | u32 val; | 304 | u32 val; |
304 | 305 | ||
305 | fpuemuprivate.stats.stores++; | 306 | fpuemustats.stores++; |
306 | #ifdef SINGLE_ONLY_FPU | ||
307 | if (MIPSInst_RT(ir) & 1) { | ||
308 | /* illegal register in single-float mode */ | ||
309 | return SIGILL; | ||
310 | } | ||
311 | #endif | ||
312 | SIFROMREG(val, MIPSInst_RT(ir)); | 307 | SIFROMREG(val, MIPSInst_RT(ir)); |
313 | if (put_user(val, va)) { | 308 | if (put_user(val, va)) { |
314 | fpuemuprivate.stats.errors++; | 309 | fpuemustats.errors++; |
315 | return SIGBUS; | 310 | return SIGBUS; |
316 | } | 311 | } |
317 | break; | 312 | break; |
@@ -320,7 +315,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | |||
320 | case cop1_op: | 315 | case cop1_op: |
321 | switch (MIPSInst_RS(ir)) { | 316 | switch (MIPSInst_RS(ir)) { |
322 | 317 | ||
323 | #if defined(__mips64) && !defined(SINGLE_ONLY_FPU) | 318 | #if defined(__mips64) |
324 | case dmfc_op: | 319 | case dmfc_op: |
325 | /* copregister fs -> gpr[rt] */ | 320 | /* copregister fs -> gpr[rt] */ |
326 | if (MIPSInst_RT(ir) != 0) { | 321 | if (MIPSInst_RT(ir) != 0) { |
@@ -337,12 +332,6 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | |||
337 | 332 | ||
338 | case mfc_op: | 333 | case mfc_op: |
339 | /* copregister rd -> gpr[rt] */ | 334 | /* copregister rd -> gpr[rt] */ |
340 | #ifdef SINGLE_ONLY_FPU | ||
341 | if (MIPSInst_RD(ir) & 1) { | ||
342 | /* illegal register in single-float mode */ | ||
343 | return SIGILL; | ||
344 | } | ||
345 | #endif | ||
346 | if (MIPSInst_RT(ir) != 0) { | 335 | if (MIPSInst_RT(ir) != 0) { |
347 | SIFROMREG(xcp->regs[MIPSInst_RT(ir)], | 336 | SIFROMREG(xcp->regs[MIPSInst_RT(ir)], |
348 | MIPSInst_RD(ir)); | 337 | MIPSInst_RD(ir)); |
@@ -351,12 +340,6 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | |||
351 | 340 | ||
352 | case mtc_op: | 341 | case mtc_op: |
353 | /* copregister rd <- rt */ | 342 | /* copregister rd <- rt */ |
354 | #ifdef SINGLE_ONLY_FPU | ||
355 | if (MIPSInst_RD(ir) & 1) { | ||
356 | /* illegal register in single-float mode */ | ||
357 | return SIGILL; | ||
358 | } | ||
359 | #endif | ||
360 | SITOREG(xcp->regs[MIPSInst_RT(ir)], MIPSInst_RD(ir)); | 343 | SITOREG(xcp->regs[MIPSInst_RT(ir)], MIPSInst_RD(ir)); |
361 | break; | 344 | break; |
362 | 345 | ||
@@ -369,9 +352,10 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | |||
369 | } | 352 | } |
370 | if (MIPSInst_RD(ir) == FPCREG_CSR) { | 353 | if (MIPSInst_RD(ir) == FPCREG_CSR) { |
371 | value = ctx->fcr31; | 354 | value = ctx->fcr31; |
355 | value = (value & ~0x3) | mips_rm[value & 0x3]; | ||
372 | #ifdef CSRTRACE | 356 | #ifdef CSRTRACE |
373 | printk("%p gpr[%d]<-csr=%08x\n", | 357 | printk("%p gpr[%d]<-csr=%08x\n", |
374 | REG_TO_VA(xcp->cp0_epc), | 358 | (void *) (xcp->cp0_epc), |
375 | MIPSInst_RT(ir), value); | 359 | MIPSInst_RT(ir), value); |
376 | #endif | 360 | #endif |
377 | } | 361 | } |
@@ -398,14 +382,13 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | |||
398 | if (MIPSInst_RD(ir) == FPCREG_CSR) { | 382 | if (MIPSInst_RD(ir) == FPCREG_CSR) { |
399 | #ifdef CSRTRACE | 383 | #ifdef CSRTRACE |
400 | printk("%p gpr[%d]->csr=%08x\n", | 384 | printk("%p gpr[%d]->csr=%08x\n", |
401 | REG_TO_VA(xcp->cp0_epc), | 385 | (void *) (xcp->cp0_epc), |
402 | MIPSInst_RT(ir), value); | 386 | MIPSInst_RT(ir), value); |
403 | #endif | 387 | #endif |
404 | ctx->fcr31 = value; | 388 | value &= (FPU_CSR_FLUSH | FPU_CSR_ALL_E | FPU_CSR_ALL_S | 0x03); |
405 | /* copy new rounding mode and | 389 | ctx->fcr31 &= ~(FPU_CSR_FLUSH | FPU_CSR_ALL_E | FPU_CSR_ALL_S | 0x03); |
406 | flush bit to ieee library state! */ | 390 | /* convert to ieee library modes */ |
407 | ieee754_csr.nod = (ctx->fcr31 & 0x1000000) != 0; | 391 | ctx->fcr31 |= (value & ~0x3) | ieee_rm[value & 0x3]; |
408 | ieee754_csr.rm = ieee_rm[value & 0x3]; | ||
409 | } | 392 | } |
410 | if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) { | 393 | if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) { |
411 | return SIGFPE; | 394 | return SIGFPE; |
@@ -445,20 +428,20 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | |||
445 | * instruction | 428 | * instruction |
446 | */ | 429 | */ |
447 | xcp->cp0_epc += 4; | 430 | xcp->cp0_epc += 4; |
448 | contpc = REG_TO_VA | 431 | contpc = (void *) |
449 | (xcp->cp0_epc + | 432 | (xcp->cp0_epc + |
450 | (MIPSInst_SIMM(ir) << 2)); | 433 | (MIPSInst_SIMM(ir) << 2)); |
451 | 434 | ||
452 | if (get_user(ir, (mips_instruction *) | 435 | if (get_user(ir, |
453 | REG_TO_VA xcp->cp0_epc)) { | 436 | (mips_instruction __user *) xcp->cp0_epc)) { |
454 | fpuemuprivate.stats.errors++; | 437 | fpuemustats.errors++; |
455 | return SIGBUS; | 438 | return SIGBUS; |
456 | } | 439 | } |
457 | 440 | ||
458 | switch (MIPSInst_OPCODE(ir)) { | 441 | switch (MIPSInst_OPCODE(ir)) { |
459 | case lwc1_op: | 442 | case lwc1_op: |
460 | case swc1_op: | 443 | case swc1_op: |
461 | #if (__mips >= 2 || __mips64) && !defined(SINGLE_ONLY_FPU) | 444 | #if (__mips >= 2 || defined(__mips64)) |
462 | case ldc1_op: | 445 | case ldc1_op: |
463 | case sdc1_op: | 446 | case sdc1_op: |
464 | #endif | 447 | #endif |
@@ -480,7 +463,7 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | |||
480 | * Single step the non-cp1 | 463 | * Single step the non-cp1 |
481 | * instruction in the dslot | 464 | * instruction in the dslot |
482 | */ | 465 | */ |
483 | return mips_dsemul(xcp, ir, VA_TO_REG contpc); | 466 | return mips_dsemul(xcp, ir, (unsigned long) contpc); |
484 | } | 467 | } |
485 | else { | 468 | else { |
486 | /* branch not taken */ | 469 | /* branch not taken */ |
@@ -539,8 +522,9 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx) | |||
539 | } | 522 | } |
540 | 523 | ||
541 | /* we did it !! */ | 524 | /* we did it !! */ |
542 | xcp->cp0_epc = VA_TO_REG(contpc); | 525 | xcp->cp0_epc = (unsigned long) contpc; |
543 | xcp->cp0_cause &= ~CAUSEF_BD; | 526 | xcp->cp0_cause &= ~CAUSEF_BD; |
527 | |||
544 | return 0; | 528 | return 0; |
545 | } | 529 | } |
546 | 530 | ||
@@ -570,7 +554,7 @@ static const unsigned char cmptab[8] = { | |||
570 | static ieee754##p fpemu_##p##_##name (ieee754##p r, ieee754##p s, \ | 554 | static ieee754##p fpemu_##p##_##name (ieee754##p r, ieee754##p s, \ |
571 | ieee754##p t) \ | 555 | ieee754##p t) \ |
572 | { \ | 556 | { \ |
573 | struct ieee754_csr ieee754_csr_save; \ | 557 | struct _ieee754_csr ieee754_csr_save; \ |
574 | s = f1 (s, t); \ | 558 | s = f1 (s, t); \ |
575 | ieee754_csr_save = ieee754_csr; \ | 559 | ieee754_csr_save = ieee754_csr; \ |
576 | s = f2 (s, r); \ | 560 | s = f2 (s, r); \ |
@@ -616,54 +600,38 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
616 | { | 600 | { |
617 | unsigned rcsr = 0; /* resulting csr */ | 601 | unsigned rcsr = 0; /* resulting csr */ |
618 | 602 | ||
619 | fpuemuprivate.stats.cp1xops++; | 603 | fpuemustats.cp1xops++; |
620 | 604 | ||
621 | switch (MIPSInst_FMA_FFMT(ir)) { | 605 | switch (MIPSInst_FMA_FFMT(ir)) { |
622 | case s_fmt:{ /* 0 */ | 606 | case s_fmt:{ /* 0 */ |
623 | 607 | ||
624 | ieee754sp(*handler) (ieee754sp, ieee754sp, ieee754sp); | 608 | ieee754sp(*handler) (ieee754sp, ieee754sp, ieee754sp); |
625 | ieee754sp fd, fr, fs, ft; | 609 | ieee754sp fd, fr, fs, ft; |
626 | u32 *va; | 610 | u32 __user *va; |
627 | u32 val; | 611 | u32 val; |
628 | 612 | ||
629 | switch (MIPSInst_FUNC(ir)) { | 613 | switch (MIPSInst_FUNC(ir)) { |
630 | case lwxc1_op: | 614 | case lwxc1_op: |
631 | va = REG_TO_VA(xcp->regs[MIPSInst_FR(ir)] + | 615 | va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] + |
632 | xcp->regs[MIPSInst_FT(ir)]); | 616 | xcp->regs[MIPSInst_FT(ir)]); |
633 | 617 | ||
634 | fpuemuprivate.stats.loads++; | 618 | fpuemustats.loads++; |
635 | if (get_user(val, va)) { | 619 | if (get_user(val, va)) { |
636 | fpuemuprivate.stats.errors++; | 620 | fpuemustats.errors++; |
637 | return SIGBUS; | 621 | return SIGBUS; |
638 | } | 622 | } |
639 | #ifdef SINGLE_ONLY_FPU | ||
640 | if (MIPSInst_FD(ir) & 1) { | ||
641 | /* illegal register in single-float | ||
642 | * mode | ||
643 | */ | ||
644 | return SIGILL; | ||
645 | } | ||
646 | #endif | ||
647 | SITOREG(val, MIPSInst_FD(ir)); | 623 | SITOREG(val, MIPSInst_FD(ir)); |
648 | break; | 624 | break; |
649 | 625 | ||
650 | case swxc1_op: | 626 | case swxc1_op: |
651 | va = REG_TO_VA(xcp->regs[MIPSInst_FR(ir)] + | 627 | va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] + |
652 | xcp->regs[MIPSInst_FT(ir)]); | 628 | xcp->regs[MIPSInst_FT(ir)]); |
653 | 629 | ||
654 | fpuemuprivate.stats.stores++; | 630 | fpuemustats.stores++; |
655 | #ifdef SINGLE_ONLY_FPU | ||
656 | if (MIPSInst_FS(ir) & 1) { | ||
657 | /* illegal register in single-float | ||
658 | * mode | ||
659 | */ | ||
660 | return SIGILL; | ||
661 | } | ||
662 | #endif | ||
663 | 631 | ||
664 | SIFROMREG(val, MIPSInst_FS(ir)); | 632 | SIFROMREG(val, MIPSInst_FS(ir)); |
665 | if (put_user(val, va)) { | 633 | if (put_user(val, va)) { |
666 | fpuemuprivate.stats.errors++; | 634 | fpuemustats.errors++; |
667 | return SIGBUS; | 635 | return SIGBUS; |
668 | } | 636 | } |
669 | break; | 637 | break; |
@@ -699,8 +667,6 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
699 | rcsr |= FPU_CSR_INV_X | FPU_CSR_INV_S; | 667 | rcsr |= FPU_CSR_INV_X | FPU_CSR_INV_S; |
700 | 668 | ||
701 | ctx->fcr31 = (ctx->fcr31 & ~FPU_CSR_ALL_X) | rcsr; | 669 | ctx->fcr31 = (ctx->fcr31 & ~FPU_CSR_ALL_X) | rcsr; |
702 | if (ieee754_csr.nod) | ||
703 | ctx->fcr31 |= 0x1000000; | ||
704 | if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) { | 670 | if ((ctx->fcr31 >> 5) & ctx->fcr31 & FPU_CSR_ALL_E) { |
705 | /*printk ("SIGFPE: fpu csr = %08x\n", | 671 | /*printk ("SIGFPE: fpu csr = %08x\n", |
706 | ctx->fcr31); */ | 672 | ctx->fcr31); */ |
@@ -715,34 +681,33 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
715 | break; | 681 | break; |
716 | } | 682 | } |
717 | 683 | ||
718 | #ifndef SINGLE_ONLY_FPU | ||
719 | case d_fmt:{ /* 1 */ | 684 | case d_fmt:{ /* 1 */ |
720 | ieee754dp(*handler) (ieee754dp, ieee754dp, ieee754dp); | 685 | ieee754dp(*handler) (ieee754dp, ieee754dp, ieee754dp); |
721 | ieee754dp fd, fr, fs, ft; | 686 | ieee754dp fd, fr, fs, ft; |
722 | u64 *va; | 687 | u64 __user *va; |
723 | u64 val; | 688 | u64 val; |
724 | 689 | ||
725 | switch (MIPSInst_FUNC(ir)) { | 690 | switch (MIPSInst_FUNC(ir)) { |
726 | case ldxc1_op: | 691 | case ldxc1_op: |
727 | va = REG_TO_VA(xcp->regs[MIPSInst_FR(ir)] + | 692 | va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] + |
728 | xcp->regs[MIPSInst_FT(ir)]); | 693 | xcp->regs[MIPSInst_FT(ir)]); |
729 | 694 | ||
730 | fpuemuprivate.stats.loads++; | 695 | fpuemustats.loads++; |
731 | if (get_user(val, va)) { | 696 | if (get_user(val, va)) { |
732 | fpuemuprivate.stats.errors++; | 697 | fpuemustats.errors++; |
733 | return SIGBUS; | 698 | return SIGBUS; |
734 | } | 699 | } |
735 | DITOREG(val, MIPSInst_FD(ir)); | 700 | DITOREG(val, MIPSInst_FD(ir)); |
736 | break; | 701 | break; |
737 | 702 | ||
738 | case sdxc1_op: | 703 | case sdxc1_op: |
739 | va = REG_TO_VA(xcp->regs[MIPSInst_FR(ir)] + | 704 | va = (void __user *) (xcp->regs[MIPSInst_FR(ir)] + |
740 | xcp->regs[MIPSInst_FT(ir)]); | 705 | xcp->regs[MIPSInst_FT(ir)]); |
741 | 706 | ||
742 | fpuemuprivate.stats.stores++; | 707 | fpuemustats.stores++; |
743 | DIFROMREG(val, MIPSInst_FS(ir)); | 708 | DIFROMREG(val, MIPSInst_FS(ir)); |
744 | if (put_user(val, va)) { | 709 | if (put_user(val, va)) { |
745 | fpuemuprivate.stats.errors++; | 710 | fpuemustats.errors++; |
746 | return SIGBUS; | 711 | return SIGBUS; |
747 | } | 712 | } |
748 | break; | 713 | break; |
@@ -773,7 +738,6 @@ static int fpux_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
773 | } | 738 | } |
774 | break; | 739 | break; |
775 | } | 740 | } |
776 | #endif | ||
777 | 741 | ||
778 | case 0x7: /* 7 */ | 742 | case 0x7: /* 7 */ |
779 | if (MIPSInst_FUNC(ir) != pfetch_op) { | 743 | if (MIPSInst_FUNC(ir) != pfetch_op) { |
@@ -810,7 +774,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
810 | #endif | 774 | #endif |
811 | } rv; /* resulting value */ | 775 | } rv; /* resulting value */ |
812 | 776 | ||
813 | fpuemuprivate.stats.cp1ops++; | 777 | fpuemustats.cp1ops++; |
814 | switch (rfmt = (MIPSInst_FFMT(ir) & 0xf)) { | 778 | switch (rfmt = (MIPSInst_FFMT(ir) & 0xf)) { |
815 | case s_fmt:{ /* 0 */ | 779 | case s_fmt:{ /* 0 */ |
816 | union { | 780 | union { |
@@ -834,7 +798,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
834 | goto scopbop; | 798 | goto scopbop; |
835 | 799 | ||
836 | /* unary ops */ | 800 | /* unary ops */ |
837 | #if __mips >= 2 || __mips64 | 801 | #if __mips >= 2 || defined(__mips64) |
838 | case fsqrt_op: | 802 | case fsqrt_op: |
839 | handler.u = ieee754sp_sqrt; | 803 | handler.u = ieee754sp_sqrt; |
840 | goto scopuop; | 804 | goto scopuop; |
@@ -913,9 +877,6 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
913 | case fcvts_op: | 877 | case fcvts_op: |
914 | return SIGILL; /* not defined */ | 878 | return SIGILL; /* not defined */ |
915 | case fcvtd_op:{ | 879 | case fcvtd_op:{ |
916 | #ifdef SINGLE_ONLY_FPU | ||
917 | return SIGILL; /* not defined */ | ||
918 | #else | ||
919 | ieee754sp fs; | 880 | ieee754sp fs; |
920 | 881 | ||
921 | SPFROMREG(fs, MIPSInst_FS(ir)); | 882 | SPFROMREG(fs, MIPSInst_FS(ir)); |
@@ -923,7 +884,6 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
923 | rfmt = d_fmt; | 884 | rfmt = d_fmt; |
924 | goto copcsr; | 885 | goto copcsr; |
925 | } | 886 | } |
926 | #endif | ||
927 | case fcvtw_op:{ | 887 | case fcvtw_op:{ |
928 | ieee754sp fs; | 888 | ieee754sp fs; |
929 | 889 | ||
@@ -933,7 +893,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
933 | goto copcsr; | 893 | goto copcsr; |
934 | } | 894 | } |
935 | 895 | ||
936 | #if __mips >= 2 || __mips64 | 896 | #if __mips >= 2 || defined(__mips64) |
937 | case fround_op: | 897 | case fround_op: |
938 | case ftrunc_op: | 898 | case ftrunc_op: |
939 | case fceil_op: | 899 | case fceil_op: |
@@ -950,7 +910,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
950 | } | 910 | } |
951 | #endif /* __mips >= 2 */ | 911 | #endif /* __mips >= 2 */ |
952 | 912 | ||
953 | #if defined(__mips64) && !defined(SINGLE_ONLY_FPU) | 913 | #if defined(__mips64) |
954 | case fcvtl_op:{ | 914 | case fcvtl_op:{ |
955 | ieee754sp fs; | 915 | ieee754sp fs; |
956 | 916 | ||
@@ -974,7 +934,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
974 | rfmt = l_fmt; | 934 | rfmt = l_fmt; |
975 | goto copcsr; | 935 | goto copcsr; |
976 | } | 936 | } |
977 | #endif /* __mips64 && !fpu(single) */ | 937 | #endif /* defined(__mips64) */ |
978 | 938 | ||
979 | default: | 939 | default: |
980 | if (MIPSInst_FUNC(ir) >= fcmp_op) { | 940 | if (MIPSInst_FUNC(ir) >= fcmp_op) { |
@@ -1001,7 +961,6 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
1001 | break; | 961 | break; |
1002 | } | 962 | } |
1003 | 963 | ||
1004 | #ifndef SINGLE_ONLY_FPU | ||
1005 | case d_fmt:{ | 964 | case d_fmt:{ |
1006 | union { | 965 | union { |
1007 | ieee754dp(*b) (ieee754dp, ieee754dp); | 966 | ieee754dp(*b) (ieee754dp, ieee754dp); |
@@ -1024,7 +983,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
1024 | goto dcopbop; | 983 | goto dcopbop; |
1025 | 984 | ||
1026 | /* unary ops */ | 985 | /* unary ops */ |
1027 | #if __mips >= 2 || __mips64 | 986 | #if __mips >= 2 || defined(__mips64) |
1028 | case fsqrt_op: | 987 | case fsqrt_op: |
1029 | handler.u = ieee754dp_sqrt; | 988 | handler.u = ieee754dp_sqrt; |
1030 | goto dcopuop; | 989 | goto dcopuop; |
@@ -1108,7 +1067,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
1108 | goto copcsr; | 1067 | goto copcsr; |
1109 | } | 1068 | } |
1110 | 1069 | ||
1111 | #if __mips >= 2 || __mips64 | 1070 | #if __mips >= 2 || defined(__mips64) |
1112 | case fround_op: | 1071 | case fround_op: |
1113 | case ftrunc_op: | 1072 | case ftrunc_op: |
1114 | case fceil_op: | 1073 | case fceil_op: |
@@ -1125,7 +1084,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
1125 | } | 1084 | } |
1126 | #endif | 1085 | #endif |
1127 | 1086 | ||
1128 | #if defined(__mips64) && !defined(SINGLE_ONLY_FPU) | 1087 | #if defined(__mips64) |
1129 | case fcvtl_op:{ | 1088 | case fcvtl_op:{ |
1130 | ieee754dp fs; | 1089 | ieee754dp fs; |
1131 | 1090 | ||
@@ -1149,7 +1108,7 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
1149 | rfmt = l_fmt; | 1108 | rfmt = l_fmt; |
1150 | goto copcsr; | 1109 | goto copcsr; |
1151 | } | 1110 | } |
1152 | #endif /* __mips >= 3 && !fpu(single) */ | 1111 | #endif /* __mips >= 3 */ |
1153 | 1112 | ||
1154 | default: | 1113 | default: |
1155 | if (MIPSInst_FUNC(ir) >= fcmp_op) { | 1114 | if (MIPSInst_FUNC(ir) >= fcmp_op) { |
@@ -1177,7 +1136,6 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
1177 | } | 1136 | } |
1178 | break; | 1137 | break; |
1179 | } | 1138 | } |
1180 | #endif /* ifndef SINGLE_ONLY_FPU */ | ||
1181 | 1139 | ||
1182 | case w_fmt:{ | 1140 | case w_fmt:{ |
1183 | ieee754sp fs; | 1141 | ieee754sp fs; |
@@ -1189,21 +1147,19 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
1189 | rv.s = ieee754sp_fint(fs.bits); | 1147 | rv.s = ieee754sp_fint(fs.bits); |
1190 | rfmt = s_fmt; | 1148 | rfmt = s_fmt; |
1191 | goto copcsr; | 1149 | goto copcsr; |
1192 | #ifndef SINGLE_ONLY_FPU | ||
1193 | case fcvtd_op: | 1150 | case fcvtd_op: |
1194 | /* convert word to double precision real */ | 1151 | /* convert word to double precision real */ |
1195 | SPFROMREG(fs, MIPSInst_FS(ir)); | 1152 | SPFROMREG(fs, MIPSInst_FS(ir)); |
1196 | rv.d = ieee754dp_fint(fs.bits); | 1153 | rv.d = ieee754dp_fint(fs.bits); |
1197 | rfmt = d_fmt; | 1154 | rfmt = d_fmt; |
1198 | goto copcsr; | 1155 | goto copcsr; |
1199 | #endif | ||
1200 | default: | 1156 | default: |
1201 | return SIGILL; | 1157 | return SIGILL; |
1202 | } | 1158 | } |
1203 | break; | 1159 | break; |
1204 | } | 1160 | } |
1205 | 1161 | ||
1206 | #if defined(__mips64) && !defined(SINGLE_ONLY_FPU) | 1162 | #if defined(__mips64) |
1207 | case l_fmt:{ | 1163 | case l_fmt:{ |
1208 | switch (MIPSInst_FUNC(ir)) { | 1164 | switch (MIPSInst_FUNC(ir)) { |
1209 | case fcvts_op: | 1165 | case fcvts_op: |
@@ -1256,18 +1212,16 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
1256 | ctx->fcr31 &= ~cond; | 1212 | ctx->fcr31 &= ~cond; |
1257 | break; | 1213 | break; |
1258 | } | 1214 | } |
1259 | #ifndef SINGLE_ONLY_FPU | ||
1260 | case d_fmt: | 1215 | case d_fmt: |
1261 | DPTOREG(rv.d, MIPSInst_FD(ir)); | 1216 | DPTOREG(rv.d, MIPSInst_FD(ir)); |
1262 | break; | 1217 | break; |
1263 | #endif | ||
1264 | case s_fmt: | 1218 | case s_fmt: |
1265 | SPTOREG(rv.s, MIPSInst_FD(ir)); | 1219 | SPTOREG(rv.s, MIPSInst_FD(ir)); |
1266 | break; | 1220 | break; |
1267 | case w_fmt: | 1221 | case w_fmt: |
1268 | SITOREG(rv.w, MIPSInst_FD(ir)); | 1222 | SITOREG(rv.w, MIPSInst_FD(ir)); |
1269 | break; | 1223 | break; |
1270 | #if defined(__mips64) && !defined(SINGLE_ONLY_FPU) | 1224 | #if defined(__mips64) |
1271 | case l_fmt: | 1225 | case l_fmt: |
1272 | DITOREG(rv.l, MIPSInst_FD(ir)); | 1226 | DITOREG(rv.l, MIPSInst_FD(ir)); |
1273 | break; | 1227 | break; |
@@ -1279,10 +1233,10 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_soft_struct *ctx, | |||
1279 | return 0; | 1233 | return 0; |
1280 | } | 1234 | } |
1281 | 1235 | ||
1282 | int fpu_emulator_cop1Handler(int xcptno, struct pt_regs *xcp, | 1236 | int fpu_emulator_cop1Handler(struct pt_regs *xcp, |
1283 | struct mips_fpu_soft_struct *ctx) | 1237 | struct mips_fpu_soft_struct *ctx) |
1284 | { | 1238 | { |
1285 | gpreg_t oldepc, prevepc; | 1239 | unsigned long oldepc, prevepc; |
1286 | mips_instruction insn; | 1240 | mips_instruction insn; |
1287 | int sig = 0; | 1241 | int sig = 0; |
1288 | 1242 | ||
@@ -1290,19 +1244,24 @@ int fpu_emulator_cop1Handler(int xcptno, struct pt_regs *xcp, | |||
1290 | do { | 1244 | do { |
1291 | prevepc = xcp->cp0_epc; | 1245 | prevepc = xcp->cp0_epc; |
1292 | 1246 | ||
1293 | if (get_user(insn, (mips_instruction *) xcp->cp0_epc)) { | 1247 | if (get_user(insn, (mips_instruction __user *) xcp->cp0_epc)) { |
1294 | fpuemuprivate.stats.errors++; | 1248 | fpuemustats.errors++; |
1295 | return SIGBUS; | 1249 | return SIGBUS; |
1296 | } | 1250 | } |
1297 | if (insn == 0) | 1251 | if (insn == 0) |
1298 | xcp->cp0_epc += 4; /* skip nops */ | 1252 | xcp->cp0_epc += 4; /* skip nops */ |
1299 | else { | 1253 | else { |
1300 | /* Update ieee754_csr. Only relevant if we have a | 1254 | /* |
1301 | h/w FPU */ | 1255 | * The 'ieee754_csr' is an alias of |
1302 | ieee754_csr.nod = (ctx->fcr31 & 0x1000000) != 0; | 1256 | * ctx->fcr31. No need to copy ctx->fcr31 to |
1303 | ieee754_csr.rm = ieee_rm[ctx->fcr31 & 0x3]; | 1257 | * ieee754_csr. But ieee754_csr.rm is ieee |
1304 | ieee754_csr.cx = (ctx->fcr31 >> 12) & 0x1f; | 1258 | * library modes. (not mips rounding mode) |
1259 | */ | ||
1260 | /* convert to ieee library modes */ | ||
1261 | ieee754_csr.rm = ieee_rm[ieee754_csr.rm]; | ||
1305 | sig = cop1Emulate(xcp, ctx); | 1262 | sig = cop1Emulate(xcp, ctx); |
1263 | /* revert to mips rounding mode */ | ||
1264 | ieee754_csr.rm = mips_rm[ieee754_csr.rm]; | ||
1306 | } | 1265 | } |
1307 | 1266 | ||
1308 | if (cpu_has_fpu) | 1267 | if (cpu_has_fpu) |
diff --git a/arch/mips/math-emu/dp_sqrt.c b/arch/mips/math-emu/dp_sqrt.c index c35e871ae975..032328c49888 100644 --- a/arch/mips/math-emu/dp_sqrt.c +++ b/arch/mips/math-emu/dp_sqrt.c | |||
@@ -37,7 +37,7 @@ static const unsigned table[] = { | |||
37 | 37 | ||
38 | ieee754dp ieee754dp_sqrt(ieee754dp x) | 38 | ieee754dp ieee754dp_sqrt(ieee754dp x) |
39 | { | 39 | { |
40 | struct ieee754_csr oldcsr; | 40 | struct _ieee754_csr oldcsr; |
41 | ieee754dp y, z, t; | 41 | ieee754dp y, z, t; |
42 | unsigned scalx, yh; | 42 | unsigned scalx, yh; |
43 | COMPXDP; | 43 | COMPXDP; |
diff --git a/arch/mips/math-emu/dsemul.c b/arch/mips/math-emu/dsemul.c index aa989c2246da..8079f3d1eca0 100644 --- a/arch/mips/math-emu/dsemul.c +++ b/arch/mips/math-emu/dsemul.c | |||
@@ -28,9 +28,6 @@ | |||
28 | #endif | 28 | #endif |
29 | #define __mips 4 | 29 | #define __mips 4 |
30 | 30 | ||
31 | extern struct mips_fpu_emulator_private fpuemuprivate; | ||
32 | |||
33 | |||
34 | /* | 31 | /* |
35 | * Emulate the arbritrary instruction ir at xcp->cp0_epc. Required when | 32 | * Emulate the arbritrary instruction ir at xcp->cp0_epc. Required when |
36 | * we have to emulate the instruction in a COP1 branch delay slot. Do | 33 | * we have to emulate the instruction in a COP1 branch delay slot. Do |
@@ -52,10 +49,10 @@ struct emuframe { | |||
52 | mips_instruction emul; | 49 | mips_instruction emul; |
53 | mips_instruction badinst; | 50 | mips_instruction badinst; |
54 | mips_instruction cookie; | 51 | mips_instruction cookie; |
55 | gpreg_t epc; | 52 | unsigned long epc; |
56 | }; | 53 | }; |
57 | 54 | ||
58 | int mips_dsemul(struct pt_regs *regs, mips_instruction ir, gpreg_t cpc) | 55 | int mips_dsemul(struct pt_regs *regs, mips_instruction ir, unsigned long cpc) |
59 | { | 56 | { |
60 | extern asmlinkage void handle_dsemulret(void); | 57 | extern asmlinkage void handle_dsemulret(void); |
61 | mips_instruction *dsemul_insns; | 58 | mips_instruction *dsemul_insns; |
@@ -91,7 +88,7 @@ int mips_dsemul(struct pt_regs *regs, mips_instruction ir, gpreg_t cpc) | |||
91 | */ | 88 | */ |
92 | 89 | ||
93 | /* Ensure that the two instructions are in the same cache line */ | 90 | /* Ensure that the two instructions are in the same cache line */ |
94 | dsemul_insns = (mips_instruction *) REG_TO_VA ((regs->regs[29] - sizeof(struct emuframe)) & ~0x7); | 91 | dsemul_insns = (mips_instruction *) ((regs->regs[29] - sizeof(struct emuframe)) & ~0x7); |
95 | fr = (struct emuframe *) dsemul_insns; | 92 | fr = (struct emuframe *) dsemul_insns; |
96 | 93 | ||
97 | /* Verify that the stack pointer is not competely insane */ | 94 | /* Verify that the stack pointer is not competely insane */ |
@@ -104,11 +101,11 @@ int mips_dsemul(struct pt_regs *regs, mips_instruction ir, gpreg_t cpc) | |||
104 | err |= __put_user(cpc, &fr->epc); | 101 | err |= __put_user(cpc, &fr->epc); |
105 | 102 | ||
106 | if (unlikely(err)) { | 103 | if (unlikely(err)) { |
107 | fpuemuprivate.stats.errors++; | 104 | fpuemustats.errors++; |
108 | return SIGBUS; | 105 | return SIGBUS; |
109 | } | 106 | } |
110 | 107 | ||
111 | regs->cp0_epc = VA_TO_REG & fr->emul; | 108 | regs->cp0_epc = (unsigned long) &fr->emul; |
112 | 109 | ||
113 | flush_cache_sigtramp((unsigned long)&fr->badinst); | 110 | flush_cache_sigtramp((unsigned long)&fr->badinst); |
114 | 111 | ||
@@ -118,7 +115,7 @@ int mips_dsemul(struct pt_regs *regs, mips_instruction ir, gpreg_t cpc) | |||
118 | int do_dsemulret(struct pt_regs *xcp) | 115 | int do_dsemulret(struct pt_regs *xcp) |
119 | { | 116 | { |
120 | struct emuframe *fr; | 117 | struct emuframe *fr; |
121 | gpreg_t epc; | 118 | unsigned long epc; |
122 | u32 insn, cookie; | 119 | u32 insn, cookie; |
123 | int err = 0; | 120 | int err = 0; |
124 | 121 | ||
@@ -141,7 +138,7 @@ int do_dsemulret(struct pt_regs *xcp) | |||
141 | err |= __get_user(cookie, &fr->cookie); | 138 | err |= __get_user(cookie, &fr->cookie); |
142 | 139 | ||
143 | if (unlikely(err || (insn != BADINST) || (cookie != BD_COOKIE))) { | 140 | if (unlikely(err || (insn != BADINST) || (cookie != BD_COOKIE))) { |
144 | fpuemuprivate.stats.errors++; | 141 | fpuemustats.errors++; |
145 | return 0; | 142 | return 0; |
146 | } | 143 | } |
147 | 144 | ||
diff --git a/arch/mips/math-emu/dsemul.h b/arch/mips/math-emu/dsemul.h index dbd85f95268d..091f0e76730f 100644 --- a/arch/mips/math-emu/dsemul.h +++ b/arch/mips/math-emu/dsemul.h | |||
@@ -1,11 +1,5 @@ | |||
1 | typedef long gpreg_t; | 1 | extern int mips_dsemul(struct pt_regs *regs, mips_instruction ir, unsigned long cpc); |
2 | typedef void *vaddr_t; | 2 | extern int do_dsemulret(struct pt_regs *xcp); |
3 | |||
4 | #define REG_TO_VA (vaddr_t) | ||
5 | #define VA_TO_REG (gpreg_t) | ||
6 | |||
7 | int mips_dsemul(struct pt_regs *regs, mips_instruction ir, gpreg_t cpc); | ||
8 | int do_dsemulret(struct pt_regs *xcp); | ||
9 | 3 | ||
10 | /* Instruction which will always cause an address error */ | 4 | /* Instruction which will always cause an address error */ |
11 | #define AdELOAD 0x8c000001 /* lw $0,1($0) */ | 5 | #define AdELOAD 0x8c000001 /* lw $0,1($0) */ |
diff --git a/arch/mips/math-emu/ieee754.c b/arch/mips/math-emu/ieee754.c index f0a364adbf34..a93c45dbdefd 100644 --- a/arch/mips/math-emu/ieee754.c +++ b/arch/mips/math-emu/ieee754.c | |||
@@ -31,6 +31,8 @@ | |||
31 | 31 | ||
32 | 32 | ||
33 | #include "ieee754int.h" | 33 | #include "ieee754int.h" |
34 | #include "ieee754sp.h" | ||
35 | #include "ieee754dp.h" | ||
34 | 36 | ||
35 | #define DP_EBIAS 1023 | 37 | #define DP_EBIAS 1023 |
36 | #define DP_EMIN (-1022) | 38 | #define DP_EMIN (-1022) |
@@ -40,20 +42,6 @@ | |||
40 | #define SP_EMIN (-126) | 42 | #define SP_EMIN (-126) |
41 | #define SP_EMAX 127 | 43 | #define SP_EMAX 127 |
42 | 44 | ||
43 | /* indexed by class */ | ||
44 | const char *const ieee754_cname[] = { | ||
45 | "Normal", | ||
46 | "Zero", | ||
47 | "Denormal", | ||
48 | "Infinity", | ||
49 | "QNaN", | ||
50 | "SNaN", | ||
51 | }; | ||
52 | |||
53 | /* the control status register | ||
54 | */ | ||
55 | struct ieee754_csr ieee754_csr; | ||
56 | |||
57 | /* special constants | 45 | /* special constants |
58 | */ | 46 | */ |
59 | 47 | ||
diff --git a/arch/mips/math-emu/ieee754.h b/arch/mips/math-emu/ieee754.h index b8772f46972d..171f177c0f88 100644 --- a/arch/mips/math-emu/ieee754.h +++ b/arch/mips/math-emu/ieee754.h | |||
@@ -1,13 +1,8 @@ | |||
1 | /* single and double precision fp ops | ||
2 | * missing extended precision. | ||
3 | */ | ||
4 | /* | 1 | /* |
5 | * MIPS floating point support | 2 | * MIPS floating point support |
6 | * Copyright (C) 1994-2000 Algorithmics Ltd. | 3 | * Copyright (C) 1994-2000 Algorithmics Ltd. |
7 | * http://www.algor.co.uk | 4 | * http://www.algor.co.uk |
8 | * | 5 | * |
9 | * ######################################################################## | ||
10 | * | ||
11 | * This program is free software; you can distribute it and/or modify it | 6 | * This program is free software; you can distribute it and/or modify it |
12 | * under the terms of the GNU General Public License (Version 2) as | 7 | * under the terms of the GNU General Public License (Version 2) as |
13 | * published by the Free Software Foundation. | 8 | * published by the Free Software Foundation. |
@@ -21,20 +16,18 @@ | |||
21 | * with this program; if not, write to the Free Software Foundation, Inc., | 16 | * with this program; if not, write to the Free Software Foundation, Inc., |
22 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. | 17 | * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. |
23 | * | 18 | * |
24 | * ######################################################################## | ||
25 | */ | ||
26 | |||
27 | /************************************************************************** | ||
28 | * Nov 7, 2000 | 19 | * Nov 7, 2000 |
29 | * Modification to allow integration with Linux kernel | 20 | * Modification to allow integration with Linux kernel |
30 | * | 21 | * |
31 | * Kevin D. Kissell, kevink@mips.com and Carsten Langgard, carstenl@mips.com | 22 | * Kevin D. Kissell, kevink@mips.com and Carsten Langgard, carstenl@mips.com |
32 | * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. | 23 | * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. |
33 | *************************************************************************/ | 24 | */ |
25 | #ifndef __ARCH_MIPS_MATH_EMU_IEEE754_H | ||
26 | #define __ARCH_MIPS_MATH_EMU_IEEE754_H | ||
34 | 27 | ||
35 | #ifdef __KERNEL__ | 28 | #include <asm/byteorder.h> |
36 | /* Going from Algorithmics to Linux native environment, add this */ | ||
37 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #include <linux/sched.h> | ||
38 | 31 | ||
39 | /* | 32 | /* |
40 | * Not very pretty, but the Linux kernel's normal va_list definition | 33 | * Not very pretty, but the Linux kernel's normal va_list definition |
@@ -44,18 +37,7 @@ | |||
44 | #include <stdarg.h> | 37 | #include <stdarg.h> |
45 | #endif | 38 | #endif |
46 | 39 | ||
47 | #else | 40 | #ifdef __LITTLE_ENDIAN |
48 | |||
49 | /* Note that __KERNEL__ is taken to mean Linux kernel */ | ||
50 | |||
51 | #if #system(OpenBSD) | ||
52 | #include <machine/types.h> | ||
53 | #endif | ||
54 | #include <machine/endian.h> | ||
55 | |||
56 | #endif /* __KERNEL__ */ | ||
57 | |||
58 | #if (defined(BYTE_ORDER) && BYTE_ORDER == LITTLE_ENDIAN) || defined(__MIPSEL__) | ||
59 | struct ieee754dp_konst { | 41 | struct ieee754dp_konst { |
60 | unsigned mantlo:32; | 42 | unsigned mantlo:32; |
61 | unsigned manthi:20; | 43 | unsigned manthi:20; |
@@ -86,13 +68,14 @@ typedef union _ieee754sp { | |||
86 | } ieee754sp; | 68 | } ieee754sp; |
87 | #endif | 69 | #endif |
88 | 70 | ||
89 | #if (defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN) || defined(__MIPSEB__) | 71 | #ifdef __BIG_ENDIAN |
90 | struct ieee754dp_konst { | 72 | struct ieee754dp_konst { |
91 | unsigned sign:1; | 73 | unsigned sign:1; |
92 | unsigned bexp:11; | 74 | unsigned bexp:11; |
93 | unsigned manthi:20; | 75 | unsigned manthi:20; |
94 | unsigned mantlo:32; | 76 | unsigned mantlo:32; |
95 | }; | 77 | }; |
78 | |||
96 | typedef union _ieee754dp { | 79 | typedef union _ieee754dp { |
97 | struct ieee754dp_konst oparts; | 80 | struct ieee754dp_konst oparts; |
98 | struct { | 81 | struct { |
@@ -222,7 +205,6 @@ ieee754dp ieee754dp_sqrt(ieee754dp x); | |||
222 | #define IEEE754_CLASS_INF 0x03 | 205 | #define IEEE754_CLASS_INF 0x03 |
223 | #define IEEE754_CLASS_SNAN 0x04 | 206 | #define IEEE754_CLASS_SNAN 0x04 |
224 | #define IEEE754_CLASS_QNAN 0x05 | 207 | #define IEEE754_CLASS_QNAN 0x05 |
225 | extern const char *const ieee754_cname[]; | ||
226 | 208 | ||
227 | /* exception numbers */ | 209 | /* exception numbers */ |
228 | #define IEEE754_INEXACT 0x01 | 210 | #define IEEE754_INEXACT 0x01 |
@@ -251,93 +233,109 @@ extern const char *const ieee754_cname[]; | |||
251 | 233 | ||
252 | /* "normal" comparisons | 234 | /* "normal" comparisons |
253 | */ | 235 | */ |
254 | static __inline int ieee754sp_eq(ieee754sp x, ieee754sp y) | 236 | static inline int ieee754sp_eq(ieee754sp x, ieee754sp y) |
255 | { | 237 | { |
256 | return ieee754sp_cmp(x, y, IEEE754_CEQ, 0); | 238 | return ieee754sp_cmp(x, y, IEEE754_CEQ, 0); |
257 | } | 239 | } |
258 | 240 | ||
259 | static __inline int ieee754sp_ne(ieee754sp x, ieee754sp y) | 241 | static inline int ieee754sp_ne(ieee754sp x, ieee754sp y) |
260 | { | 242 | { |
261 | return ieee754sp_cmp(x, y, | 243 | return ieee754sp_cmp(x, y, |
262 | IEEE754_CLT | IEEE754_CGT | IEEE754_CUN, 0); | 244 | IEEE754_CLT | IEEE754_CGT | IEEE754_CUN, 0); |
263 | } | 245 | } |
264 | 246 | ||
265 | static __inline int ieee754sp_lt(ieee754sp x, ieee754sp y) | 247 | static inline int ieee754sp_lt(ieee754sp x, ieee754sp y) |
266 | { | 248 | { |
267 | return ieee754sp_cmp(x, y, IEEE754_CLT, 0); | 249 | return ieee754sp_cmp(x, y, IEEE754_CLT, 0); |
268 | } | 250 | } |
269 | 251 | ||
270 | static __inline int ieee754sp_le(ieee754sp x, ieee754sp y) | 252 | static inline int ieee754sp_le(ieee754sp x, ieee754sp y) |
271 | { | 253 | { |
272 | return ieee754sp_cmp(x, y, IEEE754_CLT | IEEE754_CEQ, 0); | 254 | return ieee754sp_cmp(x, y, IEEE754_CLT | IEEE754_CEQ, 0); |
273 | } | 255 | } |
274 | 256 | ||
275 | static __inline int ieee754sp_gt(ieee754sp x, ieee754sp y) | 257 | static inline int ieee754sp_gt(ieee754sp x, ieee754sp y) |
276 | { | 258 | { |
277 | return ieee754sp_cmp(x, y, IEEE754_CGT, 0); | 259 | return ieee754sp_cmp(x, y, IEEE754_CGT, 0); |
278 | } | 260 | } |
279 | 261 | ||
280 | 262 | ||
281 | static __inline int ieee754sp_ge(ieee754sp x, ieee754sp y) | 263 | static inline int ieee754sp_ge(ieee754sp x, ieee754sp y) |
282 | { | 264 | { |
283 | return ieee754sp_cmp(x, y, IEEE754_CGT | IEEE754_CEQ, 0); | 265 | return ieee754sp_cmp(x, y, IEEE754_CGT | IEEE754_CEQ, 0); |
284 | } | 266 | } |
285 | 267 | ||
286 | static __inline int ieee754dp_eq(ieee754dp x, ieee754dp y) | 268 | static inline int ieee754dp_eq(ieee754dp x, ieee754dp y) |
287 | { | 269 | { |
288 | return ieee754dp_cmp(x, y, IEEE754_CEQ, 0); | 270 | return ieee754dp_cmp(x, y, IEEE754_CEQ, 0); |
289 | } | 271 | } |
290 | 272 | ||
291 | static __inline int ieee754dp_ne(ieee754dp x, ieee754dp y) | 273 | static inline int ieee754dp_ne(ieee754dp x, ieee754dp y) |
292 | { | 274 | { |
293 | return ieee754dp_cmp(x, y, | 275 | return ieee754dp_cmp(x, y, |
294 | IEEE754_CLT | IEEE754_CGT | IEEE754_CUN, 0); | 276 | IEEE754_CLT | IEEE754_CGT | IEEE754_CUN, 0); |
295 | } | 277 | } |
296 | 278 | ||
297 | static __inline int ieee754dp_lt(ieee754dp x, ieee754dp y) | 279 | static inline int ieee754dp_lt(ieee754dp x, ieee754dp y) |
298 | { | 280 | { |
299 | return ieee754dp_cmp(x, y, IEEE754_CLT, 0); | 281 | return ieee754dp_cmp(x, y, IEEE754_CLT, 0); |
300 | } | 282 | } |
301 | 283 | ||
302 | static __inline int ieee754dp_le(ieee754dp x, ieee754dp y) | 284 | static inline int ieee754dp_le(ieee754dp x, ieee754dp y) |
303 | { | 285 | { |
304 | return ieee754dp_cmp(x, y, IEEE754_CLT | IEEE754_CEQ, 0); | 286 | return ieee754dp_cmp(x, y, IEEE754_CLT | IEEE754_CEQ, 0); |
305 | } | 287 | } |
306 | 288 | ||
307 | static __inline int ieee754dp_gt(ieee754dp x, ieee754dp y) | 289 | static inline int ieee754dp_gt(ieee754dp x, ieee754dp y) |
308 | { | 290 | { |
309 | return ieee754dp_cmp(x, y, IEEE754_CGT, 0); | 291 | return ieee754dp_cmp(x, y, IEEE754_CGT, 0); |
310 | } | 292 | } |
311 | 293 | ||
312 | static __inline int ieee754dp_ge(ieee754dp x, ieee754dp y) | 294 | static inline int ieee754dp_ge(ieee754dp x, ieee754dp y) |
313 | { | 295 | { |
314 | return ieee754dp_cmp(x, y, IEEE754_CGT | IEEE754_CEQ, 0); | 296 | return ieee754dp_cmp(x, y, IEEE754_CGT | IEEE754_CEQ, 0); |
315 | } | 297 | } |
316 | 298 | ||
317 | 299 | ||
318 | /* like strtod | 300 | /* |
319 | */ | 301 | * Like strtod |
302 | */ | ||
320 | ieee754dp ieee754dp_fstr(const char *s, char **endp); | 303 | ieee754dp ieee754dp_fstr(const char *s, char **endp); |
321 | char *ieee754dp_tstr(ieee754dp x, int prec, int fmt, int af); | 304 | char *ieee754dp_tstr(ieee754dp x, int prec, int fmt, int af); |
322 | 305 | ||
323 | 306 | ||
324 | /* the control status register | 307 | /* |
325 | */ | 308 | * The control status register |
326 | struct ieee754_csr { | 309 | */ |
327 | unsigned pad:13; | 310 | struct _ieee754_csr { |
311 | #ifdef __BIG_ENDIAN | ||
312 | unsigned pad0:7; | ||
328 | unsigned nod:1; /* set 1 for no denormalised numbers */ | 313 | unsigned nod:1; /* set 1 for no denormalised numbers */ |
329 | unsigned cx:5; /* exceptions this operation */ | 314 | unsigned c:1; /* condition */ |
315 | unsigned pad1:5; | ||
316 | unsigned cx:6; /* exceptions this operation */ | ||
330 | unsigned mx:5; /* exception enable mask */ | 317 | unsigned mx:5; /* exception enable mask */ |
331 | unsigned sx:5; /* exceptions total */ | 318 | unsigned sx:5; /* exceptions total */ |
332 | unsigned rm:2; /* current rounding mode */ | 319 | unsigned rm:2; /* current rounding mode */ |
320 | #endif | ||
321 | #ifdef __LITTLE_ENDIAN | ||
322 | unsigned rm:2; /* current rounding mode */ | ||
323 | unsigned sx:5; /* exceptions total */ | ||
324 | unsigned mx:5; /* exception enable mask */ | ||
325 | unsigned cx:6; /* exceptions this operation */ | ||
326 | unsigned pad1:5; | ||
327 | unsigned c:1; /* condition */ | ||
328 | unsigned nod:1; /* set 1 for no denormalised numbers */ | ||
329 | unsigned pad0:7; | ||
330 | #endif | ||
333 | }; | 331 | }; |
334 | extern struct ieee754_csr ieee754_csr; | 332 | #define ieee754_csr (*(struct _ieee754_csr *)(¤t->thread.fpu.soft.fcr31)) |
335 | 333 | ||
336 | static __inline unsigned ieee754_getrm(void) | 334 | static inline unsigned ieee754_getrm(void) |
337 | { | 335 | { |
338 | return (ieee754_csr.rm); | 336 | return (ieee754_csr.rm); |
339 | } | 337 | } |
340 | static __inline unsigned ieee754_setrm(unsigned rm) | 338 | static inline unsigned ieee754_setrm(unsigned rm) |
341 | { | 339 | { |
342 | return (ieee754_csr.rm = rm); | 340 | return (ieee754_csr.rm = rm); |
343 | } | 341 | } |
@@ -345,14 +343,14 @@ static __inline unsigned ieee754_setrm(unsigned rm) | |||
345 | /* | 343 | /* |
346 | * get current exceptions | 344 | * get current exceptions |
347 | */ | 345 | */ |
348 | static __inline unsigned ieee754_getcx(void) | 346 | static inline unsigned ieee754_getcx(void) |
349 | { | 347 | { |
350 | return (ieee754_csr.cx); | 348 | return (ieee754_csr.cx); |
351 | } | 349 | } |
352 | 350 | ||
353 | /* test for current exception condition | 351 | /* test for current exception condition |
354 | */ | 352 | */ |
355 | static __inline int ieee754_cxtest(unsigned n) | 353 | static inline int ieee754_cxtest(unsigned n) |
356 | { | 354 | { |
357 | return (ieee754_csr.cx & n); | 355 | return (ieee754_csr.cx & n); |
358 | } | 356 | } |
@@ -360,21 +358,21 @@ static __inline int ieee754_cxtest(unsigned n) | |||
360 | /* | 358 | /* |
361 | * get sticky exceptions | 359 | * get sticky exceptions |
362 | */ | 360 | */ |
363 | static __inline unsigned ieee754_getsx(void) | 361 | static inline unsigned ieee754_getsx(void) |
364 | { | 362 | { |
365 | return (ieee754_csr.sx); | 363 | return (ieee754_csr.sx); |
366 | } | 364 | } |
367 | 365 | ||
368 | /* clear sticky conditions | 366 | /* clear sticky conditions |
369 | */ | 367 | */ |
370 | static __inline unsigned ieee754_clrsx(void) | 368 | static inline unsigned ieee754_clrsx(void) |
371 | { | 369 | { |
372 | return (ieee754_csr.sx = 0); | 370 | return (ieee754_csr.sx = 0); |
373 | } | 371 | } |
374 | 372 | ||
375 | /* test for sticky exception condition | 373 | /* test for sticky exception condition |
376 | */ | 374 | */ |
377 | static __inline int ieee754_sxtest(unsigned n) | 375 | static inline int ieee754_sxtest(unsigned n) |
378 | { | 376 | { |
379 | return (ieee754_csr.sx & n); | 377 | return (ieee754_csr.sx & n); |
380 | } | 378 | } |
@@ -406,52 +404,34 @@ extern const struct ieee754sp_konst __ieee754sp_spcvals[]; | |||
406 | #define ieee754dp_spcvals ((const ieee754dp *)__ieee754dp_spcvals) | 404 | #define ieee754dp_spcvals ((const ieee754dp *)__ieee754dp_spcvals) |
407 | #define ieee754sp_spcvals ((const ieee754sp *)__ieee754sp_spcvals) | 405 | #define ieee754sp_spcvals ((const ieee754sp *)__ieee754sp_spcvals) |
408 | 406 | ||
409 | /* return infinity with given sign | 407 | /* |
410 | */ | 408 | * Return infinity with given sign |
411 | #define ieee754dp_inf(sn) \ | 409 | */ |
412 | (ieee754dp_spcvals[IEEE754_SPCVAL_PINFINITY+(sn)]) | 410 | #define ieee754dp_inf(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PINFINITY+(sn)]) |
413 | #define ieee754dp_zero(sn) \ | 411 | #define ieee754dp_zero(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PZERO+(sn)]) |
414 | (ieee754dp_spcvals[IEEE754_SPCVAL_PZERO+(sn)]) | 412 | #define ieee754dp_one(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PONE+(sn)]) |
415 | #define ieee754dp_one(sn) \ | 413 | #define ieee754dp_ten(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PTEN+(sn)]) |
416 | (ieee754dp_spcvals[IEEE754_SPCVAL_PONE+(sn)]) | 414 | #define ieee754dp_indef() (ieee754dp_spcvals[IEEE754_SPCVAL_INDEF]) |
417 | #define ieee754dp_ten(sn) \ | 415 | #define ieee754dp_max(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PMAX+(sn)]) |
418 | (ieee754dp_spcvals[IEEE754_SPCVAL_PTEN+(sn)]) | 416 | #define ieee754dp_min(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PMIN+(sn)]) |
419 | #define ieee754dp_indef() \ | 417 | #define ieee754dp_mind(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PMIND+(sn)]) |
420 | (ieee754dp_spcvals[IEEE754_SPCVAL_INDEF]) | 418 | #define ieee754dp_1e31() (ieee754dp_spcvals[IEEE754_SPCVAL_P1E31]) |
421 | #define ieee754dp_max(sn) \ | 419 | #define ieee754dp_1e63() (ieee754dp_spcvals[IEEE754_SPCVAL_P1E63]) |
422 | (ieee754dp_spcvals[IEEE754_SPCVAL_PMAX+(sn)]) | 420 | |
423 | #define ieee754dp_min(sn) \ | 421 | #define ieee754sp_inf(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PINFINITY+(sn)]) |
424 | (ieee754dp_spcvals[IEEE754_SPCVAL_PMIN+(sn)]) | 422 | #define ieee754sp_zero(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PZERO+(sn)]) |
425 | #define ieee754dp_mind(sn) \ | 423 | #define ieee754sp_one(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PONE+(sn)]) |
426 | (ieee754dp_spcvals[IEEE754_SPCVAL_PMIND+(sn)]) | 424 | #define ieee754sp_ten(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PTEN+(sn)]) |
427 | #define ieee754dp_1e31() \ | 425 | #define ieee754sp_indef() (ieee754sp_spcvals[IEEE754_SPCVAL_INDEF]) |
428 | (ieee754dp_spcvals[IEEE754_SPCVAL_P1E31]) | 426 | #define ieee754sp_max(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PMAX+(sn)]) |
429 | #define ieee754dp_1e63() \ | 427 | #define ieee754sp_min(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PMIN+(sn)]) |
430 | (ieee754dp_spcvals[IEEE754_SPCVAL_P1E63]) | 428 | #define ieee754sp_mind(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PMIND+(sn)]) |
431 | 429 | #define ieee754sp_1e31() (ieee754sp_spcvals[IEEE754_SPCVAL_P1E31]) | |
432 | #define ieee754sp_inf(sn) \ | 430 | #define ieee754sp_1e63() (ieee754sp_spcvals[IEEE754_SPCVAL_P1E63]) |
433 | (ieee754sp_spcvals[IEEE754_SPCVAL_PINFINITY+(sn)]) | 431 | |
434 | #define ieee754sp_zero(sn) \ | 432 | /* |
435 | (ieee754sp_spcvals[IEEE754_SPCVAL_PZERO+(sn)]) | 433 | * Indefinite integer value |
436 | #define ieee754sp_one(sn) \ | 434 | */ |
437 | (ieee754sp_spcvals[IEEE754_SPCVAL_PONE+(sn)]) | ||
438 | #define ieee754sp_ten(sn) \ | ||
439 | (ieee754sp_spcvals[IEEE754_SPCVAL_PTEN+(sn)]) | ||
440 | #define ieee754sp_indef() \ | ||
441 | (ieee754sp_spcvals[IEEE754_SPCVAL_INDEF]) | ||
442 | #define ieee754sp_max(sn) \ | ||
443 | (ieee754sp_spcvals[IEEE754_SPCVAL_PMAX+(sn)]) | ||
444 | #define ieee754sp_min(sn) \ | ||
445 | (ieee754sp_spcvals[IEEE754_SPCVAL_PMIN+(sn)]) | ||
446 | #define ieee754sp_mind(sn) \ | ||
447 | (ieee754sp_spcvals[IEEE754_SPCVAL_PMIND+(sn)]) | ||
448 | #define ieee754sp_1e31() \ | ||
449 | (ieee754sp_spcvals[IEEE754_SPCVAL_P1E31]) | ||
450 | #define ieee754sp_1e63() \ | ||
451 | (ieee754sp_spcvals[IEEE754_SPCVAL_P1E63]) | ||
452 | |||
453 | /* indefinite integer value | ||
454 | */ | ||
455 | #define ieee754si_indef() INT_MAX | 435 | #define ieee754si_indef() INT_MAX |
456 | #ifdef LONG_LONG_MAX | 436 | #ifdef LONG_LONG_MAX |
457 | #define ieee754di_indef() LONG_LONG_MAX | 437 | #define ieee754di_indef() LONG_LONG_MAX |
@@ -487,3 +467,5 @@ extern void ieee754_xcpt(struct ieee754xctx *xcp); | |||
487 | /* compat */ | 467 | /* compat */ |
488 | #define ieee754dp_fix(x) ieee754dp_tint(x) | 468 | #define ieee754dp_fix(x) ieee754dp_tint(x) |
489 | #define ieee754sp_fix(x) ieee754sp_tint(x) | 469 | #define ieee754sp_fix(x) ieee754sp_tint(x) |
470 | |||
471 | #endif /* __ARCH_MIPS_MATH_EMU_IEEE754_H */ | ||
diff --git a/arch/mips/math-emu/kernel_linkage.c b/arch/mips/math-emu/kernel_linkage.c index 4002f0cf79f3..d187ab71c2ff 100644 --- a/arch/mips/math-emu/kernel_linkage.c +++ b/arch/mips/math-emu/kernel_linkage.c | |||
@@ -27,8 +27,6 @@ | |||
27 | 27 | ||
28 | #include <asm/fpu_emulator.h> | 28 | #include <asm/fpu_emulator.h> |
29 | 29 | ||
30 | extern struct mips_fpu_emulator_private fpuemuprivate; | ||
31 | |||
32 | #define SIGNALLING_NAN 0x7ff800007ff80000LL | 30 | #define SIGNALLING_NAN 0x7ff800007ff80000LL |
33 | 31 | ||
34 | void fpu_emulator_init_fpu(void) | 32 | void fpu_emulator_init_fpu(void) |
@@ -65,7 +63,6 @@ int fpu_emulator_save_context(struct sigcontext *sc) | |||
65 | &sc->sc_fpregs[i]); | 63 | &sc->sc_fpregs[i]); |
66 | } | 64 | } |
67 | err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); | 65 | err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); |
68 | err |= __put_user(fpuemuprivate.eir, &sc->sc_fpc_eir); | ||
69 | 66 | ||
70 | return err; | 67 | return err; |
71 | } | 68 | } |
@@ -81,7 +78,6 @@ int fpu_emulator_restore_context(struct sigcontext *sc) | |||
81 | &sc->sc_fpregs[i]); | 78 | &sc->sc_fpregs[i]); |
82 | } | 79 | } |
83 | err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); | 80 | err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); |
84 | err |= __get_user(fpuemuprivate.eir, &sc->sc_fpc_eir); | ||
85 | 81 | ||
86 | return err; | 82 | return err; |
87 | } | 83 | } |
@@ -102,7 +98,6 @@ int fpu_emulator_save_context32(struct sigcontext32 *sc) | |||
102 | &sc->sc_fpregs[i]); | 98 | &sc->sc_fpregs[i]); |
103 | } | 99 | } |
104 | err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); | 100 | err |= __put_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); |
105 | err |= __put_user(fpuemuprivate.eir, &sc->sc_fpc_eir); | ||
106 | 101 | ||
107 | return err; | 102 | return err; |
108 | } | 103 | } |
@@ -118,7 +113,6 @@ int fpu_emulator_restore_context32(struct sigcontext32 *sc) | |||
118 | &sc->sc_fpregs[i]); | 113 | &sc->sc_fpregs[i]); |
119 | } | 114 | } |
120 | err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); | 115 | err |= __get_user(current->thread.fpu.soft.fcr31, &sc->sc_fpc_csr); |
121 | err |= __get_user(fpuemuprivate.eir, &sc->sc_fpc_eir); | ||
122 | 116 | ||
123 | return err; | 117 | return err; |
124 | } | 118 | } |