2 * Copyright (C) 2004 PathScale, Inc
3 * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
9 #include "kern_constants.h"
12 #include "sysdep/ptrace_user.h"
14 int save_fp_registers(int pid, unsigned long *fp_regs)
16 if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0)
21 int restore_fp_registers(int pid, unsigned long *fp_regs)
23 if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0)
28 int save_fpx_registers(int pid, unsigned long *fp_regs)
30 if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0)
35 int restore_fpx_registers(int pid, unsigned long *fp_regs)
37 if (ptrace(PTRACE_SETFPXREGS, pid, 0, fp_regs) < 0)
42 unsigned long get_thread_reg(int reg, jmp_buf *buf)
52 printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n",
58 int have_fpx_regs = 1;
60 int get_fp_registers(int pid, unsigned long *regs)
63 return save_fpx_registers(pid, regs);
65 return save_fp_registers(pid, regs);
68 int put_fp_registers(int pid, unsigned long *regs)
71 return restore_fpx_registers(pid, regs);
73 return restore_fp_registers(pid, regs);
76 void arch_init_registers(int pid)
78 struct user_fxsr_struct fpx_regs;
81 err = ptrace(PTRACE_GETFPXREGS, pid, 0, &fpx_regs);
86 panic("check_ptrace : PTRACE_GETFPXREGS failed, errno = %d",