r6000_fpu.S 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * r6000_fpu.S: Save/restore floating point context for signal handlers.
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 1996 by Ralf Baechle
  9. *
  10. * Multi-arch abstraction and asm macros for easier reading:
  11. * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
  12. */
  13. #include <asm/asm.h>
  14. #include <asm/fpregdef.h>
  15. #include <asm/mipsregs.h>
  16. #include <asm/asm-offsets.h>
  17. #include <asm/regdef.h>
  18. .set noreorder
  19. .set mips2
  20. .set push
  21. SET_HARDFLOAT
  22. /**
  23. * _save_fp_context() - save FP context from the FPU
  24. * @a0 - pointer to fpregs field of sigcontext
  25. * @a1 - pointer to fpc_csr field of sigcontext
  26. *
  27. * Save FP context, including the 32 FP data registers and the FP
  28. * control & status register, from the FPU to signal context.
  29. */
  30. LEAF(_save_fp_context)
  31. mfc0 t0,CP0_STATUS
  32. sll t0,t0,2
  33. bgez t0,1f
  34. nop
  35. cfc1 t1,fcr31
  36. /* Store the 16 double precision registers */
  37. sdc1 $f0,0(a0)
  38. sdc1 $f2,16(a0)
  39. sdc1 $f4,32(a0)
  40. sdc1 $f6,48(a0)
  41. sdc1 $f8,64(a0)
  42. sdc1 $f10,80(a0)
  43. sdc1 $f12,96(a0)
  44. sdc1 $f14,112(a0)
  45. sdc1 $f16,128(a0)
  46. sdc1 $f18,144(a0)
  47. sdc1 $f20,160(a0)
  48. sdc1 $f22,176(a0)
  49. sdc1 $f24,192(a0)
  50. sdc1 $f26,208(a0)
  51. sdc1 $f28,224(a0)
  52. sdc1 $f30,240(a0)
  53. jr ra
  54. sw t0,(a1)
  55. 1: jr ra
  56. nop
  57. END(_save_fp_context)
  58. /**
  59. * _restore_fp_context() - restore FP context to the FPU
  60. * @a0 - pointer to fpregs field of sigcontext
  61. * @a1 - pointer to fpc_csr field of sigcontext
  62. *
  63. * Restore FP context, including the 32 FP data registers and the FP
  64. * control & status register, from signal context to the FPU.
  65. */
  66. LEAF(_restore_fp_context)
  67. mfc0 t0,CP0_STATUS
  68. sll t0,t0,2
  69. bgez t0,1f
  70. lw t0,(a1)
  71. /* Restore the 16 double precision registers */
  72. ldc1 $f0,0(a0)
  73. ldc1 $f2,16(a0)
  74. ldc1 $f4,32(a0)
  75. ldc1 $f6,48(a0)
  76. ldc1 $f8,64(a0)
  77. ldc1 $f10,80(a0)
  78. ldc1 $f12,96(a0)
  79. ldc1 $f14,112(a0)
  80. ldc1 $f16,128(a0)
  81. ldc1 $f18,144(a0)
  82. ldc1 $f20,160(a0)
  83. ldc1 $f22,176(a0)
  84. ldc1 $f24,192(a0)
  85. ldc1 $f26,208(a0)
  86. ldc1 $f28,224(a0)
  87. ldc1 $f30,240(a0)
  88. jr ra
  89. ctc1 t0,fcr31
  90. 1: jr ra
  91. nop
  92. END(_restore_fp_context)
  93. .set pop /* SET_HARDFLOAT */