xref: /llvm-project/compiler-rt/test/msan/test.h (revision 19074450ee2770684ff3d02e9e8872e49193d80b)
1 #if __LP64__
2 # define SANITIZER_WORDSIZE 64
3 #else
4 # define SANITIZER_WORDSIZE 32
5 #endif
6 
7 // This is a simplified version of GetMaxVirtualAddress function.
SystemVMA()8 unsigned long SystemVMA () {
9 #if SANITIZER_WORDSIZE == 64
10   unsigned long vma = (unsigned long)__builtin_frame_address(0);
11   return SANITIZER_WORDSIZE - __builtin_clzll(vma);
12 #else
13   return SANITIZER_WORDSIZE;
14 #endif
15 }
16