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

[Xen-changelog] With this patch, 32-bit binary can work on 64-bit VMX guest.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID aa1adbeecfcdafeb2cea4d4991368ff168a9329b
# Parent  20b6be0e1fa1feaf7942fdde976efa0bbac5c22d
With this patch, 32-bit binary can work on 64-bit VMX guest.

Signed-off-by: Chengyuan Li <chengyuan.li@xxxxxxxxx>
Signed-off-by: Jun Nakajima <jun.nakajima@xxxxxxxxx>
Signed-off-by: Asit Mallick <asit.k.mallick@xxxxxxxxx>

diff -r 20b6be0e1fa1 -r aa1adbeecfcd xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c        Sat Sep 10 14:22:12 2005
+++ b/xen/arch/x86/vmx.c        Sat Sep 10 14:24:39 2005
@@ -1394,21 +1394,20 @@
 
 static inline void vmx_do_msr_read(struct cpu_user_regs *regs)
 {
+    u64 msr_content = 0;
+
     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);
     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;
+            __vmread(GUEST_SYSENTER_CS, (u32 *)&msr_content);
+            break;
+        case MSR_IA32_SYSENTER_ESP:
+             __vmread(GUEST_SYSENTER_ESP, &msr_content);
+            break;
+        case MSR_IA32_SYSENTER_EIP:
+            __vmread(GUEST_SYSENTER_EIP, &msr_content);
             break;
         default:
             if(long_mode_do_msr_read(regs))
@@ -1417,6 +1416,9 @@
             break;
     }
 
+    regs->eax = msr_content & 0xFFFFFFFF;
+    regs->edx = msr_content >> 32;
+
     VMX_DBG_LOG(DBG_LEVEL_1, "vmx_do_msr_read returns: "
                 "ecx=%lx, eax=%lx, edx=%lx",
                 (unsigned long)regs->ecx, (unsigned long)regs->eax,
@@ -1425,18 +1427,23 @@
 
 static inline void vmx_do_msr_write(struct cpu_user_regs *regs)
 {
+    u64 msr_content;
+
     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);
+
+    msr_content = (regs->eax & 0xFFFFFFFF) | ((u64)regs->edx << 32);
+
     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);
+            __vmwrite(GUEST_SYSENTER_CS, msr_content);
+            break;
+        case MSR_IA32_SYSENTER_ESP:
+             __vmwrite(GUEST_SYSENTER_ESP, msr_content);
+            break;
+        case MSR_IA32_SYSENTER_EIP:
+            __vmwrite(GUEST_SYSENTER_EIP, msr_content);
             break;
         default:
             long_mode_do_msr_write(regs);

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


 


Rackspace

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