Skip to content

Commit

Permalink
Try the other way with CMPXCHG8B
Browse files Browse the repository at this point in the history
  • Loading branch information
joncampbell123 committed Oct 29, 2024
1 parent 1ecc5fb commit 03f04db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cpu/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4673,8 +4673,8 @@ void CPU_CMPXCHG8B(PhysPt eaa) {
uint32_t hi,lo;

/* NTS: We assume that, if reading doesn't cause a page fault, writing won't either */
hi = (uint32_t)mem_readd(eaa+(PhysPt)4);
lo = (uint32_t)mem_readd(eaa);
hi = (uint32_t)mem_readd(eaa+(PhysPt)4);

#if 0 // it works, shut up now
LOG_MSG("Experimental CMPXCHG8B implementation executed. EDX:EAX=0x%08lx%08lx ECX:EBX=0x%08lx%08lx EA=0x%08lx MEM64=0x%08lx%08lx",
Expand All @@ -4692,14 +4692,14 @@ void CPU_CMPXCHG8B(PhysPt eaa) {
* else, ZF=0 and load memaddr 'eaa' into EDX:EAX */
FillFlags();
if (reg_edx == hi && reg_eax == lo) {
mem_writed(eaa+(PhysPt)4,reg_ecx);
mem_writed(eaa, reg_ebx);
mem_writed(eaa+(PhysPt)4,reg_ecx);
SETFLAGBIT(ZF,true);
}
else {
SETFLAGBIT(ZF,false);
reg_edx = hi;
reg_eax = lo;
reg_edx = hi;
}
}

Expand Down

0 comments on commit 03f04db

Please sign in to comment.