ptrace.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /*
  2. * U-boot - ptrace.h
  3. *
  4. * Copyright (c) 2005 blackfin.uclinux.org
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #ifndef _BLACKFIN_PTRACE_H
  25. #define _BLACKFIN_PTRACE_H
  26. #define NEW_PT_REGS
  27. /*
  28. * GCC defines register number like this:
  29. * -----------------------------
  30. * 0 - 7 are data registers R0-R7
  31. * 8 - 15 are address registers P0-P7
  32. * 16 - 31 dsp registers I/B/L0 -- I/B/L3 & M0--M3
  33. * 32 - 33 A registers A0 & A1
  34. * 34 - status register
  35. *
  36. * We follows above, except:
  37. * 32-33 --- Low 32-bit of A0&1
  38. * 34-35 --- High 8-bit of A0&1
  39. */
  40. #if defined(NEW_PT_REGS)
  41. #define PT_IPEND 0
  42. #define PT_SYSCFG (PT_IPEND+4)
  43. #define PT_SEQSTAT (PT_SYSCFG+4)
  44. #define PT_RETE (PT_SEQSTAT+4)
  45. #define PT_RETN (PT_RETE+4)
  46. #define PT_RETX (PT_RETN+4)
  47. #define PT_RETI (PT_RETX+4)
  48. #define PT_PC PT_RETI
  49. #define PT_RETS (PT_RETI+4)
  50. #define PT_RESERVED (PT_RETS+4)
  51. #define PT_ASTAT (PT_RESERVED+4)
  52. #define PT_LB1 (PT_ASTAT+4)
  53. #define PT_LB0 (PT_LB1+4)
  54. #define PT_LT1 (PT_LB0+4)
  55. #define PT_LT0 (PT_LT1+4)
  56. #define PT_LC1 (PT_LT0+4)
  57. #define PT_LC0 (PT_LC1+4)
  58. #define PT_A1W (PT_LC0+4)
  59. #define PT_A1X (PT_A1W+4)
  60. #define PT_A0W (PT_A1X+4)
  61. #define PT_A0X (PT_A0W+4)
  62. #define PT_B3 (PT_A0X+4)
  63. #define PT_B2 (PT_B3+4)
  64. #define PT_B1 (PT_B2+4)
  65. #define PT_B0 (PT_B1+4)
  66. #define PT_L3 (PT_B0+4)
  67. #define PT_L2 (PT_L3+4)
  68. #define PT_L1 (PT_L2+4)
  69. #define PT_L0 (PT_L1+4)
  70. #define PT_M3 (PT_L0+4)
  71. #define PT_M2 (PT_M3+4)
  72. #define PT_M1 (PT_M2+4)
  73. #define PT_M0 (PT_M1+4)
  74. #define PT_I3 (PT_M0+4)
  75. #define PT_I2 (PT_I3+4)
  76. #define PT_I1 (PT_I2+4)
  77. #define PT_I0 (PT_I1+4)
  78. #define PT_USP (PT_I0+4)
  79. #define PT_FP (PT_USP+4)
  80. #define PT_P5 (PT_FP+4)
  81. #define PT_P4 (PT_P5+4)
  82. #define PT_P3 (PT_P4+4)
  83. #define PT_P2 (PT_P3+4)
  84. #define PT_P1 (PT_P2+4)
  85. #define PT_P0 (PT_P1+4)
  86. #define PT_R7 (PT_P0+4)
  87. #define PT_R6 (PT_R7+4)
  88. #define PT_R5 (PT_R6+4)
  89. #define PT_R4 (PT_R5+4)
  90. #define PT_R3 (PT_R4+4)
  91. #define PT_R2 (PT_R3+4)
  92. #define PT_R1 (PT_R2+4)
  93. #define PT_R0 (PT_R1+4)
  94. #define PT_ORIG_R0 (PT_R0+4)
  95. #define PT_SR PT_SEQSTAT
  96. #else
  97. /*
  98. * Here utilize blackfin : dpregs = [pregs + imm16s4]
  99. * [pregs + imm16s4] = dpregs
  100. * to access defferent saved reg in stack
  101. */
  102. #define PT_R3 0
  103. #define PT_R4 4
  104. #define PT_R2 8
  105. #define PT_R1 12
  106. #define PT_P5 16
  107. #define PT_P4 20
  108. #define PT_P3 24
  109. #define PT_P2 28
  110. #define PT_P1 32
  111. #define PT_P0 36
  112. #define PT_R7 40
  113. #define PT_R6 44
  114. #define PT_R5 48
  115. #define PT_PC 52
  116. #define PT_SEQSTAT 56 /* so-called SR reg */
  117. #define PT_SR PT_SEQSTAT
  118. #define PT_ASTAT 60
  119. #define PT_RETS 64
  120. #define PT_A1w 68
  121. #define PT_A0w 72
  122. #define PT_A1x 76
  123. #define PT_A0x 80
  124. #define PT_ORIG_R0 84
  125. #define PT_R0 88
  126. #define PT_USP 92
  127. #define PT_FP 96
  128. #define PT_SP 100
  129. /* Added by HuTao, May26 2003 3:18PM */
  130. #define PT_IPEND 100
  131. /* Add SYSCFG register for single stepping support */
  132. #define PT_SYSCFG 104
  133. #endif
  134. #ifndef __ASSEMBLY__
  135. #if defined(NEW_PT_REGS)
  136. /* this struct defines the way the registers are stored on the
  137. * stack during a system call.
  138. */
  139. struct pt_regs {
  140. long ipend;
  141. long syscfg;
  142. long seqstat;
  143. long rete;
  144. long retn;
  145. long retx;
  146. long pc;
  147. long rets;
  148. long reserved;
  149. long astat;
  150. long lb1;
  151. long lb0;
  152. long lt1;
  153. long lt0;
  154. long lc1;
  155. long lc0;
  156. long a1w;
  157. long a1x;
  158. long a0w;
  159. long a0x;
  160. long b3;
  161. long b2;
  162. long b1;
  163. long b0;
  164. long l3;
  165. long l2;
  166. long l1;
  167. long l0;
  168. long m3;
  169. long m2;
  170. long m1;
  171. long m0;
  172. long i3;
  173. long i2;
  174. long i1;
  175. long i0;
  176. long usp;
  177. long fp;
  178. long p5;
  179. long p4;
  180. long p3;
  181. long p2;
  182. long p1;
  183. long p0;
  184. long r7;
  185. long r6;
  186. long r5;
  187. long r4;
  188. long r3;
  189. long r2;
  190. long r1;
  191. long r0;
  192. long orig_r0;
  193. };
  194. #else
  195. /* now we don't know what regs the system call will use */
  196. struct pt_regs {
  197. long r3;
  198. long r4;
  199. long r2;
  200. long r1;
  201. long p5;
  202. long p4;
  203. long p3;
  204. long p2;
  205. long p1;
  206. long p0;
  207. long r7;
  208. long r6;
  209. long r5;
  210. unsigned long pc;
  211. unsigned long seqstat;
  212. unsigned long astat;
  213. unsigned long rets;
  214. long a1w;
  215. long a0w;
  216. long a1x;
  217. long a0x;
  218. long orig_r0;
  219. long r0;
  220. long usp;
  221. long fp;
  222. /*
  223. * Added for supervisor/user mode switch.
  224. *
  225. * HuTao May26 03 3:23PM
  226. */
  227. long ipend;
  228. long syscfg;
  229. };
  230. #endif
  231. /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  232. #define PTRACE_GETREGS 12
  233. #define PTRACE_SETREGS 13 /* ptrace signal */
  234. #ifdef __KERNEL__
  235. #ifndef PS_S
  236. #define PS_S (0x0c00)
  237. /* Bit 11:10 of SEQSTAT defines user/supervisor/debug mode
  238. * 00: user
  239. * 01: supervisor
  240. * 1x: debug
  241. */
  242. #define PS_M (0x1000) /* I am not sure why this is required here Akbar */
  243. #endif
  244. #define user_mode(regs) (!((regs)->seqstat & PS_S))
  245. #define instruction_pointer(regs) ((regs)->pc)
  246. extern void show_regs(struct pt_regs *);
  247. #endif
  248. #endif
  249. #endif