Index: usr.bin/kdump/Makefile =================================================================== --- usr.bin/kdump/Makefile +++ usr.bin/kdump/Makefile @@ -3,10 +3,6 @@ .include -.if (${MACHINE_ARCH} == "amd64") -SFX= 32 -.endif - .PATH: ${.CURDIR}/../ktrace PROG= kdump @@ -30,6 +26,9 @@ .if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386") CLEANFILES+= linux_syscalls.c .endif +.if (${MACHINE_ARCH} == "amd64") +CLEANFILES+= linux32_syscalls.c +.endif ioctl.c: mkioctls env MACHINE=${MACHINE} CPP="${CPP}" \ @@ -43,7 +42,11 @@ sh ${.CURDIR}/mksubr ${DESTDIR}/usr/include >${.TARGET} .if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386") sh ${.CURDIR}/../../sys/kern/makesyscalls.sh \ - ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux${SFX}/syscalls.master ${.CURDIR}/linux_syscalls.conf + ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux/syscalls.master ${.CURDIR}/linux_syscalls.conf +.endif +.if (${MACHINE_ARCH} == "amd64") + sh ${.CURDIR}/../../sys/kern/makesyscalls.sh \ + ${.CURDIR}/../../sys/${MACHINE_ARCH}/linux32/syscalls.master ${.CURDIR}/linux32_syscalls.conf .endif .include Index: usr.bin/kdump/kdump.c =================================================================== --- usr.bin/kdump/kdump.c +++ usr.bin/kdump/kdump.c @@ -146,8 +146,8 @@ #if defined(__amd64__) || defined(__i386__) -void linux_ktrsyscall(struct ktr_syscall *); -void linux_ktrsysret(struct ktr_sysret *); +void linux_ktrsyscall(struct ktr_syscall *, u_int); +void linux_ktrsysret(struct ktr_sysret *, u_int); extern const char *linux_syscallnames[]; #include @@ -172,6 +172,14 @@ }; #endif +#if defined(__amd64__) +extern const char *linux32_syscallnames[]; + +#include +static int nlinux32_syscalls = sizeof(linux32_syscallnames) / \ + sizeof(linux32_syscallnames[0]); +#endif + struct proc_info { TAILQ_ENTRY(proc_info) info; @@ -402,7 +410,8 @@ case KTR_SYSCALL: #if defined(__amd64__) || defined(__i386__) if ((sv_flags & SV_ABI_MASK) == SV_ABI_LINUX) - linux_ktrsyscall((struct ktr_syscall *)m); + linux_ktrsyscall((struct ktr_syscall *)m, + sv_flags); else #endif ktrsyscall((struct ktr_syscall *)m, sv_flags); @@ -410,7 +419,8 @@ case KTR_SYSRET: #if defined(__amd64__) || defined(__i386__) if ((sv_flags & SV_ABI_MASK) == SV_ABI_LINUX) - linux_ktrsysret((struct ktr_sysret *)m); + linux_ktrsysret((struct ktr_sysret *)m, + sv_flags); else #endif ktrsysret((struct ktr_sysret *)m, sv_flags); @@ -1951,16 +1961,28 @@ } #if defined(__amd64__) || defined(__i386__) + +#if defined(__amd64__) +#define NLINUX_SYSCALLS(v) ((v) & SV_ILP32 ? \ + nlinux32_syscalls : nlinux_syscalls) +#define LINUX_SYSCALLNAMES(v, i) ((v) & SV_ILP32 ? \ + linux32_syscallnames[i] : linux_syscallnames[i]) +#else +#define NLINUX_SYSCALLS(v) (nlinux_syscalls) +#define LINUX_SYSCALLNAMES(v, i) (linux_syscallnames[i]) +#endif + void -linux_ktrsyscall(struct ktr_syscall *ktr) +linux_ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags) { int narg = ktr->ktr_narg; register_t *ip; - if (ktr->ktr_code >= nlinux_syscalls || ktr->ktr_code < 0) + + if (ktr->ktr_code >= NLINUX_SYSCALLS(sv_flags) || ktr->ktr_code < 0) printf("[%d]", ktr->ktr_code); else { - printf("%s", linux_syscallnames[ktr->ktr_code]); + printf("%s", LINUX_SYSCALLNAMES(sv_flags, ktr->ktr_code)); if (syscallno) printf("[%d]", ktr->ktr_code); } @@ -1975,16 +1997,16 @@ } void -linux_ktrsysret(struct ktr_sysret *ktr) +linux_ktrsysret(struct ktr_sysret *ktr, u_int sv_flags) { register_t ret = ktr->ktr_retval; int error = ktr->ktr_error; int code = ktr->ktr_code; - if (code >= nlinux_syscalls || code < 0) + if (code >= NLINUX_SYSCALLS(sv_flags) || code < 0) printf("[%d] ", code); else { - printf("%s", linux_syscallnames[code]); + printf("%s ", LINUX_SYSCALLNAMES(sv_flags, code)); if (syscallno) printf("[%d]", code); printf(" "); Index: usr.bin/kdump/linux32_syscalls.conf =================================================================== --- /dev/null +++ usr.bin/kdump/linux32_syscalls.conf @@ -0,0 +1,22 @@ +# $FreeBSD$ +sysnames="linux32_syscalls.c" +sysproto="/dev/null" +sysproto_h=_LINUX32_SYSPROTO_H_ +syshdr="/dev/null" +syssw="/dev/null" +sysmk="/dev/null" +syscallprefix="LINUX32_SYS_" +switchname="/dev/null" +namesname="linux32_syscallnames" +systrace="/dev/null" +# $FreeBSD$ +sysnames="linux32_syscalls.c" +sysproto="/dev/null" +sysproto_h=_LINUX32_SYSPROTO_H_ +syshdr="/dev/null" +syssw="/dev/null" +sysmk="/dev/null" +syscallprefix="LINUX32_SYS_" +switchname="/dev/null" +namesname="linux32_syscallnames" +systrace="/dev/null"