Am 26.10.2011 18:07, schrieb Peter Maydell: > From: Paolo Bonzini <pbonz...@redhat.com> > > Make cpu_single_env thread-local. This fixes a regression > in handling of multi-threaded programs in linux-user mode > (bug 823902). > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > cpu-all.h | 4 +++- > darwin-user/main.c | 2 -- > exec.c | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/cpu-all.h b/cpu-all.h > index 42a5fa0..e37ebfc 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);
So this effectively becomes tls__tls_cpu_single_env iiuc. For compile-checking for missed conversions, DECLARE_TLS(CPUState *,cpu_single_env); should do, no? > diff --git a/darwin-user/main.c b/darwin-user/main.c > index 1a881a0..c0f14f8 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; This is not making anything local, it's apparently removing an unused variable. Can we then have that in a patch saying so, please? Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg