From: notaz Date: Tue, 4 Jun 2013 22:39:46 +0000 (+0300) Subject: drc: add a test to catch broken platforms early X-Git-Tag: r20~60 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=commitdiff_plain;h=d848b60a3da875fca0b1f2ddf8a4ae9d487d685b drc: add a test to catch broken platforms early --- diff --git a/libpcsxcore/new_dynarec/new_dynarec.c b/libpcsxcore/new_dynarec/new_dynarec.c index 84370089..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 @@ -8005,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() @@ -8039,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<