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>
Xu Liu committed
Aug 17, 2026 at 16:30 UTC
598ef9c81a7f3a9edefdb71e87ca51fb9a4b28bd
1 file changed
+4
-2
target/riscv/tcg/zce_helper.c
+4
-2
@@ -18,12 +18,14 @@
18
19
#include "qemu/osdep.h"
20
#include "cpu.h"
21
+#include "internals.h"
22
#include "exec/helper-proto.h"
23
#include "accel/tcg/cpu-ldst.h"
24
25
target_ulong HELPER(cm_jalt)(CPURISCVState *env, uint32_t index)
26
{
27
unsigned mmu_index = cpu_mmu_index(env_cpu(env), true);
28
+ MemOp endian = mo_endian_env(env);
29
MemOpIdx oi;
30
31
#if !defined(CONFIG_USER_ONLY)
@@ -45,11 +47,11 @@ target_ulong HELPER(cm_jalt)(CPURISCVState *env, uint32_t index)
47
}
48
49
if (xlen == 32) {
48
- oi = make_memop_idx(MO_LEUL, mmu_index);
50
+ oi = make_memop_idx(MO_UL | endian, mmu_index);
51
t0 = base + (index << 2);
52
target = cpu_ldl_code_mmu(env, t0, oi, 0);
53
} else {
52
- oi = make_memop_idx(MO_LEUQ, mmu_index);
54
+ oi = make_memop_idx(MO_UQ | endian, mmu_index);
55
t0 = base + (index << 3);
56
target = cpu_ldq_code_mmu(env, t0, oi, 0);
57
}