static int vhost_verify_ring_mappings(struct vhost_dev *dev,

                                      uint64_t start_addr,

                                      uint64_t size)

{

    int i;

    for (i = 0; i < dev->nvqs; ++i) {

        struct vhost_virtqueue *vq = dev->vqs + i;

        hwaddr l;

        void *p;



        if (!ranges_overlap(start_addr, size, vq->ring_phys, vq->ring_size)) {

            continue;

        }

        l = vq->ring_size;

        p = cpu_physical_memory_map(vq->ring_phys, &l, 1);

        if (!p || l != vq->ring_size) {

            fprintf(stderr, "Unable to map ring buffer for ring %d\n", i);

            return -ENOMEM;

        }

        if (p != vq->ring) {

            fprintf(stderr, "Ring buffer relocated for ring %d\n", i);

            return -EBUSY;

        }

        cpu_physical_memory_unmap(p, l, 0, 0);

    }

    return 0;

}

static int vhost_verify_ring_mappings(struct vhost_dev *dev,

                                      uint64_t start_addr,

                                      uint64_t size)

{

    int i;

    for (i = 0; i < dev->nvqs; ++i) {

        struct vhost_virtqueue *vq = dev->vqs + i;

        hwaddr l;

        void *p;



        if (!ranges_overlap(start_addr, size, vq->ring_phys, vq->ring_size)) {

            continue;

        }

        l = vq->ring_size;

        p = cpu_physical_memory_map(vq->ring_phys, &l, 1);

        if (!p || l != vq->ring_size) {

            fprintf(stderr, "Unable to map ring buffer for ring %d\n", i);

            return -ENOMEM;

        }

        if (p != vq->ring) {

            fprintf(stderr, "Ring buffer relocated for ring %d\n", i);

            return -EBUSY;

        }

        cpu_physical_memory_unmap(p, l, 0, 0);

    }

    return 0;

}

    for (i = 0; i < dev->nvqs; ++i) {             return -ENOMEM;             return -EBUSY;     return 0;
static int FUNC_0(struct vhost_dev *VAR_0,

                                      uint64_t VAR_1,

                                      uint64_t VAR_2)

{

    int VAR_3;

    for (VAR_3 = 0; VAR_3 < VAR_0->nvqs; ++VAR_3) {

        struct vhost_virtqueue *VAR_4 = VAR_0->vqs + VAR_3;

        hwaddr l;

        void *VAR_5;



        if (!ranges_overlap(VAR_1, VAR_2, VAR_4->ring_phys, VAR_4->ring_size)) {

            continue;

        }

        l = VAR_4->ring_size;

        VAR_5 = cpu_physical_memory_map(VAR_4->ring_phys, &l, 1);

        if (!VAR_5 || l != VAR_4->ring_size) {

            fprintf(stderr, "Unable to map ring buffer for ring %d\n", VAR_3);

            return -ENOMEM;

        }

        if (VAR_5 != VAR_4->ring) {

            fprintf(stderr, "Ring buffer relocated for ring %d\n", VAR_3);

            return -EBUSY;

        }

        cpu_physical_memory_unmap(VAR_5, l, 0, 0);

    }

    return 0;

}

static int FUNC_0(struct vhost_dev *VAR_0,
uint64_t VAR_1,
uint64_t VAR_2)
{ int VAR_3; for (VAR_3 = 0; VAR_3 < VAR_0->nvqs; ++VAR_3) { struct vhost_virtqueue *VAR_4 = VAR_0->vqs + VAR_3; hwaddr l; void *VAR_5; if (!ranges_overlap(VAR_1, VAR_2, VAR_4->ring_phys, VAR_4->ring_size)) { continue; } l = VAR_4->ring_size; VAR_5 = cpu_physical_memory_map(VAR_4->ring_phys, &l, 1); if (!VAR_5 || l != VAR_4->ring_size) { fprintf(stderr, "Unable to map ring buffer for ring %d\n", VAR_3); return -ENOMEM; } if (VAR_5 != VAR_4->ring) { fprintf(stderr, "Ring buffer relocated for ring %d\n", VAR_3); return -EBUSY; } cpu_physical_memory_unmap(VAR_5, l, 0, 0); } return 0; }