aboutsummaryrefslogtreecommitdiff
path: root/cpu-exec.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2010-06-25 16:56:49 +0200
committerAurelien Jarno <aurelien@aurel32.net>2010-07-22 05:52:08 +0200
commit1d93f0f03d4d911fdf1dc4ef529d8b2a0c0765f2 (patch)
tree843739dbf41d3162ea8c25d8603d6797c0a7ac9c /cpu-exec.c
parent1e29a009e35f2184236d09f45e58bc6a954074c6 (diff)
Introduce proper compiler barrier
Define barrier() as optimization barrier and replace (potentially unreliable) asm("") fences. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'cpu-exec.c')
-rw-r--r--cpu-exec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cpu-exec.c b/cpu-exec.c
index 026980a552..525b3b45ee 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -21,6 +21,7 @@
#include "disas.h"
#include "tcg.h"
#include "kvm.h"
+#include "qemu-barrier.h"
#if !defined(CONFIG_SOFTMMU)
#undef EAX
@@ -233,7 +234,7 @@ int cpu_exec(CPUState *env1)
use it. */
QEMU_BUILD_BUG_ON (sizeof (saved_env_reg) != sizeof (env));
saved_env_reg = (host_reg_t) env;
- asm("");
+ barrier();
env = env1;
if (exit_request) {
@@ -669,7 +670,7 @@ int cpu_exec(CPUState *env1)
#endif
/* restore global registers */
- asm("");
+ barrier();
env = (void *) saved_env_reg;
/* fail safe : never use cpu_single_env outside cpu_exec() */