From mboxrd@z Thu Jan 1 00:00:00 1970 From: Glauber Costa Subject: [PATCH] use a thread id variable Date: Wed, 5 Mar 2008 17:01:09 -0300 Message-ID: <12047472772114-git-send-email-gcosta@redhat.com> References: <12047472711034-git-send-email-gcosta@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: qemu-devel@nongnu.org, avi@qumranet.com, Glauber Costa , chrisw@sous-sol.org To: kvm-devel@lists.sourceforge.net Return-path: In-Reply-To: <12047472711034-git-send-email-gcosta@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.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 ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/