From patchwork Fri Apr 9 17:46:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 50159 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 74D5BB7D2F for ; Thu, 15 Apr 2010 00:26:50 +1000 (EST) Received: from localhost ([127.0.0.1]:56521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O23YF-00081K-9g for incoming@patchwork.ozlabs.org; Wed, 14 Apr 2010 10:26:47 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O23V8-0007I3-Uv for qemu-devel@nongnu.org; Wed, 14 Apr 2010 10:23:35 -0400 Received: from [140.186.70.92] (port=37273 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O23V4-0007Gj-LV for qemu-devel@nongnu.org; Wed, 14 Apr 2010 10:23:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O23V2-0006bi-01 for qemu-devel@nongnu.org; Wed, 14 Apr 2010 10:23:30 -0400 Received: from are.twiddle.net ([75.149.56.221]:43810) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O23V1-0006a8-Lf for qemu-devel@nongnu.org; Wed, 14 Apr 2010 10:23:27 -0400 Received: by are.twiddle.net (Postfix, from userid 5000) id 161BDD91; Wed, 14 Apr 2010 07:16:20 -0700 (PDT) Message-Id: <4752d21224bc25924dee4123b4c4d3b335de0a00.1271253049.git.rth@twiddle.net> In-Reply-To: References: From: Richard Henderson Date: Fri, 9 Apr 2010 10:46:40 -0700 To: qemu-devel@nongnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: aurelien@aurel32.net Subject: [Qemu-devel] [PATCH 2/6] tcg-hppa: Fix GUEST_BASE initialization in prologue. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- tcg/hppa/tcg-target.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tcg/hppa/tcg-target.c b/tcg/hppa/tcg-target.c index c9410b2..ffdaf00 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); }