Revision 30ba0ee5

b/exec.c
625 625
    abort();
626 626
}
627 627

  
628
CPUArchState *cpu_copy(CPUArchState *env)
629
{
630
    CPUArchState *new_env = cpu_init(env->cpu_model_str);
631
#if defined(TARGET_HAS_ICE)
632
    CPUBreakpoint *bp;
633
    CPUWatchpoint *wp;
634
#endif
635

  
636
    /* Reset non arch specific state */
637
    cpu_reset(ENV_GET_CPU(new_env));
638

  
639
    /* Copy arch specific state into the new CPU */
640
    memcpy(new_env, env, sizeof(CPUArchState));
641

  
642
    /* Clone all break/watchpoints.
643
       Note: Once we support ptrace with hw-debug register access, make sure
644
       BP_CPU break/watchpoints are handled correctly on clone. */
645
    QTAILQ_INIT(&env->breakpoints);
646
    QTAILQ_INIT(&env->watchpoints);
647
#if defined(TARGET_HAS_ICE)
648
    QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
649
        cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
650
    }
651
    QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
652
        cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
653
                              wp->flags, NULL);
654
    }
655
#endif
656

  
657
    return new_env;
658
}
659

  
660 628
#if !defined(CONFIG_USER_ONLY)
661 629
static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t end,
662 630
                                      uintptr_t length)
b/linux-user/main.c
3285 3285
    ts->sigqueue_table[i].next = NULL;
3286 3286
}
3287 3287

  
3288
CPUArchState *cpu_copy(CPUArchState *env)
3289
{
3290
    CPUArchState *new_env = cpu_init(env->cpu_model_str);
3291
#if defined(TARGET_HAS_ICE)
3292
    CPUBreakpoint *bp;
3293
    CPUWatchpoint *wp;
3294
#endif
3295

  
3296
    /* Reset non arch specific state */
3297
    cpu_reset(ENV_GET_CPU(new_env));
3298

  
3299
    memcpy(new_env, env, sizeof(CPUArchState));
3300

  
3301
    /* Clone all break/watchpoints.
3302
       Note: Once we support ptrace with hw-debug register access, make sure
3303
       BP_CPU break/watchpoints are handled correctly on clone. */
3304
    QTAILQ_INIT(&env->breakpoints);
3305
    QTAILQ_INIT(&env->watchpoints);
3306
#if defined(TARGET_HAS_ICE)
3307
    QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
3308
        cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
3309
    }
3310
    QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
3311
        cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
3312
                              wp->flags, NULL);
3313
    }
3314
#endif
3315

  
3316
    return new_env;
3317
}
3318

  
3288 3319
static void handle_arg_help(const char *arg)
3289 3320
{
3290 3321
    usage();

Also available in: Unified diff