Skip to contentSkip to conversation

tcg/arm: Fix SIGILL in tcg_out_qemu_st_direct

PATCH In review Joseph Burt 2 participants 2 messages Jan 21, 2024 – Jan 23, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tcg/arm: Fix SIGILL in tcg_out_qemu_st_direct

When tcg_out_qemu_st_{index,direct} were merged, the direct case for MO_64 was omitted, causing qemu_st_i64 to be encoded as 0xffffffff due to underflow when adding h.base and h.index.

Fixes 1df6d611bdc2("tcg/arm: Introduce HostAddress")
---
 tcg/arm/tcg-target.c.inc | 3 +++
 1 file changed, 3 insertions(+)
tcg/arm/tcg-target.c.inc +3 -0
index fc78566494..a9aa8aa91c 100644
@@ -1662,6 +1662,9 @@ static void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, TCGReg datalo,
             } else {
                 tcg_out_strd_r(s, h.cond, datalo, h.base, h.index);
             }
+        } else if (h.index < 0) {
+            tcg_out_st32_12(s, h.cond, datalo, h.base, 0);
+            tcg_out_st32_12(s, h.cond, datahi, h.base, 4);
         } else if (h.index_scratch) {
             tcg_out_st32_rwb(s, h.cond, datalo, h.index, h.base);
             tcg_out_st32_12(s, h.cond, datahi, h.index, 4);
Signature · 1 line
2.42.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Joseph Burt

When tcg_out_qemu_st_{index,direct} were merged, the direct case for MO_64 was omitted, causing qemu_st_i64 to be encoded as 0xffffffff due to underflow when adding h.base and h.index.

Fixes 1df6d611bdc2("tcg/arm: Introduce HostAddress")
---
  tcg/arm/tcg-target.c.inc | 3 +++
  1 file changed, 3 insertions(+)

r~