ptrace.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #ifndef __ASM_SH_PTRACE_H
  2. #define __ASM_SH_PTRACE_H
  3. /*
  4. * Copyright (C) 1999, 2000 Niibe Yutaka
  5. *
  6. */
  7. #if defined(__SH5__)
  8. struct pt_regs {
  9. unsigned long long pc;
  10. unsigned long long sr;
  11. long long syscall_nr;
  12. unsigned long long regs[63];
  13. unsigned long long tregs[8];
  14. unsigned long long pad[2];
  15. };
  16. #else
  17. /*
  18. * GCC defines register number like this:
  19. * -----------------------------
  20. * 0 - 15 are integer registers
  21. * 17 - 22 are control/special registers
  22. * 24 - 39 fp registers
  23. * 40 - 47 xd registers
  24. * 48 - fpscr register
  25. * -----------------------------
  26. *
  27. * We follows above, except:
  28. * 16 --- program counter (PC)
  29. * 22 --- syscall #
  30. * 23 --- floating point communication register
  31. */
  32. #define REG_REG0 0
  33. #define REG_REG15 15
  34. #define REG_PC 16
  35. #define REG_PR 17
  36. #define REG_SR 18
  37. #define REG_GBR 19
  38. #define REG_MACH 20
  39. #define REG_MACL 21
  40. #define REG_SYSCALL 22
  41. #define REG_FPREG0 23
  42. #define REG_FPREG15 38
  43. #define REG_XFREG0 39
  44. #define REG_XFREG15 54
  45. #define REG_FPSCR 55
  46. #define REG_FPUL 56
  47. /*
  48. * This struct defines the way the registers are stored on the
  49. * kernel stack during a system call or other kernel entry.
  50. */
  51. struct pt_regs {
  52. unsigned long regs[16];
  53. unsigned long pc;
  54. unsigned long pr;
  55. unsigned long sr;
  56. unsigned long gbr;
  57. unsigned long mach;
  58. unsigned long macl;
  59. long tra;
  60. };
  61. /*
  62. * This struct defines the way the DSP registers are stored on the
  63. * kernel stack during a system call or other kernel entry.
  64. */
  65. struct pt_dspregs {
  66. unsigned long a1;
  67. unsigned long a0g;
  68. unsigned long a1g;
  69. unsigned long m0;
  70. unsigned long m1;
  71. unsigned long a0;
  72. unsigned long x0;
  73. unsigned long x1;
  74. unsigned long y0;
  75. unsigned long y1;
  76. unsigned long dsr;
  77. unsigned long rs;
  78. unsigned long re;
  79. unsigned long mod;
  80. };
  81. #endif
  82. #define PTRACE_GETREGS 12 /* General registers */
  83. #define PTRACE_SETREGS 13
  84. #define PTRACE_GETFPREGS 14 /* FPU registers */
  85. #define PTRACE_SETFPREGS 15
  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 PTRACE_GETDSPREGS 55 /* DSP registers */
  90. #define PTRACE_SETDSPREGS 56
  91. #define PT_TEXT_END_ADDR 240
  92. #define PT_TEXT_ADDR 244 /* &(struct user)->start_code */
  93. #define PT_DATA_ADDR 248 /* &(struct user)->start_data */
  94. #define PT_TEXT_LEN 252
  95. #ifdef __KERNEL__
  96. #include <asm/addrspace.h>
  97. #define user_mode(regs) (((regs)->sr & 0x40000000)==0)
  98. #define instruction_pointer(regs) ((unsigned long)(regs)->pc)
  99. extern void show_regs(struct pt_regs *);
  100. /*
  101. * These are defined as per linux/ptrace.h.
  102. */
  103. struct task_struct;
  104. #define arch_has_single_step() (1)
  105. extern void user_enable_single_step(struct task_struct *);
  106. extern void user_disable_single_step(struct task_struct *);
  107. #define task_pt_regs(task) \
  108. ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE) - 1)
  109. static inline unsigned long profile_pc(struct pt_regs *regs)
  110. {
  111. unsigned long pc = instruction_pointer(regs);
  112. #ifdef P2SEG
  113. if (pc >= P2SEG && pc < P3SEG)
  114. pc -= 0x20000000;
  115. #endif
  116. return pc;
  117. }
  118. #endif /* __KERNEL__ */
  119. #endif /* __ASM_SH_PTRACE_H */