[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 13/16] x86emul: support XSETBV
This is a prereq for switching PV privileged op emulation to the generic instruction emulator. Since handle_xsetbv() is already capable of dealing with all guest kinds, avoid introducing another hook here. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- v2: Explicitly generate #UD when vex.pfx is non-zero. --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -4178,6 +4178,23 @@ x86_emulate( switch( modrm ) { +#ifdef __XEN__ + case 0xd1: /* xsetbv */ + { + unsigned long cr4; + + generate_exception_if(vex.pfx, EXC_UD, -1); + if ( !ops->read_cr || ops->read_cr(4, &cr4, ctxt) != X86EMUL_OKAY ) + cr4 = 0; + generate_exception_if(!(cr4 & X86_CR4_OSXSAVE), EXC_UD, -1); + generate_exception_if(!mode_ring0() || + handle_xsetbv(_regs._ecx, + _regs._eax | (_regs.rdx << 32)), + EXC_GP, 0); + goto no_writeback; + } +#endif + case 0xdf: /* invlpga */ generate_exception_if(!in_protmode(ctxt, ops), EXC_UD, -1); generate_exception_if(!mode_ring0(), EXC_GP, 0); Attachment:
x86emul-XSETBV.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |