From: Jack Lange Date: Fri, 31 Oct 2008 23:25:45 +0000 (-0500) Subject: hooked in page table walkers for 64 bit page table activation X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=11b5cccde17af54f3998c38952e0eeedf85ced0a hooked in page table walkers for 64 bit page table activation bug fixes --- diff --git a/palacios/include/palacios/vmm_paging.h b/palacios/include/palacios/vmm_paging.h index b2e0a65..15c089a 100644 --- a/palacios/include/palacios/vmm_paging.h +++ b/palacios/include/palacios/vmm_paging.h @@ -538,7 +538,7 @@ int v3_check_guest_pt_64(struct guest_info * info, v3_reg_t guest_cr3, addr_t va int v3_walk_host_pt_32(v3_reg_t host_cr3, - int (*callback)(int level, addr_t page_va, addr_t page_pa, void * private_data), + void (*callback)(page_type_t type, addr_t page_va, addr_t page_pa, void * private_data), void * private_data); int v3_walk_host_pt_32pae(v3_reg_t host_cr3, @@ -548,6 +548,18 @@ int v3_walk_host_pt_32pae(v3_reg_t host_cr3, int v3_walk_host_pt_64(v3_reg_t host_cr3, void (*callback)(page_type_t type, addr_t page_va, addr_t page_pa, void * private_data), void * private_data); + +int v3_walk_guest_pt_32(struct guest_info * info, v3_reg_t guest_cr3, + void (*callback)(page_type_t type, addr_t page_va, addr_t page_pa, void * private_data), + void * private_data); + +int v3_walk_guest_pt_32pae(struct guest_info * info, v3_reg_t guest_cr3, + void (*callback)(page_type_t type, addr_t page_va, addr_t page_pa, void * private_data), + void * private_data); + +int v3_walk_guest_pt_64(struct guest_info * info, v3_reg_t guest_cr3, + void (*callback)(page_type_t type, addr_t page_va, addr_t page_pa, void * private_data), + void * private_data); struct guest_info; diff --git a/palacios/src/palacios/vmm_paging.c b/palacios/src/palacios/vmm_paging.c index edcab77..f63ddf1 100644 --- a/palacios/src/palacios/vmm_paging.c +++ b/palacios/src/palacios/vmm_paging.c @@ -1412,7 +1412,7 @@ pml4e64_t * create_passthrough_pts_64(struct guest_info * info) { int v3_walk_guest_pt_32(struct guest_info * info, v3_reg_t guest_cr3, - int (*callback)(int level, addr_t page_ptr, addr_t page_pa, void * private_data), + void (*callback)(page_type_t type, addr_t page_ptr, addr_t page_pa, void * private_data), void * private_data) { addr_t guest_pde_pa = CR3_TO_PDE32_PA(guest_cr3); pde32_t * guest_pde = NULL; @@ -1479,7 +1479,7 @@ int v3_walk_guest_pt_32(struct guest_info * info, v3_reg_t guest_cr3, int v3_walk_guest_pt_32pae(struct guest_info * info, v3_reg_t guest_cr3, - int (*callback)(int level, addr_t page_ptr, addr_t page_pa, void * private_data), + void (*callback)(page_type_t type, addr_t page_ptr, addr_t page_pa, void * private_data), void * private_data) { addr_t guest_pdpe_pa = CR3_TO_PDPE32PAE_PA(guest_cr3); pdpe32pae_t * guest_pdpe = NULL; @@ -1565,7 +1565,7 @@ int v3_walk_guest_pt_32pae(struct guest_info * info, v3_reg_t guest_cr3, int v3_walk_guest_pt_64(struct guest_info * info, v3_reg_t guest_cr3, - int (*callback)(int level, addr_t page_ptr, addr_t page_pa, void * private_data), + void (*callback)(page_type_t type, addr_t page_ptr, addr_t page_pa, void * private_data), void * private_data) { addr_t guest_pml_pa = CR3_TO_PML4E64_PA(guest_cr3); pml4e64_t * guest_pml = NULL; @@ -1678,7 +1678,7 @@ int v3_walk_guest_pt_64(struct guest_info * info, v3_reg_t guest_cr3, } int v3_walk_host_pt_32(v3_reg_t host_cr3, - int (*callback)(int level, addr_t page_ptr, addr_t page_pa, void * private_data), + void (*callback)(page_type_t type, addr_t page_ptr, addr_t page_pa, void * private_data), void * private_data) { pde32_t * host_pde = (pde32_t *)CR3_TO_PDE32_VA(host_cr3); addr_t pde_pa = CR3_TO_PDE32_PA(host_cr3); diff --git a/palacios/src/palacios/vmm_shadow_paging.c b/palacios/src/palacios/vmm_shadow_paging.c index 933ef6b..702b6f0 100644 --- a/palacios/src/palacios/vmm_shadow_paging.c +++ b/palacios/src/palacios/vmm_shadow_paging.c @@ -80,6 +80,7 @@ static int handle_shadow_pagefault_64(struct guest_info * info, addr_t fault_add static int cache_page_tables_32(struct guest_info * info, addr_t pde); +static int cache_page_tables_64(struct guest_info * info, addr_t pde); int v3_init_shadow_page_state(struct guest_info * info) { struct shadow_page_state * state = &(info->shdw_pg_state); @@ -277,15 +278,26 @@ static int activate_shadow_pt_32pae(struct guest_info * info) { return -1; } +static void activate_shadow_pt_64_cb(page_type_t type, addr_t page_ptr, addr_t page_pa, void * private_data) { + PrintDebug("CB: Page: %p, Type: %s\n", (void *)page_pa, v3_page_type_to_str(type)); +} + + static int activate_shadow_pt_64(struct guest_info * info) { - struct cr3_64 * shadow_cr3 = (struct cr3_64 *)&(info->ctrl_regs.cr3); + // struct cr3_64 * shadow_cr3 = (struct cr3_64 *)&(info->ctrl_regs.cr3); struct cr3_64 * guest_cr3 = (struct cr3_64 *)&(info->shdw_pg_state.guest_cr3); int cached = 0; + v3_walk_guest_pt_64(info, info->shdw_pg_state.guest_cr3, activate_shadow_pt_64_cb, NULL); + + + return -1; + + // Check if shadow page tables are in the cache cached = cache_page_tables_64(info, CR3_TO_PDE32_PA(*(addr_t *)guest_cr3)); - + /* if (cached == -1) { PrintError("CR3 Cache failed\n"); return -1; @@ -307,6 +319,7 @@ static int activate_shadow_pt_64(struct guest_info * info) { shadow_cr3->pcd = guest_cr3->pcd; return 0; + */ }