1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
From: Lennart Weller <lhw@ring0.de>
Date: Tue, 17 May 2016 13:09:46 +0200
Subject: Fix bugs with kFreeBSD/64-bit Architectures/ARM
---
extern/poshlib/posh.h | 5 +++++
src/nvcore/Debug.cpp | 3 ++-
src/nvcore/Debug.h | 2 +-
src/nvcore/nvcore.h | 1 +
4 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/extern/poshlib/posh.h b/extern/poshlib/posh.h
index e401fb8..1151f63 100644
--- a/extern/poshlib/posh.h
+++ b/extern/poshlib/posh.h
@@ -317,6 +317,11 @@ LCC predefines the following:
# define POSH_OS_STRING "NetBSD"
#endif
+#if defined __FreeBSD_kernel__
+# define POSH_OS_FREEBSD 1
+# define POSH_OS_STRING "kFreeBSD"
+#endif
+
#if defined __OpenBSD__
# define POSH_OS_OPENBSD 1
# define POSH_OS_STRING "OpenBSD"
diff --git a/src/nvcore/Debug.h b/src/nvcore/Debug.h
index 48e765e..51311fb 100644
--- a/src/nvcore/Debug.h
+++ b/src/nvcore/Debug.h
@@ -166,7 +166,7 @@ NVCORE_API void NV_CDECL nvDebugPrint( const char *msg, ... ) __attribute__((for
namespace nv
{
inline bool isValidPtr(const void * ptr) {
- #if NV_CPU_X86_64 || POSH_CPU_PPC64 || NV_CPU_AARCH64
+ #if defined NV_POINTER_64
if (ptr == NULL) return true;
if (reinterpret_cast<uint64>(ptr) < 0x10000ULL) return false;
if (reinterpret_cast<uint64>(ptr) >= 0x000007FFFFFEFFFFULL) return false;
diff --git a/src/nvcore/nvcore.h b/src/nvcore/nvcore.h
index 511d23e..158a059 100644
--- a/src/nvcore/nvcore.h
+++ b/src/nvcore/nvcore.h
@@ -166,6 +166,7 @@
// Define the right printf prefix for size_t arguments:
#if POSH_64BIT_POINTER
# define NV_SIZET_PRINTF_PREFIX POSH_I64_PRINTF_PREFIX
+# define NV_POINTER_64
#else
# define NV_SIZET_PRINTF_PREFIX
#endif
|