5544c1b
From 2acbc7d596b022dca4fc147eb89e3d5f297acb1f Mon Sep 17 00:00:00 2001
5544c1b
From: Stefan Weil <sw@weilnetz.de>
5544c1b
Date: Tue, 18 Sep 2012 22:43:38 +0200
5544c1b
Subject: [PATCH] tci: Fix for AREG0 free mode
5544c1b
5544c1b
Support for helper functions with 5 arguments was missing
5544c1b
in the code generator and in the interpreter.
5544c1b
5544c1b
There is no need to pass the constant TCG_AREG0 from the
5544c1b
code generator to the interpreter. Remove that code for
5544c1b
the INDEX_op_qemu_st* opcodes.
5544c1b
5544c1b
Signed-off-by: Stefan Weil <sw@weilnetz.de>
5544c1b
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
5544c1b
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1b
---
5544c1b
 tcg/tci/tcg-target.c | 10 +++++-----
5544c1b
 tci.c                | 13 +++++++++----
5544c1b
 2 files changed, 14 insertions(+), 9 deletions(-)
5544c1b
5544c1b
diff --git a/tcg/tci/tcg-target.c b/tcg/tci/tcg-target.c
5544c1b
index 003244c..c8c2f1d 100644
5544c1b
--- a/tcg/tci/tcg-target.c
5544c1b
+++ b/tcg/tci/tcg-target.c
5544c1b
@@ -300,7 +300,7 @@ static const int tcg_target_reg_alloc_order[] = {
5544c1b
 #endif
5544c1b
 };
5544c1b
 
5544c1b
-#if MAX_OPC_PARAM_IARGS != 4
5544c1b
+#if MAX_OPC_PARAM_IARGS != 5
5544c1b
 # error Fix needed, number of supported input arguments changed!
5544c1b
 #endif
5544c1b
 
5544c1b
@@ -309,16 +309,18 @@ static const int tcg_target_call_iarg_regs[] = {
5544c1b
     TCG_REG_R1,
5544c1b
     TCG_REG_R2,
5544c1b
     TCG_REG_R3,
5544c1b
-#if TCG_TARGET_REG_BITS == 32
5544c1b
-    /* 32 bit hosts need 2 * MAX_OPC_PARAM_IARGS registers. */
5544c1b
 #if 0 /* used for TCG_REG_CALL_STACK */
5544c1b
     TCG_REG_R4,
5544c1b
 #endif
5544c1b
     TCG_REG_R5,
5544c1b
+#if TCG_TARGET_REG_BITS == 32
5544c1b
+    /* 32 bit hosts need 2 * MAX_OPC_PARAM_IARGS registers. */
5544c1b
     TCG_REG_R6,
5544c1b
     TCG_REG_R7,
5544c1b
 #if TCG_TARGET_NB_REGS >= 16
5544c1b
     TCG_REG_R8,
5544c1b
+    TCG_REG_R9,
5544c1b
+    TCG_REG_R10,
5544c1b
 #else
5544c1b
 # error Too few input registers available
5544c1b
 #endif
5544c1b
@@ -798,7 +800,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
5544c1b
     case INDEX_op_qemu_st8:
5544c1b
     case INDEX_op_qemu_st16:
5544c1b
     case INDEX_op_qemu_st32:
5544c1b
-        tcg_out_r(s, TCG_AREG0);
5544c1b
         tcg_out_r(s, *args++);
5544c1b
         tcg_out_r(s, *args++);
5544c1b
 #if TARGET_LONG_BITS > TCG_TARGET_REG_BITS
5544c1b
@@ -809,7 +810,6 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
5544c1b
 #endif
5544c1b
         break;
5544c1b
     case INDEX_op_qemu_st64:
5544c1b
-        tcg_out_r(s, TCG_AREG0);
5544c1b
         tcg_out_r(s, *args++);
5544c1b
 #if TCG_TARGET_REG_BITS == 32
5544c1b
         tcg_out_r(s, *args++);
5544c1b
diff --git a/tci.c b/tci.c
5544c1b
index ce8a988..a4f7b78 100644
5544c1b
--- a/tci.c
5544c1b
+++ b/tci.c
5544c1b
@@ -36,17 +36,19 @@
5544c1b
         tcg_abort(); \
5544c1b
     } while (0)
5544c1b
 
5544c1b
-#if MAX_OPC_PARAM_IARGS != 4
5544c1b
+#if MAX_OPC_PARAM_IARGS != 5
5544c1b
 # error Fix needed, number of supported input arguments changed!
5544c1b
 #endif
5544c1b
 #if TCG_TARGET_REG_BITS == 32
5544c1b
 typedef uint64_t (*helper_function)(tcg_target_ulong, tcg_target_ulong,
5544c1b
                                     tcg_target_ulong, tcg_target_ulong,
5544c1b
                                     tcg_target_ulong, tcg_target_ulong,
5544c1b
+                                    tcg_target_ulong, tcg_target_ulong,
5544c1b
                                     tcg_target_ulong, tcg_target_ulong);
5544c1b
 #else
5544c1b
 typedef uint64_t (*helper_function)(tcg_target_ulong, tcg_target_ulong,
5544c1b
-                                    tcg_target_ulong, tcg_target_ulong);
5544c1b
+                                    tcg_target_ulong, tcg_target_ulong,
5544c1b
+                                    tcg_target_ulong);
5544c1b
 #endif
5544c1b
 
5544c1b
 /* TCI can optionally use a global register variable for env. */
5544c1b
@@ -489,14 +491,17 @@ tcg_target_ulong tcg_qemu_tb_exec(CPUArchState *cpustate, uint8_t *tb_ptr)
5544c1b
                                           tci_read_reg(TCG_REG_R5),
5544c1b
                                           tci_read_reg(TCG_REG_R6),
5544c1b
                                           tci_read_reg(TCG_REG_R7),
5544c1b
-                                          tci_read_reg(TCG_REG_R8));
5544c1b
+                                          tci_read_reg(TCG_REG_R8),
5544c1b
+                                          tci_read_reg(TCG_REG_R9),
5544c1b
+                                          tci_read_reg(TCG_REG_R10));
5544c1b
             tci_write_reg(TCG_REG_R0, tmp64);
5544c1b
             tci_write_reg(TCG_REG_R1, tmp64 >> 32);
5544c1b
 #else
5544c1b
             tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),
5544c1b
                                           tci_read_reg(TCG_REG_R1),
5544c1b
                                           tci_read_reg(TCG_REG_R2),
5544c1b
-                                          tci_read_reg(TCG_REG_R3));
5544c1b
+                                          tci_read_reg(TCG_REG_R3),
5544c1b
+                                          tci_read_reg(TCG_REG_R5));
5544c1b
             tci_write_reg(TCG_REG_R0, tmp64);
5544c1b
 #endif
5544c1b
             break;