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 <[EMAIL PROTECTED]> --- 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