aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-user/main.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index e8406917e3..2140465709 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -127,6 +127,7 @@ int cpu_get_pic_interrupt(CPUX86State *env)
/* Make sure everything is in a consistent state for calling fork(). */
void fork_start(void)
{
+ start_exclusive();
mmap_fork_start();
qemu_mutex_lock(&tb_ctx.tb_lock);
cpu_list_lock();
@@ -147,9 +148,13 @@ void fork_end(int child)
qemu_mutex_init(&tb_ctx.tb_lock);
qemu_init_cpu_list();
gdbserver_fork(thread_cpu);
+ /* qemu_init_cpu_list() takes care of reinitializing the
+ * exclusive state, so we don't need to end_exclusive() here.
+ */
} else {
qemu_mutex_unlock(&tb_ctx.tb_lock);
cpu_list_unlock();
+ end_exclusive();
}
}