xcp-1.6-updates/xen-4.1.hg

changeset 23282:182633356cd4

x86_emulate: Do not push an error code onto a #UD exception stack

Signed-off-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 25099:4bd752a4cdf3
xen-unstable date: Fri Mar 23 20:51:48 2012 +0000


x86_emulate: raise #UD rather than #GP on invalid use of LOCK prefix

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset: 25098:2e45b26bc412
xen-unstable date: Fri Mar 23 20:45:16 2012 +0000
author Andrew Cooper <andrew.cooper3@citrix.com>
date Tue Apr 17 08:34:28 2012 +0100 (2012-04-17)
parents 00881b29bfe2
children 494aa5ecd2e1
files xen/arch/x86/x86_emulate/x86_emulate.c
line diff
     1.1 --- a/xen/arch/x86/x86_emulate/x86_emulate.c	Tue Apr 17 08:33:33 2012 +0100
     1.2 +++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Tue Apr 17 08:34:28 2012 +0100
     1.3 @@ -1309,7 +1309,7 @@ x86_emulate(
     1.4      }
     1.5  
     1.6      /* Lock prefix is allowed only on RMW instructions. */
     1.7 -    generate_exception_if((d & Mov) && lock_prefix, EXC_GP, 0);
     1.8 +    generate_exception_if((d & Mov) && lock_prefix, EXC_UD, -1);
     1.9  
    1.10      /* ModRM and SIB bytes. */
    1.11      if ( d & ModRM )
    1.12 @@ -1528,12 +1528,12 @@ x86_emulate(
    1.13              lock_prefix &&
    1.14              ((b < 0x20) || (b > 0x23)) && /* MOV CRn/DRn */
    1.15              (b != 0xc7),                  /* CMPXCHG{8,16}B */
    1.16 -            EXC_GP, 0);
    1.17 +            EXC_UD, -1);
    1.18          dst.type = OP_NONE;
    1.19          break;
    1.20  
    1.21      case DstReg:
    1.22 -        generate_exception_if(lock_prefix, EXC_GP, 0);
    1.23 +        generate_exception_if(lock_prefix, EXC_UD, -1);
    1.24          dst.type = OP_REG;
    1.25          if ( d & ByteOp )
    1.26          {
    1.27 @@ -1589,7 +1589,7 @@ x86_emulate(
    1.28          dst = ea;
    1.29          if ( dst.type == OP_REG )
    1.30          {
    1.31 -            generate_exception_if(lock_prefix, EXC_GP, 0);
    1.32 +            generate_exception_if(lock_prefix, EXC_UD, -1);
    1.33              switch ( dst.bytes )
    1.34              {
    1.35              case 1: dst.val = *(uint8_t  *)dst.reg; break;
    1.36 @@ -3598,14 +3598,14 @@ x86_emulate(
    1.37          struct segment_register cs = { 0 }, ss = { 0 };
    1.38          int rc;
    1.39  
    1.40 -        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, 0);
    1.41 -        generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, 0);
    1.42 +        generate_exception_if(in_realmode(ctxt, ops), EXC_UD, -1);
    1.43 +        generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, -1);
    1.44  
    1.45          /* Inject #UD if syscall/sysret are disabled. */
    1.46          fail_if(ops->read_msr == NULL);
    1.47          if ( (rc = ops->read_msr(MSR_EFER, &msr_content, ctxt)) != 0 )
    1.48              goto done;
    1.49 -        generate_exception_if((msr_content & EFER_SCE) == 0, EXC_UD, 0);
    1.50 +        generate_exception_if((msr_content & EFER_SCE) == 0, EXC_UD, -1);
    1.51  
    1.52          if ( (rc = ops->read_msr(MSR_STAR, &msr_content, ctxt)) != 0 )
    1.53              goto done;