diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2021-09-22 10:40:38 +0300 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2022-10-31 13:47:33 +0300 |
commit | f74375fdecdb59ef5aaf9c3812f0fbfb1aecacec (patch) | |
tree | 46cf0e2ae429ccbe4c7ef60116639d9edc3ffc6a | |
parent | d89d0f7f26c1a39c5067e7ee9f46b72e51aec1d5 (diff) |
orcarm.c: Implement orc_arm_flush_cache on Windows
Use the Windows API FlushInstructionCache() to flush the CPU cache on ARM64
Windows. As a consequence, include windows.h with WIN32_LEAN_AND_MEAN defined.
-rw-r--r-- | orc/orcarm.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/orc/orcarm.c b/orc/orcarm.c index 94ab88e..21933d4 100644 --- a/orc/orcarm.c +++ b/orc/orcarm.c @@ -18,6 +18,10 @@ #if defined(__APPLE__) #include <libkern/OSCacheControl.h> #endif +#if defined (_WIN32) +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#endif #endif /** @@ -935,6 +939,13 @@ orc_arm_flush_cache (OrcCode *code) #ifdef __APPLE__ sys_dcache_flush(code->code, code->code_size); sys_icache_invalidate(code->exec, code->code_size); +#elif defined (_WIN32) + HANDLE h_proc = GetCurrentProcess(); + + FlushInstructionCache(h_proc, code->code, code->code_size); + + if ((void *) code->exec != (void *) code->code) + FlushInstructionCache(h_proc, code->exec, code->code_size); #else __clear_cache (code->code, code->code + code->code_size); if ((void *) code->exec != (void *) code->code) |