Fix breakage introduced in r211725 and improve functionality of truss on

64-bit powerpc by adding 32-bit compatibility features.
This commit is contained in:
Nathan Whitehorn 2010-08-28 15:04:53 +00:00
parent b12277d1d4
commit 4e5833219a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211935
5 changed files with 31 additions and 3 deletions

View File

@ -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 <bsd.prog.mk>

View File

@ -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);

View File

@ -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 },

View File

@ -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]);

View File

@ -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;