2 * Copyright (C) 2004 PathScale, Inc
3 * Licensed under the GPL
8 #include <sys/ptrace.h>
10 #include "sysdep/ptrace.h"
12 /* This is set once at boot time and not changed thereafter */
14 static unsigned long exec_regs[MAX_REG_NR];
16 void init_thread_registers(struct uml_pt_regs *to)
18 memcpy(to->regs, exec_regs, sizeof(to->regs));
21 void save_registers(int pid, struct uml_pt_regs *regs)
25 err = ptrace(PTRACE_GETREGS, pid, 0, regs->regs);
27 panic("save_registers - saving registers failed, errno = %d\n",
31 void restore_registers(int pid, struct uml_pt_regs *regs)
35 err = ptrace(PTRACE_SETREGS, pid, 0, regs->regs);
37 panic("restore_registers - saving registers failed, "
38 "errno = %d\n", errno);
41 void init_registers(int pid)
45 err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
47 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
51 void get_safe_registers(unsigned long *regs)
53 memcpy(regs, exec_regs, sizeof(exec_regs));