ptrace.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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__) || defined(CONFIG_SUPERH64)
  8. struct pt_regs {
  9. unsigned long long pc;
  10. unsigned long long sr;
  11. unsigned 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. #define PTRACE_GETDSPREGS 55
  82. #define PTRACE_SETDSPREGS 56
  83. #endif
  84. #ifdef __KERNEL__
  85. #include <asm/addrspace.h>
  86. #define user_mode(regs) (((regs)->sr & 0x40000000)==0)
  87. #define instruction_pointer(regs) ((unsigned long)(regs)->pc)
  88. extern void show_regs(struct pt_regs *);
  89. #ifdef CONFIG_SH_DSP
  90. #define task_pt_regs(task) \
  91. ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
  92. - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
  93. #else
  94. #define task_pt_regs(task) \
  95. ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
  96. - sizeof(unsigned long)) - 1)
  97. #endif
  98. static inline unsigned long profile_pc(struct pt_regs *regs)
  99. {
  100. unsigned long pc = instruction_pointer(regs);
  101. #ifdef P2SEG
  102. if (pc >= P2SEG && pc < P3SEG)
  103. pc -= 0x20000000;
  104. #endif
  105. return pc;
  106. }
  107. #endif /* __KERNEL__ */
  108. #endif /* __ASM_SH_PTRACE_H */