Test for REPE/SCAS with ZF initially clear
PATCH 1/1 Test for REPE/SCAS with ZF initially clear
REPE tests ZF after the string instruction is executed. Try it with ZF initially clear to make sure.
Signed-off-by Avi Kivity <[email protected]>
--- x86/emulator.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
x86/emulator.c +7 -0
@@ -53,6 +53,13 @@ void test_cmps_one(unsigned char *m1, unsigned char *m3) : : "cc");report ("repe/cmpsb (1)" , rcx ==0 && rsi == m1 +30 && rdi == m3 +30 ); + rsi = m1; rdi = m3; rcx =30 ; + asmvolatile ("or $1, %[tmp]\n\t" // clear ZF +"repe/cmpsb" + :"+S" (rsi),"+D" (rdi),"+c" (rcx), [tmp]"=&r" (tmp) + : :"cc" ); +report ("repe/cmpsb (1.zf)" , rcx ==0 && rsi == m1 +30 && rdi == m3 +30 ); + rsi = m1; rdi = m3; rcx =15 ; asmvolatile ("xor %[tmp], %[tmp] \n\t" "repe/cmpsw"
Signature · 1 line
1.7.1