xref: /linux/arch/x86/include/uapi/asm/ptrace-abi.h (revision ca55b2fef3a9373fcfc30f82fd26bc7fccbda732)
1 #ifndef _ASM_X86_PTRACE_ABI_H
2 #define _ASM_X86_PTRACE_ABI_H
3 
4 #ifdef __i386__
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 #else /* __i386__ */
26 
27 #if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS)
28 /*
29  * C ABI says these regs are callee-preserved. They aren't saved on kernel entry
30  * unless syscall needs a complete, fully filled "struct pt_regs".
31  */
32 #define R15 0
33 #define R14 8
34 #define R13 16
35 #define R12 24
36 #define RBP 32
37 #define RBX 40
38 /* These regs are callee-clobbered. Always saved on kernel entry. */
39 #define R11 48
40 #define R10 56
41 #define R9 64
42 #define R8 72
43 #define RAX 80
44 #define RCX 88
45 #define RDX 96
46 #define RSI 104
47 #define RDI 112
48 /*
49  * On syscall entry, this is syscall#. On CPU exception, this is error code.
50  * On hw interrupt, it's IRQ number:
51  */
52 #define ORIG_RAX 120
53 /* Return frame for iretq */
54 #define RIP 128
55 #define CS 136
56 #define EFLAGS 144
57 #define RSP 152
58 #define SS 160
59 #endif /* __ASSEMBLY__ */
60 
61 /* top of stack page */
62 #define FRAME_SIZE 168
63 
64 #endif /* !__i386__ */
65 
66 /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
67 #define PTRACE_GETREGS            12
68 #define PTRACE_SETREGS            13
69 #define PTRACE_GETFPREGS          14
70 #define PTRACE_SETFPREGS          15
71 #define PTRACE_GETFPXREGS         18
72 #define PTRACE_SETFPXREGS         19
73 
74 #define PTRACE_OLDSETOPTIONS      21
75 
76 /* only useful for access 32bit programs / kernels */
77 #define PTRACE_GET_THREAD_AREA    25
78 #define PTRACE_SET_THREAD_AREA    26
79 
80 #ifdef __x86_64__
81 # define PTRACE_ARCH_PRCTL	  30
82 #endif
83 
84 #define PTRACE_SYSEMU		  31
85 #define PTRACE_SYSEMU_SINGLESTEP  32
86 
87 #define PTRACE_SINGLEBLOCK	33	/* resume execution until next branch */
88 
89 #ifndef __ASSEMBLY__
90 #include <linux/types.h>
91 #endif
92 
93 #endif /* _ASM_X86_PTRACE_ABI_H */
94