qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael Espíndola" <rafael.espindola@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] cpustate patch
Date: Thu, 14 Sep 2006 17:48:27 -0300	[thread overview]
Message-ID: <564d96fb0609141348y3bf4bbaat539cea1694c5c02d@mail.gmail.com> (raw)

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

             reply	other threads:[~2006-09-14 20:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-14 20:48 Rafael Espíndola [this message]
2006-09-14 21:23 ` [Qemu-devel] cpustate patch Fabrice Bellard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=564d96fb0609141348y3bf4bbaat539cea1694c5c02d@mail.gmail.com \
    --to=rafael.espindola@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).