ptrace.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef _I386_PTRACE_H
  2. #define _I386_PTRACE_H
  3. #include <asm/ptrace-abi.h>
  4. /* this struct defines the way the registers are stored on the
  5. stack during a system call. */
  6. struct pt_regs {
  7. long ebx;
  8. long ecx;
  9. long edx;
  10. long esi;
  11. long edi;
  12. long ebp;
  13. long eax;
  14. int xds;
  15. int xes;
  16. long orig_eax;
  17. long eip;
  18. int xcs;
  19. long eflags;
  20. long esp;
  21. int xss;
  22. };
  23. #ifdef __KERNEL__
  24. #include <asm/vm86.h>
  25. #include <asm/segment.h>
  26. struct task_struct;
  27. extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
  28. /*
  29. * user_mode_vm(regs) determines whether a register set came from user mode.
  30. * This is true if V8086 mode was enabled OR if the register set was from
  31. * protected mode with RPL-3 CS value. This tricky test checks that with
  32. * one comparison. Many places in the kernel can bypass this full check
  33. * if they have already ruled out V8086 mode, so user_mode(regs) can be used.
  34. */
  35. static inline int user_mode(struct pt_regs *regs)
  36. {
  37. return (regs->xcs & SEGMENT_RPL_MASK) == USER_RPL;
  38. }
  39. static inline int user_mode_vm(struct pt_regs *regs)
  40. {
  41. return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL;
  42. }
  43. #define instruction_pointer(regs) ((regs)->eip)
  44. #define regs_return_value(regs) ((regs)->eax)
  45. extern unsigned long profile_pc(struct pt_regs *regs);
  46. #endif /* __KERNEL__ */
  47. #endif