static void virtqueue_map_iovec(struct iovec *sg, hwaddr *addr,

                                unsigned int *num_sg, unsigned int max_size,

                                int is_write)

{

    unsigned int i;

    hwaddr len;



    /* Note: this function MUST validate input, some callers

     * are passing in num_sg values received over the network.

     */

    /* TODO: teach all callers that this can fail, and return failure instead

     * of asserting here.

     * When we do, we might be able to re-enable NDEBUG below.

     */

#ifdef NDEBUG

#error building with NDEBUG is not supported

#endif

    assert(*num_sg <= max_size);



    for (i = 0; i < *num_sg; i++) {

        len = sg[i].iov_len;

        sg[i].iov_base = cpu_physical_memory_map(addr[i], &len, is_write);

        if (!sg[i].iov_base) {

            error_report("virtio: error trying to map MMIO memory");

            exit(1);

        }

        if (len != sg[i].iov_len) {

            error_report("virtio: unexpected memory split");

            exit(1);

        }

    }

}

static void virtqueue_map_iovec(struct iovec *sg, hwaddr *addr,

                                unsigned int *num_sg, unsigned int max_size,

                                int is_write)

{

    unsigned int i;

    hwaddr len;



    





    







#ifdef NDEBUG

#error building with NDEBUG is not supported

#endif

    assert(*num_sg <= max_size);



    for (i = 0; i < *num_sg; i++) {

        len = sg[i].iov_len;

        sg[i].iov_base = cpu_physical_memory_map(addr[i], &len, is_write);

        if (!sg[i].iov_base) {

            error_report("virtio: error trying to map MMIO memory");

            exit(1);

        }

        if (len != sg[i].iov_len) {

            error_report("virtio: unexpected memory split");

            exit(1);

        }

    }

}

static void FUNC_0(struct iovec *VAR_0, hwaddr *VAR_1,

                                unsigned int *VAR_2, unsigned int VAR_3,

                                int VAR_4)

{

    unsigned int VAR_5;

    hwaddr len;



    





    







#ifdef NDEBUG

#error building with NDEBUG is not supported

#endif

    assert(*VAR_2 <= VAR_3);



    for (VAR_5 = 0; VAR_5 < *VAR_2; VAR_5++) {

        len = VAR_0[VAR_5].iov_len;

        VAR_0[VAR_5].iov_base = cpu_physical_memory_map(VAR_1[VAR_5], &len, VAR_4);

        if (!VAR_0[VAR_5].iov_base) {

            error_report("virtio: error trying to map MMIO memory");

            exit(1);

        }

        if (len != VAR_0[VAR_5].iov_len) {

            error_report("virtio: unexpected memory split");

            exit(1);

        }

    }

}

static void FUNC_0(struct iovec *VAR_0, hwaddr *VAR_1,
unsigned int *VAR_2, unsigned int VAR_3,
int VAR_4)
{ unsigned int VAR_5; hwaddr len; #ifdef NDEBUG
#error building with NDEBUG is not supported
#endif
assert(*VAR_2 <= VAR_3); for (VAR_5 = 0; VAR_5 < *VAR_2; VAR_5++) { len = VAR_0[VAR_5].iov_len; VAR_0[VAR_5].iov_base = cpu_physical_memory_map(VAR_1[VAR_5], &len, VAR_4); if (!VAR_0[VAR_5].iov_base) { error_report("virtio: error trying to map MMIO memory"); exit(1); } if (len != VAR_0[VAR_5].iov_len) { error_report("virtio: unexpected memory split"); exit(1); } } }