From: Jack Lange Date: Mon, 24 Sep 2012 20:21:59 +0000 (-0400) Subject: add correct caching behavior to VMX EPT environments X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=f65a7b2c1b9bd2196054ac2cabd0b09472b0d83f;p=palacios.releases.git add correct caching behavior to VMX EPT environments --- diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index c341982..833d08e 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -419,8 +419,10 @@ static int init_vmcs_bios(struct guest_info * core, struct vmx_data * vmx_state) // Cause VM_EXIT whenever the CR4.VMXE bit is set vmx_ret |= check_vmcs_write(VMCS_CR4_MASK, CR4_VMXE); #define CR0_NE 0x00000020 - vmx_ret |= check_vmcs_write(VMCS_CR0_MASK, CR0_NE); +#define CR0_CD 0x40000000 + vmx_ret |= check_vmcs_write(VMCS_CR0_MASK, CR0_NE | CR0_CD); ((struct cr0_32 *)&(core->shdw_pg_state.guest_cr0))->ne = 1; + ((struct cr0_32 *)&(core->shdw_pg_state.guest_cr0))->cd = 0; if (v3_init_ept(core, &hw_info) == -1) { PrintError("Error initializing EPT\n"); diff --git a/palacios/src/palacios/vmx_ctrl_regs.c b/palacios/src/palacios/vmx_ctrl_regs.c index 2b0bfb5..0f10f7e 100644 --- a/palacios/src/palacios/vmx_ctrl_regs.c +++ b/palacios/src/palacios/vmx_ctrl_regs.c @@ -246,6 +246,8 @@ static int handle_mov_to_cr0(struct guest_info * info, v3_reg_t * new_cr0, struc // *(uint32_t *)shdw_cr0 = (0x00000020 & *(uint32_t *)new_shdw_cr0); *guest_cr0 = *new_shdw_cr0; + + guest_cr0->cd = 0; } guest_cr0->ne = 1; diff --git a/palacios/src/palacios/vmx_ept.c b/palacios/src/palacios/vmx_ept.c index d239bd2..2a7055d 100644 --- a/palacios/src/palacios/vmx_ept.c +++ b/palacios/src/palacios/vmx_ept.c @@ -151,7 +151,9 @@ int v3_handle_ept_fault(struct guest_info * core, addr_t fault_addr, struct ept_ // Full access pde2mb[pde_index].read = 1; pde2mb[pde_index].exec = 1; - + pde2mb[pde_index].ipat = 1; + pde2mb[pde_index].mt = 6; + if (region->flags.write == 1) { pde2mb[pde_index].write = 1; } else { @@ -204,6 +206,8 @@ int v3_handle_ept_fault(struct guest_info * core, addr_t fault_addr, struct ept_ // Full access pte[pte_index].read = 1; pte[pte_index].exec = 1; + pte[pte_index].ipat = 1; + pte[pte_index].mt = 6; if (region->flags.write == 1) { pte[pte_index].write = 1;