Subversion Repositories HelenOS

Rev

Rev 501 | Rev 534 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (C) 2005 Martin Decky
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. #ifndef __ppc32_MACRO_H__
  30. #define __ppc32_MACRO_H__
  31.  
  32. /*
  33.  * PPC assembler macros
  34.  */
  35.  
  36. /* Condition Register Bit Fields */
  37. #define cr0 0
  38. #define cr1 1
  39. #define cr2 2
  40. #define cr3 3
  41. #define cr4 4
  42. #define cr5 5
  43. #define cr6 6
  44. #define cr7 7
  45.  
  46. /* General Purpose Registers (GPRs) */
  47. #define r0  0
  48. #define r1  1
  49. #define r2  2
  50. #define r3  3
  51. #define r4  4
  52. #define r5  5
  53. #define r6  6
  54. #define r7  7
  55. #define r8  8
  56. #define r9  9
  57. #define r10 10
  58. #define r11 11
  59. #define r12 12
  60. #define r13 13
  61. #define r14 14
  62. #define r15 15
  63. #define r16 16
  64. #define r17 17
  65. #define r18 18
  66. #define r19 19
  67. #define r20 20
  68. #define r21 21
  69. #define r22 22
  70. #define r23 23
  71. #define r24 24
  72. #define r25 25
  73. #define r26 26
  74. #define r27 27
  75. #define r28 28
  76. #define r29 29
  77. #define r30 30
  78. #define r31 31
  79.  
  80. /* GPR Aliases */
  81. #define sp  1
  82.  
  83. /* Floating Point Registers (FPRs) */
  84. #define fr0 0
  85. #define fr1 1
  86. #define fr2 2
  87. #define fr3 3
  88. #define fr4 4
  89. #define fr5 5
  90. #define fr6 6
  91. #define fr7 7
  92. #define fr8 8
  93. #define fr9 9
  94. #define fr10    10
  95. #define fr11    11
  96. #define fr12    12
  97. #define fr13    13
  98. #define fr14    14
  99. #define fr15    15
  100. #define fr16    16
  101. #define fr17    17
  102. #define fr18    18
  103. #define fr19    19
  104. #define fr20    20
  105. #define fr21    21
  106. #define fr22    22
  107. #define fr23    23
  108. #define fr24    24
  109. #define fr25    25
  110. #define fr26    26
  111. #define fr27    27
  112. #define fr28    28
  113. #define fr29    29
  114. #define fr30    30
  115. #define fr31    31
  116.  
  117. #define vr0 0
  118. #define vr1 1
  119. #define vr2 2
  120. #define vr3 3
  121. #define vr4 4
  122. #define vr5 5
  123. #define vr6 6
  124. #define vr7 7
  125. #define vr8 8
  126. #define vr9 9
  127. #define vr10    10
  128. #define vr11    11
  129. #define vr12    12
  130. #define vr13    13
  131. #define vr14    14
  132. #define vr15    15
  133. #define vr16    16
  134. #define vr17    17
  135. #define vr18    18
  136. #define vr19    19
  137. #define vr20    20
  138. #define vr21    21
  139. #define vr22    22
  140. #define vr23    23
  141. #define vr24    24
  142. #define vr25    25
  143. #define vr26    26
  144. #define vr27    27
  145. #define vr28    28
  146. #define vr29    29
  147. #define vr30    30
  148. #define vr31    31
  149.  
  150. #define evr0    0
  151. #define evr1    1
  152. #define evr2    2
  153. #define evr3    3
  154. #define evr4    4
  155. #define evr5    5
  156. #define evr6    6
  157. #define evr7    7
  158. #define evr8    8
  159. #define evr9    9
  160. #define evr10   10
  161. #define evr11   11
  162. #define evr12   12
  163. #define evr13   13
  164. #define evr14   14
  165. #define evr15   15
  166. #define evr16   16
  167. #define evr17   17
  168. #define evr18   18
  169. #define evr19   19
  170. #define evr20   20
  171. #define evr21   21
  172. #define evr22   22
  173. #define evr23   23
  174. #define evr24   24
  175. #define evr25   25
  176. #define evr26   26
  177. #define evr27   27
  178. #define evr28   28
  179. #define evr29   29
  180. #define evr30   30
  181. #define evr31   31
  182.  
  183. /* Special Purpose Registers (SPRs) */
  184. #define xer 1
  185. #define lr  8
  186. #define ctr 9
  187. #define dec 22
  188. #define srr0    26
  189. #define srr1    27
  190. #define sprg0   272
  191. #define sprg1   273
  192. #define sprg2   274
  193. #define sprg3   275
  194. #define prv 287
  195.  
  196. .macro REGISTERS_STORE r
  197.     stw r0, 0(\r)
  198.     stw r1, 4(\r)
  199.     stw r2, 8(\r)
  200.     stw r3, 12(\r)
  201.     stw r4, 16(\r)
  202.     stw r5, 20(\r)
  203.     stw r6, 24(\r)
  204.     stw r7, 28(\r)
  205.     stw r8, 32(\r)
  206.     stw r9, 36(\r)
  207.     stw r10, 40(\r)
  208.     stw r11, 44(\r)
  209.     stw r12, 48(\r)
  210.     stw r13, 52(\r)
  211.     stw r14, 56(\r)
  212.     stw r15, 60(\r)
  213.     stw r16, 64(\r)
  214.     stw r17, 68(\r)
  215.     stw r18, 72(\r)
  216.     stw r19, 76(\r)
  217.     stw r20, 80(\r)
  218.     stw r21, 84(\r)
  219.     stw r22, 88(\r)
  220.     stw r23, 92(\r)
  221.     stw r24, 96(\r)
  222.     stw r25, 100(\r)
  223.     stw r26, 104(\r)
  224.     stw r27, 108(\r)
  225.     stw r28, 112(\r)
  226.     stw r29, 116(\r)
  227.     stw r30, 120(\r)
  228.     stw r31, 124(\r)
  229. .endm
  230.  
  231. .macro REGISTERS_LOAD r
  232.     lwz r0, 0(\r)
  233.     lwz r1, 4(\r)
  234.     lwz r2, 8(\r)  
  235.     lwz r3, 12(\r)
  236.     lwz r4, 16(\r)
  237.     lwz r5, 20(\r)
  238.     lwz r6, 24(\r)
  239.     lwz r7, 28(\r)
  240.     lwz r8, 32(\r)
  241.     lwz r9, 36(\r)
  242.     lwz r10, 40(\r)
  243.     lwz r11, 44(\r)
  244.     lwz r12, 48(\r)
  245.     lwz r13, 52(\r)
  246.     lwz r14, 56(\r)
  247.     lwz r15, 60(\r)
  248.     lwz r16, 64(\r)
  249.     lwz r17, 68(\r)
  250.     lwz r18, 72(\r)
  251.     lwz r19, 76(\r)
  252.     lwz r20, 80(\r)
  253.     lwz r21, 84(\r)
  254.     lwz r22, 88(\r)
  255.     lwz r23, 92(\r)
  256.     lwz r24, 96(\r)
  257.     lwz r25, 100(\r)
  258.     lwz r26, 104(\r)
  259.     lwz r27, 108(\r)
  260.     lwz r28, 112(\r)
  261.     lwz r29, 116(\r)
  262.     lwz r30, 120(\r)
  263.     lwz r31, 124(\r)
  264. .endm
  265.  
  266. #endif
  267.