aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-i386/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/sys-i386/ptrace.c')
-rw-r--r--arch/um/sys-i386/ptrace.c120
1 files changed, 0 insertions, 120 deletions
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index 28bf01150323..572fd504b94b 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -14,12 +14,6 @@
14#include "sysdep/sigcontext.h" 14#include "sysdep/sigcontext.h"
15#include "sysdep/sc.h" 15#include "sysdep/sc.h"
16 16
17void arch_switch_to_tt(struct task_struct *from, struct task_struct *to)
18{
19 update_debugregs(to->thread.arch.debugregs_seq);
20 arch_switch_tls_tt(from, to);
21}
22
23void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) 17void arch_switch_to_skas(struct task_struct *from, struct task_struct *to)
24{ 18{
25 int err = arch_switch_tls_skas(from, to); 19 int err = arch_switch_tls_skas(from, to);
@@ -233,79 +227,12 @@ static inline unsigned long twd_fxsr_to_i387( struct i387_fxsave_struct *fxsave
233 return ret; 227 return ret;
234} 228}
235 229
236/*
237 * FXSR floating point environment conversions.
238 */
239
240#ifdef CONFIG_MODE_TT
241static inline int convert_fxsr_to_user_tt(struct _fpstate __user *buf,
242 struct pt_regs *regs)
243{
244 struct i387_fxsave_struct *fxsave = SC_FXSR_ENV(PT_REGS_SC(regs));
245 unsigned long env[7];
246 struct _fpreg __user *to;
247 struct _fpxreg *from;
248 int i;
249
250 env[0] = (unsigned long)fxsave->cwd | 0xffff0000;
251 env[1] = (unsigned long)fxsave->swd | 0xffff0000;
252 env[2] = twd_fxsr_to_i387(fxsave);
253 env[3] = fxsave->fip;
254 env[4] = fxsave->fcs | ((unsigned long)fxsave->fop << 16);
255 env[5] = fxsave->foo;
256 env[6] = fxsave->fos;
257
258 if ( __copy_to_user( buf, env, 7 * sizeof(unsigned long) ) )
259 return 1;
260
261 to = &buf->_st[0];
262 from = (struct _fpxreg *) &fxsave->st_space[0];
263 for ( i = 0 ; i < 8 ; i++, to++, from++ ) {
264 if ( __copy_to_user( to, from, sizeof(*to) ) )
265 return 1;
266 }
267 return 0;
268}
269#endif
270
271static inline int convert_fxsr_to_user(struct _fpstate __user *buf, 230static inline int convert_fxsr_to_user(struct _fpstate __user *buf,
272 struct pt_regs *regs) 231 struct pt_regs *regs)
273{ 232{
274 return(CHOOSE_MODE(convert_fxsr_to_user_tt(buf, regs), 0)); 233 return(CHOOSE_MODE(convert_fxsr_to_user_tt(buf, regs), 0));
275} 234}
276 235
277#ifdef CONFIG_MODE_TT
278static inline int convert_fxsr_from_user_tt(struct pt_regs *regs,
279 struct _fpstate __user *buf)
280{
281 struct i387_fxsave_struct *fxsave = SC_FXSR_ENV(PT_REGS_SC(regs));
282 unsigned long env[7];
283 struct _fpxreg *to;
284 struct _fpreg __user *from;
285 int i;
286
287 if ( __copy_from_user( env, buf, 7 * sizeof(long) ) )
288 return 1;
289
290 fxsave->cwd = (unsigned short)(env[0] & 0xffff);
291 fxsave->swd = (unsigned short)(env[1] & 0xffff);
292 fxsave->twd = twd_i387_to_fxsr((unsigned short)(env[2] & 0xffff));
293 fxsave->fip = env[3];
294 fxsave->fop = (unsigned short)((env[4] & 0xffff0000) >> 16);
295 fxsave->fcs = (env[4] & 0xffff);
296 fxsave->foo = env[5];
297 fxsave->fos = env[6];
298
299 to = (struct _fpxreg *) &fxsave->st_space[0];
300 from = &buf->_st[0];
301 for ( i = 0 ; i < 8 ; i++, to++, from++ ) {
302 if ( __copy_from_user( to, from, sizeof(*from) ) )
303 return 1;
304 }
305 return 0;
306}
307#endif
308
309static inline int convert_fxsr_from_user(struct pt_regs *regs, 236static inline int convert_fxsr_from_user(struct pt_regs *regs,
310 struct _fpstate __user *buf) 237 struct _fpstate __user *buf)
311{ 238{
@@ -332,39 +259,11 @@ int set_fpregs(unsigned long buf, struct task_struct *child)
332 else return(0); 259 else return(0);
333} 260}
334 261
335#ifdef CONFIG_MODE_TT
336int get_fpxregs_tt(unsigned long buf, struct task_struct *tsk)
337{
338 struct pt_regs *regs = &tsk->thread.regs;
339 struct i387_fxsave_struct *fxsave = SC_FXSR_ENV(PT_REGS_SC(regs));
340 int err;
341
342 err = __copy_to_user((void __user *) buf, fxsave,
343 sizeof(struct user_fxsr_struct));
344 if(err) return -EFAULT;
345 else return 0;
346}
347#endif
348
349int get_fpxregs(unsigned long buf, struct task_struct *tsk) 262int get_fpxregs(unsigned long buf, struct task_struct *tsk)
350{ 263{
351 return(CHOOSE_MODE(get_fpxregs_tt(buf, tsk), 0)); 264 return(CHOOSE_MODE(get_fpxregs_tt(buf, tsk), 0));
352} 265}
353 266
354#ifdef CONFIG_MODE_TT
355int set_fpxregs_tt(unsigned long buf, struct task_struct *tsk)
356{
357 struct pt_regs *regs = &tsk->thread.regs;
358 struct i387_fxsave_struct *fxsave = SC_FXSR_ENV(PT_REGS_SC(regs));
359 int err;
360
361 err = __copy_from_user(fxsave, (void __user *) buf,
362 sizeof(struct user_fxsr_struct) );
363 if(err) return -EFAULT;
364 else return 0;
365}
366#endif
367
368int set_fpxregs(unsigned long buf, struct task_struct *tsk) 267int set_fpxregs(unsigned long buf, struct task_struct *tsk)
369{ 268{
370 return(CHOOSE_MODE(set_fpxregs_tt(buf, tsk), 0)); 269 return(CHOOSE_MODE(set_fpxregs_tt(buf, tsk), 0));
@@ -387,25 +286,6 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
387} 286}
388#endif 287#endif
389 288
390#ifdef CONFIG_MODE_TT
391static inline void copy_fpu_fxsave_tt(struct pt_regs *regs,
392 struct user_i387_struct *buf)
393{
394 struct i387_fxsave_struct *fpu = SC_FXSR_ENV(PT_REGS_SC(regs));
395 unsigned short *to;
396 unsigned short *from;
397 int i;
398
399 memcpy( buf, fpu, 7 * sizeof(long) );
400
401 to = (unsigned short *) &buf->st_space[0];
402 from = (unsigned short *) &fpu->st_space[0];
403 for ( i = 0 ; i < 8 ; i++, to += 5, from += 8 ) {
404 memcpy( to, from, 5 * sizeof(unsigned short) );
405 }
406}
407#endif
408
409static inline void copy_fpu_fxsave(struct pt_regs *regs, 289static inline void copy_fpu_fxsave(struct pt_regs *regs,
410 struct user_i387_struct *buf) 290 struct user_i387_struct *buf)
411{ 291{