Add basic NetBSD support

pull/241/head
Kamil Rytarowski 8 years ago
parent 475c66d2cc
commit 3c4ccd41fa

@ -306,6 +306,11 @@ LLVM:
# define POSH_OS_STRING "FreeBSD"
#endif
#if defined __NetBSD__
# define POSH_OS_NETBSD 1
# define POSH_OS_STRING "NetBSD"
#endif
#if defined __OpenBSD__
# define POSH_OS_OPENBSD 1
# define POSH_OS_STRING "OpenBSD"
@ -1027,5 +1032,3 @@ extern posh_i64_t POSH_ReadI64FromBig( const void *src );
#ifdef __cplusplus
}
#endif

@ -38,9 +38,12 @@ ENDIF(NVCORE_SHARED)
TARGET_LINK_LIBRARIES(nvcore ${LIBS})
# On NetBSD backtrace() is provided by libexecinfo, not libc.
if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
TARGET_LINK_LIBRARIES(nvcore execinfo)
endif()
INSTALL(TARGETS nvcore
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static)

@ -51,7 +51,7 @@
# endif
#endif
#if NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
#if NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_NETBSD || NV_OS_OPENBSD
# include <sys/types.h>
# include <sys/param.h>
# include <sys/sysctl.h> // sysctl
@ -635,6 +635,19 @@ namespace
# else
# error "Unknown CPU"
# endif
#elif NV_OS_NETBSD
# if NV_CPU_X86_64
ucontext_t * ucp = (ucontext_t *)secret;
return (void *)ucp->uc_mcontext.__gregs[_REG_RIP];
# elif NV_CPU_X86
ucontext_t * ucp = (ucontext_t *)secret;
return (void *)ucp->uc_mcontext.__gregs[_REG_EIP];
# elif NV_CPU_PPC
ucontext_t * ucp = (ucontext_t *)secret;
return (void *) ucp->uc_mcontext.__gregs[_REG_PC];
# else
# error "Unknown CPU"
# endif
#elif NV_OS_OPENBSD
# if NV_CPU_X86_64
ucontext_t * ucp = (ucontext_t *)secret;
@ -666,7 +679,7 @@ namespace
// How to obtain the instruction pointers in different platforms, from mlton's source code.
// http://mlton.org/
// OpenBSD && NetBSD
// OpenBSD
// ucp->sc_eip
// FreeBSD:
// ucp->uc_mcontext.mc_eip

@ -44,6 +44,9 @@
#elif defined POSH_OS_FREEBSD
# define NV_OS_FREEBSD 1
# define NV_OS_UNIX 1
#elif defined POSH_OS_NETBSD
# define NV_OS_NETBSD 1
# define NV_OS_UNIX 1
#elif defined POSH_OS_OPENBSD
# define NV_OS_OPENBSD 1
# define NV_OS_UNIX 1
@ -290,7 +293,7 @@ NV_COMPILER_CHECK(sizeof(uint32) == 4);
#elif NV_CC_GNUC
# if NV_OS_LINUX
# include "DefsGnucLinux.h"
# elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
# elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_NETBSD || NV_OS_OPENBSD
# include "DefsGnucDarwin.h"
# elif NV_OS_MINGW
# include "DefsGnucWin32.h"

@ -172,7 +172,7 @@ namespace nv
{
#if NV_OS_WIN32 || NV_OS_XBOX
return _finite(f) != 0;
#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD || NV_OS_ORBIS
#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_NETBSD || NV_OS_OPENBSD || NV_OS_ORBIS
return isfinite(f);
#elif NV_OS_LINUX
return finitef(f);
@ -187,7 +187,7 @@ namespace nv
{
#if NV_OS_WIN32 || NV_OS_XBOX
return _isnan(f) != 0;
#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD || NV_OS_ORBIS
#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_NETBSD || NV_OS_OPENBSD || NV_OS_ORBIS
return isnan(f);
#elif NV_OS_LINUX
return isnanf(f);

@ -88,7 +88,7 @@ uint nv::processorCount() {
return 6;
#elif NV_OS_XBOX
return 3; // or 6?
#elif NV_OS_LINUX // Linux, Solaris, & AIX
#elif NV_OS_LINUX || NV_OS_NETBSD // Linux, Solaris, & AIX
return sysconf(_SC_NPROCESSORS_ONLN);
#elif NV_OS_DARWIN || NV_OS_FREEBSD || NV_OS_OPENBSD
int numCPU;
@ -329,4 +329,4 @@ uint nv::physicalProcessorCount() {
return processorCount();
}
#endif
#endif

Loading…
Cancel
Save