mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00

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>
42 lines
1,004 B
C
42 lines
1,004 B
C
/*
|
|
* Flush the host cpu caches.
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#ifndef QEMU_CACHEFLUSH_H
|
|
#define QEMU_CACHEFLUSH_H
|
|
|
|
/**
|
|
* flush_idcache_range:
|
|
* @rx: instruction address
|
|
* @rw: data address
|
|
* @len: length to flush
|
|
*
|
|
* Flush @len bytes of the data cache at @rw and the icache at @rx
|
|
* to bring them in sync. The two addresses may be different virtual
|
|
* mappings of the same physical page(s).
|
|
*/
|
|
|
|
#if defined(__i386__) || defined(__x86_64__) || defined(__s390__)
|
|
|
|
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);
|
|
|
|
#endif
|
|
|
|
#endif /* QEMU_CACHEFLUSH_H */
|