Try Different Cache API

This commit is contained in:
TheBrokenRail 2020-10-16 22:41:13 -04:00
parent e501391142
commit 76cb02ef46

View File

@ -3,6 +3,8 @@
#include <unistd.h> #include <unistd.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <stdint.h> #include <stdint.h>
#include <asm/cachectl.h>
#include <errno.h>
#include <libcore/libcore.h> #include <libcore/libcore.h>
@ -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); 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) { void _patch_address(const char *file, int line, void *start, void *target) {