mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-24 07:40:52 +00:00
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
This commit is contained in:
parent
5bf0d7ad74
commit
87f69beea3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326910
@ -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, int error)
|
||||
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, int error)
|
||||
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, int error)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -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 int code)
|
||||
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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user