From e5d3015f47ca8f88dfedb85243e8e77957bd51cd Mon Sep 17 00:00:00 2001 From: Patrick Meyer Date: Thu, 6 May 2021 23:08:51 +0200 Subject: executor: initial darwin support --- executor/common.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'executor/common.h') diff --git a/executor/common.h b/executor/common.h index b5a1ba593..c8bfccb9b 100644 --- a/executor/common.h +++ b/executor/common.h @@ -17,6 +17,13 @@ #if GOOS_freebsd || GOOS_test && HOSTGOOS_freebsd #include // for htobe*. +#elif GOOS_darwin +#include +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htobe64(x) OSSwapHostToBigInt64(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) #elif GOOS_windows #define htobe16 _byteswap_ushort #define htobe32 _byteswap_ulong @@ -51,7 +58,7 @@ NORETURN void doexit(int status) #if SYZ_EXECUTOR || SYZ_MULTI_PROC || SYZ_REPEAT && SYZ_CGROUPS || \ SYZ_NET_DEVICES || __NR_syz_mount_image || __NR_syz_read_part_table || \ __NR_syz_usb_connect || __NR_syz_usb_connect_ath9k || \ - (GOOS_freebsd || GOOS_openbsd || GOOS_netbsd) && SYZ_NET_INJECTION + (GOOS_freebsd || GOOS_darwin || GOOS_openbsd || GOOS_netbsd) && SYZ_NET_INJECTION static unsigned long long procid; #endif @@ -208,7 +215,7 @@ static void use_temporary_dir(void) #endif #endif -#if GOOS_akaros || GOOS_netbsd || GOOS_freebsd || GOOS_openbsd || GOOS_test +#if GOOS_akaros || GOOS_netbsd || GOOS_freebsd || GOOS_darwin || GOOS_openbsd || GOOS_test #if (SYZ_EXECUTOR || SYZ_REPEAT) && SYZ_EXECUTOR_USES_FORK_SERVER && (SYZ_EXECUTOR || SYZ_USE_TMP_DIR) #include #include @@ -311,7 +318,7 @@ static void thread_start(void* (*fn)(void*), void* arg) #endif #endif -#if GOOS_freebsd || GOOS_netbsd || GOOS_openbsd || GOOS_akaros || GOOS_test +#if GOOS_freebsd || GOOS_darwin || GOOS_netbsd || GOOS_openbsd || GOOS_akaros || GOOS_test #if SYZ_EXECUTOR || SYZ_THREADED #include @@ -428,7 +435,7 @@ static uint16 csum_inet_digest(struct csum_inet* csum) #if GOOS_akaros #include "common_akaros.h" -#elif GOOS_freebsd || GOOS_netbsd || GOOS_openbsd +#elif GOOS_freebsd || GOOS_darwin || GOOS_netbsd || GOOS_openbsd #include "common_bsd.h" #elif GOOS_fuchsia #include "common_fuchsia.h" @@ -442,7 +449,7 @@ static uint16 csum_inet_digest(struct csum_inet* csum) #error "unknown OS" #endif -#if SYZ_EXECUTOR || __NR_syz_execute_func +#if !GOOS_darwin && SYZ_EXECUTOR || __NR_syz_execute_func // syz_execute_func(text ptr[in, text[taget]]) static long syz_execute_func(volatile long text) { -- cgit mrf-deployment