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"
13 /* This is set once at boot time and not changed thereafter */
15 static unsigned long exec_regs
[MAX_REG_NR
];
17 void init_thread_registers(struct uml_pt_regs
*to
)
19 memcpy(to
->gp
, exec_regs
, sizeof(to
->gp
));
22 void save_registers(int pid
, struct uml_pt_regs
*regs
)
26 err
= ptrace(PTRACE_GETREGS
, pid
, 0, regs
->gp
);
28 panic("save_registers - saving registers failed, errno = %d\n",
32 void restore_registers(int pid
, struct uml_pt_regs
*regs
)
36 err
= ptrace(PTRACE_SETREGS
, pid
, 0, regs
->gp
);
38 panic("restore_registers - saving registers failed, "
39 "errno = %d\n", errno
);
42 void init_registers(int pid
)
46 err
= ptrace(PTRACE_GETREGS
, pid
, 0, exec_regs
);
48 panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
51 arch_init_registers(pid
);
54 void get_safe_registers(unsigned long *regs
)
56 memcpy(regs
, exec_regs
, sizeof(exec_regs
));