qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] fixup changes from commit f62a6b2f from Paulo B


From: Mike Day
Subject: [Qemu-devel] [PATCH 2/3] fixup changes from commit f62a6b2f from Paulo Bonzini
Date: Fri, 16 Aug 2013 10:41:40 -0400

From: Paolo Bonzini <address@hidden>
Reviewed-by: Mike Day <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]