]> xenbits.xensource.com Git - xen.git/commitdiff
hvm/fep: Allow testing of instructions crossing the -1 -> 0 virtual boundary
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 12 Sep 2016 14:04:08 +0000 (16:04 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 12 Sep 2016 14:04:08 +0000 (16:04 +0200)
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 <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: 7b5cee79dad24e7006059667b02bd7de685d8ee5
master date: 2016-09-08 16:39:46 +0100

xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/vmx/vmx.c

index cc128b4442c2aca62c01f97f5e6c3f274ec6bed5..d8ab74dfd0bde17f16a7ab6e86adbd3aa93a74e7 100644 (file)
@@ -2136,6 +2136,10 @@ static void svm_vmexit_ud_intercept(struct cpu_user_regs *regs)
         {
             regs->eip += sizeof(sig);
             regs->eflags &= ~X86_EFLAGS_RF;
+
+            /* Zero the upper 32 bits of %rip if not in long mode. */
+            if ( svm_guest_x86_mode(current) != 8 )
+                regs->eip = regs->_eip;
         }
     }
 
index 9181258268903ff63790533df978dbe701957b9a..072ac6c0f1b09a2d13be38c6a6dc4b2b692e06ee 100644 (file)
@@ -2554,6 +2554,10 @@ static void vmx_vmexit_ud_intercept(struct cpu_user_regs *regs)
         {
             regs->eip += sizeof(sig);
             regs->eflags &= ~X86_EFLAGS_RF;
+
+            /* Zero the upper 32 bits of %rip if not in long mode. */
+            if ( vmx_guest_x86_mode(current) != 8 )
+                regs->eip = regs->_eip;
         }
     }