r4k_fpu.S
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * This file is subject to the terms and conditions of the GNU General Public
  3.  * License.  See the file "COPYING" in the main directory of this archive
  4.  * for more details.
  5.  *
  6.  * Copyright (C) 1996, 1998, 2000 by Ralf Baechle
  7.  *
  8.  * Multi-arch abstraction and asm macros for easier reading:
  9.  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
  10.  *
  11.  *  Carsten Langgaard, carstenl@mips.com
  12.  *  Copyright (C) 2000 MIPS Technologies, Inc.
  13.  */
  14. #include <asm/asm.h>
  15. #include <asm/errno.h>
  16. #include <asm/fpregdef.h>
  17. #include <asm/mipsregs.h>
  18. #include <asm/offset.h>
  19. #include <asm/regdef.h>
  20. #define EX(a,b)
  21. 9: a,b;
  22. .section __ex_table,"a";
  23. PTR 9b, fault;
  24. .previous
  25. .set noreorder
  26. .set mips3
  27. /* Save floating point context */
  28. LEAF(_save_fp_context)
  29. li v0, 0 # assume success
  30. cfc1 t1,fcr31
  31. /* Store the 16 even double precision registers */
  32. EX(sdc1 $f0,(SC_FPREGS+0)(a0))
  33. EX(sdc1 $f2,(SC_FPREGS+16)(a0))
  34. EX(sdc1 $f4,(SC_FPREGS+32)(a0))
  35. EX(sdc1 $f6,(SC_FPREGS+48)(a0))
  36. EX(sdc1 $f8,(SC_FPREGS+64)(a0))
  37. EX(sdc1 $f10,(SC_FPREGS+80)(a0))
  38. EX(sdc1 $f12,(SC_FPREGS+96)(a0))
  39. EX(sdc1 $f14,(SC_FPREGS+112)(a0))
  40. EX(sdc1 $f16,(SC_FPREGS+128)(a0))
  41. EX(sdc1 $f18,(SC_FPREGS+144)(a0))
  42. EX(sdc1 $f20,(SC_FPREGS+160)(a0))
  43. EX(sdc1 $f22,(SC_FPREGS+176)(a0))
  44. EX(sdc1 $f24,(SC_FPREGS+192)(a0))
  45. EX(sdc1 $f26,(SC_FPREGS+208)(a0))
  46. EX(sdc1 $f28,(SC_FPREGS+224)(a0))
  47. EX(sdc1 $f30,(SC_FPREGS+240)(a0))
  48. EX(sw t1,SC_FPC_CSR(a0))
  49. cfc1 t0,$0 # implementation/version
  50. jr ra
  51. .set nomacro
  52.  EX(sw t0,SC_FPC_EIR(a0))
  53. .set macro
  54. END(_save_fp_context)
  55. /*
  56.  * Restore FPU state:
  57.  *  - fp gp registers
  58.  *  - cp1 status/control register
  59.  *
  60.  * We base the decision which registers to restore from the signal stack
  61.  * frame on the current content of c0_status, not on the content of the
  62.  * stack frame which might have been changed by the user.
  63.  */
  64. LEAF(_restore_fp_context)
  65. li v0, 0 # assume success
  66. EX(lw t0,SC_FPC_CSR(a0))
  67. /*
  68.  * Restore the 16 even double precision registers
  69.  * when cp1 was enabled in the cp0 status register.
  70.  */
  71. EX(ldc1 $f0,(SC_FPREGS+0)(a0))
  72. EX(ldc1 $f2,(SC_FPREGS+16)(a0))
  73. EX(ldc1 $f4,(SC_FPREGS+32)(a0))
  74. EX(ldc1 $f6,(SC_FPREGS+48)(a0))
  75. EX(ldc1 $f8,(SC_FPREGS+64)(a0))
  76. EX(ldc1 $f10,(SC_FPREGS+80)(a0))
  77. EX(ldc1 $f12,(SC_FPREGS+96)(a0))
  78. EX(ldc1 $f14,(SC_FPREGS+112)(a0))
  79. EX(ldc1 $f16,(SC_FPREGS+128)(a0))
  80. EX(ldc1 $f18,(SC_FPREGS+144)(a0))
  81. EX(ldc1 $f20,(SC_FPREGS+160)(a0))
  82. EX(ldc1 $f22,(SC_FPREGS+176)(a0))
  83. EX(ldc1 $f24,(SC_FPREGS+192)(a0))
  84. EX(ldc1 $f26,(SC_FPREGS+208)(a0))
  85. EX(ldc1 $f28,(SC_FPREGS+224)(a0))
  86. EX(ldc1 $f30,(SC_FPREGS+240)(a0))
  87. jr ra
  88.  ctc1 t0,fcr31
  89. END(_restore_fp_context)
  90. .set reorder
  91. .type fault@function
  92. .ent fault
  93. fault: li v0, -EFAULT
  94. jr ra
  95. .end fault