[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
- [Qemu-ppc] [PATCH 00/14] POWER9 TCG enablements - part10, Nikunj A Dadhania, 2017/01/05
- [Qemu-ppc] [PATCH 02/14] target-ppc: Add xxinsertw instruction, Nikunj A Dadhania, 2017/01/05
- [Qemu-ppc] [PATCH 06/14] target-ppc: Add xsaddqp instructions, Nikunj A Dadhania, 2017/01/05
- [Qemu-ppc] [PATCH 01/14] target-ppc: Add xxextractuw instruction, Nikunj A Dadhania, 2017/01/05
- [Qemu-ppc] [PATCH 09/14] target-ppc: Add xscvdpqp instruction, Nikunj A Dadhania, 2017/01/05
- [Qemu-ppc] [PATCH 08/14] target-ppc: Use correct precision for FPRF setting, Nikunj A Dadhania, 2017/01/05
- [Qemu-ppc] [PATCH 04/14] target-ppc: Replace isden by float64_is_zero_or_denormal, Nikunj A Dadhania, 2017/01/05
- [Qemu-ppc] [PATCH 07/14] target-ppc: Add xscvdphp, xscvhpdp, Nikunj A Dadhania, 2017/01/05
- [Qemu-ppc] [PATCH 10/14] target-ppc: Add xscvqpdp instruction, Nikunj A Dadhania, 2017/01/05
- [Qemu-ppc] [PATCH 03/14] target-ppc: Use float64 arg in helper_compute_fprf(), Nikunj A Dadhania, 2017/01/05