X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmx_ctrl_regs.c;h=01c5dfe60513fc11404167f01f300045d80bc91f;hb=d597d493eb303496f3bb32e2a73a094a8a20a022;hp=33033651702b0381c28c76e6f3e661eb23428d2c;hpb=a686a57429dcd9fa2f701228227dadcd096df8ed;p=palacios.releases.git diff --git a/palacios/src/palacios/vmx_ctrl_regs.c b/palacios/src/palacios/vmx_ctrl_regs.c index 3303365..01c5dfe 100644 --- a/palacios/src/palacios/vmx_ctrl_regs.c +++ b/palacios/src/palacios/vmx_ctrl_regs.c @@ -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");