aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/ptrace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/ptrace.h')
-rw-r--r--include/asm-x86/ptrace.h80
1 files changed, 67 insertions, 13 deletions
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h
index 04204f359298..9187b2fab754 100644
--- a/include/asm-x86/ptrace.h
+++ b/include/asm-x86/ptrace.h
@@ -10,6 +10,8 @@
10/* this struct defines the way the registers are stored on the 10/* this struct defines the way the registers are stored on the
11 stack during a system call. */ 11 stack during a system call. */
12 12
13#ifndef __KERNEL__
14
13struct pt_regs { 15struct pt_regs {
14 long ebx; 16 long ebx;
15 long ecx; 17 long ecx;
@@ -21,7 +23,7 @@ struct pt_regs {
21 int xds; 23 int xds;
22 int xes; 24 int xes;
23 int xfs; 25 int xfs;
24 /* int xgs; */ 26 /* int gs; */
25 long orig_eax; 27 long orig_eax;
26 long eip; 28 long eip;
27 int xcs; 29 int xcs;
@@ -30,7 +32,27 @@ struct pt_regs {
30 int xss; 32 int xss;
31}; 33};
32 34
33#ifdef __KERNEL__ 35#else /* __KERNEL__ */
36
37struct pt_regs {
38 long bx;
39 long cx;
40 long dx;
41 long si;
42 long di;
43 long bp;
44 long ax;
45 int ds;
46 int es;
47 int fs;
48 /* int gs; */
49 long orig_ax;
50 long ip;
51 int cs;
52 long flags;
53 long sp;
54 int ss;
55};
34 56
35#include <asm/vm86.h> 57#include <asm/vm86.h>
36#include <asm/segment.h> 58#include <asm/segment.h>
@@ -47,27 +69,30 @@ extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int erro
47 */ 69 */
48static inline int user_mode(struct pt_regs *regs) 70static inline int user_mode(struct pt_regs *regs)
49{ 71{
50 return (regs->xcs & SEGMENT_RPL_MASK) == USER_RPL; 72 return (regs->cs & SEGMENT_RPL_MASK) == USER_RPL;
51} 73}
52static inline int user_mode_vm(struct pt_regs *regs) 74static inline int user_mode_vm(struct pt_regs *regs)
53{ 75{
54 return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL; 76 return ((regs->cs & SEGMENT_RPL_MASK) |
77 (regs->flags & VM_MASK)) >= USER_RPL;
55} 78}
56static inline int v8086_mode(struct pt_regs *regs) 79static inline int v8086_mode(struct pt_regs *regs)
57{ 80{
58 return (regs->eflags & VM_MASK); 81 return (regs->flags & VM_MASK);
59} 82}
60 83
61#define instruction_pointer(regs) ((regs)->eip) 84#define instruction_pointer(regs) ((regs)->ip)
62#define frame_pointer(regs) ((regs)->ebp) 85#define frame_pointer(regs) ((regs)->bp)
63#define stack_pointer(regs) ((unsigned long)(regs)) 86#define stack_pointer(regs) ((unsigned long)(regs))
64#define regs_return_value(regs) ((regs)->eax) 87#define regs_return_value(regs) ((regs)->ax)
65 88
66extern unsigned long profile_pc(struct pt_regs *regs); 89extern unsigned long profile_pc(struct pt_regs *regs);
67#endif /* __KERNEL__ */ 90#endif /* __KERNEL__ */
68 91
69#else /* __i386__ */ 92#else /* __i386__ */
70 93
94#ifndef __KERNEL__
95
71struct pt_regs { 96struct pt_regs {
72 unsigned long r15; 97 unsigned long r15;
73 unsigned long r14; 98 unsigned long r14;
@@ -96,14 +121,43 @@ struct pt_regs {
96/* top of stack page */ 121/* top of stack page */
97}; 122};
98 123
99#ifdef __KERNEL__ 124#else /* __KERNEL__ */
125
126struct pt_regs {
127 unsigned long r15;
128 unsigned long r14;
129 unsigned long r13;
130 unsigned long r12;
131 unsigned long bp;
132 unsigned long bx;
133/* arguments: non interrupts/non tracing syscalls only save upto here*/
134 unsigned long r11;
135 unsigned long r10;
136 unsigned long r9;
137 unsigned long r8;
138 unsigned long ax;
139 unsigned long cx;
140 unsigned long dx;
141 unsigned long si;
142 unsigned long di;
143 unsigned long orig_ax;
144/* end of arguments */
145/* cpu exception frame or undefined */
146 unsigned long ip;
147 unsigned long cs;
148 unsigned long flags;
149 unsigned long sp;
150 unsigned long ss;
151/* top of stack page */
152};
100 153
101#define user_mode(regs) (!!((regs)->cs & 3)) 154#define user_mode(regs) (!!((regs)->cs & 3))
102#define user_mode_vm(regs) user_mode(regs) 155#define user_mode_vm(regs) user_mode(regs)
103#define instruction_pointer(regs) ((regs)->rip) 156#define v8086_mode(regs) 0 /* No V86 mode support in long mode */
104#define frame_pointer(regs) ((regs)->rbp) 157#define instruction_pointer(regs) ((regs)->ip)
105#define stack_pointer(regs) ((regs)->rsp) 158#define frame_pointer(regs) ((regs)->bp)
106#define regs_return_value(regs) ((regs)->rax) 159#define stack_pointer(regs) ((regs)->sp)
160#define regs_return_value(regs) ((regs)->ax)
107 161
108extern unsigned long profile_pc(struct pt_regs *regs); 162extern unsigned long profile_pc(struct pt_regs *regs);
109void signal_fault(struct pt_regs *regs, void __user *frame, char *where); 163void signal_fault(struct pt_regs *regs, void __user *frame, char *where);