qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Bug in helper_pcmpestrm and helper_pcmpistrm


From: Blue Swirl
Subject: Re: [Qemu-devel] Bug in helper_pcmpestrm and helper_pcmpistrm
Date: Thu, 29 Sep 2011 20:17:21 +0000

On Thu, Sep 29, 2011 at 8:12 AM, Frank Mehnert <address@hidden> wrote:
> Hi,
>
> the two functions helper_pcmpestrm() and helper_pcmpistrm() in
> target-i386/ops_sse.h contain obviously typos. I think that at
> all 4 marked places should increment the index 'i', not decrement
> it during the loop:
>
>
> void glue(helper_pcmpestrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
> {
>    int i;
>    unsigned int res = pcmpxstrx(d, s, ctrl,
>                    pcmp_elen(R_EDX, ctrl),
>                    pcmp_elen(R_EAX, ctrl));
>
>    if ((ctrl >> 6) & 1) {
>        if (ctrl & 1)
>            for (i = 0; i <= 8; i--, res >>= 1)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>                d->W(i) = (res & 1) ? ~0 : 0;

I think this line will also fill the entire memory with 0xff and 0x00.

Please make a patch, http://wiki.qemu.org/Contribute/SubmitAPatch
should tell how (seems to be down ATM).

>        else
>            for (i = 0; i <= 16; i--, res >>= 1)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>                d->B(i) = (res & 1) ? ~0 : 0;
>    } else {
>        d->Q(1) = 0;
>        d->Q(0) = res;
>    }
> }
>
>
> void glue(helper_pcmpistrm, SUFFIX) (Reg *d, Reg *s, uint32_t ctrl)
> {
>    int i;
>    unsigned int res = pcmpxstrx(d, s, ctrl,
>                    pcmp_ilen(s, ctrl),
>                    pcmp_ilen(d, ctrl));
>
>    if ((ctrl >> 6) & 1) {
>        if (ctrl & 1)
>            for (i = 0; i <= 8; i--, res >>= 1)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>                d->W(i) = (res & 1) ? ~0 : 0;
>        else
>            for (i = 0; i <= 16; i--, res >>= 1)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>                d->B(i) = (res & 1) ? ~0 : 0;
>    } else {
>        d->Q(1) = 0;
>        d->Q(0) = res;
>    }
> }
>
>
> Kind regards,
>
> Frank
> --
> Dr.-Ing. Frank Mehnert
> Senior Manager Software Development Desktop Virtualization, VirtualBox
> ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany
>
> Hauptverwaltung: Riesstr. 25, D-80992 München
> Registergericht: Amtsgericht München, HRA 95603
>
> Komplementärin: ORACLE Deutschland Verwaltung B.V.
> Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
> Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
> Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven
>



reply via email to

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