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 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
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
@@ -306,6 +306,11 @@ LLVM:
# define POSH_OS_STRING "FreeBSD"
#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.cpp b/src/nvcore/Debug.cpp
index e84522a..533afdd 100644
--- a/src/nvcore/Debug.cpp
+++ b/src/nvcore/Debug.cpp
@@ -1012,7 +1012,8 @@ void debug::dumpCallstack(MessageHandler *messageHandler, int callstackLevelsToS
writeStackTrace(trace, size, callstackLevelsToSkip + 1, lines); // + 1 to skip the call to dumpCallstack
for (uint i = 0; i < lines.count(); i++) {
- messageHandler->log(lines[i], NULL);
+ static va_list empty_va_list;
+ messageHandler->log(lines[i], empty_va_list);
delete lines[i];
}
}
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
+ #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
@@ -153,6 +153,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
|