riscv: Use __riscv_flush_icache() on Linux.

This seems to perhaps clear icache on all harts.  Otherwise crashing is
seen.  Not sure what to do on other platforms.
This commit is contained in:
Unknown W. Brackets
2023-02-14 19:59:42 -08:00
parent ada6aa77e0
commit 1ec33ddc04
+8
View File
@@ -18,6 +18,9 @@
#include "ppsspp_config.h"
#include <algorithm>
#include <cstring>
#if PPSSPP_ARCH(RISCV64) && PPSSPP_PLATFORM(LINUX)
#include <sys/cachectl.h>
#endif
#include "Common/BitScan.h"
#include "Common/CPUDetect.h"
#include "Common/RiscVEmitter.h"
@@ -1051,8 +1054,13 @@ void RiscVEmitter::FlushIcache() {
void RiscVEmitter::FlushIcacheSection(const u8 *start, const u8 *end) {
#if PPSSPP_ARCH(RISCV64)
#if PPSSPP_PLATFORM(LINUX)
__riscv_flush_icache((char *)start, (char *)end, 0);
#else
// TODO: This might only correspond to a local hart icache clear, which is no good.
__builtin___clear_cache((char *)start, (char *)end);
#endif
#endif
}
FixupBranch::~FixupBranch() {