[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] use a thread id variable
From: |
Glauber Costa |
Subject: |
[Qemu-devel] [PATCH] use a thread id variable |
Date: |
Wed, 5 Mar 2008 17:01:09 -0300 |
This patch introduces a "thread_id" variable to CPUState.
It's duty will be to hold the process, or more generally, thread
id of the current executing cpu
Signed-off-by: Glauber Costa <address@hidden>
---
qemu/cpu-defs.h | 1 +
qemu/exec.c | 5 +++++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/qemu/cpu-defs.h b/qemu/cpu-defs.h
index 6979c11..6387a2f 100644
--- a/qemu/cpu-defs.h
+++ b/qemu/cpu-defs.h
@@ -162,6 +162,7 @@ typedef struct CPUTLBEntry {
\
void *next_cpu; /* next CPU sharing TB cache */ \
int cpu_index; /* CPU index (informative) */ \
+ int thread_id; \
/* user data */ \
void *opaque; \
\
diff --git a/qemu/exec.c b/qemu/exec.c
index 960adcd..b82d26d 100644
--- a/qemu/exec.c
+++ b/qemu/exec.c
@@ -340,6 +340,11 @@ void cpu_exec_init(CPUState *env)
}
env->cpu_index = cpu_index;
env->nb_watchpoints = 0;
+#ifdef __WIN32
+ env->thread_id = GetCurrentProcessId();
+#else
+ env->thread_id = getpid();
+#endif
*penv = env;
}
--
1.5.0.6