WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [PATCH] sysenter-msr.patch

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [PATCH] sysenter-msr.patch
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Thu, 23 Jun 2005 09:50:16 +0000
Cc: james@xxxxxxxxxxxxx
Delivery-date: Thu, 23 Jun 2005 11:04:50 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1736, 2005/06/23 10:50:16+01:00, arun.sharma@xxxxxxxxx

        [PATCH] sysenter-msr.patch
        
        Handle MSR reads/writes to sysenter related MSRs.
        
        Signed-off-by: Xiaofeng Ling <xiaofeng.ling@xxxxxxxxx>
        Signed-off-by: Chengyuan Li <chengyuan.li@xxxxxxxxx>
        Signed-off-by: Arun Sharma <arun.sharma@xxxxxxxxx>



 vmx.c |   48 +++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 43 insertions(+), 5 deletions(-)


diff -Nru a/xen/arch/x86/vmx.c b/xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c        2005-06-23 07:06:01 -04:00
+++ b/xen/arch/x86/vmx.c        2005-06-23 07:06:01 -04:00
@@ -1009,8 +1009,23 @@
     VMX_DBG_LOG(DBG_LEVEL_1, "vmx_do_msr_read: ecx=%lx, eax=%lx, edx=%lx",
                 (unsigned long)regs->ecx, (unsigned long)regs->eax, 
                 (unsigned long)regs->edx);
-
-    rdmsr(regs->ecx, regs->eax, regs->edx);
+    switch (regs->ecx) {
+        case MSR_IA32_SYSENTER_CS:
+            __vmread(GUEST_SYSENTER_CS, &regs->eax);
+            regs->edx = 0;
+            break;
+        case MSR_IA32_SYSENTER_ESP:    
+             __vmread(GUEST_SYSENTER_ESP, &regs->eax);
+             regs->edx = 0;
+            break;
+        case MSR_IA32_SYSENTER_EIP:            
+            __vmread(GUEST_SYSENTER_EIP, &regs->eax);
+            regs->edx = 0;
+            break;
+        default:
+            rdmsr(regs->ecx, regs->eax, regs->edx);
+            break;
+    }
 
     VMX_DBG_LOG(DBG_LEVEL_1, "vmx_do_msr_read returns: "
                 "ecx=%lx, eax=%lx, edx=%lx",
@@ -1018,6 +1033,31 @@
                 (unsigned long)regs->edx);
 }
 
+static inline void vmx_do_msr_write(struct cpu_user_regs *regs)
+{
+    VMX_DBG_LOG(DBG_LEVEL_1, "vmx_do_msr_write: ecx=%lx, eax=%lx, edx=%lx",
+                (unsigned long)regs->ecx, (unsigned long)regs->eax, 
+                (unsigned long)regs->edx);
+    switch (regs->ecx) {
+        case MSR_IA32_SYSENTER_CS:
+            __vmwrite(GUEST_SYSENTER_CS, regs->eax);
+            break;
+        case MSR_IA32_SYSENTER_ESP:    
+             __vmwrite(GUEST_SYSENTER_ESP, regs->eax);
+            break;
+        case MSR_IA32_SYSENTER_EIP:            
+            __vmwrite(GUEST_SYSENTER_EIP, regs->eax);
+            break;
+        default:
+            break;
+    }
+
+    VMX_DBG_LOG(DBG_LEVEL_1, "vmx_do_msr_write returns: "
+                "ecx=%lx, eax=%lx, edx=%lx",
+                (unsigned long)regs->ecx, (unsigned long)regs->eax,
+                (unsigned long)regs->edx);
+}
+
 /*
  * Need to use this exit to reschedule
  */
@@ -1332,9 +1372,7 @@
         break;
     case EXIT_REASON_MSR_WRITE:
         __vmread(GUEST_RIP, &eip);
-        VMX_DBG_LOG(DBG_LEVEL_1, "MSR_WRITE: eip=%lx, eax=%lx, edx=%lx",
-                eip, (unsigned long)regs.eax, (unsigned long)regs.edx);
-        /* just ignore this point */
+        vmx_do_msr_write(&regs);
         __get_instruction_length(inst_len);
         __update_guest_eip(inst_len);
         break;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [PATCH] sysenter-msr.patch, BitKeeper Bot <=