Leendert van Doorn
2005-May-23 08:00 UTC
[Xen-devel] [PATCH] VMX: bad PIO/MMIO effective address computations
The PIO/MMIO effective address computations in VMX for partitions running in VM8086 mode are wrong. This bug prevented FreeDOS and Lilo to work under VMX. The following patches fix this. Leendert Signed-Off-By: Leendert van Doorn <leendert@watson.ibm.com> diff --exclude=BitKeeper -ru xeno-unstable.orig/xen/arch/x86/vmx.c xeno-unstable.latest/xen/arch/x86/vmx.c --- xeno-unstable.orig/xen/arch/x86/vmx.c 2005-05-22 22:54:41.000000000 -0400 +++ xeno-unstable.latest/xen/arch/x86/vmx.c 2005-05-23 03:40:57.000000000 -0400 @@ -366,11 +366,11 @@ if (p->dir == IOREQ_WRITE) { __vmread(GUEST_DS_SELECTOR, &seg); p->u.pdata = (void *) - ((seg << 4) | (regs->esi & 0xFFFF)); + ((seg << 4) + (regs->esi & 0xFFFF)); } else { __vmread(GUEST_ES_SELECTOR, &seg); p->u.pdata = (void *) - ((seg << 4) | (regs->edi & 0xFFFF)); + ((seg << 4) + (regs->edi & 0xFFFF)); } } else { p->u.pdata = (void *) ((p->dir == IOREQ_WRITE) ? @@ -378,7 +378,6 @@ } p->u.pdata = (void *) gva_to_gpa(p->u.data); - if (test_bit(5, &exit_qualification)) p->count = vm86 ? regs->ecx & 0xFFFF : regs->ecx; if ((p->u.data & PAGE_MASK) != diff --exclude=BitKeeper -ru xeno-unstable.orig/xen/arch/x86/vmx_platform.c xeno-unstable.latest/xen/arch/x86/vmx_platform.c --- xeno-unstable.orig/xen/arch/x86/vmx_platform.c 2005-05-19 23:15:49.000000000 -0400 +++ xeno-unstable.latest/xen/arch/x86/vmx_platform.c 2005-05-23 03:43:05.000000000 -0400 @@ -544,7 +544,7 @@ if (vm86) { __vmread(GUEST_CS_SELECTOR, &cs); - inst_addr = (cs << 4) | eip; + inst_addr = (cs << 4) + eip; } else inst_addr = eip; /* XXX should really look at GDT[cs].base too */ @@ -592,13 +592,13 @@ unsigned long seg; __vmread(GUEST_ES_SELECTOR, &seg); - if (((seg << 4) | (inst_decoder_regs->edi & 0xFFFF)) == va) { + if (((seg << 4) + (inst_decoder_regs->edi & 0xFFFF)) == va) { dir = IOREQ_WRITE; __vmread(GUEST_DS_SELECTOR, &seg); - addr = (seg << 4) | (inst_decoder_regs->esi & 0xFFFF); + addr = (seg << 4) + (inst_decoder_regs->esi & 0xFFFF); } else { dir = IOREQ_READ; - addr = (seg << 4) | (inst_decoder_regs->edi & 0xFFFF); + addr = (seg << 4) + (inst_decoder_regs->edi & 0xFFFF); } } else { /* XXX should really look at GDT[ds/es].base too */ if (va == inst_decoder_regs->edi) { _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel