Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Intel VMX ASM fixes
Jack Lange [Sat, 30 Jan 2010 21:18:55 +0000 (15:18 -0600)]
palacios/include/palacios/vmx_lowlevel.h
palacios/src/palacios/vmx.c

index 81872e0..9ea6ffb 100644 (file)
@@ -136,9 +136,9 @@ static inline int vmcs_read(vmcs_field_t vmcs_field, void * dst) {
                 VMREAD_OPCODE
                 EAX_ECX_MODRM
                 "seteb %1;" // fail valid
-                "setnaeb %2;" // fail invalid
-                :  "=&c"(val), "=q"(ret_valid), "=q"(ret_invalid) // Use ECX
-                : "a" (vmcs_field), "1"(ret_valid), "2"(ret_invalid)
+                "setnaeb %1;" // fail invalid
+                :  "=c"(val), "=d"(ret_valid) //, "=r"(ret_invalid) // Use ECX
+                : "a" (vmcs_field), "0"(0), "1"(ret_valid)
                 : "memory"
                 );
 
@@ -170,8 +170,8 @@ static inline int vmcs_write(vmcs_field_t vmcs_field, addr_t value) {
                 EAX_ECX_MODRM
                 "seteb %0;" // fail valid (ZF=1)
                 "setnaeb %1;" // fail invalid (CF=1)
-                : "=q" (ret_valid), "=q" (ret_invalid)
-                : "a" (vmcs_field), "c"(value), "0"(ret_valid), "1"(ret_invalid)
+                : "=r" (ret_valid), "=r" (ret_invalid)
+                : "a" (vmcs_field), "c"(value)
                 : "memory");
 
     CHECK_VMXFAIL(ret_valid, ret_invalid);
index aba5656..4a8c021 100644 (file)
@@ -794,7 +794,7 @@ void v3_init_vmx_cpu(int cpu_id) {
     uint64_t ret = 0;
 
     v3_get_msr(VMX_CR4_FIXED0_MSR,&(tmp_msr.hi),&(tmp_msr.lo));
-    
+#ifdef __V3_64BIT__
     __asm__ __volatile__ (
                          "movq %%cr4, %%rbx;"
                          "orq  $0x00002000, %%rbx;"
@@ -823,6 +823,38 @@ void v3_init_vmx_cpu(int cpu_id) {
                          :
                          : "%rbx"
                          );
+#elif __V3_32BIT__
+    __asm__ __volatile__ (
+                         "movq %%cr4, %%ecx;"
+                         "orq  $0x00002000, %%ecx;"
+                         "movq %%ecx, %0;"
+                         : "=m"(ret) 
+                         :
+                         : "%ecx"
+                         );
+
+    if ((~ret & tmp_msr.value) == 0) {
+        __asm__ __volatile__ (
+                             "movq %0, %%cr4;"
+                             :
+                             : "q"(ret)
+                             );
+    } else {
+        PrintError("Invalid CR4 Settings!\n");
+        return;
+    }
+
+    __asm__ __volatile__ (
+                         "movq %%cr0, %%ecx; "
+                         "orq  $0x00000020,%%ecx; "
+                         "movq %%ecx, %%cr0;"
+                         :
+                         :
+                         : "%ecx"
+                         );
+
+#endif
+
     //
     // Should check and return Error here....