hw/i386/vmport: Propagate IOPort read to vCPU EAX register
commitb889212973dabee119a1ab21326a27fc51b88d6d
authorLiran Alon <liran.alon@oracle.com>
Thu, 12 Mar 2020 16:54:18 +0000 (12 18:54 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 Jun 2020 16:09:43 +0000 (10 12:09 -0400)
tree576d81bfed3d8cdc34f6319346f08822b9ef257e
parentc9ab24cef8ab680e3d24d7332599b2b857bd107b
hw/i386/vmport: Propagate IOPort read to vCPU EAX register

vmport_ioport_read() returns the value that should propagate to vCPU EAX
register when guest reads VMPort IOPort (i.e. By x86 IN instruction).

However, because vmport_ioport_read() calls cpu_synchronize_state(), the
returned value gets overridden by the value in QEMU vCPU EAX register.
i.e. cpu->env.regs[R_EAX].

To fix this issue, change vmport_ioport_read() to explicitly override
cpu->env.regs[R_EAX] with the value it wish to propagate to vCPU EAX
register.

Reviewed-by: Nikita Leshenko <nikita.leshchenko@oracle.com>
Signed-off-by: Liran Alon <liran.alon@oracle.com>
Message-Id: <20200312165431.82118-4-liran.alon@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/core/machine.c
hw/i386/vmport.c