direct-io.hg

changeset 5719:afe05231fe25

cmpl workaround for mmio regions

Although we don't normally expect a guest to use cmpl against a MMIO region,
this may happen due to bugs. This workaround is needed for 64 bit linux-2.6.

Signed-off-by: Chengyuan Li <chengyuan.li@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Jul 11 09:00:12 2005 +0000 (2005-07-11)
parents c270d9ffdcef
children dd798dd2abce
files xen/arch/x86/vmx_platform.c
line diff
     1.1 --- a/xen/arch/x86/vmx_platform.c	Mon Jul 11 08:59:58 2005 +0000
     1.2 +++ b/xen/arch/x86/vmx_platform.c	Mon Jul 11 09:00:12 2005 +0000
     1.3 @@ -264,7 +264,7 @@ static inline unsigned long get_immediat
     1.4  
     1.5      switch(mod) {
     1.6          case 0:
     1.7 -            if (rm == 5) {
     1.8 +            if (rm == 5 || rm == 4) {
     1.9                  if (op16)
    1.10                      inst = inst + 2; //disp16, skip 2 bytes
    1.11                  else
    1.12 @@ -361,6 +361,11 @@ static int vmx_decode(const unsigned cha
    1.13      }
    1.14  
    1.15      switch(*inst) {
    1.16 +        case 0x81:
    1.17 +            /* This is only a workaround for cmpl instruction*/
    1.18 +            strcpy((char *)thread_inst->i_name, "cmp");
    1.19 +            return DECODE_success;
    1.20 +
    1.21          case 0x88:
    1.22              /* mov r8 to m8 */
    1.23              thread_inst->op_size = BYTE;
    1.24 @@ -633,7 +638,6 @@ void handle_mmio(unsigned long va, unsig
    1.25  
    1.26      __vmread(GUEST_RIP, &eip);
    1.27      __vmread(INSTRUCTION_LEN, &inst_len);
    1.28 -
    1.29      __vmread(GUEST_RFLAGS, &eflags);
    1.30      vm86 = eflags & X86_EFLAGS_VM;
    1.31  
    1.32 @@ -735,6 +739,12 @@ void handle_mmio(unsigned long va, unsig
    1.33              inst_decoder_regs->eax, IOREQ_WRITE, 0);
    1.34          return;
    1.35      }
    1.36 +    /* Workaround for cmp instruction */
    1.37 +    if (!strncmp((char *)mmio_inst.i_name, "cmp", 3)) {
    1.38 +        inst_decoder_regs->eflags &= ~X86_EFLAGS_ZF;
    1.39 +        __vmwrite(GUEST_RFLAGS, inst_decoder_regs->eflags);
    1.40 +        return;
    1.41 +    }
    1.42  
    1.43      domain_crash_synchronous();
    1.44  }