static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iovec *iov,
                               unsigned int max_num_sg, bool is_write,
                               hwaddr pa, size_t sz)
{
    unsigned num_sg = *p_num_sg;
    assert(num_sg <= max_num_sg);
    if (!sz) {
        error_report("virtio: zero sized buffers are not allowed");
    while (sz) {
        hwaddr len = sz;
        if (num_sg == max_num_sg) {
            error_report("virtio: too many write descriptors in indirect table");
        iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write);
        iov[num_sg].iov_len = len;
        addr[num_sg] = pa;
        sz -= len;
        pa += len;
        num_sg++;
    *p_num_sg = num_sg;
static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iovec *iov,
                               unsigned int max_num_sg, bool is_write,
                               hwaddr pa, size_t sz)
{
    unsigned num_sg = *p_num_sg;
    assert(num_sg <= max_num_sg);
    if (!sz) {
        error_report("virtio: zero sized buffers are not allowed");
    while (sz) {
        hwaddr len = sz;
        if (num_sg == max_num_sg) {
            error_report("virtio: too many write descriptors in indirect table");
        iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write);
        iov[num_sg].iov_len = len;
        addr[num_sg] = pa;
        sz -= len;
        pa += len;
        num_sg++;
    *p_num_sg = num_sg;
static void FUNC_0(unsigned int *VAR_0, hwaddr *VAR_1, struct iovec *VAR_2,
                               unsigned int VAR_3, bool VAR_4,
                               hwaddr VAR_5, size_t VAR_6)
{
    unsigned VAR_7 = *VAR_0;
    assert(VAR_7 <= VAR_3);
    if (!VAR_6) {
        error_report("virtio: zero sized buffers are not allowed");
    while (VAR_6) {
        hwaddr len = VAR_6;
        if (VAR_7 == VAR_3) {
            error_report("virtio: too many write descriptors in indirect table");
        VAR_2[VAR_7].iov_base = cpu_physical_memory_map(VAR_5, &len, VAR_4);
        VAR_2[VAR_7].iov_len = len;
        VAR_1[VAR_7] = VAR_5;
        VAR_6 -= len;
        VAR_5 += len;
        VAR_7++;
    *VAR_0 = VAR_7;
static void FUNC_0(unsigned int *VAR_0, hwaddr *VAR_1, struct iovec *VAR_2,
unsigned int VAR_3, bool VAR_4,
hwaddr VAR_5, size_t VAR_6)
{ unsigned VAR_7 = *VAR_0; assert(VAR_7 <= VAR_3); if (!VAR_6) { error_report("virtio: zero sized buffers are not allowed"); while (VAR_6) { hwaddr len = VAR_6; if (VAR_7 == VAR_3) { error_report("virtio: too many write descriptors in indirect table"); VAR_2[VAR_7].iov_base = cpu_physical_memory_map(VAR_5, &len, VAR_4); VAR_2[VAR_7].iov_len = len; VAR_1[VAR_7] = VAR_5; VAR_6 -= len; VAR_5 += len; VAR_7++; *VAR_0 = VAR_7;