From 42670c0130172da006357ba0f455a2a209bdebf8 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 5 Jun 2021 08:58:51 +0200 Subject: Fixed BT/BTC/BTR/BTS opcodes ([DYNAREC] too) --- src/emu/x64run0f.c | 43 +++++++++++++--------------------- src/emu/x64run660f.c | 66 ++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 67 insertions(+), 42 deletions(-) (limited to 'src/emu') diff --git a/src/emu/x64run0f.c b/src/emu/x64run0f.c index 887ca31c..30c89c0b 100644 --- a/src/emu/x64run0f.c +++ b/src/emu/x64run0f.c @@ -712,19 +712,19 @@ int Run0F(x64emu_t *emu, rex_t rex) nextop = F8; GETED(0); GETGD; - tmp8u = GD->byte[0]; + tmp32s = GD->sdword[0]; + tmp8u=tmp32s&(rex.w?63:31); + tmp32s >>= (rex.w?6:5); if(!MODREG) { - ED=(reg64_t*)(((uint32_t*)(ED))+(tmp8u>>5)); + ED=(reg64_t*)(((uintptr_t)(ED))+(tmp32s<<(rex.w?3:2))); } if(rex.w) { - tmp8u&=63; if(ED->q[0] & (1LL<dword[0] & (1<byte[0]; + tmp32s = GD->sdword[0]; + tmp8u=tmp32s&(rex.w?63:31); + tmp32s >>= (rex.w?6:5); if(!MODREG) { - ED=(reg64_t*)(((uint32_t*)(ED))+(tmp8u>>5)); + ED=(reg64_t*)(((uintptr_t)(ED))+(tmp32s<<(rex.w?3:2))); } if(rex.w) { - tmp8u&=63; if(ED->q[0] & (1LL<dword[0] & (1<byte[0]; + tmp32s = GD->sdword[0]; + tmp8u=tmp32s&(rex.w?63:31); + tmp32s >>= (rex.w?6:5); if(!MODREG) { - ED=(reg64_t*)(((uint32_t*)(ED))+(tmp8u>>5)); + ED=(reg64_t*)(((uintptr_t)(ED))+(tmp32s<<(rex.w?3:2))); } if(rex.w) { - tmp8u&=63; if(ED->q[0] & (1LL<q[0] ^= (1LL<dword[0] & (1<dword[0] ^= (1<>5)); if(rex.w) { tmp8u&=63; if(ED->q[0] & (1LL<>5)); if(rex.w) { tmp8u&=63; if(ED->q[0] & (1LL<>5)); if(rex.w) { tmp8u&=63; if(ED->q[0] & (1LL<>5)); if(rex.w) { tmp8u&=63; if(ED->q[0] & (1LL<byte[0]; + tmp32s = GD->sdword[0]; + tmp8u=tmp32s&(rex.w?63:31); + tmp32s >>= (rex.w?6:5); if(!MODREG) { - if(rex.w) - ED=(reg64_t*)(((uint64_t*)(ED))+(tmp8u>>6)); - else - ED=(reg64_t*)(((uint32_t*)(ED))+(tmp8u>>5)); + ED=(reg64_t*)(((uintptr_t)(ED))+(tmp32s<<(rex.w?3:2))); } if(rex.w) { - tmp8u&=63; if(ED->q[0] & (1LL<q[0] ^= (1LL<dword[0] & (1<sdword[0]:GW->sword[0]; + tmp8u=tmp32s&(rex.w?63:15); + tmp32s >>= (rex.w?6:4); + if(!MODREG) + { + EW=(reg64_t*)(((uintptr_t)(EW))+(tmp32s<<(rex.w?3:1))); + } if(rex.w) { - if(EW->q[0] & (1LL<<(GW->q[0]&63))) + if(EW->q[0] & (1LL<word[0] & (1<<(GW->word[0]&15))) + if(EW->word[0] & (1<sdword[0]:GW->sword[0]; + tmp8u=tmp32s&(rex.w?63:15); + tmp32s >>= (rex.w?6:4); + if(!MODREG) + { + EW=(reg64_t*)(((uintptr_t)(EW))+(tmp32s<<(rex.w?3:1))); + } if(rex.w) { - if(EW->q[0] & (1LL<<(GW->q[0]&63))) + if(EW->q[0] & (1LL<q[0] |= (1LL<<(GW->q[0]&63)); + EW->q[0] |= (1LL<word[0] & (1<<(GW->word[0]&15))) + if(EW->word[0] & (1<word[0] |= (1<<(GW->word[0]&15)); + EW->word[0] |= (1<sdword[0]:GW->sword[0]; + tmp8u=tmp32s&(rex.w?63:15); + tmp32s >>= (rex.w?6:4); + if(!MODREG) + { + EW=(reg64_t*)(((uintptr_t)(EW))+(tmp32s<<(rex.w?3:1))); + } if(rex.w) { - if(EW->q[0] & (1LL<<(GW->q[0]&63))) { + if(EW->q[0] & (1LL<q[0] ^= (1LL<<(GW->q[0]&63)); + EW->q[0] ^= (1LL<word[0] & (1<<(GW->word[0]&15))) { + if(EW->word[0] & (1<word[0] ^= (1<<(GW->word[0]&15)); + EW->word[0] ^= (1<word[0] & (1<<(GW->word[0]&15))) - SET_FLAG(F_CF); - else - CLEAR_FLAG(F_CF); - EW->word[0] ^= (1<<(GW->word[0]&15)); + tmp32s = rex.w?GW->sdword[0]:GW->sword[0]; + tmp8u=tmp32s&(rex.w?63:15); + tmp32s >>= (rex.w?6:4); + if(!MODREG) + { + EW=(reg64_t*)(((uintptr_t)(EW))+(tmp32s<<(rex.w?3:1))); + } + if(rex.w) { + if(EW->q[0] & (1LL<q[0] ^= (1LL<word[0] & (1<word[0] ^= (1<