From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JWzqM-0001VQ-Gw for qemu-devel@nongnu.org; Wed, 05 Mar 2008 15:04:02 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JWzqK-0001UV-HI for qemu-devel@nongnu.org; Wed, 05 Mar 2008 15:04:01 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JWzqK-0001US-CS for qemu-devel@nongnu.org; Wed, 05 Mar 2008 15:04:00 -0500 Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JWzqJ-0006xL-U1 for qemu-devel@nongnu.org; Wed, 05 Mar 2008 15:04:00 -0500 From: Glauber Costa Date: Wed, 5 Mar 2008 17:01:09 -0300 Message-Id: <12047472772114-git-send-email-gcosta@redhat.com> In-Reply-To: <12047472711034-git-send-email-gcosta@redhat.com> References: <12047472711034-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH] use a thread id variable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kvm-devel@lists.sourceforge.net Cc: glommer@gmail.com, qemu-devel@nongnu.org, Glauber Costa , chrisw@sous-sol.org 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 --- 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