Commit 970d622e8ab1de8fdf5762e23e92a2dea9d7d36c
1 parent
e441570f
target-alpha: fix cmpbge instruction
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). (Vince Weaver) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5667 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
1 additions
and
1 deletions
target-alpha/op_helper.c
| @@ -330,7 +330,7 @@ uint64_t helper_cmpbge (uint64_t op1, uint64_t op2) | @@ -330,7 +330,7 @@ uint64_t helper_cmpbge (uint64_t op1, uint64_t op2) | ||
| 330 | int i; | 330 | int i; |
| 331 | 331 | ||
| 332 | res = 0; | 332 | res = 0; |
| 333 | - for (i = 0; i < 7; i++) { | 333 | + for (i = 0; i < 8; i++) { |
| 334 | opa = op1 >> (i * 8); | 334 | opa = op1 >> (i * 8); |
| 335 | opb = op2 >> (i * 8); | 335 | opb = op2 >> (i * 8); |
| 336 | if (opa >= opb) | 336 | if (opa >= opb) |