diff options
| author | Yang Liu <numbksco@gmail.com> | 2024-09-05 17:07:27 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-05 11:07:27 +0200 |
| commit | 4e63b82f5eda8995a2b5cd09d64304ac9e30dbd6 (patch) | |
| tree | 0141a4651e55dd11df71e41b40e45df4106535c2 /src/emu | |
| parent | 6bc2abae3b71ad1aea750fbfb433310f6e45bbac (diff) | |
| download | box64-4e63b82f5eda8995a2b5cd09d64304ac9e30dbd6.tar.gz box64-4e63b82f5eda8995a2b5cd09d64304ac9e30dbd6.zip | |
[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
Diffstat (limited to 'src/emu')
| -rw-r--r-- | src/emu/x64emu_private.h | 1 | ||||
| -rw-r--r-- | src/emu/x64run.c | 55 | ||||
| -rw-r--r-- | src/emu/x64run0f.c | 28 | ||||
| -rw-r--r-- | src/emu/x64run64.c | 3 | ||||
| -rw-r--r-- | src/emu/x64run66.c | 3 | ||||
| -rw-r--r-- | src/emu/x64run67.c | 3 | ||||
| -rw-r--r-- | src/emu/x64runavx0f.c | 6 | ||||
| -rw-r--r-- | src/emu/x64test.c | 16 |
8 files changed, 1 insertions, 114 deletions
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); -} |