aboutsummaryrefslogtreecommitdiff
path: root/tcg/i386/tcg-target.h
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2012-09-13 19:37:43 +0200
committerAurelien Jarno <aurelien@aurel32.net>2012-09-22 15:10:22 +0200
commit1b7621ad99d352629c096cba40eadc6fb2b0c294 (patch)
tree04c24816e0f4644e4b2b3d8ebd02cead7b0dd35d /tcg/i386/tcg-target.h
parent9bacf4143190ca57771c8db5981d040f9c625ae5 (diff)
w64: Fix TCG helper functions with 5 arguments
TCG uses 6 registers for function arguments on 64 bit Linux hosts, but only 4 registers on W64 hosts. Commit 2999a0b20074a7e4a58f56572bb1436749368f59 increased the number of arguments for some important helper functions from 4 to 5 which triggered a bug for W64 hosts: QEMU aborts when executing helper_lcall_real in the guest's BIOS because function tcg_target_get_call_iarg_regs_count always returned 6. As W64 has only 4 registers for arguments, the 5th argument must be passed on the stack using a correct stack offset. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'tcg/i386/tcg-target.h')
-rw-r--r--tcg/i386/tcg-target.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h
index b356d76312..ace63ba37b 100644
--- a/tcg/i386/tcg-target.h
+++ b/tcg/i386/tcg-target.h
@@ -67,7 +67,11 @@ typedef enum {
/* used for function call generation */
#define TCG_REG_CALL_STACK TCG_REG_ESP
#define TCG_TARGET_STACK_ALIGN 16
+#if defined(_WIN64)
+#define TCG_TARGET_CALL_STACK_OFFSET 32
+#else
#define TCG_TARGET_CALL_STACK_OFFSET 0
+#endif
/* optional instructions */
#define TCG_TARGET_HAS_div2_i32 1