diff mbox

[4/4] bsd-user: add helper to set current_cpu before cpu_loop()

Message ID 1440463270-11819-4-git-send-email-cota@braap.org
State New
Headers show

Commit Message

Emilio Cota Aug. 25, 2015, 12:41 a.m. UTC
Note: cannot compile bsd-user here (linux), please compile-test.

Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 bsd-user/main.c | 2 +-
 bsd-user/qemu.h | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Emilio Cota Aug. 25, 2015, 6:07 p.m. UTC | #1
On Mon, Aug 24, 2015 at 20:41:10 -0400, Emilio G. Cota wrote:
> Note: cannot compile bsd-user here (linux), please compile-test.
> 
> Signed-off-by: Emilio G. Cota <cota@braap.org>
> ---
(snip)
> diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
> index 5902614..751efd5 100644
> --- a/bsd-user/qemu.h
> +++ b/bsd-user/qemu.h
> @@ -163,6 +163,12 @@ int get_osversion(void);
>  void fork_start(void);
>  void fork_end(int child);
>  
> +static inline void do_cpu_loop(CPUArchState *env)
> +{

Here we should also call rcu_register_thread().

> +    current_cpu = ENV_GET_CPU(env);
> +    cpu_loop(env);
> +}

		Emilio
diff mbox

Patch

diff --git a/bsd-user/main.c b/bsd-user/main.c
index ee68daa..0bea358 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -1133,7 +1133,7 @@  int main(int argc, char **argv)
         gdbserver_start (gdbstub_port);
         gdb_handlesig(cpu, 0);
     }
-    cpu_loop(env);
+    do_cpu_loop(env);
     /* never exits */
     return 0;
 }
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 5902614..751efd5 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -163,6 +163,12 @@  int get_osversion(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);
+}
+
 #include "qemu/log.h"
 
 /* strace.c */