From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: Invalid op code emulation for HVM guest and GPF Date: Fri, 23 Mar 2012 19:58:19 +0000 Message-ID: <4F6CD5DB.6090806@citrix.com> References: <20120323114425.07bd6db7@mantra.us.oracle.com> <4F6CCD1A.4090505@citrix.com> <20120323123042.5ebc0e18@mantra.us.oracle.com> <4F6CD14B.4020701@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050209030108060705090907" Return-path: In-Reply-To: <4F6CD14B.4020701@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Mukesh Rathor Cc: "Xen-devel@lists.xensource.com" , "kris.van.hees@oracle.com" , Keir Fraser List-Id: xen-devel@lists.xenproject.org --------------050209030108060705090907 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit On 23/03/12 19:38, Andrew Cooper wrote: > Sadly, given your other email, I doubt it will work, because of the big > catch all regarding the lock prefix. > > A brief scan over the Intel manuals and I cant see a case where an > incorrect LOCK prefix would cause #GPF rather than #UD. > > Perhaps try changing it to EXP_UD instead of EXP_GP. (Although I make > no guarantee that this wont cause a lot of things to break.) Try this patch instead. I have still yet to find a single example in either manual 2A or B where an invalid lock prefix would cause a #GPF rather than #UD -- Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer T: +44 (0)1223 225 900, http://www.citrix.com --------------050209030108060705090907 Content-Type: text/x-patch; name="x86_emulate_nop.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="x86_emulate_nop.patch" diff -r 0ecb8ffe61b2 xen/arch/x86/x86_emulate/x86_emulate.c --- 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; --------------050209030108060705090907 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --------------050209030108060705090907--