xref: /openbmc/linux/arch/x86/include/uapi/asm/ptrace.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*6f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2af170c50SDavid Howells #ifndef _UAPI_ASM_X86_PTRACE_H
3af170c50SDavid Howells #define _UAPI_ASM_X86_PTRACE_H
4af170c50SDavid Howells 
5af170c50SDavid Howells #include <linux/compiler.h>	/* For __user */
6af170c50SDavid Howells #include <asm/ptrace-abi.h>
7af170c50SDavid Howells #include <asm/processor-flags.h>
8af170c50SDavid Howells 
9af170c50SDavid Howells 
10af170c50SDavid Howells #ifndef __ASSEMBLY__
11af170c50SDavid Howells 
12af170c50SDavid Howells #ifdef __i386__
13af170c50SDavid Howells /* this struct defines the way the registers are stored on the
14af170c50SDavid Howells    stack during a system call. */
15af170c50SDavid Howells 
16af170c50SDavid Howells #ifndef __KERNEL__
17af170c50SDavid Howells 
18af170c50SDavid Howells struct pt_regs {
19af170c50SDavid Howells 	long ebx;
20af170c50SDavid Howells 	long ecx;
21af170c50SDavid Howells 	long edx;
22af170c50SDavid Howells 	long esi;
23af170c50SDavid Howells 	long edi;
24af170c50SDavid Howells 	long ebp;
25af170c50SDavid Howells 	long eax;
26af170c50SDavid Howells 	int  xds;
27af170c50SDavid Howells 	int  xes;
28af170c50SDavid Howells 	int  xfs;
29af170c50SDavid Howells 	int  xgs;
30af170c50SDavid Howells 	long orig_eax;
31af170c50SDavid Howells 	long eip;
32af170c50SDavid Howells 	int  xcs;
33af170c50SDavid Howells 	long eflags;
34af170c50SDavid Howells 	long esp;
35af170c50SDavid Howells 	int  xss;
36af170c50SDavid Howells };
37af170c50SDavid Howells 
38af170c50SDavid Howells #endif /* __KERNEL__ */
39af170c50SDavid Howells 
40af170c50SDavid Howells #else /* __i386__ */
41af170c50SDavid Howells 
42af170c50SDavid Howells #ifndef __KERNEL__
43af170c50SDavid Howells 
44af170c50SDavid Howells struct pt_regs {
45e90e147cSDenys Vlasenko /*
46e90e147cSDenys Vlasenko  * C ABI says these regs are callee-preserved. They aren't saved on kernel entry
47e90e147cSDenys Vlasenko  * unless syscall needs a complete, fully filled "struct pt_regs".
48e90e147cSDenys Vlasenko  */
49af170c50SDavid Howells 	unsigned long r15;
50af170c50SDavid Howells 	unsigned long r14;
51af170c50SDavid Howells 	unsigned long r13;
52af170c50SDavid Howells 	unsigned long r12;
53af170c50SDavid Howells 	unsigned long rbp;
54af170c50SDavid Howells 	unsigned long rbx;
55e90e147cSDenys Vlasenko /* These regs are callee-clobbered. Always saved on kernel entry. */
56af170c50SDavid Howells 	unsigned long r11;
57af170c50SDavid Howells 	unsigned long r10;
58af170c50SDavid Howells 	unsigned long r9;
59af170c50SDavid Howells 	unsigned long r8;
60af170c50SDavid Howells 	unsigned long rax;
61af170c50SDavid Howells 	unsigned long rcx;
62af170c50SDavid Howells 	unsigned long rdx;
63af170c50SDavid Howells 	unsigned long rsi;
64af170c50SDavid Howells 	unsigned long rdi;
65e90e147cSDenys Vlasenko /*
66e90e147cSDenys Vlasenko  * On syscall entry, this is syscall#. On CPU exception, this is error code.
67e90e147cSDenys Vlasenko  * On hw interrupt, it's IRQ number:
68e90e147cSDenys Vlasenko  */
69af170c50SDavid Howells 	unsigned long orig_rax;
70e90e147cSDenys Vlasenko /* Return frame for iretq */
71af170c50SDavid Howells 	unsigned long rip;
72af170c50SDavid Howells 	unsigned long cs;
73af170c50SDavid Howells 	unsigned long eflags;
74af170c50SDavid Howells 	unsigned long rsp;
75af170c50SDavid Howells 	unsigned long ss;
76af170c50SDavid Howells /* top of stack page */
77af170c50SDavid Howells };
78af170c50SDavid Howells 
79af170c50SDavid Howells #endif /* __KERNEL__ */
80af170c50SDavid Howells #endif /* !__i386__ */
81af170c50SDavid Howells 
82af170c50SDavid Howells 
83af170c50SDavid Howells 
84af170c50SDavid Howells #endif /* !__ASSEMBLY__ */
85af170c50SDavid Howells 
86af170c50SDavid Howells #endif /* _UAPI_ASM_X86_PTRACE_H */
87