@@ -509,7 +509,7 @@ static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
#include "../../softmmu_defs.h"
#ifdef CONFIG_TCG_PASS_AREG0
-#error CONFIG_TCG_PASS_AREG0 is not supported
+/* #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] = {
@@ -614,6 +614,24 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
#endif
/* slow path */
+#ifdef CONFIG_TCG_PASS_AREG0
+ tcg_out_mov (s, TCG_TYPE_I32, 3, TCG_AREG0);
+#if TARGET_LONG_BITS == 32
+ tcg_out_mov (s, TCG_TYPE_I32, 4, addr_reg);
+ tcg_out_movi (s, TCG_TYPE_I32, 5, mem_index);
+#else
+ {
+#ifdef TCG_TARGET_CALL_ALIGN_ARGS
+ int ir = 5;
+#else
+ int ir = 4;
+#endif
+ tcg_out_mov (s, TCG_TYPE_I32, ir, addr_reg2);
+ tcg_out_mov (s, TCG_TYPE_I32, ir + 1, addr_reg);
+ tcg_out_movi (s, TCG_TYPE_I32, ir + 2, mem_index);
+ }
+#endif
+#else
#if TARGET_LONG_BITS == 32
tcg_out_mov (s, TCG_TYPE_I32, 3, addr_reg);
tcg_out_movi (s, TCG_TYPE_I32, 4, mem_index);
@@ -622,6 +640,7 @@ static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
tcg_out_mov (s, TCG_TYPE_I32, 4, addr_reg);
tcg_out_movi (s, TCG_TYPE_I32, 5, mem_index);
#endif
+#endif
tcg_out_call (s, (tcg_target_long) qemu_ld_helpers[s_bits], 1);
switch (opc) {
@@ -810,6 +829,17 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
#endif
/* slow path */
+#ifdef CONFIG_TCG_PASS_AREG0
+ tcg_out_mov (s, TCG_TYPE_I32, 3, TCG_AREG0);
+#if TARGET_LONG_BITS == 32
+ tcg_out_mov (s, TCG_TYPE_I32, 4, addr_reg);
+ ir = 5;
+#else
+ tcg_out_mov (s, TCG_TYPE_I32, 5, addr_reg2);
+ tcg_out_mov (s, TCG_TYPE_I32, 6, addr_reg);
+ ir = 7;
+#endif
+#else
#if TARGET_LONG_BITS == 32
tcg_out_mov (s, TCG_TYPE_I32, 3, addr_reg);
ir = 4;
@@ -822,6 +852,7 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
ir = 4;
#endif
#endif
+#endif
switch (opc) {
case 0:
@@ -844,7 +875,7 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
tcg_out_mov (s, TCG_TYPE_I32, ir, data_reg);
break;
case 3:
-#ifdef TCG_TARGET_CALL_ALIGN_ARGS
+#if defined TCG_TARGET_CALL_ALIGN_ARGS && !defined CONFIG_TCG_PASS_AREG0
ir = 5;
#endif
tcg_out_mov (s, TCG_TYPE_I32, ir++, data_reg2);