X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fnew_dynarec%2Fnew_dynarec.c;h=d8d89913cded383a84f10c6808cc7bb4faefa381;hp=425591761463d25675a19ffc2ef6f1914e170275;hb=bdd050c3ed792381df2e744fee5b7ee80b93fd68;hpb=c43b5311cb0f9b559b65c94ad4d8f6afaddae27f diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index 42559176..d8d89913 100644 --- a/libpcsxcore/new_dynarec/new_dynarec.c +++ b/libpcsxcore/new_dynarec/new_dynarec.c @@ -21,6 +21,7 @@ #include #include //include for uint64_t #include +#include #include #include "emu_if.h" //emulator interface @@ -44,6 +45,14 @@ #ifdef __BLACKBERRY_QNX__ #undef __clear_cache #define __clear_cache(start,end) msync(start, (size_t)((void*)end - (void*)start), MS_SYNC | MS_CACHE_ONLY | MS_INVALIDATE_ICACHE); +#elif defined(__MACH__) +#include +#define __clear_cache mach_clear_cache +static void __clear_cache(void *start, void *end) { + size_t len = (char *)end - (char *)start; + sys_dcache_flush(start, len); + sys_icache_invalidate(start, len); +} #endif #define MAXBLOCK 4096 @@ -7997,6 +8006,28 @@ void disassemble_inst(int i) static void disassemble_inst(int i) {} #endif // DISASM +#define DRC_TEST_VAL 0x74657374 + +static int new_dynarec_test(void) +{ + int (*testfunc)(void) = (void *)out; + int ret; + emit_movimm(DRC_TEST_VAL,0); // test + emit_jmpreg(14); + literal_pool(0); +#ifdef __arm__ + __clear_cache((void *)testfunc, out); +#endif + SysPrintf("testing if we can run recompiled code..\n"); + ret = testfunc(); + if (ret == DRC_TEST_VAL) + SysPrintf("test passed.\n"); + else + SysPrintf("test failed: %08x\n", ret); + out=(u_char *)BASE_ADDR; + return ret == DRC_TEST_VAL; +} + // clear the state completely, instead of just marking // things invalid like invalidate_all_pages() does void new_dynarec_clear_full() @@ -8031,17 +8062,19 @@ void new_dynarec_clear_full() void new_dynarec_init() { - printf("Init new dynarec\n"); + SysPrintf("Init new dynarec\n"); out=(u_char *)BASE_ADDR; #if BASE_ADDR_FIXED if (mmap (out, 1<