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