static int virtio_read_many(ulong sector, void *load_addr, int sec_num)

{

    struct virtio_blk_outhdr out_hdr;

    u8 status;



    /* Tell the host we want to read */

    out_hdr.type = VIRTIO_BLK_T_IN;

    out_hdr.ioprio = 99;

    out_hdr.sector = sector;



    vring_send_buf(&block, &out_hdr, sizeof(out_hdr), VRING_DESC_F_NEXT);



    /* This is where we want to receive data */

    vring_send_buf(&block, load_addr, SECTOR_SIZE * sec_num,

                   VRING_DESC_F_WRITE | VRING_HIDDEN_IS_CHAIN |

                   VRING_DESC_F_NEXT);



    /* status field */

    vring_send_buf(&block, &status, sizeof(u8), VRING_DESC_F_WRITE |

                   VRING_HIDDEN_IS_CHAIN);



    /* Now we can tell the host to read */

    vring_wait_reply(&block, 0);



    drain_irqs(block.schid);



    return status;

}

static int virtio_read_many(ulong sector, void *load_addr, int sec_num)

{

    struct virtio_blk_outhdr out_hdr;

    u8 status;



    

    out_hdr.type = VIRTIO_BLK_T_IN;

    out_hdr.ioprio = 99;

    out_hdr.sector = sector;



    vring_send_buf(&block, &out_hdr, sizeof(out_hdr), VRING_DESC_F_NEXT);



    

    vring_send_buf(&block, load_addr, SECTOR_SIZE * sec_num,

                   VRING_DESC_F_WRITE | VRING_HIDDEN_IS_CHAIN |

                   VRING_DESC_F_NEXT);



    

    vring_send_buf(&block, &status, sizeof(u8), VRING_DESC_F_WRITE |

                   VRING_HIDDEN_IS_CHAIN);



    

    vring_wait_reply(&block, 0);



    drain_irqs(block.schid);



    return status;

}

static int FUNC_0(ulong VAR_0, void *VAR_1, int VAR_2)

{

    struct virtio_blk_outhdr VAR_3;

    u8 status;



    

    VAR_3.type = VIRTIO_BLK_T_IN;

    VAR_3.ioprio = 99;

    VAR_3.VAR_0 = VAR_0;



    vring_send_buf(&block, &VAR_3, sizeof(VAR_3), VRING_DESC_F_NEXT);



    

    vring_send_buf(&block, VAR_1, SECTOR_SIZE * VAR_2,

                   VRING_DESC_F_WRITE | VRING_HIDDEN_IS_CHAIN |

                   VRING_DESC_F_NEXT);



    

    vring_send_buf(&block, &status, sizeof(u8), VRING_DESC_F_WRITE |

                   VRING_HIDDEN_IS_CHAIN);



    

    vring_wait_reply(&block, 0);



    drain_irqs(block.schid);



    return status;

}

static int FUNC_0(ulong VAR_0, void *VAR_1, int VAR_2)
{ struct virtio_blk_outhdr VAR_3; u8 status; VAR_3.type = VIRTIO_BLK_T_IN; VAR_3.ioprio = 99; VAR_3.VAR_0 = VAR_0; vring_send_buf(&block, &VAR_3, sizeof(VAR_3), VRING_DESC_F_NEXT); vring_send_buf(&block, VAR_1, SECTOR_SIZE * VAR_2,
VRING_DESC_F_WRITE | VRING_HIDDEN_IS_CHAIN |
VRING_DESC_F_NEXT); vring_send_buf(&block, &status, sizeof(u8), VRING_DESC_F_WRITE |
VRING_HIDDEN_IS_CHAIN); vring_wait_reply(&block, 0); drain_irqs(block.schid); return status; }