diff --git a/bsd-user/main.c b/bsd-user/main.c index f27fcbc..16a0590 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -272,6 +272,7 @@ void init_task_state(TaskState *ts) CPUArchState *cpu_copy(CPUArchState *env) { CPUArchState *new_env = cpu_init(cpu_model); + CPUState *cpu; #if defined(TARGET_HAS_ICE) CPUBreakpoint *bp; CPUWatchpoint *wp; @@ -281,18 +282,19 @@ CPUArchState *cpu_copy(CPUArchState *env) cpu_reset(ENV_GET_CPU(new_env)); memcpy(new_env, env, sizeof(CPUArchState)); + cpu = ENV_GET_CPU(env); /* Clone all break/watchpoints. Note: Once we support ptrace with hw-debug register access, make sure BP_CPU break/watchpoints are handled correctly on clone. */ - QTAILQ_INIT(&env->breakpoints); - QTAILQ_INIT(&env->watchpoints); + QTAILQ_INIT(&cpu->breakpoints); + QTAILQ_INIT(&cpu->watchpoints); #if defined(TARGET_HAS_ICE) - QTAILQ_FOREACH(bp, &env->breakpoints, entry) { - cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL); + QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { + cpu_breakpoint_insert(cpu, bp->pc, bp->flags, NULL); } - QTAILQ_FOREACH(wp, &env->watchpoints, entry) { - cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1, + QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) { + cpu_watchpoint_insert(cpu, wp->vaddr, (~wp->len_mask) + 1, wp->flags, NULL); } #endif