PrintDebug("Activating 32 Bit cacheable page tables\n");
shdw_pg = find_shdw_pt(core->vm_info, gpa, PAGE_PD32);
- PrintError("shdw_pg returned as %p\n", shdw_pg);
+ PrintError("shdw_pg returned as %p for CR3:%p\n", shdw_pg, (void *)gpa);
if (shdw_pg == NULL) {
shdw_pg = create_shdw_pt(core->vm_info, gpa, PAGE_PD32);
+
+ // update current reverse map entries...
+ // We are now using this page in a PT, so:
+ // any existing writable mappings must be updated
+ update_rmap_entries(core->vm_info, gpa);
}
PrintDebug("shdw_pg now exists...\n");
return 0;
}
-
+
pte32_t * shadow_pt = NULL;
pte32_t * guest_pt = NULL;
/* Set up cache state */
addr_t gpa = BASE_TO_PAGE_ADDR_4KB(guest_pde->pt_base_addr);
-
+
struct shdw_pg_data * shdw_page = NULL;
page_type_t pt_type = PAGE_PT32;
if (shdw_page == NULL) {
shdw_page = create_shdw_pt(core->vm_info, gpa, pt_type);
- }
-
- // update current reverse map entries...
- // We are now using this page in a PT, so:
- // any existing writable mappings must be updated
- update_rmap_entries(core->vm_info, gpa);
+
+ if (pt_type == PAGE_PT32) {
+ // update current reverse map entries...
+ // We are now using this page in a PT, so:
+ // any existing writable mappings must be updated
+ update_rmap_entries(core->vm_info, gpa);
+ }
+ }
+
struct shdw_pg_data * parent_page = find_shdw_pt(core->vm_info, guest_cr3, PAGE_PD32);
pte32_t * shadow_pte = (pte32_t *)&(shadow_pt[PTE32_INDEX(fault_addr)]);
addr_t guest_pa = BASE_TO_PAGE_ADDR((addr_t)(guest_pte->page_base_addr)) + PAGE_OFFSET(fault_addr);
- struct v3_mem_region * shdw_reg = v3_get_mem_region(core->vm_info, core->cpu_id, guest_pa);
+ struct v3_mem_region * shdw_reg = v3_get_mem_region(core->vm_info, core->vcpu_id, guest_pa);
if (shdw_reg == NULL) {
// Inject a machine check in the guest
}
if (pt_page != NULL) {
+ PrintError("Found PT page (small), marking RD-ONLY (va=%p), (gpa=%p)\n",
+ (void *)fault_addr, (void *)pg_gpa);
// This is a page table page...
shadow_pte->writable = 0;
shadow_pte->vmm_info = V3_CACHED_PG;
PrintDebug("Handling 4MB fault (guest_fault_pa=%p) (error_code=%x)\n", (void *)guest_fault_pa, *(uint_t*)&error_code);
PrintDebug("ShadowPT=%p, LargeGuestPDE=%p\n", shadow_pt, large_guest_pde);
- struct v3_mem_region * shdw_reg = v3_get_mem_region(core->vm_info, core->cpu_id, guest_fault_pa);
+ struct v3_mem_region * shdw_reg = v3_get_mem_region(core->vm_info, core->vcpu_id, guest_fault_pa);
if (shdw_reg == NULL) {
if (pt_page != NULL) {
// This is a page table page...
+ PrintError("Found PT page (large), marking RD-ONLY (va=%p), (gpa=%p)\n",
+ (void *)fault_addr, (void *)pg_gpa);
+
shadow_pte->writable = 0;
shadow_pte->vmm_info = V3_CACHED_PG;
}
guest_pde = (pde32_t *)&(guest_pd[PDE32_INDEX(vaddr)]);
+ // Should we back propagate the invalidations, because they might be cached...??
+
if (guest_pde->large_page == 1) {
shadow_pde->present = 0;
- PrintError("\tInvalidating small page\n");
+ // PrintError("\tInvalidating small page\n");
shadow_pte->present = 0;