[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 8/8] x86/emul: Implement the STAC and CLAC instructions
>>> On 05.12.16 at 11:09, <andrew.cooper3@xxxxxxxxxx> wrote: > @@ -4362,11 +4363,27 @@ x86_emulate( > > switch( modrm ) > { > -#ifdef __XEN__ > - case 0xd1: /* xsetbv */ > - { > unsigned long cr4; > > + case 0xca: /* clac */ > + case 0xcb: /* stac */ > + generate_exception_if( > + lock_prefix || (_regs.eflags & EFLG_VM), EXC_UD); > + if ( !ops->read_cr || ops->read_cr(4, &cr4, ctxt) != > X86EMUL_OKAY ) > + cr4 = 0; > + /* > + * Contrary to expectation (i.e. #GP[0]), #UD for the CPL check > is > + * the documented and observed behaviour. > + */ > + generate_exception_if(!(cr4 & CR4_SMAP) || !mode_ring0(), > EXC_UD); If documentation is to be trusted, then there's no CR4.SMAP check supposed to be here, but just a CPUID one. Otoh I assume documentation can't be trusted regarding the use of prefixes 66, F2, and F3: Just like they're apparently illegal to use with VMFUNC (thread still pending with Intel) and like documented for e.g. XGETBV and XSETBV, I would think you need a vex.pfx check here despite the SDM not explicitly saying so. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |