diff options
author | Jeff Dike <jdike@addtoit.com> | 2008-05-12 17:01:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-13 11:02:21 -0400 |
commit | 47906dd9e63ba1a8cb188e9e786c5928674fbbd3 (patch) | |
tree | 34db787b1b1de132e374cbce25994ac652ccf57e /arch/um/sys-i386 | |
parent | 46d7b522ebf486edbd096965d534cc6465e9e309 (diff) |
uml: tidy ptrace interface
Tidy the ptrace interface code. Removed a bunch of unused macros.
Started converting register sets from arrays of longs to structures.
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Cc: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/sys-i386')
-rw-r--r-- | arch/um/sys-i386/ptrace.c | 30 | ||||
-rw-r--r-- | arch/um/sys-i386/user-offsets.c | 2 |
2 files changed, 15 insertions, 17 deletions
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); |