Commit 598ef9c81a for qemu.org
commit 598ef9c81a7f3a9edefdb71e87ca51fb9a4b28bd
Author: Xu Liu <liuxu@nucleisys.com>
Date: Mon Aug 17 16:30:05 2026 +0800
target/riscv: Make Zcmt JVT loads endian-aware
The Zcmt specification says JVT table entries follow the current data
endianness. Support that behavior as described by the specification so
big-endian guests can use JVT tables stored in big-endian form.
Signed-off-by: Xu Liu <liuxu@nucleisys.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <02050B1BBB8815BE+20260817083005.2392-1-liuxu@nucleisys.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
diff --git a/target/riscv/tcg/zce_helper.c b/target/riscv/tcg/zce_helper.c
index 15bf0a99c8..c6ba4c1a47 100644
--- a/target/riscv/tcg/zce_helper.c
+++ b/target/riscv/tcg/zce_helper.c
@@ -18,12 +18,14 @@
#include "qemu/osdep.h"
#include "cpu.h"
+#include "internals.h"
#include "exec/helper-proto.h"
#include "accel/tcg/cpu-ldst.h"
target_ulong HELPER(cm_jalt)(CPURISCVState *env, uint32_t index)
{
unsigned mmu_index = cpu_mmu_index(env_cpu(env), true);
+ MemOp endian = mo_endian_env(env);
MemOpIdx oi;
#if !defined(CONFIG_USER_ONLY)
@@ -45,11 +47,11 @@ target_ulong HELPER(cm_jalt)(CPURISCVState *env, uint32_t index)
}
if (xlen == 32) {
- oi = make_memop_idx(MO_LEUL, mmu_index);
+ oi = make_memop_idx(MO_UL | endian, mmu_index);
t0 = base + (index << 2);
target = cpu_ldl_code_mmu(env, t0, oi, 0);
} else {
- oi = make_memop_idx(MO_LEUQ, mmu_index);
+ oi = make_memop_idx(MO_UQ | endian, mmu_index);
t0 = base + (index << 3);
target = cpu_ldq_code_mmu(env, t0, oi, 0);
}