ptrace.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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/powerpc/kernel/ptrace.c.
  17. */
  18. #ifndef __ASSEMBLY__
  19. #ifdef CONFIG_PPC64BRIDGE
  20. #define PPC_REG unsigned long /*long*/
  21. #else
  22. #define PPC_REG unsigned long
  23. #endif
  24. struct pt_regs {
  25. PPC_REG gpr[32];
  26. PPC_REG nip;
  27. PPC_REG msr;
  28. PPC_REG orig_gpr3; /* Used for restarting system calls */
  29. PPC_REG ctr;
  30. PPC_REG link;
  31. PPC_REG xer;
  32. PPC_REG ccr;
  33. PPC_REG mq; /* 601 only (not used at present) */
  34. /* Used on APUS to hold IPL value. */
  35. PPC_REG trap; /* Reason for being here */
  36. PPC_REG dar; /* Fault registers */
  37. PPC_REG dsisr;
  38. PPC_REG result; /* Result of a system call */
  39. };
  40. #endif
  41. #define STACK_FRAME_OVERHEAD 16 /* size of minimum stack frame */
  42. /* Size of stack frame allocated when calling signal handler. */
  43. #define __SIGNAL_FRAMESIZE 64
  44. #define instruction_pointer(regs) ((regs)->nip)
  45. #define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
  46. /*
  47. * Offsets used by 'ptrace' system call interface.
  48. * These can't be changed without breaking binary compatibility
  49. * with MkLinux, etc.
  50. */
  51. #define PT_R0 0
  52. #define PT_R1 1
  53. #define PT_R2 2
  54. #define PT_R3 3
  55. #define PT_R4 4
  56. #define PT_R5 5
  57. #define PT_R6 6
  58. #define PT_R7 7
  59. #define PT_R8 8
  60. #define PT_R9 9
  61. #define PT_R10 10
  62. #define PT_R11 11
  63. #define PT_R12 12
  64. #define PT_R13 13
  65. #define PT_R14 14
  66. #define PT_R15 15
  67. #define PT_R16 16
  68. #define PT_R17 17
  69. #define PT_R18 18
  70. #define PT_R19 19
  71. #define PT_R20 20
  72. #define PT_R21 21
  73. #define PT_R22 22
  74. #define PT_R23 23
  75. #define PT_R24 24
  76. #define PT_R25 25
  77. #define PT_R26 26
  78. #define PT_R27 27
  79. #define PT_R28 28
  80. #define PT_R29 29
  81. #define PT_R30 30
  82. #define PT_R31 31
  83. #define PT_NIP 32
  84. #define PT_MSR 33
  85. #ifdef __KERNEL__
  86. #define PT_ORIG_R3 34
  87. #endif
  88. #define PT_CTR 35
  89. #define PT_LNK 36
  90. #define PT_XER 37
  91. #define PT_CCR 38
  92. #define PT_MQ 39
  93. #define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
  94. #define PT_FPR31 (PT_FPR0 + 2*31)
  95. #define PT_FPSCR (PT_FPR0 + 2*32 + 1)
  96. #endif