ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / um / sys-ppc / ptrace_user.c
1 #include <sys/ptrace.h>
2 #include <errno.h>
3 #include <asm/ptrace.h>
4 #include "sysdep/ptrace.h"
5
6 int ptrace_getregs(long pid, unsigned long *regs_out)
7 {
8     int i;
9     for (i=0; i < sizeof(struct sys_pt_regs)/sizeof(PPC_REG); ++i) {
10         errno = 0;
11         regs_out->regs[i] = ptrace(PTRACE_PEEKUSER, pid, i*4, 0);
12         if (errno) {
13             return -errno;
14         }
15     }
16     return 0;
17 }
18
19 int ptrace_setregs(long pid, unsigned long *regs_in)
20 {
21     int i;
22     for (i=0; i < sizeof(struct sys_pt_regs)/sizeof(PPC_REG); ++i) {
23         if (i != 34 /* FIXME: PT_ORIG_R3 */ && i <= PT_MQ) {
24             if (ptrace(PTRACE_POKEUSER, pid, i*4, regs_in->regs[i]) < 0) {
25                 return -errno;
26             }
27         }
28     }
29     return 0;
30 }
31 /*
32  * Overrides for Emacs so that we follow Linus's tabbing style.
33  * Emacs will notice this stuff at the end of the file and automatically
34  * adjust the settings for this buffer only.  This must remain at the end
35  * of the file.
36  * ---------------------------------------------------------------------------
37  * Local variables:
38  * c-file-style: "linux"
39  * End:
40  */