Skip to contentSkip to conversation

test_x86_emulate: adjust CMPXCHG test

PATCH In review Eugene Korenevsky 2 participants 2 messages Apr 29, 2015 – May 1, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 test_x86_emulate: adjust CMPXCHG test

CMPXCHG: in the case of inequality of the rAX and the operand, need to check CF, PF, AF, SF and OF flags as well.

This adjustment covers the fix of incorrect comparison during CMPXCHG emulation.

---
 tools/tests/x86_emulator/test_x86_emulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/tests/x86_emulator/test_x86_emulator.c +1 -1
index 66d5eff..64a5b2e 100644
@@ -288,7 +288,7 @@ int main(int argc, char **argv)
     rc = x86_emulate(&ctxt, &emulops);
     if ( (rc != X86EMUL_OKAY) || 
          (*res != 0x923456AA) || 
-         ((regs.eflags&0x240) != 0x200) ||
+         ((regs.eflags&0x8d5) != 0x891) ||
          (regs.eax != 0xAABBCCAA) ||
          (regs.ecx != 0xFF) ||
          (regs.eip != (unsigned long)&instr[4]) )
Signature · 1 line
2.0.5
#1 lore raw

tools/tests/x86_emulator/test_x86_emulator.c int main(int argc, char **argv) · line 291

Quoted 9 lines
Quoted 1 line
Quoted 1 line

Eugene Korenevsky <[email protected]> 04/28/15 11:54 PM >>>

tools/tests/x86_emulator/test_x86_emulator.c +0 -0
@@ -288,7 +288,7 @@ int main(int argc, char **argv)
 rc = x86_emulate(&ctxt, &emulops);

if ( (rc != X86EMUL_OKAY) ||
(*res != 0x923456AA) ||

tools/tests/x86_emulator/test_x86_emulator.c +1 -1
-         ((regs.eflags&0x240) != 0x200) ||
+         ((regs.eflags&0x8d5) != 0x891) ||

While not a big problem, without saying so in the commit message the checking that IF didn't accidentally get cleared shouldn't be removed. I'll try to remember to fix this up before committing.

Jan