initial import from qemu 1.7.1