ptrace.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. 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_GETFDPIC 31 /* get the ELF fdpic loadmap address */
  82. #define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */
  83. #define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */
  84. #define PTRACE_GETDSPREGS 55
  85. #define PTRACE_SETDSPREGS 56
  86. #endif
  87. #ifdef __KERNEL__
  88. #include <asm/addrspace.h>
  89. #define user_mode(regs) (((regs)->sr & 0x40000000)==0)
  90. #define instruction_pointer(regs) ((unsigned long)(regs)->pc)
  91. extern void show_regs(struct pt_regs *);
  92. /*
  93. * These are defined as per linux/ptrace.h.
  94. */
  95. struct task_struct;
  96. #define arch_has_single_step() (1)
  97. extern void user_enable_single_step(struct task_struct *);
  98. extern void user_disable_single_step(struct task_struct *);
  99. #ifdef CONFIG_SH_DSP
  100. #define task_pt_regs(task) \
  101. ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
  102. - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1)
  103. #else
  104. #define task_pt_regs(task) \
  105. ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \
  106. - sizeof(unsigned long)) - 1)
  107. #endif
  108. static inline unsigned long profile_pc(struct pt_regs *regs)
  109. {
  110. unsigned long pc = instruction_pointer(regs);
  111. #ifdef P2SEG
  112. if (pc >= P2SEG && pc < P3SEG)
  113. pc -= 0x20000000;
  114. #endif
  115. return pc;
  116. }
  117. #endif /* __KERNEL__ */
  118. #endif /* __ASM_SH_PTRACE_H */