summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2013-10-17 12:32:56 +0200
committerCraig Small <csmall@enc.com.au>2014-01-31 22:53:54 +1100
commit87702a095569d8de8d80c0b16a7260d194c80645 (patch)
treee6969a09b7a91722aaa9ce393d8872a724096bed
parent4b50aac325fb56c3188b12fadcca1dec1adba17c (diff)
Port peekfd to m68k
-rw-r--r--configure.ac5
-rw-r--r--src/Makefile.am4
-rw-r--r--src/peekfd.c8
3 files changed, 16 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 6fed37f..20549f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,6 +117,8 @@ AC_CHECK_MEMBERS([struct pt_regs.orig_gpr3,
AC_CHECK_MEMBERS([struct pt_regs.uregs],[],[], [#include <asm/ptrace.h>])
AC_CHECK_MEMBERS([struct pt_regs.regs,
struct pt_regs.cp0_status],[],[], [#include <asm/ptrace.h>])
+AC_CHECK_MEMBERS([struct pt_regs.orig_d0,
+ struct pt_regs.d0],[],[], [#include <asm/ptrace.h>])
case ${host_os} in
gnu*)
@@ -149,6 +151,9 @@ AM_CONDITIONAL(WANT_PEEKFD_MIPS,
test $build_cpu = mipsel &&
test $ac_cv_member_struct_pt_regs_regs = yes &&
test $ac_cv_member_struct_pt_regs_cp0_status = yes)
+AM_CONDITIONAL(WANT_PEEKFD_M68K,
+ test $ac_cv_member_struct_pt_regs_orig_d0 = yes &&
+ test $ac_cv_member_struct_pt_regs_d0 = yes)
dnl Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
diff --git a/src/Makefile.am b/src/Makefile.am
index 9d6f777..3a1fe19 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,6 +25,10 @@ if WANT_PEEKFD_MIPS
bin_PROGRAMS += peekfd
AM_CFLAGS += -DMIPS
endif
+if WANT_PEEKFD_M68K
+ bin_PROGRAMS += peekfd
+ AM_CFLAGS += -DM68K
+endif
fuser_SOURCES = fuser.c comm.h signals.c signals.h i18n.h fuser.h lists.h
if WANT_TIMEOUT_STAT
diff --git a/src/peekfd.c b/src/peekfd.c
index c4a3474..cba2130 100644
--- a/src/peekfd.c
+++ b/src/peekfd.c
@@ -76,6 +76,12 @@
#define REG_PARAM1 regs[4]
#define REG_PARAM2 regs[5]
#define REG_PARAM3 regs[6]
+#elif defined(M68K)
+ #define REG_ORIG_ACCUM orig_d0
+ #define REG_ACCUM d0
+ #define REG_PARAM1 d1
+ #define REG_PARAM2 d2
+ #define REG_PARAM3 d3
#endif
#define MAX_ATTACHED_PIDS 1024
@@ -270,7 +276,7 @@ int main(int argc, char **argv)
}
for (i = 0; i < regs.REG_PARAM3; i++) {
-#ifdef _BIG_ENDIAN
+#if BYTE_ORDER == BIG_ENDIAN
#if __WORDSIZE == 64
unsigned int a = bswap_64(ptrace(PTRACE_PEEKTEXT, pid, regs.REG_PARAM2 + i, 0));
#else