summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2016-03-18 21:06:03 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2016-03-18 21:06:03 +0000
commitc6ba55378e7008a3e3f158566202c5acfc2765c7 (patch)
treef1f160cfbadf9b93d7fb8c87386adf416fd93cad /lib
parent06e9031f0f5eb6f30be8c28cb2a25b8a27855994 (diff)
downloadcompiler-rt-c6ba55378e7008a3e3f158566202c5acfc2765c7.tar.gz
builtins: port __clear_cache to Windows ARM
Support __clear_cache on Windows on ARM using the `FlushInstructionCache` library call. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@263832 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/builtins/clear_cache.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/builtins/clear_cache.c b/lib/builtins/clear_cache.c
index 80bebd036..752d8abe4 100644
--- a/lib/builtins/clear_cache.c
+++ b/lib/builtins/clear_cache.c
@@ -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 *end) {
if (start_reg != 0) {
compilerrt_abort();
}
+ #elif defined(_WIN32)
+ FlushInstructionCache(GetCurrentProcess(), start, end - start);
#else
compilerrt_abort();
#endif