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);
}
+static int cache_page_tables_64(struct guest_info * info, addr_t pde) {
+ return -1;
+}
+
int v3_replace_shdw_page32(struct guest_info * info, addr_t location, pte32_t * new_page, pte32_t * old_page) {
pde32_t * shadow_pd = (pde32_t *)CR3_TO_PDE32_VA(info->ctrl_regs.cr3);
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;
shadow_pt = v3_create_new_shadow_pt();
- shadow_cr3->pdt_base_addr = (addr_t)V3_PAddr((void *)(addr_t)PAGE_BASE_ADDR(shadow_pt));
- PrintDebug( "Created new shadow page table %p\n", (void *)(addr_t)shadow_cr3->pdt_base_addr );
+ shadow_cr3->pml4t_base_addr = (addr_t)V3_PAddr((void *)(addr_t)PAGE_BASE_ADDR(shadow_pt));
+ PrintDebug( "Created new shadow page table %p\n", (void *)(addr_t)shadow_cr3->pml4t_base_addr );
} else {
PrintDebug("Reusing cached shadow Page table\n");
}
shadow_cr3->pcd = guest_cr3->pcd;
return 0;
+ */
}