From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZU2IH-0003yg-FV for qemu-devel@nongnu.org; Mon, 24 Aug 2015 20:40:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZU2IE-0005vy-Bl for qemu-devel@nongnu.org; Mon, 24 Aug 2015 20:40:53 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:48489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZU2IE-0005vS-7S for qemu-devel@nongnu.org; Mon, 24 Aug 2015 20:40:50 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0400620BD6 for ; Mon, 24 Aug 2015 20:40:48 -0400 (EDT) From: "Emilio G. Cota" Date: Mon, 24 Aug 2015 20:41:08 -0400 Message-Id: <1440463270-11819-2-git-send-email-cota@braap.org> In-Reply-To: <1440463270-11819-1-git-send-email-cota@braap.org> References: <55DA6D53.2080709@redhat.com> <1440463270-11819-1-git-send-email-cota@braap.org> Subject: [Qemu-devel] [PATCH 2/4] linux-user: add helper to set current_cpu before cpu_loop() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: pbonzini@redhat.com Cc: mttcg@listserver.greensocs.com, mark.burton@greensocs.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, guillaume.delbergue@greensocs.com, alex.bennee@linaro.org, Frederic Konrad There are as many versions of cpu_loop as architectures supported, so introduce here a helper that is common to all of them. Signed-off-by: Emilio G. Cota --- linux-user/main.c | 2 +- linux-user/qemu.h | 6 ++++++ linux-user/syscall.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 3e10bd8..24c53ad 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -4405,7 +4405,7 @@ int main(int argc, char **argv, char **envp) } gdb_handlesig(cpu, 0); } - cpu_loop(env); + do_cpu_loop(env); /* never exits */ return 0; } diff --git a/linux-user/qemu.h b/linux-user/qemu.h index e8606b2..8af5e01 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -201,6 +201,12 @@ void init_qemu_uname_release(void); void fork_start(void); void fork_end(int child); +static inline void do_cpu_loop(CPUArchState *env) +{ + current_cpu = ENV_GET_CPU(env); + cpu_loop(env); +} + /* Creates the initial guest address space in the host memory space using * the given host start address hint and size. The guest_start parameter * specifies the start address of the guest space. guest_base will be the diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c7062ab..701c8fa 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4533,7 +4533,7 @@ static void *clone_func(void *arg) /* Wait until the parent has finshed initializing the tls state. */ pthread_mutex_lock(&clone_lock); pthread_mutex_unlock(&clone_lock); - cpu_loop(env); + do_cpu_loop(env); /* never exits */ return NULL; } -- 1.9.1