qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [PATCH 02/14] target-ppc: Add xxinsertw instruction


From: Nikunj Dadhania
Subject: Re: [Qemu-ppc] [PATCH 02/14] target-ppc: Add xxinsertw instruction
Date: Fri, 6 Jan 2017 09:37:17 +0530

On 6 January 2017 at 03:27, David Gibson <address@hidden> wrote:
> On Thu, Jan 05, 2017 at 04:56:07PM +0530, Nikunj A Dadhania wrote:
>> xxinsertw: VSX Vector Insert Word
>
> I think this still has problems with out of bounds values.
>
>>
>> Signed-off-by: Nikunj A Dadhania <address@hidden>
>> ---
>>  target-ppc/helper.h                 |  1 +
>>  target-ppc/int_helper.c             | 25 +++++++++++++++++++++++++
>>  target-ppc/translate/vsx-impl.inc.c |  5 +++--
>>  target-ppc/translate/vsx-ops.inc.c  |  1 +
>>  4 files changed, 30 insertions(+), 2 deletions(-)
>>

>> +
>> +#if defined(HOST_WORDS_BIGENDIAN)
>> +    ins_index = index;
>> +    for (i = 0; i < es && ins_index < 16; i++, ins_index++) {
>> +        xt.u8[ins_index] = xb.u8[8 - es + i];
>
> Unlike extract, you don't mod the ins_index here.  Which IIUC, means
> for UIMM > 12 you will overwrite data beyond xt, which sounds like a
> very bad thing.

"ins_index < 16" in for loop will take.

>
>> +    }
>> +#else
>> +    ins_index = 15 - index;
>> +    for (i = es - 1; i >= 0 && ins_index >= 0; i--, ins_index--) {

Here "ins_index >= 0" in for loop will take.

>> +        xt.u8[ins_index] = xb.u8[8 + i];
>> +    }
>> +#endif
>> +
>> +    putVSR(xtn, &xt, env);
>> +}
>> +

Regards
Nikunj



reply via email to

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