diff options
-rw-r--r-- | arch/um/include/sysdep-i386/ptrace_user.h | 30 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/ptrace_user.h | 17 | ||||
-rw-r--r-- | arch/um/os-Linux/sys-i386/registers.c | 5 | ||||
-rw-r--r-- | arch/um/sys-i386/ptrace.c | 30 | ||||
-rw-r--r-- | arch/um/sys-i386/user-offsets.c | 2 | ||||
-rw-r--r-- | arch/um/sys-x86_64/user-offsets.c | 1 |
6 files changed, 23 insertions, 62 deletions
diff --git a/arch/um/include/sysdep-i386/ptrace_user.h b/arch/um/include/sysdep-i386/ptrace_user.h index 75650723c38f..ef56247e4143 100644 --- a/arch/um/include/sysdep-i386/ptrace_user.h +++ b/arch/um/include/sysdep-i386/ptrace_user.h | |||
@@ -41,38 +41,10 @@ | |||
41 | #define PT_SP_OFFSET PT_OFFSET(UESP) | 41 | #define PT_SP_OFFSET PT_OFFSET(UESP) |
42 | #define PT_SP(regs) ((regs)[UESP]) | 42 | #define PT_SP(regs) ((regs)[UESP]) |
43 | 43 | ||
44 | #define FP_SIZE ((HOST_XFP_SIZE > HOST_FP_SIZE) ? HOST_XFP_SIZE : HOST_FP_SIZE) | 44 | #define FP_SIZE ((HOST_FPX_SIZE > HOST_FP_SIZE) ? HOST_FPX_SIZE : HOST_FP_SIZE) |
45 | 45 | ||
46 | #ifndef FRAME_SIZE | 46 | #ifndef FRAME_SIZE |
47 | #define FRAME_SIZE (17) | 47 | #define FRAME_SIZE (17) |
48 | #endif | 48 | #endif |
49 | #define FRAME_SIZE_OFFSET (FRAME_SIZE * sizeof(unsigned long)) | ||
50 | |||
51 | #define FP_FRAME_SIZE (27) | ||
52 | #define FPX_FRAME_SIZE (128) | ||
53 | |||
54 | #ifdef PTRACE_GETREGS | ||
55 | #define UM_HAVE_GETREGS | ||
56 | #endif | ||
57 | |||
58 | #ifdef PTRACE_SETREGS | ||
59 | #define UM_HAVE_SETREGS | ||
60 | #endif | ||
61 | |||
62 | #ifdef PTRACE_GETFPREGS | ||
63 | #define UM_HAVE_GETFPREGS | ||
64 | #endif | ||
65 | |||
66 | #ifdef PTRACE_SETFPREGS | ||
67 | #define UM_HAVE_SETFPREGS | ||
68 | #endif | ||
69 | |||
70 | #ifdef PTRACE_GETFPXREGS | ||
71 | #define UM_HAVE_GETFPXREGS | ||
72 | #endif | ||
73 | |||
74 | #ifdef PTRACE_SETFPXREGS | ||
75 | #define UM_HAVE_SETFPXREGS | ||
76 | #endif | ||
77 | 49 | ||
78 | #endif | 50 | #endif |
diff --git a/arch/um/include/sysdep-x86_64/ptrace_user.h b/arch/um/include/sysdep-x86_64/ptrace_user.h index 45c0bd881cb3..4dbccdb58f48 100644 --- a/arch/um/include/sysdep-x86_64/ptrace_user.h +++ b/arch/um/include/sysdep-x86_64/ptrace_user.h | |||
@@ -48,7 +48,8 @@ | |||
48 | #define PT_ORIG_RAX_OFFSET (ORIG_RAX) | 48 | #define PT_ORIG_RAX_OFFSET (ORIG_RAX) |
49 | #define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)]) | 49 | #define PT_ORIG_RAX(regs) ((regs)[PT_INDEX(ORIG_RAX)]) |
50 | 50 | ||
51 | /* x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though | 51 | /* |
52 | * x86_64 FC3 doesn't define this in /usr/include/linux/ptrace.h even though | ||
52 | * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the | 53 | * it's defined in the kernel's include/linux/ptrace.h. Additionally, use the |
53 | * 2.4 name and value for 2.4 host compatibility. | 54 | * 2.4 name and value for 2.4 host compatibility. |
54 | */ | 55 | */ |
@@ -56,7 +57,8 @@ | |||
56 | #define PTRACE_OLDSETOPTIONS 21 | 57 | #define PTRACE_OLDSETOPTIONS 21 |
57 | #endif | 58 | #endif |
58 | 59 | ||
59 | /* These are before the system call, so the system call number is RAX | 60 | /* |
61 | * These are before the system call, so the system call number is RAX | ||
60 | * rather than ORIG_RAX, and arg4 is R10 rather than RCX | 62 | * rather than ORIG_RAX, and arg4 is R10 rather than RCX |
61 | */ | 63 | */ |
62 | #define REGS_SYSCALL_NR PT_INDEX(RAX) | 64 | #define REGS_SYSCALL_NR PT_INDEX(RAX) |
@@ -73,14 +75,3 @@ | |||
73 | #define FP_SIZE (HOST_FP_SIZE) | 75 | #define FP_SIZE (HOST_FP_SIZE) |
74 | 76 | ||
75 | #endif | 77 | #endif |
76 | |||
77 | /* | ||
78 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
79 | * Emacs will notice this stuff at the end of the file and automatically | ||
80 | * adjust the settings for this buffer only. This must remain at the end | ||
81 | * of the file. | ||
82 | * --------------------------------------------------------------------------- | ||
83 | * Local variables: | ||
84 | * c-file-style: "linux" | ||
85 | * End: | ||
86 | */ | ||
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c index b613473b3ec1..c6183e7aec3d 100644 --- a/arch/um/os-Linux/sys-i386/registers.c +++ b/arch/um/os-Linux/sys-i386/registers.c | |||
@@ -5,6 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <errno.h> | 7 | #include <errno.h> |
8 | #include <asm/user.h> | ||
8 | #include "kern_constants.h" | 9 | #include "kern_constants.h" |
9 | #include "longjmp.h" | 10 | #include "longjmp.h" |
10 | #include "user.h" | 11 | #include "user.h" |
@@ -74,10 +75,10 @@ int put_fp_registers(int pid, unsigned long *regs) | |||
74 | 75 | ||
75 | void arch_init_registers(int pid) | 76 | void arch_init_registers(int pid) |
76 | { | 77 | { |
77 | unsigned long fpx_regs[HOST_XFP_SIZE]; | 78 | struct user_fxsr_struct fpx_regs; |
78 | int err; | 79 | int err; |
79 | 80 | ||
80 | err = ptrace(PTRACE_GETFPXREGS, pid, 0, fpx_regs); | 81 | err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs); |
81 | if (!err) | 82 | if (!err) |
82 | return; | 83 | return; |
83 | 84 | ||
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c index 6b4499906a6c..c9b176534d65 100644 --- a/arch/um/sys-i386/ptrace.c +++ b/arch/um/sys-i386/ptrace.c | |||
@@ -148,14 +148,13 @@ int peek_user(struct task_struct *child, long addr, long data) | |||
148 | int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | 148 | int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) |
149 | { | 149 | { |
150 | int err, n, cpu = ((struct thread_info *) child->stack)->cpu; | 150 | int err, n, cpu = ((struct thread_info *) child->stack)->cpu; |
151 | long fpregs[HOST_FP_SIZE]; | 151 | struct user_i387_struct fpregs; |
152 | 152 | ||
153 | BUG_ON(sizeof(*buf) != sizeof(fpregs)); | 153 | err = save_fp_registers(userspace_pid[cpu], (unsigned long *) &fpregs); |
154 | err = save_fp_registers(userspace_pid[cpu], fpregs); | ||
155 | if (err) | 154 | if (err) |
156 | return err; | 155 | return err; |
157 | 156 | ||
158 | n = copy_to_user(buf, fpregs, sizeof(fpregs)); | 157 | n = copy_to_user(buf, &fpregs, sizeof(fpregs)); |
159 | if(n > 0) | 158 | if(n > 0) |
160 | return -EFAULT; | 159 | return -EFAULT; |
161 | 160 | ||
@@ -165,27 +164,26 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | |||
165 | int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | 164 | int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) |
166 | { | 165 | { |
167 | int n, cpu = ((struct thread_info *) child->stack)->cpu; | 166 | int n, cpu = ((struct thread_info *) child->stack)->cpu; |
168 | long fpregs[HOST_FP_SIZE]; | 167 | struct user_i387_struct fpregs; |
169 | 168 | ||
170 | BUG_ON(sizeof(*buf) != sizeof(fpregs)); | 169 | n = copy_from_user(&fpregs, buf, sizeof(fpregs)); |
171 | n = copy_from_user(fpregs, buf, sizeof(fpregs)); | ||
172 | if (n > 0) | 170 | if (n > 0) |
173 | return -EFAULT; | 171 | return -EFAULT; |
174 | 172 | ||
175 | return restore_fp_registers(userspace_pid[cpu], fpregs); | 173 | return restore_fp_registers(userspace_pid[cpu], |
174 | (unsigned long *) &fpregs); | ||
176 | } | 175 | } |
177 | 176 | ||
178 | int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) | 177 | int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) |
179 | { | 178 | { |
180 | int err, n, cpu = ((struct thread_info *) child->stack)->cpu; | 179 | int err, n, cpu = ((struct thread_info *) child->stack)->cpu; |
181 | long fpregs[HOST_XFP_SIZE]; | 180 | struct user_fxsr_struct fpregs; |
182 | 181 | ||
183 | BUG_ON(sizeof(*buf) != sizeof(fpregs)); | 182 | err = save_fpx_registers(userspace_pid[cpu], (unsigned long *) &fpregs); |
184 | err = save_fpx_registers(userspace_pid[cpu], fpregs); | ||
185 | if (err) | 183 | if (err) |
186 | return err; | 184 | return err; |
187 | 185 | ||
188 | n = copy_to_user(buf, fpregs, sizeof(fpregs)); | 186 | n = copy_to_user(buf, &fpregs, sizeof(fpregs)); |
189 | if(n > 0) | 187 | if(n > 0) |
190 | return -EFAULT; | 188 | return -EFAULT; |
191 | 189 | ||
@@ -195,14 +193,14 @@ int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) | |||
195 | int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) | 193 | int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) |
196 | { | 194 | { |
197 | int n, cpu = ((struct thread_info *) child->stack)->cpu; | 195 | int n, cpu = ((struct thread_info *) child->stack)->cpu; |
198 | long fpregs[HOST_XFP_SIZE]; | 196 | struct user_fxsr_struct fpregs; |
199 | 197 | ||
200 | BUG_ON(sizeof(*buf) != sizeof(fpregs)); | 198 | n = copy_from_user(&fpregs, buf, sizeof(fpregs)); |
201 | n = copy_from_user(fpregs, buf, sizeof(fpregs)); | ||
202 | if (n > 0) | 199 | if (n > 0) |
203 | return -EFAULT; | 200 | return -EFAULT; |
204 | 201 | ||
205 | return restore_fpx_registers(userspace_pid[cpu], fpregs); | 202 | return restore_fpx_registers(userspace_pid[cpu], |
203 | (unsigned long *) &fpregs); | ||
206 | } | 204 | } |
207 | 205 | ||
208 | long subarch_ptrace(struct task_struct *child, long request, long addr, | 206 | long subarch_ptrace(struct task_struct *child, long request, long addr, |
diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c index 39bd32bf84f0..5f883bfe773f 100644 --- a/arch/um/sys-i386/user-offsets.c +++ b/arch/um/sys-i386/user-offsets.c | |||
@@ -22,7 +22,7 @@ void foo(void) | |||
22 | OFFSET(HOST_SC_CR2, sigcontext, cr2); | 22 | OFFSET(HOST_SC_CR2, sigcontext, cr2); |
23 | 23 | ||
24 | DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct)); | 24 | DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct)); |
25 | DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fpxregs_struct)); | 25 | DEFINE_LONGS(HOST_FPX_SIZE, sizeof(struct user_fpxregs_struct)); |
26 | 26 | ||
27 | DEFINE(HOST_IP, EIP); | 27 | DEFINE(HOST_IP, EIP); |
28 | DEFINE(HOST_SP, UESP); | 28 | DEFINE(HOST_SP, UESP); |
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c index 2f3443c6e859..973585414a66 100644 --- a/arch/um/sys-x86_64/user-offsets.c +++ b/arch/um/sys-x86_64/user-offsets.c | |||
@@ -24,7 +24,6 @@ void foo(void) | |||
24 | OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); | 24 | OFFSET(HOST_SC_TRAPNO, sigcontext, trapno); |
25 | 25 | ||
26 | DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); | 26 | DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long)); |
27 | DEFINE(HOST_XFP_SIZE, 0); | ||
28 | DEFINE_LONGS(HOST_RBX, RBX); | 27 | DEFINE_LONGS(HOST_RBX, RBX); |
29 | DEFINE_LONGS(HOST_RCX, RCX); | 28 | DEFINE_LONGS(HOST_RCX, RCX); |
30 | DEFINE_LONGS(HOST_RDI, RDI); | 29 | DEFINE_LONGS(HOST_RDI, RDI); |