struct user_regs_struct.rdi,
struct user_regs_struct.rsi,
struct user_regs_struct.rdx], [],[], [#include <linux/user.h>])
+AC_CHECK_MEMBERS([struct pt_regs.orig_gpr3,
+ struct pt_regs.gpr], [],[], [#include <linux/ptrace.h>])
AM_CONDITIONAL(WANT_PEEKFD_I386,
test $ac_cv_member_struct_user_regs_struct_orig_eax = yes &&
test $ac_cv_member_struct_user_regs_struct_eax = yes &&
test $ac_cv_member_struct_user_regs_struct_rdi = yes &&
test $ac_cv_member_struct_user_regs_struct_rsi = yes &&
test $ac_cv_member_struct_user_regs_struct_rdx = yes )
+AM_CONDITIONAL(WANT_PEEKFD_PPC,
+ test $ac_cv_member_struct_pt_regs_orig_gpr3 = yes &&
+ test $ac_cv_member_struct_pt_regs_gpr = yes )
dnl Check for language stuff
AM_GNU_GETTEXT([external])
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/syscall.h>
+#include <byteswap.h>
+#include <endian.h>
#include <linux/user.h>
#include <stdlib.h>
#include <getopt.h>
#define REG_PARAM1 rdi
#define REG_PARAM2 rsi
#define REG_PARAM3 rdx
+#elif PPC
+ #define REG_ORIG_ACCUM gpr[0]
+ #define REG_ACCUM gpr[3]
+ #define REG_PARAM1 orig_gpr3
+ #define REG_PARAM2 gpr[4]
+ #define REG_PARAM3 gpr[5]
+#ifndef PT_ORIG_R3
+ #define PT_ORIG_R3 34
+#endif
#endif
#define MAX_ATTACHED_PIDS 1024
int status;
int pid = wait(&status);
if (WIFSTOPPED(status)) {
+#ifdef PPC
+ struct pt_regs regs;
+ regs.gpr[0] = ptrace(PTRACE_PEEKUSER, pid, 4 * PT_R0, 0);
+ regs.gpr[3] = ptrace(PTRACE_PEEKUSER, pid, 4 * PT_R3, 0);
+ regs.gpr[4] = ptrace(PTRACE_PEEKUSER, pid, 4 * PT_R4, 0);
+ regs.gpr[5] = ptrace(PTRACE_PEEKUSER, pid, 4 * PT_R5, 0);
+ regs.orig_gpr3 = ptrace(PTRACE_PEEKUSER, pid, 4 * PT_ORIG_R3, 0);
+#else
struct user_regs_struct regs;
ptrace(PTRACE_GETREGS, pid, 0, ®s);
-
+#endif
/*unsigned int b = ptrace(PTRACE_PEEKTEXT, pid, regs.eip, 0);*/
if (follow_forks && (regs.REG_ORIG_ACCUM == SYS_fork || regs.REG_ORIG_ACCUM == SYS_clone)) {
if (regs.REG_ACCUM > 0)
}
for (i = 0; i < regs.REG_PARAM3; i++) {
+#ifdef _BIG_ENDIAN
+ unsigned int a = bswap_32(ptrace(PTRACE_PEEKTEXT, pid, regs.REG_PARAM2 + i, 0));
+#else
unsigned int a = ptrace(PTRACE_PEEKTEXT, pid, regs.REG_PARAM2 + i, 0);
+#endif
if (remove_duplicates)
lastbuf[i] = a & 0xff;