On Thu, May 28, 2026 at 6:15 AM Philippe Mathieu-Daudé <[email protected]> wrote: > > Use uint32_t for RV32, uint64_t otherwise. > > Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Alistair Francis <[email protected]> Alistair > --- > target/riscv/cpu_helper.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c > index 6da67e132eb..fd7c6ac1b23 100644 > --- a/target/riscv/cpu_helper.c > +++ b/target/riscv/cpu_helper.c > @@ -1625,16 +1625,18 @@ static int get_physical_address(CPURISCVState *env, > hwaddr *physical, > return TRANSLATE_FAIL; > } > > - target_ulong *pte_pa = qemu_map_ram_ptr(mr->ram_block, addr1); > - target_ulong old_pte; > + void *pte_pa = qemu_map_ram_ptr(mr->ram_block, addr1); > + uint64_t old_pte; > > if (riscv_cpu_sxl(env) == MXL_RV32) { > - old_pte = qatomic_cmpxchg((uint32_t *)pte_pa, cpu_to_le32(pte), > - cpu_to_le32(updated_pte)); > + uint32_t cmp = cpu_to_le32(pte); > + uint32_t val = cpu_to_le32(updated_pte); > + old_pte = qatomic_cmpxchg((uint32_t *)pte_pa, cmp, val); > old_pte = le32_to_cpu(old_pte); > } else { > - old_pte = qatomic_cmpxchg(pte_pa, cpu_to_le64(pte), > - cpu_to_le64(updated_pte)); > + uint64_t cmp = cpu_to_le64(pte); > + uint64_t val = cpu_to_le64(updated_pte); > + old_pte = qatomic_cmpxchg((uint64_t *)pte_pa, cmp, val); > old_pte = le64_to_cpu(old_pte); > } > if (old_pte != pte) { > -- > 2.53.0 > >
