Author: nwhitehorn
Date: Sat Aug 28 15:04:53 2010
New Revision: 211935
URL: http://svn.freebsd.org/changeset/base/211935

Log:
  Fix breakage introduced in r211725 and improve functionality of truss on
  64-bit powerpc by adding 32-bit compatibility features.

Modified:
  head/usr.bin/truss/Makefile
  head/usr.bin/truss/extern.h
  head/usr.bin/truss/main.c
  head/usr.bin/truss/powerpc-fbsd.c
  head/usr.bin/truss/powerpc64-fbsd.c

Modified: head/usr.bin/truss/Makefile
==============================================================================
--- head/usr.bin/truss/Makefile Sat Aug 28 15:03:11 2010        (r211934)
+++ head/usr.bin/truss/Makefile Sat Aug 28 15:04:53 2010        (r211935)
@@ -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.ma
                ${.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 <bsd.prog.mk>

Modified: head/usr.bin/truss/extern.h
==============================================================================
--- head/usr.bin/truss/extern.h Sat Aug 28 15:03:11 2010        (r211934)
+++ head/usr.bin/truss/extern.h Sat Aug 28 15:04:53 2010        (r211935)
@@ -58,6 +58,8 @@ extern long ia64_syscall_exit(struct tru
 #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);

Modified: head/usr.bin/truss/main.c
==============================================================================
--- head/usr.bin/truss/main.c   Sat Aug 28 15:03:11 2010        (r211934)
+++ head/usr.bin/truss/main.c   Sat Aug 28 15:04:53 2010        (r211935)
@@ -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 },

Modified: head/usr.bin/truss/powerpc-fbsd.c
==============================================================================
--- head/usr.bin/truss/powerpc-fbsd.c   Sat Aug 28 15:03:11 2010        
(r211934)
+++ head/usr.bin/truss/powerpc-fbsd.c   Sat Aug 28 15:04:53 2010        
(r211935)
@@ -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]);
 

Modified: head/usr.bin/truss/powerpc64-fbsd.c
==============================================================================
--- head/usr.bin/truss/powerpc64-fbsd.c Sat Aug 28 15:03:11 2010        
(r211934)
+++ head/usr.bin/truss/powerpc64-fbsd.c Sat Aug 28 15:04:53 2010        
(r211935)
@@ -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 *
  */
 
 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;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to