[compiler-rt] r263832 - builtins: port __clear_cache to Windows ARM

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 18 14:06:03 PDT 2016


Author: compnerd
Date: Fri Mar 18 16:06:03 2016
New Revision: 263832

URL: http://llvm.org/viewvc/llvm-project?rev=263832&view=rev
Log:
builtins: port __clear_cache to Windows ARM

Support __clear_cache on Windows on ARM using the `FlushInstructionCache`
library call.

Modified:
    compiler-rt/trunk/lib/builtins/clear_cache.c

Modified: compiler-rt/trunk/lib/builtins/clear_cache.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/clear_cache.c?rev=263832&r1=263831&r2=263832&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/clear_cache.c (original)
+++ compiler-rt/trunk/lib/builtins/clear_cache.c Fri Mar 18 16:06:03 2016
@@ -14,6 +14,15 @@
 #if __APPLE__
   #include <libkern/OSCacheControl.h>
 #endif
+
+#if defined(_WIN32)
+/* Forward declare Win32 APIs since the GCC mode driver does not handle the
+   newer SDKs as well as needed.  */
+uint32_t FlushInstructionCache(uintptr_t hProcess, void *lpBaseAddress,
+                               uintptr_t dwSize);
+uintptr_t GetCurrentProcess(void);
+#endif
+
 #if (defined(__FreeBSD__) || defined(__Bitrig__)) && defined(__arm__)
   #include <sys/types.h>
   #include <machine/sysarch.h>
@@ -109,6 +118,8 @@ void __clear_cache(void *start, void *en
          if (start_reg != 0) {
              compilerrt_abort();
          }
+    #elif defined(_WIN32)
+        FlushInstructionCache(GetCurrentProcess(), start, end - start);
     #else
         compilerrt_abort();
     #endif




More information about the llvm-commits mailing list