1 #ifndef _ASM_X86_PTRACE_H
2 #define _ASM_X86_PTRACE_H
4 #include <linux/compiler.h> /* For __user */
5 #include <asm/ptrace-abi.h>
10 /* this struct defines the way the registers are stored on the
11 stack during a system call. */
36 #include <asm/segment.h>
39 extern void send_sigtrap(struct task_struct
*tsk
, struct pt_regs
*regs
, int error_code
);
42 * user_mode_vm(regs) determines whether a register set came from user mode.
43 * This is true if V8086 mode was enabled OR if the register set was from
44 * protected mode with RPL-3 CS value. This tricky test checks that with
45 * one comparison. Many places in the kernel can bypass this full check
46 * if they have already ruled out V8086 mode, so user_mode(regs) can be used.
48 static inline int user_mode(struct pt_regs
*regs
)
50 return (regs
->xcs
& SEGMENT_RPL_MASK
) == USER_RPL
;
52 static inline int user_mode_vm(struct pt_regs
*regs
)
54 return ((regs
->xcs
& SEGMENT_RPL_MASK
) | (regs
->eflags
& VM_MASK
)) >= USER_RPL
;
56 static inline int v8086_mode(struct pt_regs
*regs
)
58 return (regs
->eflags
& VM_MASK
);
61 #define instruction_pointer(regs) ((regs)->eip)
62 #define frame_pointer(regs) ((regs)->ebp)
63 #define stack_pointer(regs) ((unsigned long)(regs))
64 #define regs_return_value(regs) ((regs)->eax)
66 extern unsigned long profile_pc(struct pt_regs
*regs
);
67 #endif /* __KERNEL__ */
78 /* arguments: non interrupts/non tracing syscalls only save upto here*/
88 unsigned long orig_rax
;
89 /* end of arguments */
90 /* cpu exception frame or undefined */
96 /* top of stack page */
101 #define user_mode(regs) (!!((regs)->cs & 3))
102 #define user_mode_vm(regs) user_mode(regs)
103 #define instruction_pointer(regs) ((regs)->rip)
104 #define frame_pointer(regs) ((regs)->rbp)
105 #define stack_pointer(regs) ((regs)->rsp)
106 #define regs_return_value(regs) ((regs)->rax)
108 extern unsigned long profile_pc(struct pt_regs
*regs
);
109 void signal_fault(struct pt_regs
*regs
, void __user
*frame
, char *where
);
114 convert_rip_to_linear(struct task_struct
*child
, struct pt_regs
*regs
);
126 EF_IOPL
= 0x00003000,
127 EF_IOPL_RING0
= 0x00000000,
128 EF_IOPL_RING1
= 0x00001000,
129 EF_IOPL_RING2
= 0x00002000,
130 EF_NT
= 0x00004000, /* nested task */
131 EF_RF
= 0x00010000, /* resume */
132 EF_VM
= 0x00020000, /* virtual mode */
133 EF_AC
= 0x00040000, /* alignment */
134 EF_VIF
= 0x00080000, /* virtual interrupt */
135 EF_VIP
= 0x00100000, /* virtual interrupt pending */
136 EF_ID
= 0x00200000, /* id */
138 #endif /* __KERNEL__ */
139 #endif /* !__i386__ */
140 #endif /* !__ASSEMBLY__ */