void-packages/srcpkgs/ppsspp/patches/riscv-musl.patch

24 lines
781 B
Diff

--- a/Common/RiscVEmitter.cpp 2024-02-04 14:08:02.000000000 +0100
+++ - 2024-02-16 16:49:35.344381020 +0100
@@ -20,6 +20,7 @@
#include <cstring>
#if PPSSPP_ARCH(RISCV64) && PPSSPP_PLATFORM(LINUX)
#include <sys/cachectl.h>
+#include <sys/syscall.h>
#endif
#include "Common/BitScan.h"
#include "Common/CPUDetect.h"
@@ -1139,8 +1140,12 @@
void RiscVEmitter::FlushIcacheSection(const u8 *start, const u8 *end) {
#if PPSSPP_ARCH(RISCV64)
#if PPSSPP_PLATFORM(LINUX)
+#ifdef __GLIBC__
__riscv_flush_icache((char *)start, (char *)end, 0);
#else
+ syscall(__NR_riscv_flush_icache, (char*)start, (char*)end, 0UL);
+#endif
+#else
// TODO: This might only correspond to a local hart icache clear, which is no good.
__builtin___clear_cache((char *)start, (char *)end);
#endif