ptrace.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #ifndef _ASMAXP_PTRACE_H
  2. #define _ASMAXP_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. * NOTE! I want to minimize the overhead of system calls, so this
  8. * struct has as little information as possible. I does not have
  9. *
  10. * - floating point regs: the kernel doesn't change those
  11. * - r9-15: saved by the C compiler
  12. *
  13. * This makes "fork()" and "exec()" a bit more complex, but should
  14. * give us low system call latency.
  15. */
  16. struct pt_regs {
  17. unsigned long r0;
  18. unsigned long r1;
  19. unsigned long r2;
  20. unsigned long r3;
  21. unsigned long r4;
  22. unsigned long r5;
  23. unsigned long r6;
  24. unsigned long r7;
  25. unsigned long r8;
  26. unsigned long r19;
  27. unsigned long r20;
  28. unsigned long r21;
  29. unsigned long r22;
  30. unsigned long r23;
  31. unsigned long r24;
  32. unsigned long r25;
  33. unsigned long r26;
  34. unsigned long r27;
  35. unsigned long r28;
  36. unsigned long hae;
  37. /* JRP - These are the values provided to a0-a2 by PALcode */
  38. unsigned long trap_a0;
  39. unsigned long trap_a1;
  40. unsigned long trap_a2;
  41. /* These are saved by PAL-code: */
  42. unsigned long ps;
  43. unsigned long pc;
  44. unsigned long gp;
  45. unsigned long r16;
  46. unsigned long r17;
  47. unsigned long r18;
  48. };
  49. /*
  50. * This is the extended stack used by signal handlers and the context
  51. * switcher: it's pushed after the normal "struct pt_regs".
  52. */
  53. struct switch_stack {
  54. unsigned long r9;
  55. unsigned long r10;
  56. unsigned long r11;
  57. unsigned long r12;
  58. unsigned long r13;
  59. unsigned long r14;
  60. unsigned long r15;
  61. unsigned long r26;
  62. unsigned long fp[32]; /* fp[31] is fpcr */
  63. };
  64. #ifdef __KERNEL__
  65. #define arch_has_single_step() (1)
  66. #define user_mode(regs) (((regs)->ps & 8) != 0)
  67. #define instruction_pointer(regs) ((regs)->pc)
  68. #define profile_pc(regs) instruction_pointer(regs)
  69. #define task_pt_regs(task) \
  70. ((struct pt_regs *) (task_stack_page(task) + 2*PAGE_SIZE) - 1)
  71. #define force_successful_syscall_return() (task_pt_regs(current)->r0 = 0)
  72. #endif
  73. #endif