References: bsc#995789 # Commit 7b5cee79dad24e7006059667b02bd7de685d8ee5 # Date 2016-09-08 16:39:46 +0100 # Author Andrew Cooper # Committer Andrew Cooper hvm/fep: Allow testing of instructions crossing the -1 -> 0 virtual boundary The Force Emulation Prefix is named to follow its PV counterpart for cpuid or rdtsc, but isn't really an instruction prefix. It behaves as a break-out into Xen, with the purpose of emulating the next instruction in the current state. It is important to be able to test legal situations which occur in real hardware, including instruction which cross certain boundaries, and instructions starting at 0. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3905,6 +3905,10 @@ void hvm_ud_intercept(struct cpu_user_re { regs->eip += sizeof(sig); regs->eflags &= ~X86_EFLAGS_RF; + + /* Zero the upper 32 bits of %rip if not in long mode. */ + if ( !(hvm_long_mode_enabled(cur) && cs.attr.fields.l) ) + regs->eip = regs->_eip; } }