aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-08-29 17:04:01 +0200
committerPeter Maydell <peter.maydell@linaro.org>2011-10-17 15:41:08 +0000
commitb674559fc8a67ae7d30fe3ab3062d5855ac77d2d (patch)
tree988c07623b7c05651c10839e55b31899963d9ead
parentdfc7a4ce48fdb5cb727557fd338b7d995fb34e89 (diff)
downloadqemu-arm-test-tls.tar.gz
Make cpu_single_env thread-localtest-tls
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--cpu-all.h4
-rw-r--r--darwin-user/main.c2
-rw-r--r--exec.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/cpu-all.h b/cpu-all.h
index 42a5fa0a7c..e37ebfcf04 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -20,6 +20,7 @@
#define CPU_ALL_H
#include "qemu-common.h"
+#include "qemu-tls.h"
#include "cpu-common.h"
/* some important defines:
@@ -334,7 +335,8 @@ void cpu_dump_statistics(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
extern CPUState *first_cpu;
-extern CPUState *cpu_single_env;
+DECLARE_TLS(CPUState *,tls_cpu_single_env);
+#define cpu_single_env get_tls(tls_cpu_single_env)
/* Flags for use in ENV->INTERRUPT_PENDING.
diff --git a/darwin-user/main.c b/darwin-user/main.c
index 1a881a0a60..c0f14f8260 100644
--- a/darwin-user/main.c
+++ b/darwin-user/main.c
@@ -729,8 +729,6 @@ static void usage(void)
/* XXX: currently only used for async signals (see signal.c) */
CPUState *global_env;
-/* used only if single thread */
-CPUState *cpu_single_env = NULL;
/* used to free thread contexts */
TaskState *first_task_state;
diff --git a/exec.c b/exec.c
index d0cbf15822..afc5fe3aca 100644
--- a/exec.c
+++ b/exec.c
@@ -120,7 +120,7 @@ static MemoryRegion *system_io;
CPUState *first_cpu;
/* current CPU in the current thread. It is only valid inside
cpu_exec() */
-CPUState *cpu_single_env;
+DEFINE_TLS(CPUState *,tls_cpu_single_env);
/* 0 = Do not count executed instructions.
1 = Precise instruction counting.
2 = Adaptive rate instruction counting. */