tcg/riscv: Do not reserve TCG_GUEST_BASE_REG for guest_base zero
authorRichard Henderson <richard.henderson@linaro.org>
Fri, 13 Oct 2023 03:45:36 +0000 (20:45 -0700)
committerRichard Henderson <richard.henderson@linaro.org>
Sun, 22 Oct 2023 23:32:28 +0000 (16:32 -0700)
Fixes: 92c041c59b ("tcg/riscv: Add the prologue generation and register the JIT")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/riscv/tcg-target.c.inc

index d6dbcaf3cbbe93f2415943086564dafd9effce8e..dc71f829d1056ae2d2931fc3a6c4beeb92dddc32 100644 (file)
@@ -2076,8 +2076,10 @@ static void tcg_target_qemu_prologue(TCGContext *s)
     }
 
 #if !defined(CONFIG_SOFTMMU)
-    tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base);
-    tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
+    if (guest_base) {
+        tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, guest_base);
+        tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
+    }
 #endif
 
     /* Call generated code */