static int vhost_verify_ring_part_mapping(void *part,

                                          uint64_t part_addr,

                                          uint64_t part_size,

                                          uint64_t start_addr,

                                          uint64_t size)

{

    hwaddr l;

    void *p;

    int r = 0;



    if (!ranges_overlap(start_addr, size, part_addr, part_size)) {

        return 0;

    }

    l = part_size;

    p = cpu_physical_memory_map(part_addr, &l, 1);

    if (!p || l != part_size) {

        r = -ENOMEM;

    }

    if (p != part) {

        r = -EBUSY;

    }

    cpu_physical_memory_unmap(p, l, 0, 0);

    return r;

}

static int vhost_verify_ring_part_mapping(void *part,

                                          uint64_t part_addr,

                                          uint64_t part_size,

                                          uint64_t start_addr,

                                          uint64_t size)

{

    hwaddr l;

    void *p;

    int r = 0;



    if (!ranges_overlap(start_addr, size, part_addr, part_size)) {

        return 0;

    }

    l = part_size;

    p = cpu_physical_memory_map(part_addr, &l, 1);

    if (!p || l != part_size) {

        r = -ENOMEM;

    }

    if (p != part) {

        r = -EBUSY;

    }

    cpu_physical_memory_unmap(p, l, 0, 0);

    return r;

}

static int FUNC_0(void *VAR_0,

                                          uint64_t VAR_1,

                                          uint64_t VAR_2,

                                          uint64_t VAR_3,

                                          uint64_t VAR_4)

{

    hwaddr l;

    void *VAR_5;

    int VAR_6 = 0;



    if (!ranges_overlap(VAR_3, VAR_4, VAR_1, VAR_2)) {

        return 0;

    }

    l = VAR_2;

    VAR_5 = cpu_physical_memory_map(VAR_1, &l, 1);

    if (!VAR_5 || l != VAR_2) {

        VAR_6 = -ENOMEM;

    }

    if (VAR_5 != VAR_0) {

        VAR_6 = -EBUSY;

    }

    cpu_physical_memory_unmap(VAR_5, l, 0, 0);

    return VAR_6;

}

static int FUNC_0(void *VAR_0,
uint64_t VAR_1,
uint64_t VAR_2,
uint64_t VAR_3,
uint64_t VAR_4)
{ hwaddr l; void *VAR_5; int VAR_6 = 0; if (!ranges_overlap(VAR_3, VAR_4, VAR_1, VAR_2)) { return 0; } l = VAR_2; VAR_5 = cpu_physical_memory_map(VAR_1, &l, 1); if (!VAR_5 || l != VAR_2) { VAR_6 = -ENOMEM; } if (VAR_5 != VAR_0) { VAR_6 = -EBUSY; } cpu_physical_memory_unmap(VAR_5, l, 0, 0); return VAR_6; }