ptrace.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #ifndef _PPC_PTRACE_H
  2. #define _PPC_PTRACE_H
  3. /*
  4. * This struct defines the way the registers are stored on the
  5. * kernel stack during a system call or other kernel entry.
  6. *
  7. * this should only contain volatile regs
  8. * since we can keep non-volatile in the thread_struct
  9. * should set this up when only volatiles are saved
  10. * by intr code.
  11. *
  12. * Since this is going on the stack, *CARE MUST BE TAKEN* to insure
  13. * that the overall structure is a multiple of 16 bytes in length.
  14. *
  15. * Note that the offsets of the fields in this struct correspond with
  16. * the PT_* values below. This simplifies arch/ppc/kernel/ptrace.c.
  17. */
  18. #ifndef __ASSEMBLY__
  19. struct pt_regs {
  20. unsigned long gpr[32];
  21. unsigned long nip;
  22. unsigned long msr;
  23. unsigned long orig_gpr3; /* Used for restarting system calls */
  24. unsigned long ctr;
  25. unsigned long link;
  26. unsigned long xer;
  27. unsigned long ccr;
  28. unsigned long mq; /* 601 only (not used at present) */
  29. /* Used on APUS to hold IPL value. */
  30. unsigned long trap; /* Reason for being here */
  31. /* N.B. for critical exceptions on 4xx, the dar and dsisr
  32. fields are overloaded to hold srr0 and srr1. */
  33. unsigned long dar; /* Fault registers */
  34. unsigned long dsisr; /* on 4xx/Book-E used for ESR */
  35. unsigned long result; /* Result of a system call */
  36. };
  37. #endif /* __ASSEMBLY__ */
  38. #ifdef __KERNEL__
  39. #define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */
  40. /* Size of stack frame allocated when calling signal handler. */
  41. #define __SIGNAL_FRAMESIZE 64
  42. #ifndef __ASSEMBLY__
  43. #define instruction_pointer(regs) ((regs)->nip)
  44. #ifdef CONFIG_SMP
  45. extern unsigned long profile_pc(struct pt_regs *regs);
  46. #else
  47. #define profile_pc(regs) instruction_pointer(regs)
  48. #endif
  49. #define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
  50. #define force_successful_syscall_return() \
  51. do { \
  52. current_thread_info()->local_flags |= _TIFL_FORCE_NOERROR; \
  53. } while(0)
  54. /*
  55. * We use the least-significant bit of the trap field to indicate
  56. * whether we have saved the full set of registers, or only a
  57. * partial set. A 1 there means the partial set.
  58. * On 4xx we use the next bit to indicate whether the exception
  59. * is a critical exception (1 means it is).
  60. */
  61. #define FULL_REGS(regs) (((regs)->trap & 1) == 0)
  62. #define IS_CRITICAL_EXC(regs) (((regs)->trap & 2) == 0)
  63. #define TRAP(regs) ((regs)->trap & ~0xF)
  64. #define CHECK_FULL_REGS(regs) \
  65. do { \
  66. if ((regs)->trap & 1) \
  67. printk(KERN_CRIT "%s: partial register set\n", __FUNCTION__); \
  68. } while (0)
  69. #endif /* __ASSEMBLY__ */
  70. #endif /* __KERNEL__ */
  71. /*
  72. * Offsets used by 'ptrace' system call interface.
  73. * These can't be changed without breaking binary compatibility
  74. * with MkLinux, etc.
  75. */
  76. #define PT_R0 0
  77. #define PT_R1 1
  78. #define PT_R2 2
  79. #define PT_R3 3
  80. #define PT_R4 4
  81. #define PT_R5 5
  82. #define PT_R6 6
  83. #define PT_R7 7
  84. #define PT_R8 8
  85. #define PT_R9 9
  86. #define PT_R10 10
  87. #define PT_R11 11
  88. #define PT_R12 12
  89. #define PT_R13 13
  90. #define PT_R14 14
  91. #define PT_R15 15
  92. #define PT_R16 16
  93. #define PT_R17 17
  94. #define PT_R18 18
  95. #define PT_R19 19
  96. #define PT_R20 20
  97. #define PT_R21 21
  98. #define PT_R22 22
  99. #define PT_R23 23
  100. #define PT_R24 24
  101. #define PT_R25 25
  102. #define PT_R26 26
  103. #define PT_R27 27
  104. #define PT_R28 28
  105. #define PT_R29 29
  106. #define PT_R30 30
  107. #define PT_R31 31
  108. #define PT_NIP 32
  109. #define PT_MSR 33
  110. #ifdef __KERNEL__
  111. #define PT_ORIG_R3 34
  112. #endif
  113. #define PT_CTR 35
  114. #define PT_LNK 36
  115. #define PT_XER 37
  116. #define PT_CCR 38
  117. #define PT_MQ 39
  118. #define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
  119. #define PT_FPR31 (PT_FPR0 + 2*31)
  120. #define PT_FPSCR (PT_FPR0 + 2*32 + 1)
  121. /* Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go */
  122. #define PTRACE_GETVRREGS 18
  123. #define PTRACE_SETVRREGS 19
  124. /* Get/set all the upper 32-bits of the SPE registers, accumulator, and
  125. * spefscr, in one go */
  126. #define PTRACE_GETEVRREGS 20
  127. #define PTRACE_SETEVRREGS 21
  128. /*
  129. * Get or set a debug register. The first 16 are DABR registers and the
  130. * second 16 are IABR registers.
  131. */
  132. #define PTRACE_GET_DEBUGREG 25
  133. #define PTRACE_SET_DEBUGREG 26
  134. #endif