ptrace.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. struct task_struct;
  52. extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
  53. #define user_mode(regs) (3 & (regs)->xcs)
  54. #define user_mode_vm(regs) ((VM_MASK & (regs)->eflags) || user_mode(regs))
  55. #define instruction_pointer(regs) ((regs)->eip)
  56. #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
  57. extern unsigned long profile_pc(struct pt_regs *regs);
  58. #else
  59. #define profile_pc(regs) instruction_pointer(regs)
  60. #endif
  61. #endif
  62. #endif