aboutsummaryrefslogtreecommitdiff
path: root/test/msan/test.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/msan/test.h')
-rw-r--r--test/msan/test.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/msan/test.h b/test/msan/test.h
new file mode 100644
index 000000000000..a5dcdfccdaed
--- /dev/null
+++ b/test/msan/test.h
@@ -0,0 +1,15 @@
+#if __LP64__
+# define SANITIZER_WORDSIZE 64
+#else
+# define SANITIZER_WORDSIZE 32
+#endif
+
+// This is a simplified version of GetMaxVirtualAddress function.
+unsigned long SystemVMA () {
+#if SANITIZER_WORDSIZE == 64
+ unsigned long vma = (unsigned long)__builtin_frame_address(0);
+ return SANITIZER_WORDSIZE - __builtin_clzll(vma);
+#else
+ return SANITIZER_WORDSIZE;
+#endif
+}