[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v11 22/77] target/riscv: rvv-1.0: fix address index overflow bug
From: |
frank . chang |
Subject: |
[PATCH v11 22/77] target/riscv: rvv-1.0: fix address index overflow bug of indexed load/store insns |
Date: |
Fri, 10 Dec 2021 15:56:08 +0800 |
From: Frank Chang <frank.chang@sifive.com>
Replace ETYPE from signed int to unsigned int to prevent index overflow
issue, which would lead to wrong index address.
Signed-off-by: Frank Chang <frank.chang@sifive.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
target/riscv/vector_helper.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/target/riscv/vector_helper.c b/target/riscv/vector_helper.c
index df45c1620c..3da4f3b1e6 100644
--- a/target/riscv/vector_helper.c
+++ b/target/riscv/vector_helper.c
@@ -374,10 +374,10 @@ static target_ulong NAME(target_ulong base, \
return (base + *((ETYPE *)vs2 + H(idx))); \
}
-GEN_VEXT_GET_INDEX_ADDR(idx_b, int8_t, H1)
-GEN_VEXT_GET_INDEX_ADDR(idx_h, int16_t, H2)
-GEN_VEXT_GET_INDEX_ADDR(idx_w, int32_t, H4)
-GEN_VEXT_GET_INDEX_ADDR(idx_d, int64_t, H8)
+GEN_VEXT_GET_INDEX_ADDR(idx_b, uint8_t, H1)
+GEN_VEXT_GET_INDEX_ADDR(idx_h, uint16_t, H2)
+GEN_VEXT_GET_INDEX_ADDR(idx_w, uint32_t, H4)
+GEN_VEXT_GET_INDEX_ADDR(idx_d, uint64_t, H8)
static inline void
vext_ldst_index(void *vd, void *v0, target_ulong base,
--
2.31.1
- [PATCH v11 15/77] target/riscv: rvv-1.0: update check functions, (continued)
- [PATCH v11 15/77] target/riscv: rvv-1.0: update check functions, frank . chang, 2021/12/10
- [PATCH v11 14/77] target/riscv: rvv-1.0: add VMA and VTA, frank . chang, 2021/12/10
- [PATCH v11 16/77] target/riscv: introduce more imm value modes in translator functions, frank . chang, 2021/12/10
- [PATCH v11 13/77] target/riscv: rvv-1.0: add fractional LMUL, frank . chang, 2021/12/10
- [PATCH v11 18/77] target/riscv: rvv-1.0: remove amo operations instructions, frank . chang, 2021/12/10
- [PATCH v11 20/77] target/riscv: rvv-1.0: stride load and store instructions, frank . chang, 2021/12/10
- [PATCH v11 19/77] target/riscv: rvv-1.0: configure instructions, frank . chang, 2021/12/10
- [PATCH v11 24/77] target/riscv: rvv-1.0: load/store whole register instructions, frank . chang, 2021/12/10
- [PATCH v11 21/77] target/riscv: rvv-1.0: index load and store instructions, frank . chang, 2021/12/10
- [PATCH v11 17/77] target/riscv: rvv:1.0: add translation-time nan-box helper function, frank . chang, 2021/12/10
- [PATCH v11 22/77] target/riscv: rvv-1.0: fix address index overflow bug of indexed load/store insns,
frank . chang <=
- [PATCH v11 23/77] target/riscv: rvv-1.0: fault-only-first unit stride load, frank . chang, 2021/12/10
- [PATCH v11 25/77] target/riscv: rvv-1.0: update vext_max_elems() for load/store insns, frank . chang, 2021/12/10
- [PATCH v11 27/77] target/riscv: rvv-1.0: floating-point square-root instruction, frank . chang, 2021/12/10
- [PATCH v11 28/77] target/riscv: rvv-1.0: floating-point classify instructions, frank . chang, 2021/12/10
- [PATCH v11 29/77] target/riscv: rvv-1.0: count population in mask instruction, frank . chang, 2021/12/10
- [PATCH v11 26/77] target/riscv: rvv-1.0: take fractional LMUL into vector max elements calculation, frank . chang, 2021/12/10
- [PATCH v11 30/77] target/riscv: rvv-1.0: find-first-set mask bit instruction, frank . chang, 2021/12/10
- [PATCH v11 34/77] target/riscv: rvv-1.0: allow load element with sign-extended, frank . chang, 2021/12/10
- [PATCH v11 33/77] target/riscv: rvv-1.0: element index instruction, frank . chang, 2021/12/10
- [PATCH v11 31/77] target/riscv: rvv-1.0: set-X-first mask bit instructions, frank . chang, 2021/12/10