qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] cpustate patch
@ 2006-09-14 20:48 Rafael Espíndola
  2006-09-14 21:23 ` Fabrice Bellard
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael Espíndola @ 2006-09-14 20:48 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

While hunting a tls related bug in ARM emulation, I found that that
qemu distributed with scratchbox includes the attached patch.

Without the patch python's configure halts when checking for the
-pthread option.

The patch inverts the order of the list and makes the code simpler. I
think that there is a remaining problem, if first_cpu == NULL then
env->cpu_index is not initialized. Should an else be added?

Any thoughts on the patch?

Thanks,
Rafael

[-- Attachment #2: cpustate.patch --]
[-- Type: application/octet-stream, Size: 891 bytes --]

Index: exec.c
===================================================================
RCS file: /sources/qemu/qemu/exec.c,v
retrieving revision 1.82
diff -u -r1.82 exec.c
--- exec.c	4 Jul 2006 09:47:34 -0000	1.82
+++ exec.c	14 Sep 2006 20:26:11 -0000
@@ -256,23 +256,17 @@
 
 void cpu_exec_init(CPUState *env)
 {
-    CPUState **penv;
-    int cpu_index;
-
     if (!code_gen_ptr) {
         code_gen_ptr = code_gen_buffer;
         page_init();
         io_mem_init();
     }
-    env->next_cpu = NULL;
-    penv = &first_cpu;
-    cpu_index = 0;
-    while (*penv != NULL) {
-        penv = (CPUState **)&(*penv)->next_cpu;
-        cpu_index++;
-    }
-    env->cpu_index = cpu_index;
-    *penv = env;
+
+    if (first_cpu)
+      env->cpu_index = first_cpu->cpu_index + 1;
+
+    env->next_cpu = first_cpu;
+    first_cpu = env;
 }
 
 static inline void invalidate_page_bitmap(PageDesc *p)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] cpustate patch
  2006-09-14 20:48 [Qemu-devel] cpustate patch Rafael Espíndola
@ 2006-09-14 21:23 ` Fabrice Bellard
  0 siblings, 0 replies; 2+ messages in thread
From: Fabrice Bellard @ 2006-09-14 21:23 UTC (permalink / raw)
  To: qemu-devel

Rafael Espíndola wrote:
> While hunting a tls related bug in ARM emulation, I found that that
> qemu distributed with scratchbox includes the attached patch.
> 
> Without the patch python's configure halts when checking for the
> -pthread option.
> 
> The patch inverts the order of the list and makes the code simpler. I
> think that there is a remaining problem, if first_cpu == NULL then
> env->cpu_index is not initialized. Should an else be added?
> 
> Any thoughts on the patch?

For consistency I prefer that the first cpu of the list is number zero, 
so I prefer to leave the code as it is now.

Regards,

Fabrice.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-14 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-14 20:48 [Qemu-devel] cpustate patch Rafael Espíndola
2006-09-14 21:23 ` Fabrice Bellard

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).