Author: ed Date: Sat Dec 16 19:37:55 2017 New Revision: 326910 URL: https://svnweb.freebsd.org/changeset/base/326910
Log: libsysdecode: Add a new ABI type, SYSDECODE_ABI_CLOUDABI32. In order to let truss(8) support tracing of 32-bit CloudABI applications, we need to add a new ABI type to libsysdecode. We can reuse the existing errno mapping table. Also link in the cloudabi32 system call table to translate system call names. While there, remove all of the architecture ifdefs. There are not needed, as the CloudABI data types and system call tables build fine on any architecture. Building this unconditionally will make it easier to do tracing for different compat modes, emulation, etc. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D13516 Modified: head/lib/libsysdecode/errno.c head/lib/libsysdecode/syscallnames.c head/lib/libsysdecode/sysdecode.3 head/lib/libsysdecode/sysdecode.h Modified: head/lib/libsysdecode/errno.c ============================================================================== --- head/lib/libsysdecode/errno.c Sat Dec 16 18:06:30 2017 (r326909) +++ head/lib/libsysdecode/errno.c Sat Dec 16 19:37:55 2017 (r326910) @@ -58,7 +58,6 @@ static int bsd_to_linux_errno[ELAST + 1] = { }; #endif -#if defined(__aarch64__) || defined(__amd64__) #include <contrib/cloudabi/cloudabi_types_common.h> static const int cloudabi_errno_table[] = { @@ -139,7 +138,6 @@ static const int cloudabi_errno_table[] = { [CLOUDABI_EXDEV] = EXDEV, [CLOUDABI_ENOTCAPABLE] = ENOTCAPABLE, }; -#endif int sysdecode_abi_to_freebsd_errno(enum sysdecode_abi abi, int error) @@ -165,13 +163,12 @@ sysdecode_abi_to_freebsd_errno(enum sysdecode_abi abi, break; } #endif -#if defined(__aarch64__) || defined(__amd64__) + case SYSDECODE_ABI_CLOUDABI32: case SYSDECODE_ABI_CLOUDABI64: if (error >= 0 && (unsigned int)error < nitems(cloudabi_errno_table)) return (cloudabi_errno_table[error]); break; -#endif default: break; } @@ -193,7 +190,7 @@ sysdecode_freebsd_to_abi_errno(enum sysdecode_abi abi, return (bsd_to_linux_errno[error]); break; #endif -#if defined(__aarch64__) || defined(__amd64__) + case SYSDECODE_ABI_CLOUDABI32: case SYSDECODE_ABI_CLOUDABI64: { unsigned int i; @@ -203,7 +200,6 @@ sysdecode_freebsd_to_abi_errno(enum sysdecode_abi abi, } break; } -#endif default: break; } Modified: head/lib/libsysdecode/syscallnames.c ============================================================================== --- head/lib/libsysdecode/syscallnames.c Sat Dec 16 18:06:30 2017 (r326909) +++ head/lib/libsysdecode/syscallnames.c Sat Dec 16 19:37:55 2017 (r326910) @@ -63,10 +63,10 @@ static #include <amd64/linux32/linux32_syscalls.c> #endif -#if defined(__amd64__) || defined(__aarch64__) static +#include <compat/cloudabi32/cloudabi32_syscalls.c> +static #include <compat/cloudabi64/cloudabi64_syscalls.c> -#endif const char * sysdecode_syscallname(enum sysdecode_abi abi, unsigned int code) @@ -95,12 +95,14 @@ sysdecode_syscallname(enum sysdecode_abi abi, unsigned return (linux32_syscallnames[code]); break; #endif -#if defined(__amd64__) || defined(__aarch64__) + case SYSDECODE_ABI_CLOUDABI32: + if (code < nitems(cloudabi32_syscallnames)) + return (cloudabi32_syscallnames[code]); + break; case SYSDECODE_ABI_CLOUDABI64: if (code < nitems(cloudabi64_syscallnames)) return (cloudabi64_syscallnames[code]); break; -#endif default: break; } Modified: head/lib/libsysdecode/sysdecode.3 ============================================================================== --- head/lib/libsysdecode/sysdecode.3 Sat Dec 16 18:06:30 2017 (r326909) +++ head/lib/libsysdecode/sysdecode.3 Sat Dec 16 19:37:55 2017 (r326910) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 2017 +.Dd December 16, 2017 .Dt SYSDECODE 3 .Os .Sh NAME @@ -61,9 +61,12 @@ Supported on amd64 and i386. .It Li SYSDECODE_ABI_LINUX32 32-bit Linux binaries. Supported on amd64. +.It Li SYSDECODE_ABI_CLOUDABI32 +32-bit CloudABI binaries. +Supported on all platforms. .It Li SYSDECODE_ABI_CLOUDABI64 64-bit CloudABI binaries. -Supported on aarch64 and amd64. +Supported on all platforms. .It Li SYSDECODE_ABI_UNKNOWN A placeholder for use when the ABI is not known. .El Modified: head/lib/libsysdecode/sysdecode.h ============================================================================== --- head/lib/libsysdecode/sysdecode.h Sat Dec 16 18:06:30 2017 (r326909) +++ head/lib/libsysdecode/sysdecode.h Sat Dec 16 19:37:55 2017 (r326910) @@ -35,7 +35,8 @@ enum sysdecode_abi { SYSDECODE_ABI_FREEBSD32, SYSDECODE_ABI_LINUX, SYSDECODE_ABI_LINUX32, - SYSDECODE_ABI_CLOUDABI64 + SYSDECODE_ABI_CLOUDABI64, + SYSDECODE_ABI_CLOUDABI32 }; int sysdecode_abi_to_freebsd_errno(enum sysdecode_abi _abi, int _error); _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"