ptrace.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef __ASM_SH_PTRACE_H
  2. #define __ASM_SH_PTRACE_H
  3. /*
  4. * Copyright (C) 1999, 2000 Niibe Yutaka
  5. *
  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. /*
  38. * This struct defines the way the registers are stored on the
  39. * kernel stack during a system call or other kernel entry.
  40. */
  41. struct pt_regs {
  42. unsigned long regs[16];
  43. unsigned long pc;
  44. unsigned long pr;
  45. unsigned long sr;
  46. unsigned long gbr;
  47. unsigned long mach;
  48. unsigned long macl;
  49. long tra;
  50. };
  51. /*
  52. * This struct defines the way the DSP registers are stored on the
  53. * kernel stack during a system call or other kernel entry.
  54. */
  55. struct pt_dspregs {
  56. unsigned long a1;
  57. unsigned long a0g;
  58. unsigned long a1g;
  59. unsigned long m0;
  60. unsigned long m1;
  61. unsigned long a0;
  62. unsigned long x0;
  63. unsigned long x1;
  64. unsigned long y0;
  65. unsigned long y1;
  66. unsigned long dsr;
  67. unsigned long rs;
  68. unsigned long re;
  69. unsigned long mod;
  70. };
  71. #define PTRACE_GETDSPREGS 55
  72. #define PTRACE_SETDSPREGS 56
  73. #ifdef __KERNEL__
  74. #define user_mode(regs) (((regs)->sr & 0x40000000)==0)
  75. #define instruction_pointer(regs) ((regs)->pc)
  76. extern void show_regs(struct pt_regs *);
  77. #ifdef CONFIG_SH_DSP
  78. #define task_pt_regs(task) \
  79. ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
  80. - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
  81. #else
  82. #define task_pt_regs(task) \
  83. ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
  84. - sizeof(unsigned long)) - 1)
  85. #endif
  86. static inline unsigned long profile_pc(struct pt_regs *regs)
  87. {
  88. unsigned long pc = instruction_pointer(regs);
  89. if (pc >= 0xa0000000UL && pc < 0xc0000000UL)
  90. pc -= 0x20000000;
  91. return pc;
  92. }
  93. #endif
  94. #endif /* __ASM_SH_PTRACE_H */