[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.6] hvm/fep: Allow testing of instructions crossing the -1 -> 0 virtual boundary



commit 7c863200e6205ba693b1c40b76a55a39e3dd1f30
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Sep 12 16:00:08 2016 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Sep 12 16:00:08 2016 +0200

    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 <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 7b5cee79dad24e7006059667b02bd7de685d8ee5
    master date: 2016-09-08 16:39:46 +0100
---
 xen/arch/x86/hvm/svm/svm.c | 4 ++++
 xen/arch/x86/hvm/vmx/vmx.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 74fb733..07ccae3 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -2139,6 +2139,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;
         }
     }
 
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 1a4073e..698c906 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2771,6 +2771,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;
         }
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.6

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.