ptrace.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ifndef __ASM_SH_PTRACE_H
  2. #define __ASM_SH_PTRACE_H
  3. #include <asm/ubc.h>
  4. /*
  5. * Copyright (C) 1999, 2000 Niibe Yutaka
  6. *
  7. */
  8. /*
  9. * GCC defines register number like this:
  10. * -----------------------------
  11. * 0 - 15 are integer registers
  12. * 17 - 22 are control/special registers
  13. * 24 - 39 fp registers
  14. * 40 - 47 xd registers
  15. * 48 - fpscr register
  16. * -----------------------------
  17. *
  18. * We follows above, except:
  19. * 16 --- program counter (PC)
  20. * 22 --- syscall #
  21. * 23 --- floating point communication register
  22. */
  23. #define REG_REG0 0
  24. #define REG_REG15 15
  25. #define REG_PC 16
  26. #define REG_PR 17
  27. #define REG_SR 18
  28. #define REG_GBR 19
  29. #define REG_MACH 20
  30. #define REG_MACL 21
  31. #define REG_SYSCALL 22
  32. #define REG_FPREG0 23
  33. #define REG_FPREG15 38
  34. #define REG_XFREG0 39
  35. #define REG_XFREG15 54
  36. #define REG_FPSCR 55
  37. #define REG_FPUL 56
  38. /* options set using PTRACE_SETOPTIONS */
  39. #define PTRACE_O_TRACESYSGOOD 0x00000001
  40. /*
  41. * This struct defines the way the registers are stored on the
  42. * kernel stack during a system call or other kernel entry.
  43. */
  44. struct pt_regs {
  45. unsigned long regs[16];
  46. unsigned long pc;
  47. unsigned long pr;
  48. unsigned long sr;
  49. unsigned long gbr;
  50. unsigned long mach;
  51. unsigned long macl;
  52. long tra;
  53. };
  54. /*
  55. * This struct defines the way the DSP registers are stored on the
  56. * kernel stack during a system call or other kernel entry.
  57. */
  58. struct pt_dspregs {
  59. unsigned long a1;
  60. unsigned long a0g;
  61. unsigned long a1g;
  62. unsigned long m0;
  63. unsigned long m1;
  64. unsigned long a0;
  65. unsigned long x0;
  66. unsigned long x1;
  67. unsigned long y0;
  68. unsigned long y1;
  69. unsigned long dsr;
  70. unsigned long rs;
  71. unsigned long re;
  72. unsigned long mod;
  73. };
  74. #define PTRACE_GETDSPREGS 55
  75. #define PTRACE_SETDSPREGS 56
  76. #ifdef __KERNEL__
  77. #define user_mode(regs) (((regs)->sr & 0x40000000)==0)
  78. #define instruction_pointer(regs) ((regs)->pc)
  79. extern void show_regs(struct pt_regs *);
  80. #ifdef CONFIG_SH_DSP
  81. #define task_pt_regs(task) \
  82. ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
  83. - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
  84. #else
  85. #define task_pt_regs(task) \
  86. ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
  87. - sizeof(unsigned long)) - 1)
  88. #endif
  89. static inline unsigned long profile_pc(struct pt_regs *regs)
  90. {
  91. unsigned long pc = instruction_pointer(regs);
  92. if (pc >= 0xa0000000UL && pc < 0xc0000000UL)
  93. pc -= 0x20000000;
  94. return pc;
  95. }
  96. #endif
  97. #endif /* __ASM_SH_PTRACE_H */