diff options
| -rw-r--r-- | include/asm-x86/Kbuild | 3 | ||||
| -rw-r--r-- | include/asm-x86/ptrace.h | 151 | ||||
| -rw-r--r-- | include/asm-x86/ptrace_32.h | 65 | ||||
| -rw-r--r-- | include/asm-x86/ptrace_64.h | 80 |
4 files changed, 141 insertions, 158 deletions
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild index da5b07c20fc5..87176b6074be 100644 --- a/include/asm-x86/Kbuild +++ b/include/asm-x86/Kbuild | |||
| @@ -24,8 +24,7 @@ unifdef-y += page_32.h | |||
| 24 | unifdef-y += page_64.h | 24 | unifdef-y += page_64.h |
| 25 | unifdef-y += posix_types_32.h | 25 | unifdef-y += posix_types_32.h |
| 26 | unifdef-y += posix_types_64.h | 26 | unifdef-y += posix_types_64.h |
| 27 | unifdef-y += ptrace_32.h | 27 | unifdef-y += ptrace.h |
| 28 | unifdef-y += ptrace_64.h | ||
| 29 | unifdef-y += setup_32.h | 28 | unifdef-y += setup_32.h |
| 30 | unifdef-y += setup_64.h | 29 | unifdef-y += setup_64.h |
| 31 | unifdef-y += shmbuf_32.h | 30 | unifdef-y += shmbuf_32.h |
diff --git a/include/asm-x86/ptrace.h b/include/asm-x86/ptrace.h index bc4d64a87689..213c97300cb3 100644 --- a/include/asm-x86/ptrace.h +++ b/include/asm-x86/ptrace.h | |||
| @@ -1,13 +1,142 @@ | |||
| 1 | #ifndef _ASM_X86_PTRACE_H | ||
| 2 | #define _ASM_X86_PTRACE_H | ||
| 3 | |||
| 4 | #include <linux/compiler.h> /* For __user */ | ||
| 5 | #include <asm/ptrace-abi.h> | ||
| 6 | |||
| 7 | #ifndef __ASSEMBLY__ | ||
| 8 | |||
| 9 | #ifdef __i386__ | ||
| 10 | /* this struct defines the way the registers are stored on the | ||
| 11 | stack during a system call. */ | ||
| 12 | |||
| 13 | struct pt_regs { | ||
| 14 | long ebx; | ||
| 15 | long ecx; | ||
| 16 | long edx; | ||
| 17 | long esi; | ||
| 18 | long edi; | ||
| 19 | long ebp; | ||
| 20 | long eax; | ||
| 21 | int xds; | ||
| 22 | int xes; | ||
| 23 | int xfs; | ||
| 24 | /* int xgs; */ | ||
| 25 | long orig_eax; | ||
| 26 | long eip; | ||
| 27 | int xcs; | ||
| 28 | long eflags; | ||
| 29 | long esp; | ||
| 30 | int xss; | ||
| 31 | }; | ||
| 32 | |||
| 1 | #ifdef __KERNEL__ | 33 | #ifdef __KERNEL__ |
| 2 | # ifdef CONFIG_X86_32 | 34 | |
| 3 | # include "ptrace_32.h" | 35 | #include <asm/vm86.h> |
| 4 | # else | 36 | #include <asm/segment.h> |
| 5 | # include "ptrace_64.h" | 37 | |
| 6 | # endif | 38 | struct task_struct; |
| 7 | #else | 39 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); |
| 8 | # ifdef __i386__ | 40 | |
| 9 | # include "ptrace_32.h" | 41 | /* |
| 10 | # else | 42 | * user_mode_vm(regs) determines whether a register set came from user mode. |
| 11 | # include "ptrace_64.h" | 43 | * This is true if V8086 mode was enabled OR if the register set was from |
| 12 | # endif | 44 | * protected mode with RPL-3 CS value. This tricky test checks that with |
| 45 | * one comparison. Many places in the kernel can bypass this full check | ||
| 46 | * if they have already ruled out V8086 mode, so user_mode(regs) can be used. | ||
| 47 | */ | ||
| 48 | static inline int user_mode(struct pt_regs *regs) | ||
| 49 | { | ||
| 50 | return (regs->xcs & SEGMENT_RPL_MASK) == USER_RPL; | ||
| 51 | } | ||
| 52 | static inline int user_mode_vm(struct pt_regs *regs) | ||
| 53 | { | ||
| 54 | return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL; | ||
| 55 | } | ||
| 56 | static inline int v8086_mode(struct pt_regs *regs) | ||
| 57 | { | ||
| 58 | return (regs->eflags & VM_MASK); | ||
| 59 | } | ||
| 60 | |||
| 61 | #define instruction_pointer(regs) ((regs)->eip) | ||
| 62 | #define frame_pointer(regs) ((regs)->ebp) | ||
| 63 | #define stack_pointer(regs) ((regs)->esp) | ||
| 64 | #define regs_return_value(regs) ((regs)->eax) | ||
| 65 | |||
| 66 | extern unsigned long profile_pc(struct pt_regs *regs); | ||
| 67 | #endif /* __KERNEL__ */ | ||
| 68 | |||
| 69 | #else /* __i386__ */ | ||
| 70 | |||
| 71 | struct pt_regs { | ||
| 72 | unsigned long r15; | ||
| 73 | unsigned long r14; | ||
| 74 | unsigned long r13; | ||
| 75 | unsigned long r12; | ||
| 76 | unsigned long rbp; | ||
| 77 | unsigned long rbx; | ||
| 78 | /* arguments: non interrupts/non tracing syscalls only save upto here*/ | ||
| 79 | unsigned long r11; | ||
| 80 | unsigned long r10; | ||
| 81 | unsigned long r9; | ||
| 82 | unsigned long r8; | ||
| 83 | unsigned long rax; | ||
| 84 | unsigned long rcx; | ||
| 85 | unsigned long rdx; | ||
| 86 | unsigned long rsi; | ||
| 87 | unsigned long rdi; | ||
| 88 | unsigned long orig_rax; | ||
| 89 | /* end of arguments */ | ||
| 90 | /* cpu exception frame or undefined */ | ||
| 91 | unsigned long rip; | ||
| 92 | unsigned long cs; | ||
| 93 | unsigned long eflags; | ||
| 94 | unsigned long rsp; | ||
| 95 | unsigned long ss; | ||
| 96 | /* top of stack page */ | ||
| 97 | }; | ||
| 98 | |||
| 99 | #ifdef __KERNEL__ | ||
| 100 | |||
| 101 | #define user_mode(regs) (!!((regs)->cs & 3)) | ||
| 102 | #define user_mode_vm(regs) user_mode(regs) | ||
| 103 | #define instruction_pointer(regs) ((regs)->rip) | ||
| 104 | #define frame_pointer(regs) ((regs)->rbp) | ||
| 105 | #define stack_pointer(regs) ((regs)->rsp) | ||
| 106 | #define regs_return_value(regs) ((regs)->rax) | ||
| 107 | |||
| 108 | extern unsigned long profile_pc(struct pt_regs *regs); | ||
| 109 | void signal_fault(struct pt_regs *regs, void __user *frame, char *where); | ||
| 110 | |||
| 111 | struct task_struct; | ||
| 112 | |||
| 113 | extern unsigned long | ||
| 114 | convert_rip_to_linear(struct task_struct *child, struct pt_regs *regs); | ||
| 115 | |||
| 116 | enum { | ||
| 117 | EF_CF = 0x00000001, | ||
| 118 | EF_PF = 0x00000004, | ||
| 119 | EF_AF = 0x00000010, | ||
| 120 | EF_ZF = 0x00000040, | ||
| 121 | EF_SF = 0x00000080, | ||
| 122 | EF_TF = 0x00000100, | ||
| 123 | EF_IE = 0x00000200, | ||
| 124 | EF_DF = 0x00000400, | ||
| 125 | EF_OF = 0x00000800, | ||
| 126 | EF_IOPL = 0x00003000, | ||
| 127 | EF_IOPL_RING0 = 0x00000000, | ||
| 128 | EF_IOPL_RING1 = 0x00001000, | ||
| 129 | EF_IOPL_RING2 = 0x00002000, | ||
| 130 | EF_NT = 0x00004000, /* nested task */ | ||
| 131 | EF_RF = 0x00010000, /* resume */ | ||
| 132 | EF_VM = 0x00020000, /* virtual mode */ | ||
| 133 | EF_AC = 0x00040000, /* alignment */ | ||
| 134 | EF_VIF = 0x00080000, /* virtual interrupt */ | ||
| 135 | EF_VIP = 0x00100000, /* virtual interrupt pending */ | ||
| 136 | EF_ID = 0x00200000, /* id */ | ||
| 137 | }; | ||
| 138 | #endif /* __KERNEL__ */ | ||
| 139 | #endif /* !__i386__ */ | ||
| 140 | #endif /* !__ASSEMBLY__ */ | ||
| 141 | |||
| 13 | #endif | 142 | #endif |
diff --git a/include/asm-x86/ptrace_32.h b/include/asm-x86/ptrace_32.h deleted file mode 100644 index 78d063dabe0a..000000000000 --- a/include/asm-x86/ptrace_32.h +++ /dev/null | |||
| @@ -1,65 +0,0 @@ | |||
| 1 | #ifndef _I386_PTRACE_H | ||
| 2 | #define _I386_PTRACE_H | ||
| 3 | |||
| 4 | #include <asm/ptrace-abi.h> | ||
| 5 | |||
| 6 | /* this struct defines the way the registers are stored on the | ||
| 7 | stack during a system call. */ | ||
| 8 | |||
| 9 | struct pt_regs { | ||
| 10 | long ebx; | ||
| 11 | long ecx; | ||
| 12 | long edx; | ||
| 13 | long esi; | ||
| 14 | long edi; | ||
| 15 | long ebp; | ||
| 16 | long eax; | ||
| 17 | int xds; | ||
| 18 | int xes; | ||
| 19 | int xfs; | ||
| 20 | /* int xgs; */ | ||
| 21 | long orig_eax; | ||
| 22 | long eip; | ||
| 23 | int xcs; | ||
| 24 | long eflags; | ||
| 25 | long esp; | ||
| 26 | int xss; | ||
| 27 | }; | ||
| 28 | |||
| 29 | #ifdef __KERNEL__ | ||
| 30 | |||
| 31 | #include <asm/vm86.h> | ||
| 32 | #include <asm/segment.h> | ||
| 33 | |||
| 34 | struct task_struct; | ||
| 35 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code); | ||
| 36 | |||
| 37 | /* | ||
| 38 | * user_mode_vm(regs) determines whether a register set came from user mode. | ||
| 39 | * This is true if V8086 mode was enabled OR if the register set was from | ||
| 40 | * protected mode with RPL-3 CS value. This tricky test checks that with | ||
| 41 | * one comparison. Many places in the kernel can bypass this full check | ||
| 42 | * if they have already ruled out V8086 mode, so user_mode(regs) can be used. | ||
| 43 | */ | ||
| 44 | static inline int user_mode(struct pt_regs *regs) | ||
| 45 | { | ||
| 46 | return (regs->xcs & SEGMENT_RPL_MASK) == USER_RPL; | ||
| 47 | } | ||
| 48 | static inline int user_mode_vm(struct pt_regs *regs) | ||
| 49 | { | ||
| 50 | return ((regs->xcs & SEGMENT_RPL_MASK) | (regs->eflags & VM_MASK)) >= USER_RPL; | ||
| 51 | } | ||
| 52 | static inline int v8086_mode(struct pt_regs *regs) | ||
| 53 | { | ||
| 54 | return (regs->eflags & VM_MASK); | ||
| 55 | } | ||
| 56 | |||
| 57 | #define instruction_pointer(regs) ((regs)->eip) | ||
| 58 | #define frame_pointer(regs) ((regs)->ebp) | ||
| 59 | #define stack_pointer(regs) ((regs)->esp) | ||
| 60 | #define regs_return_value(regs) ((regs)->eax) | ||
| 61 | |||
| 62 | extern unsigned long profile_pc(struct pt_regs *regs); | ||
| 63 | #endif /* __KERNEL__ */ | ||
| 64 | |||
| 65 | #endif | ||
diff --git a/include/asm-x86/ptrace_64.h b/include/asm-x86/ptrace_64.h deleted file mode 100644 index 7bfe61e1b705..000000000000 --- a/include/asm-x86/ptrace_64.h +++ /dev/null | |||
| @@ -1,80 +0,0 @@ | |||
| 1 | #ifndef _X86_64_PTRACE_H | ||
| 2 | #define _X86_64_PTRACE_H | ||
| 3 | |||
| 4 | #include <linux/compiler.h> /* For __user */ | ||
| 5 | #include <asm/ptrace-abi.h> | ||
| 6 | |||
| 7 | #ifndef __ASSEMBLY__ | ||
| 8 | |||
| 9 | struct pt_regs { | ||
| 10 | unsigned long r15; | ||
| 11 | unsigned long r14; | ||
| 12 | unsigned long r13; | ||
| 13 | unsigned long r12; | ||
| 14 | unsigned long rbp; | ||
| 15 | unsigned long rbx; | ||
| 16 | /* arguments: non interrupts/non tracing syscalls only save upto here*/ | ||
| 17 | unsigned long r11; | ||
| 18 | unsigned long r10; | ||
| 19 | unsigned long r9; | ||
| 20 | unsigned long r8; | ||
| 21 | unsigned long rax; | ||
| 22 | unsigned long rcx; | ||
| 23 | unsigned long rdx; | ||
| 24 | unsigned long rsi; | ||
| 25 | unsigned long rdi; | ||
| 26 | unsigned long orig_rax; | ||
| 27 | /* end of arguments */ | ||
| 28 | /* cpu exception frame or undefined */ | ||
| 29 | unsigned long rip; | ||
| 30 | unsigned long cs; | ||
| 31 | unsigned long eflags; | ||
| 32 | unsigned long rsp; | ||
| 33 | unsigned long ss; | ||
| 34 | /* top of stack page */ | ||
| 35 | }; | ||
| 36 | |||
| 37 | #endif | ||
| 38 | |||
| 39 | #if defined(__KERNEL__) && !defined(__ASSEMBLY__) | ||
| 40 | #define user_mode(regs) (!!((regs)->cs & 3)) | ||
| 41 | #define user_mode_vm(regs) user_mode(regs) | ||
| 42 | #define instruction_pointer(regs) ((regs)->rip) | ||
| 43 | #define frame_pointer(regs) ((regs)->rbp) | ||
| 44 | #define stack_pointer(regs) ((regs)->rsp) | ||
| 45 | #define regs_return_value(regs) ((regs)->rax) | ||
| 46 | |||
| 47 | extern unsigned long profile_pc(struct pt_regs *regs); | ||
| 48 | void signal_fault(struct pt_regs *regs, void __user *frame, char *where); | ||
| 49 | |||
| 50 | struct task_struct; | ||
| 51 | |||
| 52 | extern unsigned long | ||
| 53 | convert_rip_to_linear(struct task_struct *child, struct pt_regs *regs); | ||
| 54 | |||
| 55 | enum { | ||
| 56 | EF_CF = 0x00000001, | ||
| 57 | EF_PF = 0x00000004, | ||
| 58 | EF_AF = 0x00000010, | ||
| 59 | EF_ZF = 0x00000040, | ||
| 60 | EF_SF = 0x00000080, | ||
| 61 | EF_TF = 0x00000100, | ||
| 62 | EF_IE = 0x00000200, | ||
| 63 | EF_DF = 0x00000400, | ||
| 64 | EF_OF = 0x00000800, | ||
| 65 | EF_IOPL = 0x00003000, | ||
| 66 | EF_IOPL_RING0 = 0x00000000, | ||
| 67 | EF_IOPL_RING1 = 0x00001000, | ||
| 68 | EF_IOPL_RING2 = 0x00002000, | ||
| 69 | EF_NT = 0x00004000, /* nested task */ | ||
| 70 | EF_RF = 0x00010000, /* resume */ | ||
| 71 | EF_VM = 0x00020000, /* virtual mode */ | ||
| 72 | EF_AC = 0x00040000, /* alignment */ | ||
| 73 | EF_VIF = 0x00080000, /* virtual interrupt */ | ||
| 74 | EF_VIP = 0x00100000, /* virtual interrupt pending */ | ||
| 75 | EF_ID = 0x00200000, /* id */ | ||
| 76 | }; | ||
| 77 | |||
| 78 | #endif | ||
| 79 | |||
| 80 | #endif | ||
