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

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * asmmacro.h: Assembler macros to make things easier to read.
  3.  *
  4.  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
  5.  * Copyright (C) 1998, 1999 Ralf Baechle
  6.  * Copyright (C) 1999 Silicon Graphics, Inc.
  7.  */
  8. #ifndef _ASM_ASMMACRO_H
  9. #define _ASM_ASMMACRO_H
  10. #include <linux/config.h>
  11. #include <asm/offset.h>
  12. #ifdef CONFIG_CPU_SB1
  13. #define FPU_ENABLE_HAZARD
  14. .set    push;
  15. .set noreorder;
  16. .set    mips2;
  17. SSNOP;
  18. bnezl   $0, .+4;
  19.  SSNOP;
  20. .set    pop
  21. #else
  22. #define FPU_ENABLE_HAZARD
  23. #endif
  24. .macro fpu_save_16even thread tmp
  25. cfc1 tmp, fcr31
  26. sdc1 $f2,  (THREAD_FPU + 0x010)(thread)
  27. sdc1 $f4,  (THREAD_FPU + 0x020)(thread)
  28. sdc1 $f6,  (THREAD_FPU + 0x030)(thread)
  29. sdc1 $f8,  (THREAD_FPU + 0x040)(thread)
  30. sdc1 $f10, (THREAD_FPU + 0x050)(thread)
  31. sdc1 $f12, (THREAD_FPU + 0x060)(thread)
  32. sdc1 $f14, (THREAD_FPU + 0x070)(thread)
  33. sdc1 $f16, (THREAD_FPU + 0x080)(thread)
  34. sdc1 $f18, (THREAD_FPU + 0x090)(thread)
  35. sdc1 $f20, (THREAD_FPU + 0x0a0)(thread)
  36. sdc1 $f22, (THREAD_FPU + 0x0b0)(thread)
  37. sdc1 $f24, (THREAD_FPU + 0x0c0)(thread)
  38. sdc1 $f26, (THREAD_FPU + 0x0d0)(thread)
  39. sdc1 $f28, (THREAD_FPU + 0x0e0)(thread)
  40. sdc1 $f30, (THREAD_FPU + 0x0f0)(thread)
  41. sw tmp, (THREAD_FPU + 0x100)(thread)
  42. .endm
  43. .macro fpu_save_16odd thread
  44. sdc1 $f1,  (THREAD_FPU + 0x08)(thread)
  45. sdc1 $f3,  (THREAD_FPU + 0x18)(thread)
  46. sdc1 $f5,  (THREAD_FPU + 0x28)(thread)
  47. sdc1 $f7,  (THREAD_FPU + 0x38)(thread)
  48. sdc1 $f9,  (THREAD_FPU + 0x48)(thread)
  49. sdc1 $f11, (THREAD_FPU + 0x58)(thread)
  50. sdc1 $f13, (THREAD_FPU + 0x68)(thread)
  51. sdc1 $f15, (THREAD_FPU + 0x78)(thread)
  52. sdc1 $f17, (THREAD_FPU + 0x88)(thread)
  53. sdc1 $f19, (THREAD_FPU + 0x98)(thread)
  54. sdc1 $f21, (THREAD_FPU + 0xa8)(thread)
  55. sdc1 $f23, (THREAD_FPU + 0xb8)(thread)
  56. sdc1 $f25, (THREAD_FPU + 0xc8)(thread)
  57. sdc1 $f27, (THREAD_FPU + 0xd8)(thread)
  58. sdc1 $f29, (THREAD_FPU + 0xe8)(thread)
  59. sdc1 $f31, (THREAD_FPU + 0xf8)(thread)
  60. .endm
  61. .macro fpu_save thread tmp
  62. cfc1 tmp,  fcr31
  63. swc1 $f0,  (THREAD_FPU + 0x000)(thread)
  64. swc1 $f1,  (THREAD_FPU + 0x008)(thread)
  65. swc1 $f2,  (THREAD_FPU + 0x010)(thread)
  66. swc1 $f3,  (THREAD_FPU + 0x018)(thread)
  67. swc1 $f4,  (THREAD_FPU + 0x020)(thread)
  68. swc1 $f5,  (THREAD_FPU + 0x028)(thread)
  69. swc1 $f6,  (THREAD_FPU + 0x030)(thread)
  70. swc1 $f7,  (THREAD_FPU + 0x038)(thread)
  71. swc1 $f8,  (THREAD_FPU + 0x040)(thread)
  72. swc1 $f9,  (THREAD_FPU + 0x048)(thread)
  73. swc1 $f10, (THREAD_FPU + 0x050)(thread)
  74. swc1 $f11, (THREAD_FPU + 0x058)(thread)
  75. swc1 $f12, (THREAD_FPU + 0x060)(thread)
  76. swc1 $f13, (THREAD_FPU + 0x068)(thread)
  77. swc1 $f14, (THREAD_FPU + 0x070)(thread)
  78. swc1 $f15, (THREAD_FPU + 0x078)(thread)
  79. swc1 $f16, (THREAD_FPU + 0x080)(thread)
  80. swc1 $f17, (THREAD_FPU + 0x088)(thread)
  81. swc1 $f18, (THREAD_FPU + 0x090)(thread)
  82. swc1 $f19, (THREAD_FPU + 0x098)(thread)
  83. swc1 $f20, (THREAD_FPU + 0x0a0)(thread)
  84. swc1 $f21, (THREAD_FPU + 0x0a8)(thread)
  85. swc1 $f22, (THREAD_FPU + 0x0b0)(thread)
  86. swc1 $f23, (THREAD_FPU + 0x0b8)(thread)
  87. swc1 $f24, (THREAD_FPU + 0x0c0)(thread)
  88. swc1 $f25, (THREAD_FPU + 0x0c8)(thread)
  89. swc1 $f26, (THREAD_FPU + 0x0d0)(thread)
  90. swc1 $f27, (THREAD_FPU + 0x0d8)(thread)
  91. swc1 $f28, (THREAD_FPU + 0x0e0)(thread)
  92. swc1 $f29, (THREAD_FPU + 0x0e8)(thread)
  93. swc1 $f30, (THREAD_FPU + 0x0f0)(thread)
  94. swc1 $f31, (THREAD_FPU + 0x0f8)(thread)
  95. sw tmp, (THREAD_FPU + 0x100)(thread)
  96. .endm
  97. .macro fpu_restore_16even thread tmp
  98. lw tmp, (THREAD_FPU + 0x100)(thread)
  99. ldc1 $f2,  (THREAD_FPU + 0x010)(thread)
  100. ldc1 $f4,  (THREAD_FPU + 0x020)(thread)
  101. ldc1 $f6,  (THREAD_FPU + 0x030)(thread)
  102. ldc1 $f8,  (THREAD_FPU + 0x040)(thread)
  103. ldc1 $f10, (THREAD_FPU + 0x050)(thread)
  104. ldc1 $f12, (THREAD_FPU + 0x060)(thread)
  105. ldc1 $f14, (THREAD_FPU + 0x070)(thread)
  106. ldc1 $f16, (THREAD_FPU + 0x080)(thread)
  107. ldc1 $f18, (THREAD_FPU + 0x090)(thread)
  108. ldc1 $f20, (THREAD_FPU + 0x0a0)(thread)
  109. ldc1 $f22, (THREAD_FPU + 0x0b0)(thread)
  110. ldc1 $f24, (THREAD_FPU + 0x0c0)(thread)
  111. ldc1 $f26, (THREAD_FPU + 0x0d0)(thread)
  112. ldc1 $f28, (THREAD_FPU + 0x0e0)(thread)
  113. ldc1 $f30, (THREAD_FPU + 0x0f0)(thread)
  114. ctc1 tmp,  fcr31
  115. .endm
  116. .macro fpu_restore_16odd thread
  117. ldc1 $f1,  (THREAD_FPU + 0x08)(thread)
  118. ldc1 $f3,  (THREAD_FPU + 0x18)(thread)
  119. ldc1 $f5,  (THREAD_FPU + 0x28)(thread)
  120. ldc1 $f7,  (THREAD_FPU + 0x38)(thread)
  121. ldc1 $f9,  (THREAD_FPU + 0x48)(thread)
  122. ldc1 $f11, (THREAD_FPU + 0x58)(thread)
  123. ldc1 $f13, (THREAD_FPU + 0x68)(thread)
  124. ldc1 $f15, (THREAD_FPU + 0x78)(thread)
  125. ldc1 $f17, (THREAD_FPU + 0x88)(thread)
  126. ldc1 $f19, (THREAD_FPU + 0x98)(thread)
  127. ldc1 $f21, (THREAD_FPU + 0xa8)(thread)
  128. ldc1 $f23, (THREAD_FPU + 0xb8)(thread)
  129. ldc1 $f25, (THREAD_FPU + 0xc8)(thread)
  130. ldc1 $f27, (THREAD_FPU + 0xd8)(thread)
  131. ldc1 $f29, (THREAD_FPU + 0xe8)(thread)
  132. ldc1 $f31, (THREAD_FPU + 0xf8)(thread)
  133. .endm
  134. .macro fpu_restore thread tmp
  135. lw tmp, (THREAD_FPU + 0x100)(thread)
  136. lwc1 $f0,  (THREAD_FPU + 0x000)(thread)
  137. lwc1 $f1,  (THREAD_FPU + 0x008)(thread)
  138. lwc1 $f2,  (THREAD_FPU + 0x010)(thread)
  139. lwc1 $f3,  (THREAD_FPU + 0x018)(thread)
  140. lwc1 $f4,  (THREAD_FPU + 0x020)(thread)
  141. lwc1 $f5,  (THREAD_FPU + 0x028)(thread)
  142. lwc1 $f6,  (THREAD_FPU + 0x030)(thread)
  143. lwc1 $f7,  (THREAD_FPU + 0x038)(thread)
  144. lwc1 $f8,  (THREAD_FPU + 0x040)(thread)
  145. lwc1 $f9,  (THREAD_FPU + 0x048)(thread)
  146. lwc1 $f10, (THREAD_FPU + 0x050)(thread)
  147. lwc1 $f11, (THREAD_FPU + 0x058)(thread)
  148. lwc1 $f12, (THREAD_FPU + 0x060)(thread)
  149. lwc1 $f13, (THREAD_FPU + 0x068)(thread)
  150. lwc1 $f14, (THREAD_FPU + 0x070)(thread)
  151. lwc1 $f15, (THREAD_FPU + 0x078)(thread)
  152. lwc1 $f16, (THREAD_FPU + 0x080)(thread)
  153. lwc1 $f17, (THREAD_FPU + 0x088)(thread)
  154. lwc1 $f18, (THREAD_FPU + 0x090)(thread)
  155. lwc1 $f19, (THREAD_FPU + 0x098)(thread)
  156. lwc1 $f20, (THREAD_FPU + 0x0a0)(thread)
  157. lwc1 $f21, (THREAD_FPU + 0x0a8)(thread)
  158. lwc1 $f22, (THREAD_FPU + 0x0b0)(thread)
  159. lwc1 $f23, (THREAD_FPU + 0x0b8)(thread)
  160. lwc1 $f24, (THREAD_FPU + 0x0c0)(thread)
  161. lwc1 $f25, (THREAD_FPU + 0x0c8)(thread)
  162. lwc1 $f26, (THREAD_FPU + 0x0d0)(thread)
  163. lwc1 $f27, (THREAD_FPU + 0x0d8)(thread)
  164. lwc1 $f28, (THREAD_FPU + 0x0e0)(thread)
  165. lwc1 $f29, (THREAD_FPU + 0x0e8)(thread)
  166. lwc1 $f30, (THREAD_FPU + 0x0f0)(thread)
  167. lwc1 $f31, (THREAD_FPU + 0x0f8)(thread)
  168. ctc1 tmp,  fcr31
  169. .endm
  170. .macro cpu_save_nonscratch thread
  171. sd s0, THREAD_REG16(thread)
  172. sd s1, THREAD_REG17(thread)
  173. sd s2, THREAD_REG18(thread)
  174. sd s3, THREAD_REG19(thread)
  175. sd s4, THREAD_REG20(thread)
  176. sd s5, THREAD_REG21(thread)
  177. sd s6, THREAD_REG22(thread)
  178. sd s7, THREAD_REG23(thread)
  179. sd sp, THREAD_REG29(thread)
  180. sd fp, THREAD_REG30(thread)
  181. .endm
  182. .macro cpu_restore_nonscratch thread
  183. ld s0, THREAD_REG16(thread)
  184. ld s1, THREAD_REG17(thread)
  185. ld s2, THREAD_REG18(thread)
  186. ld s3, THREAD_REG19(thread)
  187. ld s4, THREAD_REG20(thread)
  188. ld s5, THREAD_REG21(thread)
  189. ld s6, THREAD_REG22(thread)
  190. ld s7, THREAD_REG23(thread)
  191. ld sp, THREAD_REG29(thread)
  192. ld fp, THREAD_REG30(thread)
  193. ld ra, THREAD_REG31(thread)
  194. .endm
  195. #endif /* !(_ASM_ASMMACRO_H) */