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] [PATCH] avoid creating a circular list of cpus
Date: Fri, 15 Sep 2006 09:57:33 -0300	[thread overview]
Message-ID: <564d96fb0609150557v266bfe9do9a9e5e92f1949965@mail.gmail.com> (raw)

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

The attached patch avoids creating a circular list of cpus in do_fork.

Currently, cpu_init returns a pointer to the last element of the list.
This element is then overwritten by memcpy, including the cpu_index
and next_cpu fields. The patch simply restores these fields to the
correct values.

The circular list causes a test program to halt when cpu_exec_init is
called again.

Best Regards,
Rafael

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

Index: linux-user/syscall.c
===================================================================
RCS file: /sources/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.75
diff -u -r1.75 syscall.c
--- linux-user/syscall.c	27 Jun 2006 21:08:10 -0000	1.75
+++ linux-user/syscall.c	15 Sep 2006 12:45:22 -0000
@@ -1616,6 +1616,7 @@
     TaskState *ts;
     uint8_t *new_stack;
     CPUState *new_env;
+    int cpu_index;
     
     if (flags & CLONE_VM) {
         ts = malloc(sizeof(TaskState) + NEW_STACK_SIZE);
@@ -1627,7 +1628,13 @@
         first_task_state = ts;
         /* we create a new CPU instance. */
         new_env = cpu_init();
+        cpu_index = new_env->cpu_index;
         memcpy(new_env, env, sizeof(CPUState));
+        //new_env is the end of the list
+        new_env->next_cpu  = NULL;
+        new_env->cpu_index = cpu_index;
+
+
 #if defined(TARGET_I386)
         if (!newsp)
             newsp = env->regs[R_ESP];

                 reply	other threads:[~2006-09-15 12:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=564d96fb0609150557v266bfe9do9a9e5e92f1949965@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).