* [Qemu-devel] [PATCH] avoid creating a circular list of cpus
@ 2006-09-15 12:57 Rafael Espíndola
0 siblings, 0 replies; only message in thread
From: Rafael Espíndola @ 2006-09-15 12:57 UTC (permalink / raw)
To: qemu-devel
[-- 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];
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-09-15 12:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-15 12:57 [Qemu-devel] [PATCH] avoid creating a circular list of cpus Rafael Espíndola
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).