Add support for FreeBSD. Patch by AMDmi3.

This commit is contained in:
castano 2009-03-21 07:44:26 +00:00
parent 0a8de141a6
commit f2090df7a5
3 changed files with 15 additions and 4 deletions

View File

@ -34,7 +34,7 @@
# endif # endif
#endif #endif
#if NV_OS_DARWIN #if NV_OS_DARWIN || NV_OS_FREEBSD
# include <unistd.h> // getpid # include <unistd.h> // getpid
# include <sys/types.h> # include <sys/types.h>
# include <sys/sysctl.h> // sysctl # include <sys/sysctl.h> // sysctl
@ -199,6 +199,14 @@ namespace
return (void *) ucp->uc_mcontext->ss.eip; return (void *) ucp->uc_mcontext->ss.eip;
# endif # endif
# endif # endif
# elif NV_OS_FREEBSD
# if NV_CPU_X86_64
ucontext_t * ucp = (ucontext_t *)secret;
return (void *)ucp->uc_mcontext.mc_rip;
# elif NV_CPU_X86
ucontext_t * ucp = (ucontext_t *)secret;
return (void *)ucp->uc_mcontext.mc_eip;
# endif
# else # else
# if NV_CPU_X86_64 # if NV_CPU_X86_64
// #define REG_RIP REG_INDEX(rip) // seems to be 16 // #define REG_RIP REG_INDEX(rip) // seems to be 16

View File

@ -38,6 +38,9 @@
#if defined POSH_OS_LINUX #if defined POSH_OS_LINUX
# define NV_OS_LINUX 1 # define NV_OS_LINUX 1
# define NV_OS_UNIX 1 # define NV_OS_UNIX 1
#elif defined POSH_OS_FREEBSD
# define NV_OS_FREEBSD 1
# define NV_OS_UNIX 1
#elif defined POSH_OS_CYGWIN32 #elif defined POSH_OS_CYGWIN32
# define NV_OS_CYGWIN 1 # define NV_OS_CYGWIN 1
#elif defined POSH_OS_MINGW #elif defined POSH_OS_MINGW
@ -161,7 +164,7 @@
#elif NV_CC_GNUC #elif NV_CC_GNUC
# if NV_OS_LINUX # if NV_OS_LINUX
# include "DefsGnucLinux.h" # include "DefsGnucLinux.h"
# elif NV_OS_DARWIN # elif NV_OS_DARWIN || NV_OS_FREEBSD
# include "DefsGnucDarwin.h" # include "DefsGnucDarwin.h"
# elif NV_OS_MINGW # elif NV_OS_MINGW
# include "DefsGnucWin32.h" # include "DefsGnucWin32.h"

View File

@ -115,7 +115,7 @@ inline bool isFinite(const float f)
{ {
#if NV_OS_WIN32 #if NV_OS_WIN32
return _finite(f) != 0; return _finite(f) != 0;
#elif NV_OS_DARWIN #elif NV_OS_DARWIN || NV_OS_FREEBSD
return isfinite(f); return isfinite(f);
#elif NV_OS_LINUX #elif NV_OS_LINUX
return finitef(f); return finitef(f);
@ -130,7 +130,7 @@ inline bool isNan(const float f)
{ {
#if NV_OS_WIN32 #if NV_OS_WIN32
return _isnan(f) != 0; return _isnan(f) != 0;
#elif NV_OS_DARWIN #elif NV_OS_DARWIN || NV_OS_FREEBSD
return isnan(f); return isnan(f);
#elif NV_OS_LINUX #elif NV_OS_LINUX
return isnanf(f); return isnanf(f);