]> git.proxmox.com Git - mirror_qemu.git/commitdiff
tcg: Initialize the prologue after GUEST_BASE is fixed.
authorRichard Henderson <rth@twiddle.net>
Thu, 6 May 2010 15:50:41 +0000 (08:50 -0700)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 21 May 2010 16:41:21 +0000 (18:41 +0200)
This will allow backends to make intelligent choices about how
to implement GUEST_BASE.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
bsd-user/main.c
exec.c
linux-user/main.c
tcg/tcg.c
tcg/tcg.h

index b1c438d895afe1b52d6905c333d726d8ea26baf0..05cc3d92b7dc6aebca6177bcb50132307fb1c3af 100644 (file)
@@ -30,7 +30,7 @@
 #include "qemu-common.h"
 /* For tb_lock */
 #include "exec-all.h"
-
+#include "tcg.h"
 #include "qemu-timer.h"
 #include "envlist.h"
 
@@ -970,6 +970,13 @@ int main(int argc, char **argv)
     syscall_init();
     signal_init();
 
+#if defined(CONFIG_USE_GUEST_BASE)
+    /* Now that we've loaded the binary, GUEST_BASE is fixed.  Delay
+       generating the prologue until now so that the prologue can take
+       the real value of GUEST_BASE into account.  */
+    tcg_prologue_init(&tcg_ctx);
+#endif
+
     /* build Task State */
     memset(ts, 0, sizeof(TaskState));
     init_task_state(ts);
diff --git a/exec.c b/exec.c
index 56b5561884d5aa8fbabc9630d9400a6690fa8e8f..bb3dcadcded839ce3bf7a4507ab5b3fe8a32202c 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -574,6 +574,11 @@ void cpu_exec_init_all(unsigned long tb_size)
 #if !defined(CONFIG_USER_ONLY)
     io_mem_init();
 #endif
+#if !defined(CONFIG_USER_ONLY) || !defined(CONFIG_USE_GUEST_BASE)
+    /* There's no guest base to take into account, so go ahead and
+       initialize the prologue now.  */
+    tcg_prologue_init(&tcg_ctx);
+#endif
 }
 
 #if defined(CPU_SAVE_VERSION) && !defined(CONFIG_USER_ONLY)
index 5027a6d99402bfdc40eec2153ee86b8794980f73..b240f290f74ae2345ebe73d4640d512f2f327bf4 100644 (file)
@@ -31,7 +31,7 @@
 #include "cache-utils.h"
 /* For tb_lock */
 #include "exec-all.h"
-
+#include "tcg.h"
 #include "qemu-timer.h"
 #include "envlist.h"
 
@@ -2984,6 +2984,13 @@ int main(int argc, char **argv, char **envp)
     syscall_init();
     signal_init();
 
+#if defined(CONFIG_USE_GUEST_BASE)
+    /* Now that we've loaded the binary, GUEST_BASE is fixed.  Delay
+       generating the prologue until now so that the prologue can take
+       the real value of GUEST_BASE into account.  */
+    tcg_prologue_init(&tcg_ctx);
+#endif
+
 #if defined(TARGET_I386)
     cpu_x86_set_cpl(env, 3);
 
index a99ecb9a9e0e6e68b8b3d594af57038951638735..880e7ceef98db205f2a8daf3cc316a615d74c421 100644 (file)
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -240,7 +240,10 @@ void tcg_context_init(TCGContext *s)
     }
     
     tcg_target_init(s);
+}
 
+void tcg_prologue_init(TCGContext *s)
+{
     /* init global prologue and epilogue */
     s->code_buf = code_gen_prologue;
     s->code_ptr = s->code_buf;
index 44856e1dd55cb85d15890581dd4290085bd0e200..58538235de534010267336dc010d8b88ffd89409 100644 (file)
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -346,6 +346,7 @@ static inline void *tcg_malloc(int size)
 }
 
 void tcg_context_init(TCGContext *s);
+void tcg_prologue_init(TCGContext *s);
 void tcg_func_start(TCGContext *s);
 
 int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf);