summary refs log tree commit diff stats
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-06-24 23:50:24 +0200
committerAndreas Färber <afaerber@suse.de>2013-09-03 12:25:55 +0200
commitbdc44640cb33c90809376a262df871a1144d339a (patch)
treeef3b8d1d6a389d85baeb0cee895471b634a2fc3b /linux-user/syscall.c
parent27013bf20d5d93ac75d398aa3608604e8ad91b5a (diff)
downloadfocaccia-qemu-bdc44640cb33c90809376a262df871a1144d339a.tar.gz
focaccia-qemu-bdc44640cb33c90809376a262df871a1144d339a.zip
cpu: Use QTAILQ for CPU list
Introduce CPU_FOREACH(), CPU_FOREACH_SAFE() and CPU_NEXT() shorthand
macros.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f986548c2d..ecead512a0 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5113,25 +5113,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
            Do thread termination if we have more then one thread.  */
         /* FIXME: This probably breaks if a signal arrives.  We should probably
            be disabling signals.  */
-        if (first_cpu->next_cpu) {
+        if (CPU_NEXT(first_cpu)) {
             TaskState *ts;
-            CPUState **lastp;
-            CPUState *p;
 
             cpu_list_lock();
-            lastp = &first_cpu;
-            p = first_cpu;
-            while (p && p != cpu) {
-                lastp = &p->next_cpu;
-                p = p->next_cpu;
-            }
-            /* If we didn't find the CPU for this thread then something is
-               horribly wrong.  */
-            if (!p) {
-                abort();
-            }
             /* Remove the CPU from the list.  */
-            *lastp = p->next_cpu;
+            QTAILQ_REMOVE(&cpus, cpu, node);
             cpu_list_unlock();
             ts = ((CPUArchState *)cpu_env)->opaque;
             if (ts->child_tidptr) {