qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [patch] Alpha : fix cmpbge instruction


From: Vince Weaver
Subject: [Qemu-devel] [patch] Alpha : fix cmpbge instruction
Date: Mon, 10 Nov 2008 01:48:28 -0500 (EST)

Hello

The cmpbge instruction should compare all 8 bytes of one 64-bit value with
another.  However, we were looping with a < 7 condition which was skipping
the top byte.  So if we were doing a compare where the top byte was
important, we could get the wrong result (this notably breaks the strlen()
function with certain sized strings).

Attached is a patch

Index: target-alpha/op_helper.c
===================================================================
--- target-alpha/op_helper.c    (revision 5666)
+++ target-alpha/op_helper.c    (working copy)
@@ -330,7 +330,7 @@
     int i;

     res = 0;
-    for (i = 0; i < 7; i++) {
+    for (i = 0; i < 8; i++) {
         opa = op1 >> (i * 8);
         opb = op2 >> (i * 8);
         if (opa >= opb)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]