int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,

                          int flags, CPUWatchpoint **watchpoint)

{

    CPUWatchpoint *wp;



    /* forbid ranges which are empty or run off the end of the address space */

    if (len == 0 || (addr + len - 1) <= addr) {

        error_report("tried to set invalid watchpoint at %"

                     VADDR_PRIx ", len=%" VADDR_PRIu, addr, len);

        return -EINVAL;

    }

    wp = g_malloc(sizeof(*wp));



    wp->vaddr = addr;

    wp->len = len;

    wp->flags = flags;



    /* keep all GDB-injected watchpoints in front */

    if (flags & BP_GDB) {

        QTAILQ_INSERT_HEAD(&cpu->watchpoints, wp, entry);

    } else {

        QTAILQ_INSERT_TAIL(&cpu->watchpoints, wp, entry);

    }



    tlb_flush_page(cpu, addr);



    if (watchpoint)

        *watchpoint = wp;

    return 0;

}

int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,

                          int flags, CPUWatchpoint **watchpoint)

{

    CPUWatchpoint *wp;



    

    if (len == 0 || (addr + len - 1) <= addr) {

        error_report("tried to set invalid watchpoint at %"

                     VADDR_PRIx ", len=%" VADDR_PRIu, addr, len);

        return -EINVAL;

    }

    wp = g_malloc(sizeof(*wp));



    wp->vaddr = addr;

    wp->len = len;

    wp->flags = flags;



    

    if (flags & BP_GDB) {

        QTAILQ_INSERT_HEAD(&cpu->watchpoints, wp, entry);

    } else {

        QTAILQ_INSERT_TAIL(&cpu->watchpoints, wp, entry);

    }



    tlb_flush_page(cpu, addr);



    if (watchpoint)

        *watchpoint = wp;

    return 0;

}

int FUNC_0(CPUState *VAR_0, vaddr VAR_1, vaddr VAR_2,

                          int VAR_3, CPUWatchpoint **VAR_4)

{

    CPUWatchpoint *wp;



    

    if (VAR_2 == 0 || (VAR_1 + VAR_2 - 1) <= VAR_1) {

        error_report("tried to set invalid VAR_4 at %"

                     VADDR_PRIx ", VAR_2=%" VADDR_PRIu, VAR_1, VAR_2);

        return -EINVAL;

    }

    wp = g_malloc(sizeof(*wp));



    wp->vaddr = VAR_1;

    wp->VAR_2 = VAR_2;

    wp->VAR_3 = VAR_3;



    

    if (VAR_3 & BP_GDB) {

        QTAILQ_INSERT_HEAD(&VAR_0->watchpoints, wp, entry);

    } else {

        QTAILQ_INSERT_TAIL(&VAR_0->watchpoints, wp, entry);

    }



    tlb_flush_page(VAR_0, VAR_1);



    if (VAR_4)

        *VAR_4 = wp;

    return 0;

}

int FUNC_0(CPUState *VAR_0, vaddr VAR_1, vaddr VAR_2,
int VAR_3, CPUWatchpoint **VAR_4)
{ CPUWatchpoint *wp; if (VAR_2 == 0 || (VAR_1 + VAR_2 - 1) <= VAR_1) { error_report("tried to set invalid VAR_4 at %"
VADDR_PRIx ", VAR_2=%" VADDR_PRIu, VAR_1, VAR_2); return -EINVAL; } wp = g_malloc(sizeof(*wp)); wp->vaddr = VAR_1; wp->VAR_2 = VAR_2; wp->VAR_3 = VAR_3; if (VAR_3 & BP_GDB) { QTAILQ_INSERT_HEAD(&VAR_0->watchpoints, wp, entry); } else { QTAILQ_INSERT_TAIL(&VAR_0->watchpoints, wp, entry); } tlb_flush_page(VAR_0, VAR_1); if (VAR_4)
*VAR_4 = wp; return 0; }