[PATCH] D45896: [scudo] Read ARM feature bits using Fuchsia APIs.
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 21 09:46:24 PDT 2018
cryptoad updated this revision to Diff 143456.
cryptoad added a comment.
Herald added subscribers: Sanitizers, llvm-commits, delcypher.
Sorry, you were right! The initial version was less complicated.
I'm updating this to fallback to it, with the style changes included.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D45896
Files:
lib/scudo/scudo_utils.cpp
Index: lib/scudo/scudo_utils.cpp
===================================================================
--- lib/scudo/scudo_utils.cpp
+++ lib/scudo/scudo_utils.cpp
@@ -17,7 +17,10 @@
# include <cpuid.h>
#elif defined(__arm__) || defined(__aarch64__)
# include "sanitizer_common/sanitizer_getauxval.h"
-# if SANITIZER_POSIX
+# if SANITIZER_FUCHSIA
+# include <zircon/syscalls.h>
+# include <zircon/features.h>
+# elif SANITIZER_POSIX
# include "sanitizer_common/sanitizer_posix.h"
# include <fcntl.h>
# endif
@@ -110,9 +113,17 @@
}
bool hasHardwareCRC32() {
+#if SANITIZER_FUCHSIA
+ u32 HWCap;
+ zx_status_t Status = zx_system_get_features(ZX_FEATURE_KIND_CPU, &HWCap);
+ if (Status != ZX_OK || (HWCap & ZX_ARM64_FEATURE_ISA_CRC32) == 0)
+ return false;
+ return true;
+#else
if (&getauxval && areBionicGlobalsInitialized())
return !!(getauxval(AT_HWCAP) & HWCAP_CRC32);
return hasHardwareCRC32ARMPosix();
+#endif // SANITIZER_FUCHSIA
}
#else
bool hasHardwareCRC32() { return false; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45896.143456.patch
Type: text/x-patch
Size: 1017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180421/10fb6ba6/attachment.bin>
More information about the llvm-commits
mailing list