Get rid of powerpc_getreg(), it's a copy of upeek()
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
diff --git a/syscall.c b/syscall.c
index 8d1f8a3..fc7cd06 100644
--- a/syscall.c
+++ b/syscall.c
@@ -996,49 +996,29 @@
#ifdef POWERPC
/*
- * PTRACE_GETREGS was added to the PowerPC kernel in v2.6.23, so we
- * provide a slow fallback for very old kernels.
+ * PTRACE_GETREGS was added to the PowerPC kernel in v2.6.23,
+ * we provide a slow fallback for old kernels.
*/
-
-static long powerpc_getreg(pid_t pid, unsigned long offset, unsigned long *p)
-{
- long val;
-
- errno = 0;
- val = ptrace(PTRACE_PEEKUSER, pid, (char *)offset, 0);
- if (val == -1 && errno)
- return -1;
-
- *p = val;
- return 0;
-}
-
-static long powerpc_getregs_old(pid_t pid)
+static int powerpc_getregs_old(pid_t pid)
{
int i;
long r;
- r = powerpc_getreg(pid, sizeof(unsigned long) * PT_MSR, &ppc_regs.msr);
+ r = upeek(pid, sizeof(long) * PT_MSR, &ppc_regs.msr);
if (r)
goto out;
-
- r = powerpc_getreg(pid, sizeof(unsigned long) * PT_CCR, &ppc_regs.ccr);
+ r = upeek(pid, sizeof(long) * PT_CCR, &ppc_regs.ccr);
if (r)
goto out;
-
- r = powerpc_getreg(pid, sizeof(unsigned long) * PT_ORIG_R3,
- &ppc_regs.orig_gpr3);
+ r = upeek(pid, sizeof(long) * PT_ORIG_R3, &ppc_regs.orig_gpr3);
if (r)
goto out;
-
for (i = 0; i <= 8; i++) {
- r = powerpc_getreg(pid, sizeof(unsigned long) * (PT_R0 + i),
- &ppc_regs.gpr[i]);
+ r = upeek(pid, sizeof(long) * (PT_R0 + i), &ppc_regs.gpr[i]);
if (r)
goto out;
}
-
-out:
+ out:
return r;
}
#endif