New threads always point at the same env which is incorrect and usually leads
to a crash.

Signed-off-by: Leon Alrae <[email protected]>
---
Hi,

This patch fixes the bug introduced in:

commit 2994fd96d986578a342f2342501b4ad30f6d0a85
Author: Eduardo Habkost <[email protected]>

    cpu: Make cpu_init() return QOM CPUState object

Regards,
Leon
---
 linux-user/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index 6e446de..04668e8 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3453,7 +3453,7 @@ CPUArchState *cpu_copy(CPUArchState *env)
 {
     CPUState *cpu = ENV_GET_CPU(env);
     CPUState *new_cpu = cpu_init(cpu_model);
-    CPUArchState *new_env = cpu->env_ptr;
+    CPUArchState *new_env = new_cpu->env_ptr;
     CPUBreakpoint *bp;
     CPUWatchpoint *wp;
 
-- 
2.1.0


Reply via email to