summary refs log tree commit diff stats
path: root/include/qemu/cacheflush.h
diff options
context:
space:
mode:
authorKohei Tokunaga <ktokunaga.mail@gmail.com>2025-04-28 15:39:00 +0900
committerPaolo Bonzini <pbonzini@redhat.com>2025-05-06 16:02:04 +0200
commit4c7c05171902d2da678f85c035efdf412ce91c4f (patch)
tree1af42823f73d6b63f3e4397cd68763375fa1712c /include/qemu/cacheflush.h
parent4cd5a25557cab10f8ef81407bed0dd6512526c1c (diff)
downloadfocaccia-qemu-4c7c05171902d2da678f85c035efdf412ce91c4f.tar.gz
focaccia-qemu-4c7c05171902d2da678f85c035efdf412ce91c4f.zip
util/cacheflush.c: Update cache flushing mechanism for Emscripten
Although __builtin___clear_cache is used to flush the instruction cache for
a specified memory region, this operation doesn't apply to wasm, as its
memory isn't executable. Moreover, Emscripten does not support this builtin
and fails to compile it with the following error.

> fatal error: error in backend: llvm.clear_cache is not supported on wasm

To resolve this, this commit removes the call to __builtin___clear_cache for
Emscripten build.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/2926a798fa52a3a5b11c3df4edd1643d2b7cdcb9.1745820062.git.ktokunaga.mail@gmail.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'include/qemu/cacheflush.h')
-rw-r--r--include/qemu/cacheflush.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/qemu/cacheflush.h b/include/qemu/cacheflush.h
index ae20bcda73..76eb55d818 100644
--- a/include/qemu/cacheflush.h
+++ b/include/qemu/cacheflush.h
@@ -26,6 +26,13 @@ static inline void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t len)
     /* icache is coherent and does not require flushing. */
 }
 
+#elif defined(EMSCRIPTEN)
+
+static inline void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t len)
+{
+    /* Wasm doesn't have executable region of memory. */
+}
+
 #else
 
 void flush_idcache_range(uintptr_t rx, uintptr_t rw, size_t len);