Skip to content

Commit

Permalink
Added F0 F7 /2 opcode ([ARM64_DYNAREC] too)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Mar 7, 2025
1 parent 946c999 commit c2d0297
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/dynarec/arm64/dynarec_arm64_f0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,34 @@ uintptr_t dynarec64_F0(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin
DEFAULT;
}
break;
case 0xF7:
nextop = F8;
switch((nextop>>3)&7) {
case 2:
INST_NAME("LOCK NOT Ed");
if(MODREG) {
GETED(x1);
MVNw_REG(x1, x1);
EBBACK;
} else {
addr = geted(dyn, addr, ninst, nextop, &wback, x2, &fixedaddress, NULL, 0, 0, rex, LOCK_LOCK, 0, 0);
if(arm64_atomics) {
MOV64x(x1, ~0LL);
STEORLxw(x1, wback);
} else {
MARKLOCK;
LDAXRxw(x1, wback);
MVNw_REG(x1, x1);
STLXRxw(x3, x1, wback);
CBNZx_MARKLOCK(x3);
}
SMDMB();
}
break;
default:
DEFAULT;
}
break;

case 0xFE:
nextop = F8;
Expand Down
36 changes: 36 additions & 0 deletions src/emu/x64runf0.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,42 @@ uintptr_t RunF0(x64emu_t *emu, rex_t rex, uintptr_t addr)
pthread_mutex_lock(&my_context->mutex_lock);
EB->byte[0] = not8(emu, EB->byte[0]);
pthread_mutex_unlock(&my_context->mutex_lock);
#endif
break;
default:
return 0;
}
break;
case 0xF7: /* GRP3 Ed(,Id) */
nextop = F8;
tmp8u = (nextop>>3)&7;
GETED((tmp8u<2)?4:0);
switch(tmp8u) {
case 2: /* NOT Eb */
#if defined(DYNAREC) && !defined(TEST_INTERPRETER)
if(rex.w)
do {
tmp64u = native_lock_read_dd(ED);
tmp64u = not64(emu, tmp64u);
} while(native_lock_write_dd(ED, tmp64u));
else {
do {
tmp32u = native_lock_read_d(ED);
tmp32u = not32(emu, tmp32u);
} while(native_lock_write_d(ED, tmp32u));
if(MODREG) ED->dword[1] = 0;
}
#else
if(rex.w) {
pthread_mutex_lock(&my_context->mutex_lock);
ED->q[0] = not64(emu, ED->q[0]);
pthread_mutex_unlock(&my_context->mutex_lock);
} else {
pthread_mutex_lock(&my_context->mutex_lock);
ED->dword[0] = not32(emu, ED->dword[0]);
pthread_mutex_unlock(&my_context->mutex_lock);
if(MODREG) ED->dword[1] = 0;
}
#endif
break;
default:
Expand Down

0 comments on commit c2d0297

Please sign in to comment.