asmmacro-64.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * asmmacro.h: Assembler macros to make things easier to read.
  3. *
  4. * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
  5. * Copyright (C) 1998, 1999 Ralf Baechle
  6. * Copyright (C) 1999 Silicon Graphics, Inc.
  7. */
  8. #ifndef _ASM_ASMMACRO_64_H
  9. #define _ASM_ASMMACRO_64_H
  10. #include <asm/asm-offsets.h>
  11. #include <asm/regdef.h>
  12. #include <asm/fpregdef.h>
  13. #include <asm/mipsregs.h>
  14. .macro fpu_save_16even thread tmp=t0
  15. cfc1 \tmp, fcr31
  16. sdc1 $f0, THREAD_FPR0(\thread)
  17. sdc1 $f2, THREAD_FPR2(\thread)
  18. sdc1 $f4, THREAD_FPR4(\thread)
  19. sdc1 $f6, THREAD_FPR6(\thread)
  20. sdc1 $f8, THREAD_FPR8(\thread)
  21. sdc1 $f10, THREAD_FPR10(\thread)
  22. sdc1 $f12, THREAD_FPR12(\thread)
  23. sdc1 $f14, THREAD_FPR14(\thread)
  24. sdc1 $f16, THREAD_FPR16(\thread)
  25. sdc1 $f18, THREAD_FPR18(\thread)
  26. sdc1 $f20, THREAD_FPR20(\thread)
  27. sdc1 $f22, THREAD_FPR22(\thread)
  28. sdc1 $f24, THREAD_FPR24(\thread)
  29. sdc1 $f26, THREAD_FPR26(\thread)
  30. sdc1 $f28, THREAD_FPR28(\thread)
  31. sdc1 $f30, THREAD_FPR30(\thread)
  32. sw \tmp, THREAD_FCR31(\thread)
  33. .endm
  34. .macro fpu_save_16odd thread
  35. sdc1 $f1, THREAD_FPR1(\thread)
  36. sdc1 $f3, THREAD_FPR3(\thread)
  37. sdc1 $f5, THREAD_FPR5(\thread)
  38. sdc1 $f7, THREAD_FPR7(\thread)
  39. sdc1 $f9, THREAD_FPR9(\thread)
  40. sdc1 $f11, THREAD_FPR11(\thread)
  41. sdc1 $f13, THREAD_FPR13(\thread)
  42. sdc1 $f15, THREAD_FPR15(\thread)
  43. sdc1 $f17, THREAD_FPR17(\thread)
  44. sdc1 $f19, THREAD_FPR19(\thread)
  45. sdc1 $f21, THREAD_FPR21(\thread)
  46. sdc1 $f23, THREAD_FPR23(\thread)
  47. sdc1 $f25, THREAD_FPR25(\thread)
  48. sdc1 $f27, THREAD_FPR27(\thread)
  49. sdc1 $f29, THREAD_FPR29(\thread)
  50. sdc1 $f31, THREAD_FPR31(\thread)
  51. .endm
  52. .macro fpu_save_double thread status tmp
  53. sll \tmp, \status, 5
  54. bgez \tmp, 2f
  55. fpu_save_16odd \thread
  56. 2:
  57. fpu_save_16even \thread \tmp
  58. .endm
  59. .macro fpu_restore_16even thread tmp=t0
  60. lw \tmp, THREAD_FCR31(\thread)
  61. ldc1 $f0, THREAD_FPR0(\thread)
  62. ldc1 $f2, THREAD_FPR2(\thread)
  63. ldc1 $f4, THREAD_FPR4(\thread)
  64. ldc1 $f6, THREAD_FPR6(\thread)
  65. ldc1 $f8, THREAD_FPR8(\thread)
  66. ldc1 $f10, THREAD_FPR10(\thread)
  67. ldc1 $f12, THREAD_FPR12(\thread)
  68. ldc1 $f14, THREAD_FPR14(\thread)
  69. ldc1 $f16, THREAD_FPR16(\thread)
  70. ldc1 $f18, THREAD_FPR18(\thread)
  71. ldc1 $f20, THREAD_FPR20(\thread)
  72. ldc1 $f22, THREAD_FPR22(\thread)
  73. ldc1 $f24, THREAD_FPR24(\thread)
  74. ldc1 $f26, THREAD_FPR26(\thread)
  75. ldc1 $f28, THREAD_FPR28(\thread)
  76. ldc1 $f30, THREAD_FPR30(\thread)
  77. ctc1 \tmp, fcr31
  78. .endm
  79. .macro fpu_restore_16odd thread
  80. ldc1 $f1, THREAD_FPR1(\thread)
  81. ldc1 $f3, THREAD_FPR3(\thread)
  82. ldc1 $f5, THREAD_FPR5(\thread)
  83. ldc1 $f7, THREAD_FPR7(\thread)
  84. ldc1 $f9, THREAD_FPR9(\thread)
  85. ldc1 $f11, THREAD_FPR11(\thread)
  86. ldc1 $f13, THREAD_FPR13(\thread)
  87. ldc1 $f15, THREAD_FPR15(\thread)
  88. ldc1 $f17, THREAD_FPR17(\thread)
  89. ldc1 $f19, THREAD_FPR19(\thread)
  90. ldc1 $f21, THREAD_FPR21(\thread)
  91. ldc1 $f23, THREAD_FPR23(\thread)
  92. ldc1 $f25, THREAD_FPR25(\thread)
  93. ldc1 $f27, THREAD_FPR27(\thread)
  94. ldc1 $f29, THREAD_FPR29(\thread)
  95. ldc1 $f31, THREAD_FPR31(\thread)
  96. .endm
  97. .macro fpu_restore_double thread status tmp
  98. sll \tmp, \status, 5
  99. bgez \tmp, 1f # 16 register mode?
  100. fpu_restore_16odd \thread
  101. 1: fpu_restore_16even \thread \tmp
  102. .endm
  103. .macro cpu_save_nonscratch thread
  104. LONG_S s0, THREAD_REG16(\thread)
  105. LONG_S s1, THREAD_REG17(\thread)
  106. LONG_S s2, THREAD_REG18(\thread)
  107. LONG_S s3, THREAD_REG19(\thread)
  108. LONG_S s4, THREAD_REG20(\thread)
  109. LONG_S s5, THREAD_REG21(\thread)
  110. LONG_S s6, THREAD_REG22(\thread)
  111. LONG_S s7, THREAD_REG23(\thread)
  112. LONG_S sp, THREAD_REG29(\thread)
  113. LONG_S fp, THREAD_REG30(\thread)
  114. .endm
  115. .macro cpu_restore_nonscratch thread
  116. LONG_L s0, THREAD_REG16(\thread)
  117. LONG_L s1, THREAD_REG17(\thread)
  118. LONG_L s2, THREAD_REG18(\thread)
  119. LONG_L s3, THREAD_REG19(\thread)
  120. LONG_L s4, THREAD_REG20(\thread)
  121. LONG_L s5, THREAD_REG21(\thread)
  122. LONG_L s6, THREAD_REG22(\thread)
  123. LONG_L s7, THREAD_REG23(\thread)
  124. LONG_L sp, THREAD_REG29(\thread)
  125. LONG_L fp, THREAD_REG30(\thread)
  126. LONG_L ra, THREAD_REG31(\thread)
  127. .endm
  128. #endif /* _ASM_ASMMACRO_64_H */