target/mips: Pass MemOpIdx argument to Linked Load/Store helpers
In preparation of using the MemOp content in the next commit (thus stopping ignoring it), pass it as MemOpIdx. The helper prototype declaration always took a TCGv_i32 as last argument, correct that. Rename the ignored 'mem_idx' argument on user emulation. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20260417042620.35329-2-philmd@linaro.org>
Philippe Mathieu-Daudé committed
Apr 16, 2026 at 15:29 UTC
859df3673dd09042cb3a713971211bf4371a8f7a
3 files changed
+10
-6
target/mips/helper.h
+2
-2
@@ -10,9 +10,9 @@ DEF_HELPER_4(swl, void, env, tl, tl, int)
10
DEF_HELPER_4(swr, void, env, tl, tl, int)
11
12
#ifndef CONFIG_USER_ONLY
13
-DEF_HELPER_3(ll, tl, env, tl, int)
13
+DEF_HELPER_3(ll, tl, env, tl, i32)
14
#ifdef TARGET_MIPS64
15
-DEF_HELPER_3(lld, tl, env, tl, int)
15
+DEF_HELPER_3(lld, tl, env, tl, i32)
16
#endif
17
#endif
18
target/mips/tcg/ldst_helper.c
+4
-1
@@ -30,8 +30,11 @@
30
#ifndef CONFIG_USER_ONLY
31
32
#define HELPER_LD_ATOMIC(name, insn, almask, do_cast) \
33
-target_ulong helper_##name(CPUMIPSState *env, target_ulong arg, int mem_idx) \
33
+target_ulong helper_##name(CPUMIPSState *env, target_ulong arg, \
34
+ uint32_t memop_idx) \
35
{ \
36
+ MemOpIdx oi = memop_idx; \
37
+ unsigned mem_idx = get_mmuidx(oi); \
38
if (arg & almask) { \
39
if (!(env->hflags & MIPS_HFLAG_DM)) { \
40
env->CP0_BadVAddr = arg; \
target/mips/tcg/translate.c
+4
-3
@@ -1922,7 +1922,7 @@ FOP_CONDNS(s, FMT_S, 32, gen_store_fpr32(ctx, fp0, fd))
1922
/* load/store instructions. */
1923
#ifdef CONFIG_USER_ONLY
1924
#define OP_LD_ATOMIC(insn, memop) \
1925
-static inline void op_ld_##insn(TCGv ret, TCGv arg1, int mem_idx, \
1925
+static inline void op_ld_##insn(TCGv ret, TCGv arg1, int mem_idx_ignored, \
1926
DisasContext *ctx) \
1927
{ \
1928
TCGv t0 = tcg_temp_new(); \
@@ -1932,11 +1932,12 @@ static inline void op_ld_##insn(TCGv ret, TCGv arg1, int mem_idx, \
1932
tcg_gen_st_tl(ret, tcg_env, offsetof(CPUMIPSState, llval)); \
1933
}
1934
#else
1935
-#define OP_LD_ATOMIC(insn, ignored_memop) \
1935
+#define OP_LD_ATOMIC(insn, memop) \
1936
static inline void op_ld_##insn(TCGv ret, TCGv arg1, int mem_idx, \
1937
DisasContext *ctx) \
1938
{ \
1939
- gen_helper_##insn(ret, tcg_env, arg1, tcg_constant_i32(mem_idx)); \
1939
+ MemOpIdx oi = make_memop_idx(memop, mem_idx); \
1940
+ gen_helper_##insn(ret, tcg_env, arg1, tcg_constant_i32(oi)); \
1941
}
1942
#endif
1943
OP_LD_ATOMIC(ll, mo_endian(ctx) | MO_SL);