int kvm_remove_breakpoint(CPUState *current_env, target_ulong addr,

                          target_ulong len, int type)

{

    struct kvm_sw_breakpoint *bp;

    CPUState *env;

    int err;



    if (type == GDB_BREAKPOINT_SW) {

        bp = kvm_find_sw_breakpoint(current_env, addr);

        if (!bp)

            return -ENOENT;



        if (bp->use_count > 1) {

            bp->use_count--;

            return 0;

        }



        err = kvm_arch_remove_sw_breakpoint(current_env, bp);

        if (err)

            return err;



        QTAILQ_REMOVE(&current_env->kvm_state->kvm_sw_breakpoints, bp, entry);

        qemu_free(bp);

    } else {

        err = kvm_arch_remove_hw_breakpoint(addr, len, type);

        if (err)

            return err;

    }



    for (env = first_cpu; env != NULL; env = env->next_cpu) {

        err = kvm_update_guest_debug(env, 0);

        if (err)

            return err;

    }

    return 0;

}

int kvm_remove_breakpoint(CPUState *current_env, target_ulong addr,

                          target_ulong len, int type)

{

    struct kvm_sw_breakpoint *bp;

    CPUState *env;

    int err;



    if (type == GDB_BREAKPOINT_SW) {

        bp = kvm_find_sw_breakpoint(current_env, addr);

        if (!bp)

            return -ENOENT;



        if (bp->use_count > 1) {

            bp->use_count--;

            return 0;

        }



        err = kvm_arch_remove_sw_breakpoint(current_env, bp);

        if (err)

            return err;



        QTAILQ_REMOVE(&current_env->kvm_state->kvm_sw_breakpoints, bp, entry);

        qemu_free(bp);

    } else {

        err = kvm_arch_remove_hw_breakpoint(addr, len, type);

        if (err)

            return err;

    }



    for (env = first_cpu; env != NULL; env = env->next_cpu) {

        err = kvm_update_guest_debug(env, 0);

        if (err)

            return err;

    }

    return 0;

}

int FUNC_0(CPUState *VAR_0, target_ulong VAR_1,

                          target_ulong VAR_2, int VAR_3)

{

    struct kvm_sw_breakpoint *VAR_4;

    CPUState *env;

    int VAR_5;



    if (VAR_3 == GDB_BREAKPOINT_SW) {

        VAR_4 = kvm_find_sw_breakpoint(VAR_0, VAR_1);

        if (!VAR_4)

            return -ENOENT;



        if (VAR_4->use_count > 1) {

            VAR_4->use_count--;

            return 0;

        }



        VAR_5 = kvm_arch_remove_sw_breakpoint(VAR_0, VAR_4);

        if (VAR_5)

            return VAR_5;



        QTAILQ_REMOVE(&VAR_0->kvm_state->kvm_sw_breakpoints, VAR_4, entry);

        qemu_free(VAR_4);

    } else {

        VAR_5 = kvm_arch_remove_hw_breakpoint(VAR_1, VAR_2, VAR_3);

        if (VAR_5)

            return VAR_5;

    }



    for (env = first_cpu; env != NULL; env = env->next_cpu) {

        VAR_5 = kvm_update_guest_debug(env, 0);

        if (VAR_5)

            return VAR_5;

    }

    return 0;

}

int FUNC_0(CPUState *VAR_0, target_ulong VAR_1,
target_ulong VAR_2, int VAR_3)
{ struct kvm_sw_breakpoint *VAR_4; CPUState *env; int VAR_5; if (VAR_3 == GDB_BREAKPOINT_SW) { VAR_4 = kvm_find_sw_breakpoint(VAR_0, VAR_1); if (!VAR_4)
return -ENOENT; if (VAR_4->use_count > 1) { VAR_4->use_count--; return 0; } VAR_5 = kvm_arch_remove_sw_breakpoint(VAR_0, VAR_4); if (VAR_5)
return VAR_5; QTAILQ_REMOVE(&VAR_0->kvm_state->kvm_sw_breakpoints, VAR_4, entry); qemu_free(VAR_4); } else { VAR_5 = kvm_arch_remove_hw_breakpoint(VAR_1, VAR_2, VAR_3); if (VAR_5)
return VAR_5; } for (env = first_cpu; env != NULL; env = env->next_cpu) { VAR_5 = kvm_update_guest_debug(env, 0); if (VAR_5)
return VAR_5; } return 0; }