mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-21 17:40:16 +00:00
RISCV: fix flush cache for linux riscv when clang <= 18
for __builtin___clear_cache, clang-18 generates __clear_cache: https://godbolt.org/z/K5Kx6EEhq, which is an empty function. clang-19 can generates __riscv_flush_icache: https://godbolt.org/z/TKe6Kh61a
This commit is contained in:
parent
d9367229e9
commit
62c0a1e7d4
@ -35,6 +35,9 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(__linux__) && defined(CPU_ARCH_RISCV64)
|
||||||
|
#include <sys/cachectl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__linux__) && !defined(MAP_FIXED_NOREPLACE)
|
#if defined(__linux__) && !defined(MAP_FIXED_NOREPLACE)
|
||||||
// Compatibility with old libc.
|
// Compatibility with old libc.
|
||||||
@ -812,7 +815,11 @@ void MemMap::ReleaseJITMemory(void* ptr, size_t size)
|
|||||||
|
|
||||||
void MemMap::FlushInstructionCache(void* address, size_t size)
|
void MemMap::FlushInstructionCache(void* address, size_t size)
|
||||||
{
|
{
|
||||||
|
#if defined(CPU_ARCH_RISCV64) && defined(__linux__) && defined(__clang__) && (__clang_major__ <= 18)
|
||||||
|
__riscv_flush_icache(reinterpret_cast<char*>(address), reinterpret_cast<char*>(address) + size, 0);
|
||||||
|
#else
|
||||||
__builtin___clear_cache(reinterpret_cast<char*>(address), reinterpret_cast<char*>(address) + size);
|
__builtin___clear_cache(reinterpret_cast<char*>(address), reinterpret_cast<char*>(address) + size);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user