Received: from eggs.gnu.org ([208.118.235.92]:58982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRB9u-0004Zo-NL for qemu-devel@nongnu.org; Sun, 06 May 2012 19:46:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRB9s-0004Z4-5Q for qemu-devel@nongnu.org; Sun, 06 May 2012 19:46:34 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 7 May 2012 01:46:24 +0200 Message-Id: <1336347984-3714-4-git-send-email-afaerber@suse.de> In-Reply-To: <1336347984-3714-1-git-send-email-afaerber@suse.de> References: <1336347984-3714-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH for-1.1 3/3] tcg/ppc: Fix CONFIG_TCG_PASS_AREG0 mode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Adjust the tcg_out_qemu_{ld,st}() slow paths to pass AREG0 in r3. Automate the register numbering to avoid double-coding the two modes, and introduce TCG_TARGET_CALL_ALIGN_I64_ARG() macro to align for SVR4 but not for Darwin ABI. Based on patch by malc. Signed-off-by: Andreas F=C3=A4rber --- tcg/ppc/tcg-target.c | 48 +++++++++++++++++++++++++++++++++-----------= ---- 1 files changed, 33 insertions(+), 15 deletions(-) diff --git a/tcg/ppc/tcg-target.c b/tcg/ppc/tcg-target.c index 5a651ce..ace5548 100644 --- a/tcg/ppc/tcg-target.c +++ b/tcg/ppc/tcg-target.c @@ -39,6 +39,16 @@ static uint8_t *tb_ret_addr; #define LR_OFFSET 4 #endif =20 +#ifdef TCG_TARGET_CALL_ALIGN_ARGS +#define TCG_TARGET_CALL_ALIGN_I64_ARG(reg) do { \ + if (((reg) % 2) =3D=3D 0) { \ + (reg)++; \ + } \ + } while (0) +#else +#define TCG_TARGET_CALL_ALIGN_I64_ARG(reg) do { } while (0) +#endif + #define FAST_PATH =20 #ifndef GUEST_BASE @@ -513,7 +523,6 @@ static void tcg_out_call (TCGContext *s, tcg_target_l= ong arg, int const_arg) #include "../../softmmu_defs.h" =20 #ifdef CONFIG_TCG_PASS_AREG0 -#error CONFIG_TCG_PASS_AREG0 is not supported /* helper signature: helper_ld_mmu(CPUState *env, target_ulong addr, int mmu_idx) */ static const void * const qemu_ld_helpers[4] =3D { @@ -556,7 +565,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCG= Arg *args, int opc) { int addr_reg, data_reg, data_reg2, r0, r1, rbase, bswap; #ifdef CONFIG_SOFTMMU - int mem_index, s_bits, r2; + int mem_index, s_bits, r2, ir; void *label1_ptr, *label2_ptr; #if TARGET_LONG_BITS =3D=3D 64 int addr_reg2; @@ -618,14 +627,20 @@ static void tcg_out_qemu_ld (TCGContext *s, const T= CGArg *args, int opc) #endif =20 /* slow path */ +#ifdef CONFIG_TCG_PASS_AREG0 + tcg_out_mov (s, TCG_TYPE_I32, 3, TCG_AREG0); + ir =3D 4; +#else + ir =3D 3; +#endif #if TARGET_LONG_BITS =3D=3D 32 - tcg_out_mov (s, TCG_TYPE_I32, 3, addr_reg); - tcg_out_movi (s, TCG_TYPE_I32, 4, mem_index); + tcg_out_mov (s, TCG_TYPE_I32, ir++, addr_reg); #else - tcg_out_mov (s, TCG_TYPE_I32, 3, addr_reg2); - tcg_out_mov (s, TCG_TYPE_I32, 4, addr_reg); - tcg_out_movi (s, TCG_TYPE_I32, 5, mem_index); + TCG_TARGET_CALL_ALIGN_I64_ARG (ir); + tcg_out_mov (s, TCG_TYPE_I32, ir++, addr_reg2); + tcg_out_mov (s, TCG_TYPE_I32, ir++, addr_reg); #endif + tcg_out_movi (s, TCG_TYPE_I32, ir, mem_index); =20 tcg_out_call (s, (tcg_target_long) qemu_ld_helpers[s_bits], 1); switch (opc) { @@ -814,13 +829,18 @@ static void tcg_out_qemu_st (TCGContext *s, const T= CGArg *args, int opc) #endif =20 /* slow path */ -#if TARGET_LONG_BITS =3D=3D 32 - tcg_out_mov (s, TCG_TYPE_I32, 3, addr_reg); +#ifdef CONFIG_TCG_PASS_AREG0 + tcg_out_mov (s, TCG_TYPE_I32, 3, TCG_AREG0); ir =3D 4; #else - tcg_out_mov (s, TCG_TYPE_I32, 3, addr_reg2); - tcg_out_mov (s, TCG_TYPE_I32, 4, addr_reg); - ir =3D 5; + ir =3D 3; +#endif +#if TARGET_LONG_BITS =3D=3D 32 + tcg_out_mov (s, TCG_TYPE_I32, ir++, addr_reg); +#else + TCG_TARGET_CALL_ALIGN_I64_ARG (ir); + tcg_out_mov (s, TCG_TYPE_I32, ir++, addr_reg2); + tcg_out_mov (s, TCG_TYPE_I32, ir++, addr_reg); #endif =20 switch (opc) { @@ -844,9 +864,7 @@ static void tcg_out_qemu_st (TCGContext *s, const TCG= Arg *args, int opc) tcg_out_mov (s, TCG_TYPE_I32, ir, data_reg); break; case 3: -#ifdef TCG_TARGET_CALL_ALIGN_ARGS - ir =3D 5; -#endif + TCG_TARGET_CALL_ALIGN_I64_ARG (ir); tcg_out_mov (s, TCG_TYPE_I32, ir++, data_reg2); tcg_out_mov (s, TCG_TYPE_I32, ir, data_reg); break; --=20 1.7.7