diff --git a/usr.bin/truss/Makefile b/usr.bin/truss/Makefile index ca0ce9234a21..f80ac0367ea6 100644 --- a/usr.bin/truss/Makefile +++ b/usr.bin/truss/Makefile @@ -2,7 +2,13 @@ NO_WERROR= PROG= truss -SRCS= main.c setup.c syscalls.c syscalls.h ioctl.c ${MACHINE_CPUARCH}-fbsd.c +SRCS= main.c setup.c syscalls.c syscalls.h ioctl.c + +.if exists(${.CURDIR}/${MACHINE_ARCH}-fbsd.c) +SRCS+= ${MACHINE_ARCH}-fbsd.c +.else +SRCS+= ${MACHINE_CPUARCH}-fbsd.c +.endif CFLAGS+= -I${.CURDIR} -I. CLEANFILES= syscalls.master syscalls.h ioctl.c @@ -53,4 +59,16 @@ freebsd32_syscalls.h: fbsd32-syscalls.master ${.CURDIR}/fbsd32.conf .endif +.if ${MACHINE_ARCH} == "powerpc64" +SRCS+= powerpc-fbsd.c freebsd32_syscalls.h +CLEANFILES+=fbsd32-syscalls.master freebsd32_syscalls.h + +fbsd32-syscalls.master: ${.CURDIR}/../../sys/compat/freebsd32/syscalls.master + cat ${.ALLSRC} > ${.TARGET} + +freebsd32_syscalls.h: fbsd32-syscalls.master + /bin/sh ${.CURDIR}/../../sys/kern/makesyscalls.sh ${.ALLSRC} \ + ${.CURDIR}/fbsd32.conf +.endif + .include diff --git a/usr.bin/truss/extern.h b/usr.bin/truss/extern.h index 322e2913169d..e3ffc4f566a3 100644 --- a/usr.bin/truss/extern.h +++ b/usr.bin/truss/extern.h @@ -58,6 +58,8 @@ extern long ia64_syscall_exit(struct trussinfo *, int); #ifdef __powerpc__ extern void powerpc_syscall_entry(struct trussinfo *, int); extern long powerpc_syscall_exit(struct trussinfo *, int); +extern void powerpc64_syscall_entry(struct trussinfo *, int); +extern long powerpc64_syscall_exit(struct trussinfo *, int); #endif #ifdef __sparc64__ extern void sparc64_syscall_entry(struct trussinfo *, int); diff --git a/usr.bin/truss/main.c b/usr.bin/truss/main.c index 5c7da1d4a6b5..b9dcfe4e7fec 100644 --- a/usr.bin/truss/main.c +++ b/usr.bin/truss/main.c @@ -97,6 +97,9 @@ struct ex_types { #ifdef __powerpc__ { "FreeBSD ELF", powerpc_syscall_entry, powerpc_syscall_exit }, { "FreeBSD ELF32", powerpc_syscall_entry, powerpc_syscall_exit }, +#ifdef __powerpc64__ + { "FreeBSD ELF64", powerpc64_syscall_entry, powerpc64_syscall_exit }, +#endif #endif #ifdef __sparc64__ { "FreeBSD ELF64", sparc64_syscall_entry, sparc64_syscall_exit }, diff --git a/usr.bin/truss/powerpc-fbsd.c b/usr.bin/truss/powerpc-fbsd.c index ab5b9a489822..d2c1db810269 100644 --- a/usr.bin/truss/powerpc-fbsd.c +++ b/usr.bin/truss/powerpc-fbsd.c @@ -63,7 +63,12 @@ static const char rcsid[] = static int cpid = -1; +#ifdef __powerpc64__ /* 32-bit compatibility */ +#include "freebsd32_syscalls.h" +#define syscallnames freebsd32_syscallnames +#else /* native 32-bit */ #include "syscalls.h" +#endif static int nsyscalls = sizeof(syscallnames) / sizeof(syscallnames[0]); diff --git a/usr.bin/truss/powerpc64-fbsd.c b/usr.bin/truss/powerpc64-fbsd.c index a929d0fa9c7b..ffa34f256e27 100644 --- a/usr.bin/truss/powerpc64-fbsd.c +++ b/usr.bin/truss/powerpc64-fbsd.c @@ -109,7 +109,7 @@ clear_fsc(void) { */ void -powerpc_syscall_entry(struct trussinfo *trussinfo, int nargs) { +powerpc64_syscall_entry(struct trussinfo *trussinfo, int nargs) { char buf[32]; struct reg regs; void *args; @@ -254,7 +254,7 @@ powerpc_syscall_entry(struct trussinfo *trussinfo, int nargs) { */ long -powerpc_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) +powerpc64_syscall_exit(struct trussinfo *trussinfo, int syscall_num __unused) { struct reg regs; long retval;