Add NetBSD support to bx.

Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
This commit is contained in:
Thomas Klausner 2015-10-02 09:57:01 +02:00
parent 10ea7aa745
commit 4206253e65
2 changed files with 10 additions and 1 deletions

View File

@ -15,6 +15,7 @@
#elif BX_PLATFORM_ANDROID \
|| BX_PLATFORM_EMSCRIPTEN \
|| BX_PLATFORM_FREEBSD \
|| BX_PLATFORM_NETBSD \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_NACL \
@ -24,6 +25,7 @@
# include <sched.h> // sched_yield
# if BX_PLATFORM_FREEBSD \
|| BX_PLATFORM_NETBSD \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_NACL \
|| BX_PLATFORM_OSX \
@ -103,7 +105,7 @@ namespace bx
return (pid_t)::syscall(SYS_gettid);
#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX
return (mach_port_t)::pthread_mach_thread_np(pthread_self() );
#elif BX_PLATFORM_FREEBSD || BX_PLATFORM_NACL
#elif BX_PLATFORM_FREEBSD || BX_PLATFORM_NACL || BX_PLATFORM_NETBSD
// Casting __nc_basic_thread_data*... need better way to do this.
return *(uint32_t*)::pthread_self();
#else

View File

@ -15,6 +15,7 @@
#define BX_PLATFORM_ANDROID 0
#define BX_PLATFORM_EMSCRIPTEN 0
#define BX_PLATFORM_FREEBSD 0
#define BX_PLATFORM_NETBSD 0
#define BX_PLATFORM_IOS 0
#define BX_PLATFORM_LINUX 0
#define BX_PLATFORM_NACL 0
@ -187,6 +188,9 @@
#elif defined(__FreeBSD__)
# undef BX_PLATFORM_FREEBSD
# define BX_PLATFORM_FREEBSD 1
#elif defined(__NetBSD__)
# undef BX_PLATFORM_NETBSD
# define BX_PLATFORM_NETBSD 1
#else
# error "BX_PLATFORM_* is not defined!"
#endif //
@ -195,6 +199,7 @@
|| BX_PLATFORM_ANDROID \
|| BX_PLATFORM_EMSCRIPTEN \
|| BX_PLATFORM_FREEBSD \
|| BX_PLATFORM_NETBSD \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_NACL \
@ -244,6 +249,8 @@
BX_STRINGIZE(__EMSCRIPTEN_tiny__)
#elif BX_PLATFORM_FREEBSD
# define BX_PLATFORM_NAME "FreeBSD"
#elif BX_PLATFORM_NETBSD
# define BX_PLATFORM_NAME "NetBSD"
#elif BX_PLATFORM_IOS
# define BX_PLATFORM_NAME "iOS"
#elif BX_PLATFORM_LINUX