Store the data to send also in iovec

All data is still copied into the static buffer.

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Use writev ops if available

Update qemu_fflush and stdio_close to use writev ops if they are available

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
More optimized qemu_put_be64/32/16

qemu_put_be functions used qemu_put_byte this caused lots of 1 bytes buffers
in the iovec.
we move to use cpu_put_be64/32/16wu and put a single buffer per call.

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Add qemu_put_buffer_no_copy

This allow us to add a buffer to the iovec to send without copying it
into the static buffer.

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
Use qemu_put_buffer_no_copy for guest memory pages

This will remove an unneeded copy of guest memory pages.
For the page header and device state we still copy the data to the
static buffer the other option is to allocate the memory on demand
which is more expensive.

Signed-off-by: Orit Wasserman <owasserm@redhat.com>