From 4e63b82f5eda8995a2b5cd09d64304ac9e30dbd6 Mon Sep 17 00:00:00 2001 From: Yang Liu Date: Thu, 5 Sep 2024 17:07:27 +0800 Subject: [CI] Refactored CI (#1795) * [CI] Enable Box32 tests on LA64 * upgrade QEMU * [COSIM] Removed thread-safe tests * Use regular cosim in CI * [CI] Simplified "Test Box64" * exclude certain tests when testing with cosim * review * box64.pod too --- src/box64context.c | 4 --- src/core.c | 6 ++-- src/dynarec/arm64/dynarec_arm64_00.c | 2 -- src/dynarec/arm64/dynarec_arm64_0f.c | 1 - src/dynarec/la64/dynarec_la64_00.c | 2 -- src/dynarec/la64/dynarec_la64_0f.c | 1 - src/dynarec/rv64/dynarec_rv64_00_1.c | 1 - src/dynarec/rv64/dynarec_rv64_00_3.c | 1 - src/dynarec/rv64/dynarec_rv64_0f.c | 1 - src/emu/x64emu_private.h | 1 - src/emu/x64run.c | 55 +----------------------------------- src/emu/x64run0f.c | 28 ------------------ src/emu/x64run64.c | 3 -- src/emu/x64run66.c | 3 -- src/emu/x64run67.c | 3 -- src/emu/x64runavx0f.c | 6 ---- src/emu/x64test.c | 16 ----------- src/include/dynarec.h | 1 - 18 files changed, 3 insertions(+), 132 deletions(-) (limited to 'src') diff --git a/src/box64context.c b/src/box64context.c index b52e41e3..d2cd150a 100644 --- a/src/box64context.c +++ b/src/box64context.c @@ -223,10 +223,6 @@ box64context_t *NewBox64Context(int argc) init_custommem_helper(context); - #ifdef DYNAREC - x64test_init(); - #endif - context->maplib = NewLibrarian(context); context->local_maplib = NewLibrarian(context); context->versym = NewDictionnary(); diff --git a/src/core.c b/src/core.c index 188102a1..86f6900f 100644 --- a/src/core.c +++ b/src/core.c @@ -649,7 +649,7 @@ void LoadLogEnv() p = getenv("BOX64_DYNAREC_DUMP"); if(p) { if(strlen(p)==1) { - if(p[0]>='0' && p[0]<='2') + if (p[0] >= '0' && p[0] <= '1') box64_dynarec_dump = p[0]-'0'; } if (box64_dynarec_dump) printf_log(LOG_INFO, "Dynarec blocks are dumped%s\n", (box64_dynarec_dump>1)?" in color":""); @@ -870,9 +870,7 @@ void LoadLogEnv() box64_dynarec_x87double = 1; box64_dynarec_div0 = 1; box64_dynarec_callret = 0; - printf_log(LOG_INFO, "Dynarec will compare it's execution with the interpreter%s (%s slow, only for testing)\n", - box64_dynarec_test == 2 ? " thread-safely" : "", - box64_dynarec_test == 2 ? "extremely" : "super"); + printf_log(LOG_INFO, "Dynarec will compare it's execution with the interpreter (super slow, only for testing)\n"); } } diff --git a/src/dynarec/arm64/dynarec_arm64_00.c b/src/dynarec/arm64/dynarec_arm64_00.c index 67a87b5d..a74568eb 100644 --- a/src/dynarec/arm64/dynarec_arm64_00.c +++ b/src/dynarec/arm64/dynarec_arm64_00.c @@ -996,7 +996,6 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; #define GO(GETFLAGS, NO, YES, F) \ - if (box64_dynarec_test == 2) { NOTEST(x1); } \ READFLAGS(F); \ i8 = F8S; \ BARRIER(BARRIER_MAYBE); \ @@ -3151,7 +3150,6 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 0xE9: case 0xEB: BARRIER(BARRIER_MAYBE); - if (box64_dynarec_test == 2) { NOTEST(x1); } if(opcode==0xEB && PK(0)==0xFF) { INST_NAME("JMP ib"); MESSAGE(LOG_DEBUG, "Hack for EB FF opcode"); diff --git a/src/dynarec/arm64/dynarec_arm64_0f.c b/src/dynarec/arm64/dynarec_arm64_0f.c index 8c970f43..225161ce 100644 --- a/src/dynarec/arm64/dynarec_arm64_0f.c +++ b/src/dynarec/arm64/dynarec_arm64_0f.c @@ -1547,7 +1547,6 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; #define GO(GETFLAGS, NO, YES, F) \ - if (box64_dynarec_test == 2) { NOTEST(x1); } \ READFLAGS(F); \ i32_ = F32S; \ BARRIER(BARRIER_MAYBE); \ diff --git a/src/dynarec/la64/dynarec_la64_00.c b/src/dynarec/la64/dynarec_la64_00.c index c6145cf4..8676b006 100644 --- a/src/dynarec/la64/dynarec_la64_00.c +++ b/src/dynarec/la64/dynarec_la64_00.c @@ -583,7 +583,6 @@ uintptr_t dynarec64_00(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni break; #define GO(GETFLAGS, NO, YES, F, I) \ - if (box64_dynarec_test == 2) { NOTEST(x1); } \ READFLAGS(F); \ i8 = F8S; \ BARRIER(BARRIER_MAYBE); \ @@ -1977,7 +1976,6 @@ uintptr_t dynarec64_00(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni case 0xE9: case 0xEB: BARRIER(BARRIER_MAYBE); - if (box64_dynarec_test == 2) { NOTEST(x1); } if (opcode == 0xE9) { INST_NAME("JMP Id"); i32 = F32S; diff --git a/src/dynarec/la64/dynarec_la64_0f.c b/src/dynarec/la64/dynarec_la64_0f.c index 7a0fbf7e..46fea7ed 100644 --- a/src/dynarec/la64/dynarec_la64_0f.c +++ b/src/dynarec/la64/dynarec_la64_0f.c @@ -566,7 +566,6 @@ uintptr_t dynarec64_0F(dynarec_la64_t* dyn, uintptr_t addr, uintptr_t ip, int ni break; #define GO(GETFLAGS, NO, YES, F, I) \ - if (box64_dynarec_test == 2) { NOTEST(x1); } \ READFLAGS(F); \ i32_ = F32S; \ BARRIER(BARRIER_MAYBE); \ diff --git a/src/dynarec/rv64/dynarec_rv64_00_1.c b/src/dynarec/rv64/dynarec_rv64_00_1.c index a361af5f..cb42d0b2 100644 --- a/src/dynarec/rv64/dynarec_rv64_00_1.c +++ b/src/dynarec/rv64/dynarec_rv64_00_1.c @@ -291,7 +291,6 @@ uintptr_t dynarec64_00_1(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int break; #define GO(GETFLAGS, NO, YES, F) \ - if (box64_dynarec_test == 2) { NOTEST(x1); } \ READFLAGS(F); \ i8 = F8S; \ BARRIER(BARRIER_MAYBE); \ diff --git a/src/dynarec/rv64/dynarec_rv64_00_3.c b/src/dynarec/rv64/dynarec_rv64_00_3.c index 3686e357..24a42951 100644 --- a/src/dynarec/rv64/dynarec_rv64_00_3.c +++ b/src/dynarec/rv64/dynarec_rv64_00_3.c @@ -976,7 +976,6 @@ uintptr_t dynarec64_00_3(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int case 0xE9: case 0xEB: BARRIER(BARRIER_MAYBE); - if (box64_dynarec_test == 2) { NOTEST(x1); } if(opcode==0xE9) { INST_NAME("JMP Id"); i32 = F32S; diff --git a/src/dynarec/rv64/dynarec_rv64_0f.c b/src/dynarec/rv64/dynarec_rv64_0f.c index 809b4ac1..434b5a99 100644 --- a/src/dynarec/rv64/dynarec_rv64_0f.c +++ b/src/dynarec/rv64/dynarec_rv64_0f.c @@ -1653,7 +1653,6 @@ uintptr_t dynarec64_0F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni SD(x3, wback, fixedaddress); break; #define GO(GETFLAGS, NO, YES, F) \ - if (box64_dynarec_test == 2) { NOTEST(x1); } \ READFLAGS(F); \ i32_ = F32S; \ BARRIER(BARRIER_MAYBE); \ diff --git a/src/emu/x64emu_private.h b/src/emu/x64emu_private.h index 31303f71..f07f100e 100644 --- a/src/emu/x64emu_private.h +++ b/src/emu/x64emu_private.h @@ -40,7 +40,6 @@ typedef struct x64test_s { int memsize; int test; int clean; - int notest; uint8_t mem[32]; } x64test_t; diff --git a/src/emu/x64run.c b/src/emu/x64run.c index fbb92d1a..6d4742d7 100644 --- a/src/emu/x64run.c +++ b/src/emu/x64run.c @@ -560,19 +560,14 @@ x64emurun: case 0x6D: /* INSD DX */ case 0x6E: /* OUTSB DX */ case 0x6F: /* OUTSD DX */ - #ifndef TEST_INTERPRETER +#ifndef TEST_INTERPRETER emit_signal(emu, SIGSEGV, (void*)R_RIP, 0); STEP; - #else - test->notest = 1; #endif break; GOCOND(0x70 , tmp8s = F8S; CHECK_FLAGS(emu); - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif , addr += tmp8s; ,,STEP2 ) /* Jxx Ib */ @@ -1336,16 +1331,10 @@ x64emurun: addr = rex.is32bits?Pop32(emu):Pop64(emu); R_RSP += tmp16u; STEP2 - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0xC3: /* RET */ addr = rex.is32bits?Pop32(emu):Pop64(emu); STEP2 - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0xC4: /* LES Gd,Ed */ nextop = F8; @@ -1496,8 +1485,6 @@ x64emurun: x64Int3(emu, &addr); if(emu->quit) goto fini; // R_RIP is up to date when returning from x64Int3 addr = R_RIP; - #else - test->notest = 1; #endif break; case 0xCD: /* INT n */ @@ -1520,23 +1507,17 @@ x64emurun: #ifndef TEST_INTERPRETER x86Syscall(emu); STEP2; - #else - test->notest = 1; #endif } else if (tmp8u==0x03) { R_RIP = addr; #ifndef TEST_INTERPRETER emit_signal(emu, SIGTRAP, NULL, 3); STEP2; - #else - test->notest = 1; #endif } else { #ifndef TEST_INTERPRETER emit_interruption(emu, tmp8u, (void*)R_RIP); STEP2; - #else - test->notest = 1; #endif } break; @@ -1570,8 +1551,6 @@ x64emurun: #ifndef TEST_INTERPRETER if(is32bits) running32bits = 1; - #else - test->notest = 1; #endif break; case 0xD0: /* GRP2 Eb,1 */ @@ -1817,8 +1796,6 @@ x64emurun: #ifndef TEST_INTERPRETER emit_signal(emu, SIGSEGV, (void*)R_RIP, 0); STEP; - #else - test->notest = 1; #endif break; case 0xE8: /* CALL Id */ @@ -1833,9 +1810,6 @@ x64emurun: addr += tmp32s; addr = (uintptr_t)getAlternate((void*)addr); STEP2 - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0xE9: /* JMP Id */ tmp32s = F32S; // jmp is relative @@ -1845,18 +1819,12 @@ x64emurun: addr += tmp32s; addr = (uintptr_t)getAlternate((void*)addr); STEP2 - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0xEB: /* JMP Ib */ tmp32s = F8S; // jump is relative addr += tmp32s; STEP2 - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0xEC: /* IN AL, DX */ case 0xED: /* IN EAX, DX */ @@ -1866,8 +1834,6 @@ x64emurun: #ifndef TEST_INTERPRETER emit_signal(emu, SIGSEGV, (void*)R_RIP, 0); STEP; - #else - test->notest = 1; #endif break; case 0xF0: /* LOCK prefix */ @@ -1897,8 +1863,6 @@ x64emurun: #ifndef TEST_INTERPRETER emit_signal(emu, SIGSEGV, (void*)R_RIP, 0); STEP; - #else - test->notest = 1; #endif break; case 0xF5: /* CMC */ @@ -1936,9 +1900,6 @@ x64emurun: if(!EB->byte[0]) emit_div0(emu, (void*)R_RIP, 0); idiv8(emu, EB->byte[0]); - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; } break; @@ -1974,9 +1935,6 @@ x64emurun: if(!ED->q[0]) emit_div0(emu, (void*)R_RIP, 0); idiv64(emu, ED->q[0]); - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; } } else { @@ -2037,17 +1995,11 @@ x64emurun: // this is a privilege opcode emit_signal(emu, SIGSEGV, (void*)R_RIP, 0); STEP; - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0xFB: /* STI */ // this is a privilege opcode emit_signal(emu, SIGSEGV, (void*)R_RIP, 0); STEP; - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0xFC: /* CLD */ CLEAR_FLAG(F_DF); @@ -2106,9 +2058,6 @@ x64emurun: } addr = tmp64u; STEP2 - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 3: /* CALL FAR Ed */ GETET(0); @@ -2133,8 +2082,6 @@ x64emurun: #ifndef TEST_INTERPRETER if(is32bits) running32bits = 1; - #else - test->notest = 1; #endif } break; diff --git a/src/emu/x64run0f.c b/src/emu/x64run0f.c index 4f12e615..1e54db04 100644 --- a/src/emu/x64run0f.c +++ b/src/emu/x64run0f.c @@ -94,8 +94,6 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) if(R_RCX) { #ifndef TEST_INTERPRETER emit_signal(emu, SIGILL, (void*)R_RIP, 0); - #else - test->notest = 1; #endif } else { R_RAX = 0b111; // x87 & SSE & AVX for now @@ -119,9 +117,6 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) R_RAX = tmp64u & 0xffffffff; R_RDX = tmp64u >> 32; R_RCX = helper_getcpu(emu); - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; default: return 0; @@ -156,8 +151,6 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) #ifndef TEST_INTERPRETER R_RIP = addr; x64Syscall(emu); - #else - test->notest = 1; #endif break; case 0x06: /* CLTS */ @@ -172,16 +165,12 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) // this is a privilege opcode... #ifndef TEST_INTERPRETER emit_signal(emu, SIGSEGV, (void*)R_RIP, 0); - #else - test->notest = 1; #endif break; case 0x0B: /* UD2 */ #ifndef TEST_INTERPRETER emit_signal(emu, SIGILL, (void*)R_RIP, 0); - #else - test->notest = 1; #endif break; @@ -199,8 +188,6 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) case 0x0E: /* FEMMS */ #ifndef TEST_INTERPRETER emit_signal(emu, SIGILL, (void*)R_RIP, 0); - #else - test->notest = 1; #endif break; @@ -392,9 +379,6 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) tmp64u<<=box64_rdtsc_shift; R_RDX = tmp64u>>32; R_RAX = tmp64u&0xFFFFFFFF; - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0x38: // these are some SSE3 opcodes @@ -710,9 +694,6 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) else GX->f[i] = 1.0f/sqrtf(EX->f[i]); } - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0x53: /* RCPPS Gx, Ex */ nextop = F8; @@ -720,9 +701,6 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) GETGX; for(int i=0; i<4; ++i) GX->f[i] = 1.0f/EX->f[i]; - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0x54: /* ANDPS Gx, Ex */ nextop = F8; @@ -1089,9 +1067,6 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) break; GOCOND(0x80 , tmp32s = F32S; CHECK_FLAGS(emu); - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif , addr += tmp32s; ,, ) /* 0x80 -> 0x8F Jxx */ //STEP3 @@ -1118,9 +1093,6 @@ uintptr_t Run0F(x64emu_t *emu, rex_t rex, uintptr_t addr, int *step) case 0xA2: /* CPUID */ tmp32u = R_EAX; my_cpuid(emu, tmp32u); - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0xA3: /* BT Ed,Gd */ CHECK_FLAGS(emu); diff --git a/src/emu/x64run64.c b/src/emu/x64run64.c index 7ceef8ab..b80a5ef4 100644 --- a/src/emu/x64run64.c +++ b/src/emu/x64run64.c @@ -753,9 +753,6 @@ uintptr_t Run64(x64emu_t *emu, rex_t rex, int seg, uintptr_t addr) break; case 7: /* IDIV Ed */ idiv64(emu, ED->q[0]); - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; } } else { diff --git a/src/emu/x64run66.c b/src/emu/x64run66.c index 89aec17c..b3fffe37 100644 --- a/src/emu/x64run66.c +++ b/src/emu/x64run66.c @@ -850,9 +850,6 @@ uintptr_t Run66(x64emu_t *emu, rex_t rex, int rep, uintptr_t addr) break; case 7: /* IDIV Ed */ idiv64(emu, ED->q[0]); - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; } } else { diff --git a/src/emu/x64run67.c b/src/emu/x64run67.c index f808517d..c8874336 100644 --- a/src/emu/x64run67.c +++ b/src/emu/x64run67.c @@ -462,9 +462,6 @@ uintptr_t Run67(x64emu_t *emu, rex_t rex, int rep, uintptr_t addr) break; case 7: /* IDIV Ed */ idiv64(emu, ED->q[0]); - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; } } else { diff --git a/src/emu/x64runavx0f.c b/src/emu/x64runavx0f.c index 7bf0c306..1b02989b 100644 --- a/src/emu/x64runavx0f.c +++ b/src/emu/x64runavx0f.c @@ -287,9 +287,6 @@ uintptr_t RunAVX_0F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) } } else GY->u128 = 0; - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0x53: /* VRCPPS Gx, Ex */ nextop = F8; @@ -303,9 +300,6 @@ uintptr_t RunAVX_0F(x64emu_t *emu, vex_t vex, uintptr_t addr, int *step) GY->f[i] = 1.0f/EY->f[i]; } else GY->u128 = 0; - #ifdef TEST_INTERPRETER - test->notest = 1; - #endif break; case 0x54: /* VANDPS Gx, Vx, Ex */ nextop = F8; diff --git a/src/emu/x64test.c b/src/emu/x64test.c index 95021ca4..135a120c 100644 --- a/src/emu/x64test.c +++ b/src/emu/x64test.c @@ -22,8 +22,6 @@ #include "bridge.h" #include "signals.h" -static pthread_mutex_t mutex_global_test; - void print_banner(x64emu_t* ref) { printf_log(LOG_NONE, "Warning, difference between %s Interpreter and Dynarec in %p (%02x %02x %02x %02x %02x %02x %02x %02x)\n"\ @@ -154,8 +152,6 @@ void x64test_step(x64emu_t* ref, uintptr_t ip) test->emu = NewX64Emu(my_context, ip, (uintptr_t)ref->init_stack, ref->size_stack, 0); CopyEmu(test->emu, ref); } else { - if (box64_dynarec_test == 2 && test->test && test->clean) - pthread_mutex_unlock(&mutex_global_test); // check if IP is same, else, sync uintptr_t prev_ip = test->emu->ip.q[0]; if(test->clean) @@ -167,20 +163,8 @@ void x64test_step(x64emu_t* ref, uintptr_t ip) // do a dry single step test->memsize = 0; test->clean = 1; - test->notest = 0; ref->old_ip = ip; - if (box64_dynarec_test == 2) pthread_mutex_lock(&mutex_global_test); RunTest(test); - if (box64_dynarec_test == 2 && test->notest) pthread_mutex_unlock(&mutex_global_test); // this will be analyzed next step } - -void x64test_init() -{ - pthread_mutexattr_t attr; - pthread_mutexattr_init(&attr); - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); - pthread_mutex_init(&mutex_global_test, &attr); - pthread_mutexattr_destroy(&attr); -} diff --git a/src/include/dynarec.h b/src/include/dynarec.h index bf72349c..baebd72d 100644 --- a/src/include/dynarec.h +++ b/src/include/dynarec.h @@ -5,7 +5,6 @@ typedef struct x64emu_s x64emu_t; void DynaCall(x64emu_t* emu, uintptr_t addr); // try to use DynaRec... Fallback to EmuCall if no dynarec available -void x64test_init(); void x64test_step(x64emu_t* ref, uintptr_t ip); void x64test_check(x64emu_t* ref, uintptr_t ip); -- cgit 1.4.1