mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 11:39:53 +00:00
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>
This commit is contained in:
parent
1e29a009e3
commit
1d93f0f03d
@ -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() */
|
||||
|
@ -4,4 +4,7 @@
|
||||
/* FIXME: arch dependant, x86 version */
|
||||
#define smp_wmb() asm volatile("" ::: "memory")
|
||||
|
||||
/* Compiler barrier */
|
||||
#define barrier() asm volatile("" ::: "memory")
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user