• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * PTRACE_GETREGS was added to the PowerPC kernel in v2.6.23,
3  * we provide a slow fallback for old kernels.
4  */
5 static int
getregs_old(struct tcb * tcp)6 getregs_old(struct tcb *tcp)
7 {
8 	int i;
9 	long r;
10 
11 	if (iflag) {
12 		r = upeek(tcp, sizeof(long) * PT_NIP, &ppc_regs.nip);
13 		if (r)
14 			goto out;
15 	}
16 #ifdef POWERPC64 /* else we never use it */
17 	r = upeek(tcp, sizeof(long) * PT_MSR, &ppc_regs.msr);
18 	if (r)
19 		goto out;
20 #endif
21 	r = upeek(tcp, sizeof(long) * PT_CCR, &ppc_regs.ccr);
22 	if (r)
23 		goto out;
24 	r = upeek(tcp, sizeof(long) * PT_ORIG_R3, &ppc_regs.orig_gpr3);
25 	if (r)
26 		goto out;
27 	for (i = 0; i <= 8; i++) {
28 		r = upeek(tcp, sizeof(long) * (PT_R0 + i),
29 			  &ppc_regs.gpr[i]);
30 		if (r)
31 			goto out;
32 	}
33  out:
34 	return r;
35 }
36