ptrace.h 2.4 KB

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