From owner-svn-src-head@freebsd.org Sat Dec 16 19:37:56 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92FCDE8C59C; Sat, 16 Dec 2017 19:37:56 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CD326FAD2; Sat, 16 Dec 2017 19:37:56 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBGJbtf9053944; Sat, 16 Dec 2017 19:37:55 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBGJbtER053939; Sat, 16 Dec 2017 19:37:55 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201712161937.vBGJbtER053939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sat, 16 Dec 2017 19:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326910 - head/lib/libsysdecode X-SVN-Group: head X-SVN-Commit-Author: ed X-SVN-Commit-Paths: head/lib/libsysdecode X-SVN-Commit-Revision: 326910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Dec 2017 19:37:56 -0000 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 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 #endif -#if defined(__amd64__) || defined(__aarch64__) static +#include +static #include -#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);