diff mbox

Test for REPE/SCAS with ZF initially clear

Message ID 1282063233-20150-1-git-send-email-avi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Avi Kivity Aug. 17, 2010, 4:40 p.m. UTC
None
diff mbox

Patch

diff --git a/x86/emulator.c b/x86/emulator.c
index 04adce7..d30ca8e 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -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;
+	asm volatile("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;
 	asm volatile("xor %[tmp], %[tmp] \n\t"
 		     "repe/cmpsw"