ia64/xen-unstable

changeset 5087:3a30cc8f8ec3

bitkeeper revision 1.1509 (42919998wk9fYs94aYbRCzMaqW0N5w)

[PATCH] [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>
author leendert@watson.ibm.com[kaf24]
date Mon May 23 08:51:36 2005 +0000 (2005-05-23)
parents 580d5a4fff25
children 9e133359e477 6cbe0dc99129
files xen/arch/x86/vmx.c xen/arch/x86/vmx_platform.c
line diff
     1.1 --- a/xen/arch/x86/vmx.c	Mon May 23 05:25:45 2005 +0000
     1.2 +++ b/xen/arch/x86/vmx.c	Mon May 23 08:51:36 2005 +0000
     1.3 @@ -366,11 +366,11 @@ static void vmx_io_instruction(struct cp
     1.4              if (p->dir == IOREQ_WRITE) {
     1.5                  __vmread(GUEST_DS_SELECTOR, &seg);
     1.6                  p->u.pdata = (void *)
     1.7 -                        ((seg << 4) | (regs->esi & 0xFFFF));
     1.8 +                        ((seg << 4) + (regs->esi & 0xFFFF));
     1.9              } else {
    1.10                  __vmread(GUEST_ES_SELECTOR, &seg);
    1.11                  p->u.pdata = (void *)
    1.12 -                        ((seg << 4) | (regs->edi & 0xFFFF));
    1.13 +                        ((seg << 4) + (regs->edi & 0xFFFF));
    1.14              }
    1.15          } else {
    1.16                 p->u.pdata = (void *) ((p->dir == IOREQ_WRITE) ?
    1.17 @@ -378,7 +378,6 @@ static void vmx_io_instruction(struct cp
    1.18          }
    1.19          p->u.pdata = (void *) gva_to_gpa(p->u.data);
    1.20  
    1.21 -
    1.22          if (test_bit(5, &exit_qualification))
    1.23  	    p->count = vm86 ? regs->ecx & 0xFFFF : regs->ecx;
    1.24          if ((p->u.data & PAGE_MASK) != 
     2.1 --- a/xen/arch/x86/vmx_platform.c	Mon May 23 05:25:45 2005 +0000
     2.2 +++ b/xen/arch/x86/vmx_platform.c	Mon May 23 08:51:36 2005 +0000
     2.3 @@ -544,7 +544,7 @@ void handle_mmio(unsigned long va, unsig
     2.4  
     2.5      if (vm86) {
     2.6          __vmread(GUEST_CS_SELECTOR, &cs);
     2.7 -        inst_addr = (cs << 4) | eip;
     2.8 +        inst_addr = (cs << 4) + eip;
     2.9      } else
    2.10          inst_addr = eip; /* XXX should really look at GDT[cs].base too */
    2.11  
    2.12 @@ -592,13 +592,13 @@ void handle_mmio(unsigned long va, unsig
    2.13  	    unsigned long seg;
    2.14  
    2.15  	    __vmread(GUEST_ES_SELECTOR, &seg);
    2.16 -	    if (((seg << 4) | (inst_decoder_regs->edi & 0xFFFF)) == va) {
    2.17 +	    if (((seg << 4) + (inst_decoder_regs->edi & 0xFFFF)) == va) {
    2.18  		dir = IOREQ_WRITE;
    2.19  		__vmread(GUEST_DS_SELECTOR, &seg);
    2.20 -		addr = (seg << 4) | (inst_decoder_regs->esi & 0xFFFF);
    2.21 +		addr = (seg << 4) + (inst_decoder_regs->esi & 0xFFFF);
    2.22  	    } else {
    2.23  		dir = IOREQ_READ;
    2.24 -		addr = (seg << 4) | (inst_decoder_regs->edi & 0xFFFF);
    2.25 +		addr = (seg << 4) + (inst_decoder_regs->edi & 0xFFFF);
    2.26  	    }
    2.27  	} else { /* XXX should really look at GDT[ds/es].base too */
    2.28  	    if (va == inst_decoder_regs->edi) {