xref: /openbmc/u-boot/arch/x86/include/asm/ptrace.h (revision 9d466f2f)
1 #ifndef _I386_PTRACE_H
2 #define _I386_PTRACE_H
3 
4 #include <asm/types.h>
5 
6 #define EBX 0
7 #define ECX 1
8 #define EDX 2
9 #define ESI 3
10 #define EDI 4
11 #define EBP 5
12 #define EAX 6
13 #define DS 7
14 #define ES 8
15 #define FS 9
16 #define GS 10
17 #define ORIG_EAX 11
18 #define EIP 12
19 #define CS  13
20 #define EFL 14
21 #define UESP 15
22 #define SS   16
23 #define FRAME_SIZE 17
24 
25 /* this struct defines the way the registers are stored on the
26    stack during a system call. */
27 
28 struct pt_regs {
29 	long ebx;
30 	long ecx;
31 	long edx;
32 	long esi;
33 	long edi;
34 	long ebp;
35 	long eax;
36 	int  xds;
37 	int  xes;
38 	int  xfs;
39 	int  xgs;
40 	long orig_eax;
41 	long eip;
42 	int  xcs;
43 	long eflags;
44 	long esp;
45 	int  xss;
46 }  __attribute__ ((packed));
47 
48 struct irq_regs {
49 	/* Pushed by irq_common_entry */
50 	long ebx;
51 	long ecx;
52 	long edx;
53 	long esi;
54 	long edi;
55 	long ebp;
56 	long esp;
57 	long eax;
58 	long xds;
59 	long xes;
60 	long xfs;
61 	long xgs;
62 	long xss;
63 	/* Pushed by vector handler (irq_<num>) */
64 	long irq_id;
65 	/* Pushed by cpu in response to interrupt */
66 	union {
67 		struct {
68 			long eip;
69 			long xcs;
70 			long eflags;
71 		} ctx1;
72 		struct {
73 			long err;
74 			long eip;
75 			long xcs;
76 			long eflags;
77 		} ctx2;
78 	} context;
79 }  __attribute__ ((packed));
80 
81 /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
82 #define PTRACE_GETREGS            12
83 #define PTRACE_SETREGS            13
84 #define PTRACE_GETFPREGS          14
85 #define PTRACE_SETFPREGS          15
86 #define PTRACE_GETFPXREGS         18
87 #define PTRACE_SETFPXREGS         19
88 
89 #define PTRACE_SETOPTIONS         21
90 
91 /* options set using PTRACE_SETOPTIONS */
92 #define PTRACE_O_TRACESYSGOOD     0x00000001
93 
94 #ifdef __KERNEL__
95 #define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs))
96 #define instruction_pointer(regs) ((regs)->eip)
97 extern void show_regs(struct pt_regs *);
98 #endif
99 
100 #endif
101