asmmacro.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:7k
源码类别:

嵌入式Linux

开发平台:

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