shithub: riscv

Download patch

ref: da759a7fced73d5a75b38be367b42a6269c1c622
parent: e63f13a8de79af905b6db5cd8dc989e33d494832
author: cinap_lenrek <[email protected]>
date: Thu Oct 25 02:55:41 EDT 2012

realemu: fix REP prefix condition

--- a/sys/src/cmd/aux/realemu/xec.c
+++ b/sys/src/cmd/aux/realemu/xec.c
@@ -1067,7 +1067,7 @@
 {
 	if(rep == OREPNE)
 		return (*f & ZF) == 0;
-	return !rep || (*f & ZF) != 0;
+	return (*f & ZF) != 0;
 }
 
 static void
@@ -1098,7 +1098,7 @@
 		d->off += n;
 		d->off &= m;
 		c--;
-		if(repcond(f, i->rep))
+		if(!repcond(f, i->rep))
 			break;
 	}
 	aw(areg(cpu, i->alen, RDI), d->off);
@@ -1135,7 +1135,7 @@
 		d->off += n;
 		d->off &= m;
 		c--;
-		if(repcond(f, i->rep))
+		if(!repcond(f, i->rep))
 			break;
 	}
 	aw(areg(cpu, i->alen, RDI), d->off);