ptrace.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef _I386_PTRACE_H
  2. #define _I386_PTRACE_H
  3. #define EBX 0
  4. #define ECX 1
  5. #define EDX 2
  6. #define ESI 3
  7. #define EDI 4
  8. #define EBP 5
  9. #define EAX 6
  10. #define DS 7
  11. #define ES 8
  12. #define FS 9
  13. #define GS 10
  14. #define ORIG_EAX 11
  15. #define EIP 12
  16. #define CS 13
  17. #define EFL 14
  18. #define UESP 15
  19. #define SS 16
  20. #define FRAME_SIZE 17
  21. /* this struct defines the way the registers are stored on the
  22. stack during a system call. */
  23. struct pt_regs {
  24. long ebx;
  25. long ecx;
  26. long edx;
  27. long esi;
  28. long edi;
  29. long ebp;
  30. long eax;
  31. int xds;
  32. int xes;
  33. long orig_eax;
  34. long eip;
  35. int xcs;
  36. long eflags;
  37. long esp;
  38. int xss;
  39. };
  40. /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
  41. #define PTRACE_GETREGS 12
  42. #define PTRACE_SETREGS 13
  43. #define PTRACE_GETFPREGS 14
  44. #define PTRACE_SETFPREGS 15
  45. #define PTRACE_GETFPXREGS 18
  46. #define PTRACE_SETFPXREGS 19
  47. #define PTRACE_OLDSETOPTIONS 21
  48. #define PTRACE_GET_THREAD_AREA 25
  49. #define PTRACE_SET_THREAD_AREA 26
  50. #ifdef __KERNEL__
  51. #include <asm/vm86.h>
  52. struct task_struct;
  53. extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
  54. static inline int user_mode(struct pt_regs *regs)
  55. {
  56. return (regs->xcs & 3) != 0;
  57. }
  58. static inline int user_mode_vm(struct pt_regs *regs)
  59. {
  60. return ((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0;
  61. }
  62. #define instruction_pointer(regs) ((regs)->eip)
  63. #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
  64. extern unsigned long profile_pc(struct pt_regs *regs);
  65. #else
  66. #define profile_pc(regs) instruction_pointer(regs)
  67. #endif
  68. #endif /* __KERNEL__ */
  69. #endif