From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VALEQ-00072I-K3 for qemu-devel@nongnu.org; Fri, 16 Aug 2013 10:42:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VALEK-00080Z-9B for qemu-devel@nongnu.org; Fri, 16 Aug 2013 10:42:26 -0400 Received: from mail-qa0-f42.google.com ([209.85.216.42]:44104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VALEK-00080L-5p for qemu-devel@nongnu.org; Fri, 16 Aug 2013 10:42:20 -0400 Received: by mail-qa0-f42.google.com with SMTP id bv4so520316qab.8 for ; Fri, 16 Aug 2013 07:42:19 -0700 (PDT) From: Mike Day Date: Fri, 16 Aug 2013 10:41:40 -0400 Message-Id: <1376664101-12634-3-git-send-email-ncmike@ncultra.org> In-Reply-To: <1376664101-12634-1-git-send-email-ncmike@ncultra.org> References: <1376664101-12634-1-git-send-email-ncmike@ncultra.org> Subject: [Qemu-devel] [PATCH 2/3] fixup changes from commit f62a6b2f from Paulo Bonzini List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Mike Day , Paolo Bonzini From: Paolo Bonzini Reviewed-by: Mike Day --- cpus.c | 3 +++ exec.c | 4 +++- include/exec/cpu-all.h | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index 624658e..d6f2775 100644 --- a/cpus.c +++ b/cpus.c @@ -764,6 +764,7 @@ static void *qemu_kvm_cpu_thread_fn(void *arg) CPUState *cpu = arg; int r; + tls_alloc_cpu_single_env_var(); qemu_mutex_lock(&qemu_global_mutex); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); @@ -804,6 +805,7 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) sigset_t waitset; int r; + tls_alloc_cpu_single_env_var(); qemu_mutex_lock_iothread(); qemu_thread_get_self(cpu->thread); cpu->thread_id = qemu_get_thread_id(); @@ -850,6 +852,7 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) { CPUState *cpu = arg; + tls_alloc_cpu_single_env_var(); qemu_tcg_init_cpu_signals(); qemu_thread_get_self(cpu->thread); diff --git a/exec.c b/exec.c index 3ca9381..52e7fd5 100644 --- a/exec.c +++ b/exec.c @@ -45,7 +45,7 @@ #include "trace.h" #endif #include "exec/cpu-all.h" - +#include "qemu/tls.h" #include "exec/cputlb.h" #include "translate-all.h" @@ -72,6 +72,7 @@ static MemoryRegion io_mem_unassigned; CPUState *first_cpu; /* current CPU in the current thread. It is only valid inside cpu_exec() */ +DEFINE_TLS(CPUArchState *, cpu_single_env_var); DEFINE_TLS(CPUState *, current_cpu); /* 0 = Do not count executed instructions. 1 = Precise instruction counting. @@ -313,6 +314,7 @@ address_space_translate_for_iotlb(AddressSpace *as, hwaddr addr, hwaddr *xlat, void cpu_exec_init_all(void) { + tls_alloc_cpu_single_env_var(); #if !defined(CONFIG_USER_ONLY) qemu_mutex_init(&ram_list.mutex); memory_map_init(); diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index a407b50..b961e58 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -22,6 +22,7 @@ #include "qemu-common.h" #include "exec/cpu-common.h" #include "qemu/thread.h" +#include "qemu/tls.h" #include "qom/cpu.h" /* some important defines: @@ -356,6 +357,8 @@ int page_get_flags(target_ulong address); void page_set_flags(target_ulong start, target_ulong end, int flags); int page_check_range(target_ulong start, target_ulong len, int flags); #endif +DECLARE_TLS(CPUArchState *, cpu_single_env_var); +#define cpu_single_env (*tls_get_cpu_single_env_var()) CPUArchState *cpu_copy(CPUArchState *env); -- 1.8.3.1