]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - include/asm-x86/ptrace_32.h
Merge branch 'locks' of git://linux-nfs.org/~bfields/linux
[mirror_ubuntu-zesty-kernel.git] / include / asm-x86 / ptrace_32.h
CommitLineData
1da177e4
LT
1#ifndef _I386_PTRACE_H
2#define _I386_PTRACE_H
3
70e0eb8e 4#include <asm/ptrace-abi.h>
1da177e4
LT
5
6/* this struct defines the way the registers are stored on the
7 stack during a system call. */
8
9struct pt_regs {
10 long ebx;
11 long ecx;
12 long edx;
13 long esi;
14 long edi;
15 long ebp;
16 long eax;
17 int xds;
18 int xes;
464d1a78
JF
19 int xfs;
20 /* int xgs; */
1da177e4
LT
21 long orig_eax;
22 long eip;
23 int xcs;
24 long eflags;
25 long esp;
26 int xss;
27};
28
1da177e4 29#ifdef __KERNEL__
388b0925
AM
30
31#include <asm/vm86.h>
78be3706 32#include <asm/segment.h>
388b0925 33
1da177e4
LT
34struct task_struct;
35extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
ae6578fe 36
0998e422
ZA
37/*
38 * user_mode_vm(regs) determines whether a register set came from user mode.
39 * This is true if V8086 mode was enabled OR if the register set was from
40 * protected mode with RPL-3 CS value. This tricky test checks that with
41 * one comparison. Many places in the kernel can bypass this full check
42 * if they have already ruled out V8086 mode, so user_mode(regs) can be used.
43 */
ae6578fe
CE
44static inline int user_mode(struct pt_regs *regs)
45{
78be3706 46 return (regs->xcs & SEGMENT_RPL_MASK) == USER_RPL;
ae6578fe
CE
47}
48static inline int user_mode_vm(struct pt_regs *regs)
49{
78be3706 50 return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL;
ae6578fe 51}
7b355202
ZA
52static inline int v8086_mode(struct pt_regs *regs)
53{
54 return (regs->eflags & VM_MASK);
55}
b3f827cb 56
1da177e4 57#define instruction_pointer(regs) ((regs)->eip)
b3f827cb
AM
58#define regs_return_value(regs) ((regs)->eax)
59
1da177e4 60extern unsigned long profile_pc(struct pt_regs *regs);
ae6578fe 61#endif /* __KERNEL__ */
1da177e4
LT
62
63#endif