ia64/xen-unstable

changeset 17920:6b0663901174

hvm: Fix lmsw handling

The lmsw instruction can be used to set CR0_PE, but can never clear
it, once set.

Signed-off-by: Trolle Selander <trolle.selander@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 27 16:20:59 2008 +0100 (2008-06-27)
parents baaea9f0db5e
children a9fff28d4f06
files xen/arch/x86/hvm/vmx/vmx.c xen/arch/x86/x86_emulate/x86_emulate.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Fri Jun 27 16:16:47 2008 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Fri Jun 27 16:20:59 2008 +0100
     1.3 @@ -1523,7 +1523,8 @@ static int vmx_cr_access(unsigned long e
     1.4          break;
     1.5      case VMX_CONTROL_REG_ACCESS_TYPE_LMSW:
     1.6          value = v->arch.hvm_vcpu.guest_cr[0];
     1.7 -        value = (value & ~0xFFFF) | ((exit_qualification >> 16) & 0xFFFF);
     1.8 +        /* NB. LMSW can set, but never clear, PE. */
     1.9 +        value = (value & 0xFFFF0001) | ((exit_qualification >> 16) & 0xFFFF);
    1.10          HVMTRACE_LONG_1D(LMSW, current, value);
    1.11          return !hvm_set_cr0(value);
    1.12      default:
     2.1 --- a/xen/arch/x86/x86_emulate/x86_emulate.c	Fri Jun 27 16:16:47 2008 +0100
     2.2 +++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Fri Jun 27 16:20:59 2008 +0100
     2.3 @@ -3284,7 +3284,7 @@ x86_emulate(
     2.4              else if ( (rc = ops->read(ea.mem.seg, ea.mem.off,
     2.5                                        &cr0w, 2, ctxt)) )
     2.6                  goto done;
     2.7 -            cr0 &= 0xffff0000;
     2.8 +            cr0 &= 0xffff0001; /* lmsw can set, but never clear, PE */
     2.9              cr0 |= (uint16_t)cr0w;
    2.10              if ( (rc = ops->write_cr(0, cr0, ctxt)) )
    2.11                  goto done;