[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] target/loongarch: Fix LLSC for LoongArch32
From: |
Jiaxun Yang |
Subject: |
[PATCH 2/3] target/loongarch: Fix LLSC for LoongArch32 |
Date: |
Sun, 22 Dec 2024 23:40:26 +0000 |
gen_ll should use tcg_gen_qemu_ld_tl to load t1, as t1 is
in TCGv which means it should be a tl type value.
gen_sc should use make_address_i to obtain source address
to ensure that address is properly truncated.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
target/loongarch/tcg/insn_trans/trans_atomic.c.inc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/target/loongarch/tcg/insn_trans/trans_atomic.c.inc
b/target/loongarch/tcg/insn_trans/trans_atomic.c.inc
index
974bc2a70feddbf021a07b19a0859781eb3a11c4..4607f19b003ae70e5ca1e5b56b174bd7696d54cd
100644
--- a/target/loongarch/tcg/insn_trans/trans_atomic.c.inc
+++ b/target/loongarch/tcg/insn_trans/trans_atomic.c.inc
@@ -9,7 +9,7 @@ static bool gen_ll(DisasContext *ctx, arg_rr_i *a, MemOp mop)
TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE);
TCGv t0 = make_address_i(ctx, src1, a->imm);
- tcg_gen_qemu_ld_i64(t1, t0, ctx->mem_idx, mop);
+ tcg_gen_qemu_ld_tl(t1, t0, ctx->mem_idx, mop);
tcg_gen_st_tl(t0, tcg_env, offsetof(CPULoongArchState, lladdr));
tcg_gen_st_tl(t1, tcg_env, offsetof(CPULoongArchState, llval));
gen_set_gpr(a->rd, t1, EXT_NONE);
@@ -28,7 +28,8 @@ static bool gen_sc(DisasContext *ctx, arg_rr_i *a, MemOp mop)
TCGLabel *l1 = gen_new_label();
TCGLabel *done = gen_new_label();
- tcg_gen_addi_tl(t0, src1, a->imm);
+ tcg_gen_mov_tl(t0, src1);
+ t0 = make_address_i(ctx, t0, a->imm);
tcg_gen_brcond_tl(TCG_COND_EQ, t0, cpu_lladdr, l1);
tcg_gen_movi_tl(dest, 0);
tcg_gen_br(done);
--
2.43.0
[PATCH 1/3] target/loongarch: Enable rotr.w/rotri.w for LoongArch32, Jiaxun Yang, 2024/12/22
[PATCH 3/3] target/loongarch: Fix PGD CSR for LoongArch32, Jiaxun Yang, 2024/12/22