From: Lei Xia Date: Tue, 10 Nov 2009 20:24:32 +0000 (-0600) Subject: Merge branch 'devel' of ssh://palacios@newskysaw.cs.northwestern.edu/home/palacios... X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=00873eb2dcc088d5b7470e25ab24b43560335a05;hp=46db31bad625ca5d360ec78d8ea2accce1faac6a Merge branch 'devel' of ssh://palacios@newskysaw.cs.northwestern.edu/home/palacios/palacios into devel --- diff --git a/palacios/include/palacios/vmm_shadow_paging.h b/palacios/include/palacios/vmm_shadow_paging.h index cd0cb7a..d7629a1 100644 --- a/palacios/include/palacios/vmm_shadow_paging.h +++ b/palacios/include/palacios/vmm_shadow_paging.h @@ -31,6 +31,9 @@ struct shadow_page_state { + // ugly optimization hack + v3_reg_t prev_guest_cr3; + // virtualized control registers v3_reg_t guest_cr3; diff --git a/palacios/src/palacios/vmm_ctrl_regs.c b/palacios/src/palacios/vmm_ctrl_regs.c index 2b20972..bbeaf4c 100644 --- a/palacios/src/palacios/vmm_ctrl_regs.c +++ b/palacios/src/palacios/vmm_ctrl_regs.c @@ -322,14 +322,33 @@ int v3_handle_cr3_write(struct guest_info * info) { struct cr3_32 * guest_cr3 = (struct cr3_32 *)&(info->shdw_pg_state.guest_cr3); *guest_cr3 = *new_cr3; } + + +#ifdef CONFIG_CRAY_XT // If Paging is enabled in the guest then we need to change the shadow page tables if (info->mem_mode == VIRTUAL_MEM) { + if (info->shdw_pg_state.prev_guest_cr3 != info->shdw_pg_state.guest_cr3) { + if (v3_activate_shadow_pt(info) == -1) { + PrintError("Failed to activate 32 bit shadow page table\n"); + return -1; + } + } + } + + info->shdw_pg_state.prev_guest_cr3 = info->shdw_pg_state.guest_cr3; +#else + + // If Paging is enabled in the guest then we need to change the shadow page tables + if (info->mem_mode == VIRTUAL_MEM) { if (v3_activate_shadow_pt(info) == -1) { PrintError("Failed to activate 32 bit shadow page table\n"); return -1; } } + +#endif + PrintDebug("New Shadow CR3=%p; New Guest CR3=%p\n", (void *)(addr_t)(info->ctrl_regs.cr3), diff --git a/palacios/src/palacios/vmm_shadow_paging.c b/palacios/src/palacios/vmm_shadow_paging.c index 0afc383..abe6d88 100644 --- a/palacios/src/palacios/vmm_shadow_paging.c +++ b/palacios/src/palacios/vmm_shadow_paging.c @@ -81,6 +81,8 @@ static void telemetry_cb(struct guest_info * info, void * private_data, char * h int v3_init_shadow_page_state(struct guest_info * info) { struct shadow_page_state * state = &(info->shdw_pg_state); + state->prev_guest_cr3 = 0; + state->guest_cr3 = 0; state->guest_cr0 = 0; state->guest_efer.value = 0x0LL;