ptrace.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. /*
  2. * Copyright 2004-2008 Analog Devices Inc.
  3. *
  4. * Licensed under the GPL-2 or later.
  5. */
  6. #ifndef _BFIN_PTRACE_H
  7. #define _BFIN_PTRACE_H
  8. /*
  9. * GCC defines register number like this:
  10. * -----------------------------
  11. * 0 - 7 are data registers R0-R7
  12. * 8 - 15 are address registers P0-P7
  13. * 16 - 31 dsp registers I/B/L0 -- I/B/L3 & M0--M3
  14. * 32 - 33 A registers A0 & A1
  15. * 34 - status register
  16. * -----------------------------
  17. *
  18. * We follows above, except:
  19. * 32-33 --- Low 32-bit of A0&1
  20. * 34-35 --- High 8-bit of A0&1
  21. */
  22. #ifndef __ASSEMBLY__
  23. struct task_struct;
  24. /* this struct defines the way the registers are stored on the
  25. stack during a system call. */
  26. struct pt_regs {
  27. long orig_pc;
  28. long ipend;
  29. long seqstat;
  30. long rete;
  31. long retn;
  32. long retx;
  33. long pc; /* PC == RETI */
  34. long rets;
  35. long reserved; /* Used as scratch during system calls */
  36. long astat;
  37. long lb1;
  38. long lb0;
  39. long lt1;
  40. long lt0;
  41. long lc1;
  42. long lc0;
  43. long a1w;
  44. long a1x;
  45. long a0w;
  46. long a0x;
  47. long b3;
  48. long b2;
  49. long b1;
  50. long b0;
  51. long l3;
  52. long l2;
  53. long l1;
  54. long l0;
  55. long m3;
  56. long m2;
  57. long m1;
  58. long m0;
  59. long i3;
  60. long i2;
  61. long i1;
  62. long i0;
  63. long usp;
  64. long fp;
  65. long p5;
  66. long p4;
  67. long p3;
  68. long p2;
  69. long p1;
  70. long p0;
  71. long r7;
  72. long r6;
  73. long r5;
  74. long r4;
  75. long r3;
  76. long r2;
  77. long r1;
  78. long r0;
  79. long orig_r0;
  80. long orig_p0;
  81. long syscfg;
  82. };
  83. /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  84. #define PTRACE_GETREGS 12
  85. #define PTRACE_SETREGS 13 /* ptrace signal */
  86. #define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */
  87. #define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
  88. #define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
  89. #define PS_S (0x0002)
  90. #ifdef __KERNEL__
  91. /* user_mode returns true if only one bit is set in IPEND, other than the
  92. master interrupt enable. */
  93. #define user_mode(regs) (!(((regs)->ipend & ~0x10) & (((regs)->ipend & ~0x10) - 1)))
  94. #define arch_has_single_step() (1)
  95. /* common code demands this function */
  96. #define ptrace_disable(child) user_disable_single_step(child)
  97. extern int is_user_addr_valid(struct task_struct *child,
  98. unsigned long start, unsigned long len);
  99. /*
  100. * Get the address of the live pt_regs for the specified task.
  101. * These are saved onto the top kernel stack when the process
  102. * is not running.
  103. *
  104. * Note: if a user thread is execve'd from kernel space, the
  105. * kernel stack will not be empty on entry to the kernel, so
  106. * ptracing these tasks will fail.
  107. */
  108. #define task_pt_regs(task) \
  109. (struct pt_regs *) \
  110. ((unsigned long)task_stack_page(task) + \
  111. (THREAD_SIZE - sizeof(struct pt_regs)))
  112. #include <asm-generic/ptrace.h>
  113. #endif /* __KERNEL__ */
  114. #endif /* __ASSEMBLY__ */
  115. /*
  116. * Offsets used by 'ptrace' system call interface.
  117. */
  118. #define PT_R0 204
  119. #define PT_R1 200
  120. #define PT_R2 196
  121. #define PT_R3 192
  122. #define PT_R4 188
  123. #define PT_R5 184
  124. #define PT_R6 180
  125. #define PT_R7 176
  126. #define PT_P0 172
  127. #define PT_P1 168
  128. #define PT_P2 164
  129. #define PT_P3 160
  130. #define PT_P4 156
  131. #define PT_P5 152
  132. #define PT_FP 148
  133. #define PT_USP 144
  134. #define PT_I0 140
  135. #define PT_I1 136
  136. #define PT_I2 132
  137. #define PT_I3 128
  138. #define PT_M0 124
  139. #define PT_M1 120
  140. #define PT_M2 116
  141. #define PT_M3 112
  142. #define PT_L0 108
  143. #define PT_L1 104
  144. #define PT_L2 100
  145. #define PT_L3 96
  146. #define PT_B0 92
  147. #define PT_B1 88
  148. #define PT_B2 84
  149. #define PT_B3 80
  150. #define PT_A0X 76
  151. #define PT_A0W 72
  152. #define PT_A1X 68
  153. #define PT_A1W 64
  154. #define PT_LC0 60
  155. #define PT_LC1 56
  156. #define PT_LT0 52
  157. #define PT_LT1 48
  158. #define PT_LB0 44
  159. #define PT_LB1 40
  160. #define PT_ASTAT 36
  161. #define PT_RESERVED 32
  162. #define PT_RETS 28
  163. #define PT_PC 24
  164. #define PT_RETX 20
  165. #define PT_RETN 16
  166. #define PT_RETE 12
  167. #define PT_SEQSTAT 8
  168. #define PT_IPEND 4
  169. #define PT_ORIG_R0 208
  170. #define PT_ORIG_P0 212
  171. #define PT_SYSCFG 216
  172. #define PT_TEXT_ADDR 220
  173. #define PT_TEXT_END_ADDR 224
  174. #define PT_DATA_ADDR 228
  175. #define PT_FDPIC_EXEC 232
  176. #define PT_FDPIC_INTERP 236
  177. #define PT_LAST_PSEUDO PT_FDPIC_INTERP
  178. #endif /* _BFIN_PTRACE_H */