Dmitry V. Levin
d70d1c4aa6
Split code that use arch-specific registers to separate arch files. * syscall.c: Move definitions of variables containing fetched registers to linux/*/arch_regs.c files. [HAVE_GETRVAL2] (getrval2): Move arch-specific code to linux/*/arch_getrval2.c, include "arch_getrval2.c". (print_pc): Move arch-specific code to linux/*/print_pc.c files, include "print_pc.c". [X86_64] (x86_64_getregs_old): Rename to getregs_old, move to linux/x86_64/getregs_old.c, include "getregs_old.c". [POWERPC] (powerpc_getregs_old): Rename to getregs_old, move to linux/powerpc/getregs_old.c, include "getregs_old.c". (get_regs) [X86_64, POWERPC]: Update callers. (get_scno): Move arch-specific code to linux/*/get_scno.c, include "get_scno.c". (get_syscall_args): Move arch-specific code to linux/*/get_syscall_args.c, include "get_syscall_args.c". (get_error): Move arch-specific code to linux/*/get_error.c, include "get_error.c". (get_syscall_result): Move arch-specific code to linux/*/get_syscall_result.c, include "get_syscall_result.c". * Makefile.am (EXTRA_DIST): Add new linux/*/*.c files.
36 lines
732 B
C
36 lines
732 B
C
/*
|
|
* PTRACE_GETREGS was added to the PowerPC kernel in v2.6.23,
|
|
* we provide a slow fallback for old kernels.
|
|
*/
|
|
static int
|
|
getregs_old(pid_t pid)
|
|
{
|
|
int i;
|
|
long r;
|
|
|
|
if (iflag) {
|
|
r = upeek(pid, sizeof(long) * PT_NIP, (long *)&ppc_regs.nip);
|
|
if (r)
|
|
goto out;
|
|
}
|
|
#ifdef POWERPC64 /* else we never use it */
|
|
r = upeek(pid, sizeof(long) * PT_MSR, (long *)&ppc_regs.msr);
|
|
if (r)
|
|
goto out;
|
|
#endif
|
|
r = upeek(pid, sizeof(long) * PT_CCR, (long *)&ppc_regs.ccr);
|
|
if (r)
|
|
goto out;
|
|
r = upeek(pid, sizeof(long) * PT_ORIG_R3, (long *)&ppc_regs.orig_gpr3);
|
|
if (r)
|
|
goto out;
|
|
for (i = 0; i <= 8; i++) {
|
|
r = upeek(pid, sizeof(long) * (PT_R0 + i),
|
|
(long *)&ppc_regs.gpr[i]);
|
|
if (r)
|
|
goto out;
|
|
}
|
|
out:
|
|
return r;
|
|
}
|