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.


vmx fixes
Jack Lange [Wed, 20 Jun 2012 19:23:02 +0000 (15:23 -0400)]
palacios/src/palacios/vmx.c
palacios/src/palacios/vmx_ctrl_regs.c

index 649181b..0950045 100644 (file)
@@ -399,7 +399,7 @@ static int init_vmcs_bios(struct guest_info * core, struct vmx_data * vmx_state)
        vmx_ret |= check_vmcs_write(VMCS_CR4_MASK, CR4_VMXE);
 #define CR0_NE 0x00000020
        vmx_ret |= check_vmcs_write(VMCS_CR0_MASK, CR0_NE);
-       //((struct cr0_32 *)&(core->shdw_pg_state.guest_cr0))->ne = 1;
+       ((struct cr0_32 *)&(core->shdw_pg_state.guest_cr0))->ne = 1;
 
        if (v3_init_ept(core, &hw_info) == -1) {
            PrintError("Error initializing EPT\n");
index 3303365..01c5dfe 100644 (file)
@@ -169,9 +169,9 @@ static int handle_mov_to_cr0(struct guest_info * info, v3_reg_t * new_cr0, struc
     extern v3_cpu_arch_t v3_mach_type;
 
 
-    V3_Print("Mov to CR0\n");
-    V3_Print("Old shadow CR0: 0x%x, New shadow CR0: 0x%x\n",
-            (uint32_t)info->shdw_pg_state.guest_cr0, (uint32_t)*new_cr0);
+    PrintDebug("Mov to CR0\n");
+    PrintDebug("Old shadow CR0: 0x%x, New shadow CR0: 0x%x\n",
+              (uint32_t)info->shdw_pg_state.guest_cr0, (uint32_t)*new_cr0);
 
     if ((new_shdw_cr0->pe != shdw_cr0->pe) && (vmx_info->assist_state != VMXASSIST_DISABLED)) {
        /*
@@ -219,15 +219,16 @@ static int handle_mov_to_cr0(struct guest_info * info, v3_reg_t * new_cr0, struc
        
            guest_cr0->pe = 1;
            guest_cr0->pg = 1;
-           guest_cr0->ne = 1;
        } else {
            // Unrestricted guest 
-           *(uint32_t *)shdw_cr0 = (0x00000020 & *(uint32_t *)new_shdw_cr0);
+           //    *(uint32_t *)shdw_cr0 = (0x00000020 & *(uint32_t *)new_shdw_cr0);
 
            *guest_cr0 = *new_shdw_cr0;
-           guest_cr0->ne = 1;
        }
 
+       guest_cr0->ne = 1;
+       guest_cr0->et = 1;
+
        
        if (paging_transition) {
            // Paging transition
@@ -236,14 +237,24 @@ static int handle_mov_to_cr0(struct guest_info * info, v3_reg_t * new_cr0, struc
                struct efer_64 * vm_efer = (struct efer_64 *)&(info->shdw_pg_state.guest_efer);
                struct efer_64 * hw_efer = (struct efer_64 *)&(info->ctrl_regs.efer);
                
-               if (vm_efer->lme) {
-                   //     PrintDebug("Enabling long mode\n");
-                   
-                   hw_efer->lma = 1;
-                   hw_efer->lme = 1;
-                   
-                   vmx_info->entry_ctrls.guest_ia32e = 1;
-               }
+               if (vmx_info->assist_state != VMXASSIST_DISABLED) {
+                   if (vm_efer->lme) {
+                       PrintDebug("Enabling long mode\n");
+                       
+                       hw_efer->lma = 1;
+                       hw_efer->lme = 1;
+                       
+                       vmx_info->entry_ctrls.guest_ia32e = 1;
+                   }
+               } else {
+                   if (hw_efer->lme) {
+                       PrintDebug("Enabling long mode\n");
+                       
+                       hw_efer->lma = 1;
+                       
+                       vmx_info->entry_ctrls.guest_ia32e = 1;
+                   }
+               }
                
                //            PrintDebug("Activating Shadow Page tables\n");