aboutsummaryrefslogtreecommitdiff
path: root/dyngen-exec.h
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2011-10-05 20:03:02 +0200
committerStefan Weil <weil@mail.berlios.de>2011-10-31 21:52:16 +0100
commit7316329aa54bb4e404dc92b8bf481d0c43c82c76 (patch)
tree4b3843f8ff056972f5138a98dd8279cbfe633e6e /dyngen-exec.h
parent2a24374ab6c27c00dd346f0961a0f05e13672a86 (diff)
tcg: Add bytecode generator for tcg interpreter
Unlike other tcg target code generators, this one does not generate machine code for some cpu. It generates machine independent bytecode which is interpreted later. This allows running QEMU on any host. Interpreted bytecode is slower than direct execution of generated machine code. Signed-off-by: Stefan Weil <sw@weilnetz.de>
Diffstat (limited to 'dyngen-exec.h')
-rw-r--r--dyngen-exec.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/dyngen-exec.h b/dyngen-exec.h
index fbde29ea01..3544372a65 100644
--- a/dyngen-exec.h
+++ b/dyngen-exec.h
@@ -19,7 +19,12 @@
#if !defined(__DYNGEN_EXEC_H__)
#define __DYNGEN_EXEC_H__
-#if defined(__i386__)
+#if defined(CONFIG_TCG_INTERPRETER)
+/* The TCG interpreter does not need a special register AREG0,
+ * but it is possible to use one by defining AREG0.
+ * On i386, register edi seems to work. */
+/* Run without special register AREG0 or use a value defined elsewhere. */
+#elif defined(__i386__)
#define AREG0 "ebp"
#elif defined(__x86_64__)
#define AREG0 "r14"
@@ -55,6 +60,11 @@
#error unsupported CPU
#endif
+#if defined(AREG0)
register CPUState *env asm(AREG0);
+#else
+/* TODO: Try env = cpu_single_env. */
+extern CPUState *env;
+#endif
#endif /* !defined(__DYNGEN_EXEC_H__) */