162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci#ifndef _UAPI_ASM_X86_PTRACE_H
362306a36Sopenharmony_ci#define _UAPI_ASM_X86_PTRACE_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/compiler.h>	/* For __user */
662306a36Sopenharmony_ci#include <asm/ptrace-abi.h>
762306a36Sopenharmony_ci#include <asm/processor-flags.h>
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef __ASSEMBLY__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#ifdef __i386__
1362306a36Sopenharmony_ci/* this struct defines the way the registers are stored on the
1462306a36Sopenharmony_ci   stack during a system call. */
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#ifndef __KERNEL__
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_cistruct pt_regs {
1962306a36Sopenharmony_ci	long ebx;
2062306a36Sopenharmony_ci	long ecx;
2162306a36Sopenharmony_ci	long edx;
2262306a36Sopenharmony_ci	long esi;
2362306a36Sopenharmony_ci	long edi;
2462306a36Sopenharmony_ci	long ebp;
2562306a36Sopenharmony_ci	long eax;
2662306a36Sopenharmony_ci	int  xds;
2762306a36Sopenharmony_ci	int  xes;
2862306a36Sopenharmony_ci	int  xfs;
2962306a36Sopenharmony_ci	int  xgs;
3062306a36Sopenharmony_ci	long orig_eax;
3162306a36Sopenharmony_ci	long eip;
3262306a36Sopenharmony_ci	int  xcs;
3362306a36Sopenharmony_ci	long eflags;
3462306a36Sopenharmony_ci	long esp;
3562306a36Sopenharmony_ci	int  xss;
3662306a36Sopenharmony_ci};
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#endif /* __KERNEL__ */
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#else /* __i386__ */
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#ifndef __KERNEL__
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_cistruct pt_regs {
4562306a36Sopenharmony_ci/*
4662306a36Sopenharmony_ci * C ABI says these regs are callee-preserved. They aren't saved on kernel entry
4762306a36Sopenharmony_ci * unless syscall needs a complete, fully filled "struct pt_regs".
4862306a36Sopenharmony_ci */
4962306a36Sopenharmony_ci	unsigned long r15;
5062306a36Sopenharmony_ci	unsigned long r14;
5162306a36Sopenharmony_ci	unsigned long r13;
5262306a36Sopenharmony_ci	unsigned long r12;
5362306a36Sopenharmony_ci	unsigned long rbp;
5462306a36Sopenharmony_ci	unsigned long rbx;
5562306a36Sopenharmony_ci/* These regs are callee-clobbered. Always saved on kernel entry. */
5662306a36Sopenharmony_ci	unsigned long r11;
5762306a36Sopenharmony_ci	unsigned long r10;
5862306a36Sopenharmony_ci	unsigned long r9;
5962306a36Sopenharmony_ci	unsigned long r8;
6062306a36Sopenharmony_ci	unsigned long rax;
6162306a36Sopenharmony_ci	unsigned long rcx;
6262306a36Sopenharmony_ci	unsigned long rdx;
6362306a36Sopenharmony_ci	unsigned long rsi;
6462306a36Sopenharmony_ci	unsigned long rdi;
6562306a36Sopenharmony_ci/*
6662306a36Sopenharmony_ci * On syscall entry, this is syscall#. On CPU exception, this is error code.
6762306a36Sopenharmony_ci * On hw interrupt, it's IRQ number:
6862306a36Sopenharmony_ci */
6962306a36Sopenharmony_ci	unsigned long orig_rax;
7062306a36Sopenharmony_ci/* Return frame for iretq */
7162306a36Sopenharmony_ci	unsigned long rip;
7262306a36Sopenharmony_ci	unsigned long cs;
7362306a36Sopenharmony_ci	unsigned long eflags;
7462306a36Sopenharmony_ci	unsigned long rsp;
7562306a36Sopenharmony_ci	unsigned long ss;
7662306a36Sopenharmony_ci/* top of stack page */
7762306a36Sopenharmony_ci};
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci#endif /* __KERNEL__ */
8062306a36Sopenharmony_ci#endif /* !__i386__ */
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci#endif /* !__ASSEMBLY__ */
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci#endif /* _UAPI_ASM_X86_PTRACE_H */
87