// Page Table Entry Not Present
PrintDebug("guest_pa =%p\n", (void *)guest_pa);
- if ((shdw_reg->host_type == SHDW_REGION_ALLOCATED) ||
- (shdw_reg->host_type == SHDW_REGION_WRITE_HOOK)) {
+ if ((shdw_reg->flags.alloced == 1) ||
+ (shdw_reg->flags.read == 1)) {
addr_t shadow_pa = v3_get_shadow_addr(shdw_reg, info->cpu_id, guest_pa);
shadow_pte->page_base_addr = PAGE_BASE_ADDR(shadow_pa);
}
-
- // Write hooks trump all, and are set Read Only
- if (shdw_reg->host_type == SHDW_REGION_WRITE_HOOK) {
+ if (shdw_reg->flags.write == 0) {
shadow_pte->writable = 0;
}
} else {
// Page fault handled by hook functions
- if (v3_handle_mem_hook(info, fault_addr, guest_pa, shdw_reg, error_code) == -1) {
+ if (shdw_reg->unhandled(info, fault_addr, guest_pa, shdw_reg, error_code) == -1) {
PrintError("Special Page fault handler returned error for address: %p\n", (void *)fault_addr);
return -1;
}
} else if (shadow_pte_access == PT_ACCESS_WRITE_ERROR) {
guest_pte->dirty = 1;
- if (shdw_reg->host_type == SHDW_REGION_WRITE_HOOK) {
- if (v3_handle_mem_hook(info, fault_addr, guest_pa, shdw_reg, error_code) == -1) {
+
+ if (shdw_reg->flags.write == 1) {
+ PrintDebug("Shadow PTE Write Error\n");
+ shadow_pte->writable = guest_pte->writable;
+ } else {
+ if (shdw_reg->unhandled(info, fault_addr, guest_pa, shdw_reg, error_code) == -1) {
PrintError("Special Page fault handler returned error for address: %p\n", (void *)fault_addr);
return -1;
}
- } else {
- PrintDebug("Shadow PTE Write Error\n");
- shadow_pte->writable = guest_pte->writable;
- }
+ }
return 0;
if (shadow_pte_access == PT_ACCESS_NOT_PRESENT) {
// Get the guest physical address of the fault
- if ((shdw_reg->host_type == SHDW_REGION_ALLOCATED) ||
- (shdw_reg->host_type == SHDW_REGION_WRITE_HOOK)) {
+ if ((shdw_reg->flags.alloced == 1) ||
+ (shdw_reg->flags.read == 1)) {
addr_t shadow_pa = v3_get_shadow_addr(shdw_reg, info->cpu_id, guest_fault_pa);
shadow_pte->page_base_addr = PAGE_BASE_ADDR(shadow_pa);
*/
shadow_pte->user_page = 1;
- if (shdw_reg->host_type == SHDW_REGION_WRITE_HOOK) {
+ if (shdw_reg->flags.write == 0) {
shadow_pte->writable = 0;
} else {
shadow_pte->writable = 1;
//
} else {
- if (v3_handle_mem_hook(info, fault_addr, guest_fault_pa, shdw_reg, error_code) == -1) {
+ if (shdw_reg->unhandled(info, fault_addr, guest_fault_pa, shdw_reg, error_code) == -1) {
PrintError("Special Page Fault handler returned error for address: %p\n", (void *)fault_addr);
return -1;
}
}
} else if (shadow_pte_access == PT_ACCESS_WRITE_ERROR) {
-
- if (shdw_reg->host_type == SHDW_REGION_WRITE_HOOK) {
-
- if (v3_handle_mem_hook(info, fault_addr, guest_fault_pa, shdw_reg, error_code) == -1) {
- PrintError("Special Page Fault handler returned error for address: %p\n", (void *)fault_addr);
- return -1;
- }
- }
-
+ if (shdw_reg->unhandled(info, fault_addr, guest_fault_pa, shdw_reg, error_code) == -1) {
+ PrintError("Special Page Fault handler returned error for address: %p\n", (void *)fault_addr);
+ return -1;
+ }
} else {
PrintError("Error in large page fault handler...\n");
PrintError("This case should have been handled at the top level handler\n");