Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/truss/setup.c
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | ||||||||||||||||||||
static void enter_syscall(struct trussinfo *, struct threadinfo *, | static void enter_syscall(struct trussinfo *, struct threadinfo *, | |||||||||||||||||||
struct ptrace_lwpinfo *); | struct ptrace_lwpinfo *); | |||||||||||||||||||
static void new_proc(struct trussinfo *, pid_t, lwpid_t); | static void new_proc(struct trussinfo *, pid_t, lwpid_t); | |||||||||||||||||||
static struct procabi cloudabi32 = { | static struct procabi cloudabi32 = { | |||||||||||||||||||
"CloudABI32", | "CloudABI32", | |||||||||||||||||||
SYSDECODE_ABI_CLOUDABI32, | SYSDECODE_ABI_CLOUDABI32, | |||||||||||||||||||
sizeof(uint32_t), | ||||||||||||||||||||
STAILQ_HEAD_INITIALIZER(cloudabi32.extra_syscalls), | STAILQ_HEAD_INITIALIZER(cloudabi32.extra_syscalls), | |||||||||||||||||||
{ NULL } | { NULL } | |||||||||||||||||||
}; | }; | |||||||||||||||||||
static struct procabi cloudabi64 = { | static struct procabi cloudabi64 = { | |||||||||||||||||||
"CloudABI64", | "CloudABI64", | |||||||||||||||||||
SYSDECODE_ABI_CLOUDABI64, | SYSDECODE_ABI_CLOUDABI64, | |||||||||||||||||||
sizeof(uint64_t), | ||||||||||||||||||||
STAILQ_HEAD_INITIALIZER(cloudabi64.extra_syscalls), | STAILQ_HEAD_INITIALIZER(cloudabi64.extra_syscalls), | |||||||||||||||||||
{ NULL } | { NULL } | |||||||||||||||||||
}; | }; | |||||||||||||||||||
static struct procabi freebsd = { | static struct procabi freebsd = { | |||||||||||||||||||
"FreeBSD", | "FreeBSD", | |||||||||||||||||||
SYSDECODE_ABI_FREEBSD, | SYSDECODE_ABI_FREEBSD, | |||||||||||||||||||
sizeof(void *), | ||||||||||||||||||||
jrtc27: This works just fine as void * even downstream in CheriBSD. | ||||||||||||||||||||
Done Inline ActionsWell, sizeof(void* __capability) in order to support a hybrid truss, but I guess that's simpler. arichardson: Well, `sizeof(void* __capability)` in order to support a hybrid truss, but I guess that's… | ||||||||||||||||||||
Done Inline ActionsSure, though your proposed patch didn't actually do that :) jrtc27: Sure, though your proposed patch didn't actually do that :) | ||||||||||||||||||||
Done Inline ActionsIt did (https://github.com/CTSRD-CHERI/cheribsd/pull/692/files), not sure why I changed it here. I think to match the linux case... arichardson: It did (https://github.com/CTSRD-CHERI/cheribsd/pull/692/files), not sure why I changed it here. | ||||||||||||||||||||
STAILQ_HEAD_INITIALIZER(freebsd.extra_syscalls), | STAILQ_HEAD_INITIALIZER(freebsd.extra_syscalls), | |||||||||||||||||||
{ NULL } | { NULL } | |||||||||||||||||||
}; | }; | |||||||||||||||||||
#ifdef __LP64__ | #if !defined(__SIZEOF_POINTER__) | |||||||||||||||||||
#error "Use a modern compiler." | ||||||||||||||||||||
#endif | ||||||||||||||||||||
#if __SIZEOF_POINTER__ > 4 | ||||||||||||||||||||
static struct procabi freebsd32 = { | static struct procabi freebsd32 = { | |||||||||||||||||||
"FreeBSD32", | "FreeBSD32", | |||||||||||||||||||
SYSDECODE_ABI_FREEBSD32, | SYSDECODE_ABI_FREEBSD32, | |||||||||||||||||||
sizeof(uint32_t), | ||||||||||||||||||||
STAILQ_HEAD_INITIALIZER(freebsd32.extra_syscalls), | STAILQ_HEAD_INITIALIZER(freebsd32.extra_syscalls), | |||||||||||||||||||
{ NULL } | { NULL } | |||||||||||||||||||
}; | }; | |||||||||||||||||||
#endif | #endif | |||||||||||||||||||
static struct procabi linux = { | static struct procabi linux = { | |||||||||||||||||||
"Linux", | "Linux", | |||||||||||||||||||
SYSDECODE_ABI_LINUX, | SYSDECODE_ABI_LINUX, | |||||||||||||||||||
sizeof(void *), | ||||||||||||||||||||
Done Inline ActionsMeh, should be void * upstream and we can make it be Linux64 downstream. jrtc27: Meh, should be `void *` upstream and we can make it be Linux64 downstream. | ||||||||||||||||||||
STAILQ_HEAD_INITIALIZER(linux.extra_syscalls), | STAILQ_HEAD_INITIALIZER(linux.extra_syscalls), | |||||||||||||||||||
{ NULL } | { NULL } | |||||||||||||||||||
}; | }; | |||||||||||||||||||
#ifdef __LP64__ | #if __SIZEOF_POINTER__ > 4 | |||||||||||||||||||
static struct procabi linux32 = { | static struct procabi linux32 = { | |||||||||||||||||||
"Linux32", | "Linux32", | |||||||||||||||||||
SYSDECODE_ABI_LINUX32, | SYSDECODE_ABI_LINUX32, | |||||||||||||||||||
sizeof(uint32_t), | ||||||||||||||||||||
STAILQ_HEAD_INITIALIZER(linux32.extra_syscalls), | STAILQ_HEAD_INITIALIZER(linux32.extra_syscalls), | |||||||||||||||||||
{ NULL } | { NULL } | |||||||||||||||||||
}; | }; | |||||||||||||||||||
#endif | #endif | |||||||||||||||||||
static struct procabi_table abis[] = { | static struct procabi_table abis[] = { | |||||||||||||||||||
{ "CloudABI ELF32", &cloudabi32 }, | { "CloudABI ELF32", &cloudabi32 }, | |||||||||||||||||||
{ "CloudABI ELF64", &cloudabi64 }, | { "CloudABI ELF64", &cloudabi64 }, | |||||||||||||||||||
#ifdef __LP64__ | #if __SIZEOF_POINTER__ == 4 | |||||||||||||||||||
{ "FreeBSD ELF32", &freebsd }, | ||||||||||||||||||||
#elif __SIZEOF_POINTER__ == 8 | ||||||||||||||||||||
{ "FreeBSD ELF64", &freebsd }, | { "FreeBSD ELF64", &freebsd }, | |||||||||||||||||||
{ "FreeBSD ELF32", &freebsd32 }, | { "FreeBSD ELF32", &freebsd32 }, | |||||||||||||||||||
#else | #else | |||||||||||||||||||
{ "FreeBSD ELF32", &freebsd }, | #error "Unsupported pointer size" | |||||||||||||||||||
#endif | #endif | |||||||||||||||||||
Done Inline Actions
Is more like we have downstream. It decouples the native ABI from what other ABIs you might know about so is easier to work out what it's doing at a glance about and easier to extend (otherwise you get a bunch of duplication once you add a third possible native ABI). jrtc27: Is more like we have downstream. It decouples the native ABI from what other ABIs you might… | ||||||||||||||||||||
#if defined(__powerpc64__) | #if defined(__powerpc64__) | |||||||||||||||||||
{ "FreeBSD ELF64 V2", &freebsd }, | { "FreeBSD ELF64 V2", &freebsd }, | |||||||||||||||||||
#endif | #endif | |||||||||||||||||||
#if defined(__amd64__) | #if defined(__amd64__) | |||||||||||||||||||
{ "FreeBSD a.out", &freebsd32 }, | { "FreeBSD a.out", &freebsd32 }, | |||||||||||||||||||
#endif | #endif | |||||||||||||||||||
#if defined(__i386__) | #if defined(__i386__) | |||||||||||||||||||
{ "FreeBSD a.out", &freebsd }, | { "FreeBSD a.out", &freebsd }, | |||||||||||||||||||
#endif | #endif | |||||||||||||||||||
#ifdef __LP64__ | #if __SIZEOF_POINTER__ >= 8 | |||||||||||||||||||
{ "Linux ELF64", &linux }, | { "Linux ELF64", &linux }, | |||||||||||||||||||
{ "Linux ELF32", &linux32 }, | { "Linux ELF32", &linux32 }, | |||||||||||||||||||
#else | #else | |||||||||||||||||||
{ "Linux ELF", &linux }, | { "Linux ELF", &linux }, | |||||||||||||||||||
#endif | #endif | |||||||||||||||||||
}; | }; | |||||||||||||||||||
/* | /* | |||||||||||||||||||
▲ Show 20 Lines • Show All 678 Lines • Show Last 20 Lines |
This works just fine as void * even downstream in CheriBSD.