From 47fb6fb49f65295c4cc1feead64657cb20363ab2 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Fri, 23 Mar 2012 20:45:16 +0000 Subject: [PATCH] x86_emulate: raise #UD rather than #GP on invalid use of LOCK prefix From: Andrew Cooper Signed-off-by: Keir Fraser Committed-by: Keir Fraser --- xen/arch/x86/x86_emulate/x86_emulate.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index acefad30b1..7f842ce0af 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -1429,7 +1429,7 @@ x86_emulate( } /* Lock prefix is allowed only on RMW instructions. */ - generate_exception_if((d & Mov) && lock_prefix, EXC_GP, 0); + generate_exception_if((d & Mov) && lock_prefix, EXC_UD, 0); /* ModRM and SIB bytes. */ if ( d & ModRM ) @@ -1712,12 +1712,12 @@ x86_emulate( lock_prefix && ((b < 0x20) || (b > 0x23)) && /* MOV CRn/DRn */ (b != 0xc7), /* CMPXCHG{8,16}B */ - EXC_GP, 0); + EXC_UD, 0); dst.type = OP_NONE; break; case DstReg: - generate_exception_if(lock_prefix, EXC_GP, 0); + generate_exception_if(lock_prefix, EXC_UD, 0); dst.type = OP_REG; if ( d & ByteOp ) { @@ -1773,7 +1773,7 @@ x86_emulate( dst = ea; if ( dst.type == OP_REG ) { - generate_exception_if(lock_prefix, EXC_GP, 0); + generate_exception_if(lock_prefix, EXC_UD, 0); switch ( dst.bytes ) { case 1: dst.val = *(uint8_t *)dst.reg; break; -- 2.39.5