aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2010-04-09 10:46:40 -0700
committerAurelien Jarno <aurelien@aurel32.net>2010-04-26 20:06:17 +0200
commit884d348b7bd4c6f1c1993dafd2e89ac31fe4e543 (patch)
treeff2240661a9089737ee3c91646542c8a32d8129b
parent0085bd5161190840ed810d771a63c8a66e7bc380 (diff)
tcg-hppa: Fix GUEST_BASE initialization in prologue.
Load from the guest_base variable rather than embed a constant. Always reserve TCG_GUEST_BASE_REG if guest base support enabled. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r--tcg/hppa/tcg-target.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c
index c9410b20b1..ffdaf004ea 100644
--- a/tcg/hppa/tcg-target.c
+++ b/tcg/hppa/tcg-target.c
@@ -34,10 +34,6 @@ static const char * const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
/* This is an 8 byte temp slot in the stack frame. */
#define STACK_TEMP_OFS -16
-#ifndef GUEST_BASE
-#define GUEST_BASE 0
-#endif
-
#ifdef CONFIG_USE_GUEST_BASE
#define TCG_GUEST_BASE_REG TCG_REG_R16
#else
@@ -1649,9 +1645,13 @@ void tcg_target_qemu_prologue(TCGContext *s)
TCG_REG_SP, -frame_size + i * 4);
}
- if (GUEST_BASE != 0) {
- tcg_out_movi(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG, GUEST_BASE);
- }
+#ifdef CONFIG_USE_GUEST_BASE
+ /* Note that GUEST_BASE can change after the prologue is generated.
+ To combat that, load the value from the variable instead of
+ embedding a constant here. */
+ tcg_out_ld(s, TCG_TYPE_PTR, TCG_GUEST_BASE_REG,
+ TCG_REG_R0, (tcg_target_long)&guest_base);
+#endif
/* Jump to TB, and adjust R18 to be the return address. */
tcg_out32(s, INSN_BLE_SR4 | INSN_R2(TCG_REG_R26));
@@ -1696,9 +1696,9 @@ void tcg_target_init(TCGContext *s)
tcg_regset_set_reg(s->reserved_regs, TCG_REG_DP); /* data pointer */
tcg_regset_set_reg(s->reserved_regs, TCG_REG_SP); /* stack pointer */
tcg_regset_set_reg(s->reserved_regs, TCG_REG_R31); /* ble link reg */
- if (GUEST_BASE != 0) {
- tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
- }
+#ifdef CONFIG_USE_GUEST_BASE
+ tcg_regset_set_reg(s->reserved_regs, TCG_GUEST_BASE_REG);
+#endif
tcg_add_target_add_op_defs(hppa_op_defs);
}