* [Qemu-devel] [patch] Alpha : fix cmpbge instruction
@ 2008-11-10 6:48 Vince Weaver
2008-11-10 11:11 ` Aurelien Jarno
0 siblings, 1 reply; 2+ messages in thread
From: Vince Weaver @ 2008-11-10 6:48 UTC (permalink / raw)
To: qemu-devel
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)
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [patch] Alpha : fix cmpbge instruction
2008-11-10 6:48 [Qemu-devel] [patch] Alpha : fix cmpbge instruction Vince Weaver
@ 2008-11-10 11:11 ` Aurelien Jarno
0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2008-11-10 11:11 UTC (permalink / raw)
To: qemu-devel
On Mon, Nov 10, 2008 at 01:48:28AM -0500, Vince Weaver wrote:
> 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
Thanks, applied.
> 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)
>
>
>
>
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-10 11:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-10 6:48 [Qemu-devel] [patch] Alpha : fix cmpbge instruction Vince Weaver
2008-11-10 11:11 ` Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).