Blame 0099-tci-Fix-for-AREG0-free-mode.patch

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