[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.2] x86/HVM: 32-bit IN result must be zero-extended to 64 bits
commit 762aeb5be310d3a40f1d1ee4474319f0a7f887aa Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Fri Nov 15 11:42:36 2013 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Nov 15 11:42:36 2013 +0100 x86/HVM: 32-bit IN result must be zero-extended to 64 bits Just like for all other operations with 32-bit operand size. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> x86/HVM: 32-bit IN result must be zero-extended to 64 bits (part 2) Just spotted a counterpart of what commit 9d89100b (same title) dealt with. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> master commit: 9d89100ba8b7b02adb7c2e89ef7c81e734942e7c master date: 2013-11-05 14:51:53 +0100 master commit: 1e521eddeb51a9f1bf0e4dd1d17efc873eafae41 master date: 2013-11-15 11:01:49 +0100 --- xen/arch/x86/hvm/io.c | 21 +++++++++++++++++---- xen/include/asm-x86/hvm/io.h | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c index 7cf0d36..b04083b 100644 --- a/xen/arch/x86/hvm/io.c +++ b/xen/arch/x86/hvm/io.c @@ -221,13 +221,15 @@ int handle_mmio_with_translation(unsigned long gva, unsigned long gpfn) return handle_mmio(); } -int handle_pio(uint16_t port, int size, int dir) +int handle_pio(uint16_t port, unsigned int size, int dir) { struct vcpu *curr = current; struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io; unsigned long data, reps = 1; int rc; + ASSERT((size - 1) < 4 && size != 3); + if ( dir == IOREQ_WRITE ) data = guest_cpu_user_regs()->eax; @@ -237,7 +239,14 @@ int handle_pio(uint16_t port, int size, int dir) { case X86EMUL_OKAY: if ( dir == IOREQ_READ ) - memcpy(&guest_cpu_user_regs()->eax, &data, vio->io_size); + { +#ifdef __x86_64__ + if ( size == 4 ) /* Needs zero extension. */ + guest_cpu_user_regs()->rax = (uint32_t)data; + else +#endif + memcpy(&guest_cpu_user_regs()->eax, &data, size); + } break; case X86EMUL_RETRY: if ( vio->io_state != HVMIO_awaiting_completion ) @@ -281,8 +290,12 @@ void hvm_io_assist(void) (void)handle_mmio(); break; case HVMIO_handle_pio_awaiting_completion: - memcpy(&guest_cpu_user_regs()->eax, - &p->data, vio->io_size); +#ifdef __x86_64__ + if ( vio->io_size == 4 ) /* Needs zero extension. */ + guest_cpu_user_regs()->rax = (uint32_t)p->data; + else +#endif + memcpy(&guest_cpu_user_regs()->eax, &p->data, vio->io_size); break; default: break; diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h index 410a5f6..b0718b8 100644 --- a/xen/include/asm-x86/hvm/io.h +++ b/xen/include/asm-x86/hvm/io.h @@ -119,7 +119,7 @@ void send_timeoffset_req(unsigned long timeoff); void send_invalidate_req(void); int handle_mmio(void); int handle_mmio_with_translation(unsigned long gva, unsigned long gpfn); -int handle_pio(uint16_t port, int size, int dir); +int handle_pio(uint16_t port, unsigned int size, int dir); void hvm_interrupt_post(struct vcpu *v, int vector, int type); void hvm_io_assist(void); void hvm_dpci_eoi(struct domain *d, unsigned int guest_irq, -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.2 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |