blob: 3849bc075663c9d568a431eccc9eca7285d69fd0 [file] [log] [blame]
wdenk591dda52002-11-18 00:14:45 +00001#ifndef _I386_PTRACE_H
2#define _I386_PTRACE_H
3
Graeme Russ43261532010-10-07 20:03:23 +11004#include <asm/types.h>
5
wdenk591dda52002-11-18 00:14:45 +00006#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
wdenk57b2d802003-06-27 21:31:46 +000025/* this struct defines the way the registers are stored on the
wdenk591dda52002-11-18 00:14:45 +000026 stack during a system call. */
27
28struct 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
Graeme Russ43261532010-10-07 20:03:23 +110048struct 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 */
Bin Meng9ff054b2015-07-10 10:38:32 +080066 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;
Graeme Russ43261532010-10-07 20:03:23 +110079} __attribute__ ((packed));
wdenk591dda52002-11-18 00:14:45 +000080
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)
97extern void show_regs(struct pt_regs *);
98#endif
99
100#endif