From 76cb02ef4654d4f0905e595e8f2a18cd25390b21 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Fri, 16 Oct 2020 22:41:13 -0400 Subject: [PATCH] Try Different Cache API --- mods/src/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/src/core.c b/mods/src/core.c index 64fb2e2..ad3a44b 100644 --- a/mods/src/core.c +++ b/mods/src/core.c @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include @@ -70,7 +72,10 @@ void _patch(const char *file, int line, void *start, unsigned char patch[]) { mprotect((void *) page_start, end - page_start, PROT_READ | PROT_EXEC); - __builtin___clear_cache(start, (void *) end); + if (cacheflush(start, 4, ICACHE) != 0) { + fprintf(stderr, "Error Flushing Cache: %s\n", strerror(errno)); + exit(1); + } } void _patch_address(const char *file, int line, void *start, void *target) {