wdenk | 591dda5 | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 1 | #ifndef _I386_PTRACE_H |
| 2 | #define _I386_PTRACE_H |
| 3 | |
Graeme Russ | 4326153 | 2010-10-07 20:03:23 +1100 | [diff] [blame] | 4 | #include <asm/types.h> |
| 5 | |
wdenk | 591dda5 | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 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 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 25 | /* this struct defines the way the registers are stored on the |
wdenk | 591dda5 | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 26 | stack during a system call. */ |
| 27 | |
| 28 | struct 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 Russ | 4326153 | 2010-10-07 20:03:23 +1100 | [diff] [blame] | 48 | struct 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 Meng | 9ff054b | 2015-07-10 10:38:32 +0800 | [diff] [blame] | 66 | 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 Russ | 4326153 | 2010-10-07 20:03:23 +1100 | [diff] [blame] | 79 | } __attribute__ ((packed)); |
wdenk | 591dda5 | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 80 | |
| 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) |
| 97 | extern void show_regs(struct pt_regs *); |
| 98 | #endif |
| 99 | |
| 100 | #endif |