ptrace.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #ifndef _ASM_M32R_PTRACE_H
  2. #define _ASM_M32R_PTRACE_H
  3. /*
  4. * linux/include/asm-m32r/ptrace.h
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. *
  10. * M32R version:
  11. * Copyright (C) 2001-2002, 2004 Hirokazu Takata <takata at linux-m32r.org>
  12. */
  13. #include <linux/config.h>
  14. #include <asm/m32r.h> /* M32R_PSW_BSM, M32R_PSW_BPM */
  15. /* 0 - 13 are integer registers (general purpose registers). */
  16. #define PT_R4 0
  17. #define PT_R5 1
  18. #define PT_R6 2
  19. #define PT_REGS 3
  20. #define PT_R0 4
  21. #define PT_R1 5
  22. #define PT_R2 6
  23. #define PT_R3 7
  24. #define PT_R7 8
  25. #define PT_R8 9
  26. #define PT_R9 10
  27. #define PT_R10 11
  28. #define PT_R11 12
  29. #define PT_R12 13
  30. #define PT_SYSCNR 14
  31. #define PT_R13 PT_FP
  32. #define PT_R14 PT_LR
  33. #define PT_R15 PT_SP
  34. /* processor status and miscellaneous context registers. */
  35. #if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
  36. #define PT_ACC0H 15
  37. #define PT_ACC0L 16
  38. #define PT_ACC1H 17
  39. #define PT_ACC1L 18
  40. #define PT_ACCH PT_ACC0H
  41. #define PT_ACCL PT_ACC0L
  42. #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
  43. #define PT_ACCH 15
  44. #define PT_ACCL 16
  45. #define PT_DUMMY_ACC1H 17
  46. #define PT_DUMMY_ACC1L 18
  47. #else
  48. #error unknown isa conifiguration
  49. #endif
  50. #define PT_PSW 19
  51. #define PT_BPC 20
  52. #define PT_BBPSW 21
  53. #define PT_BBPC 22
  54. #define PT_SPU 23
  55. #define PT_FP 24
  56. #define PT_LR 25
  57. #define PT_SPI 26
  58. #define PT_ORIGR0 27
  59. /* virtual pt_reg entry for gdb */
  60. #define PT_PC 30
  61. #define PT_CBR 31
  62. #define PT_EVB 32
  63. /* Control registers. */
  64. #define SPR_CR0 PT_PSW
  65. #define SPR_CR1 PT_CBR /* read only */
  66. #define SPR_CR2 PT_SPI
  67. #define SPR_CR3 PT_SPU
  68. #define SPR_CR4
  69. #define SPR_CR5 PT_EVB /* part of M32R/E, M32R/I core only */
  70. #define SPR_CR6 PT_BPC
  71. #define SPR_CR7
  72. #define SPR_CR8 PT_BBPSW
  73. #define SPR_CR9
  74. #define SPR_CR10
  75. #define SPR_CR11
  76. #define SPR_CR12
  77. #define SPR_CR13 PT_WR
  78. #define SPR_CR14 PT_BBPC
  79. #define SPR_CR15
  80. /* this struct defines the way the registers are stored on the
  81. stack during a system call. */
  82. struct pt_regs {
  83. /* Saved main processor registers. */
  84. unsigned long r4;
  85. unsigned long r5;
  86. unsigned long r6;
  87. struct pt_regs *pt_regs;
  88. unsigned long r0;
  89. unsigned long r1;
  90. unsigned long r2;
  91. unsigned long r3;
  92. unsigned long r7;
  93. unsigned long r8;
  94. unsigned long r9;
  95. unsigned long r10;
  96. unsigned long r11;
  97. unsigned long r12;
  98. long syscall_nr;
  99. /* Saved main processor status and miscellaneous context registers. */
  100. #if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2)
  101. unsigned long acc0h;
  102. unsigned long acc0l;
  103. unsigned long acc1h;
  104. unsigned long acc1l;
  105. #elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R)
  106. unsigned long acch;
  107. unsigned long accl;
  108. unsigned long dummy_acc1h;
  109. unsigned long dummy_acc1l;
  110. #else
  111. #error unknown isa configuration
  112. #endif
  113. unsigned long psw;
  114. unsigned long bpc; /* saved PC for TRAP syscalls */
  115. unsigned long bbpsw;
  116. unsigned long bbpc;
  117. unsigned long spu; /* saved user stack */
  118. unsigned long fp;
  119. unsigned long lr; /* saved PC for JL syscalls */
  120. unsigned long spi; /* saved kernel stack */
  121. unsigned long orig_r0;
  122. };
  123. /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  124. #define PTRACE_GETREGS 12
  125. #define PTRACE_SETREGS 13
  126. #define PTRACE_OLDSETOPTIONS 21
  127. /* options set using PTRACE_SETOPTIONS */
  128. #define PTRACE_O_TRACESYSGOOD 0x00000001
  129. #ifdef __KERNEL__
  130. #define __ARCH_SYS_PTRACE 1
  131. #if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2)
  132. #define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0)
  133. #elif defined(CONFIG_ISA_M32R)
  134. #define user_mode(regs) ((M32R_PSW_BSM & (regs)->psw) != 0)
  135. #else
  136. #error unknown isa configuration
  137. #endif
  138. #define instruction_pointer(regs) ((regs)->bpc)
  139. #define profile_pc(regs) instruction_pointer(regs)
  140. extern void show_regs(struct pt_regs *);
  141. extern void withdraw_debug_trap(struct pt_regs *regs);
  142. #define task_pt_regs(task) \
  143. ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1)
  144. #endif /* __KERNEL */
  145. #endif /* _ASM_M32R_PTRACE_H */