From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>, anthony@codemonkey.ws
Subject: [Qemu-devel] [PATCH for-1.2 2/4] cpu: Move CPU_COMMON_THREAD into CPUState
Date: Thu, 2 Aug 2012 02:48:35 +0200 [thread overview]
Message-ID: <1343868517-11852-3-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1343868517-11852-1-git-send-email-afaerber@suse.de>
CPU_COMMON_THREAD was only used for Windows, adding an hThread field
to CPU_COMMON.
Move the field into QOM CPUState and change its type to HANDLE,
which it is assigned from. This requires Windows headers, pulled in
through qemu-thread.h.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
cpu-defs.h | 9 ---------
cpus.c | 10 +++++++---
include/qemu/cpu.h | 5 +++++
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/cpu-defs.h b/cpu-defs.h
index f49e950..d0dd781 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -151,14 +151,6 @@ typedef struct CPUWatchpoint {
QTAILQ_ENTRY(CPUWatchpoint) entry;
} CPUWatchpoint;
-#ifdef _WIN32
-#define CPU_COMMON_THREAD \
- void *hThread;
-
-#else
-#define CPU_COMMON_THREAD
-#endif
-
#define CPU_TEMP_BUF_NLONGS 128
#define CPU_COMMON \
struct TranslationBlock *current_tb; /* currently executing TB */ \
@@ -217,7 +209,6 @@ typedef struct CPUWatchpoint {
uint32_t stop; /* Stop request */ \
uint32_t stopped; /* Artificially stopped */ \
struct QemuThread *thread; \
- CPU_COMMON_THREAD \
struct QemuCond *halt_cond; \
int thread_kicked; \
struct qemu_work_item *queued_work_first, *queued_work_last; \
diff --git a/cpus.c b/cpus.c
index 756e624..7042fb5 100644
--- a/cpus.c
+++ b/cpus.c
@@ -852,9 +852,10 @@ static void qemu_cpu_kick_thread(CPUArchState *env)
}
#else /* _WIN32 */
if (!qemu_cpu_is_self(env)) {
- SuspendThread(env->hThread);
+ CPUState *cpu = ENV_GET_CPU(env);
+ SuspendThread(cpu->hThread);
cpu_signal(0);
- ResumeThread(env->hThread);
+ ResumeThread(cpu->hThread);
}
#endif
}
@@ -974,6 +975,9 @@ void resume_all_vcpus(void)
static void qemu_tcg_init_vcpu(void *_env)
{
CPUArchState *env = _env;
+#ifdef _WIN32
+ CPUState *cpu = ENV_GET_CPU(env);
+#endif
/* share a single thread for all cpus with TCG */
if (!tcg_cpu_thread) {
@@ -984,7 +988,7 @@ static void qemu_tcg_init_vcpu(void *_env)
qemu_thread_create(env->thread, qemu_tcg_cpu_thread_fn, env,
QEMU_THREAD_JOINABLE);
#ifdef _WIN32
- env->hThread = qemu_thread_get_handle(env->thread);
+ cpu->hThread = qemu_thread_get_handle(env->thread);
#endif
while (env->created == 0) {
qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex);
diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h
index 78b65b3..5d52e1c 100644
--- a/include/qemu/cpu.h
+++ b/include/qemu/cpu.h
@@ -21,6 +21,7 @@
#define QEMU_CPU_H
#include "qemu/object.h"
+#include "qemu-thread.h"
/**
* SECTION:cpu
@@ -61,6 +62,10 @@ struct CPUState {
Object parent_obj;
/*< public >*/
+#ifdef _WIN32
+ HANDLE hThread;
+#endif
+
/* TODO Move common fields from CPUArchState here. */
};
--
1.7.7
next prev parent reply other threads:[~2012-08-02 0:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-02 0:48 [Qemu-devel] [PULL for-1.2] QOM CPUState, part 4: initial field movements Andreas Färber
2012-08-02 0:48 ` [Qemu-devel] [PATCH for-1.2 1/4] qemu-thread: Let qemu_thread_is_self() return bool Andreas Färber
2012-08-02 6:27 ` Stefan Weil
2012-08-02 16:14 ` Andreas Färber
2012-08-02 0:48 ` Andreas Färber [this message]
2012-08-02 0:48 ` [Qemu-devel] [PATCH for-1.2 3/4] cpu: Move thread field into CPUState Andreas Färber
2012-08-02 0:48 ` [Qemu-devel] [PATCH for-1.2 4/4] cpu: Move thread_kicked to CPUState Andreas Färber
2012-08-03 20:44 ` [Qemu-devel] [PULL for-1.2] QOM CPUState, part 4: initial field movements Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343868517-11852-3-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).