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 <sys/ptrace.h>
10 #include <sysdep/ptrace.h>
11 #include <sysdep/ptrace_user.h>
12 #include <registers.h>
14 int save_registers(int pid, struct uml_pt_regs *regs)
18 err = ptrace(PTRACE_GETREGS, pid, 0, regs->gp);
24 int restore_registers(int pid, struct uml_pt_regs *regs)
28 err = ptrace(PTRACE_SETREGS, pid, 0, regs->gp);
34 /* This is set once at boot time and not changed thereafter */
36 static unsigned long exec_regs[MAX_REG_NR];
37 static unsigned long exec_fp_regs[FP_SIZE];
39 int init_registers(int pid)
43 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
47 arch_init_registers(pid);
48 get_fp_registers(pid, exec_fp_regs);
52 void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
54 memcpy(regs, exec_regs, sizeof(exec_regs));
57 memcpy(fp_regs, exec_fp_regs, sizeof(exec_fp_regs));