Get rid of powerpc_getreg(), it's a copy of upeek()

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
Denys Vlasenko 2013-06-28 14:36:39 +02:00
parent 752e5a02e6
commit 7f5a132c81

View File

@ -996,49 +996,29 @@ undefined_scno_name(struct tcb *tcp)
#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