# Makefile for GeekOS kernel, userspace, and tools
# Copyright (c) 2004,2005 David H. Hovemeyer <daveho@cs.umd.edu>
-# $Revision: 1.46 $
+# $Revision: 1.47 $
# This is free software. You are permitted to use,
# redistribute, and modify it as specified in the file "COPYING".
XED=0
ifeq ($(DEBUG),1)
- JRLDEBUG= -DSERIAL_PRINT_DEBUG=1 -DSERIAL_PRINT_DEBUG_LEVEL=10 -DSERIAL_PRINT=1 -DVMM_DEBUG=1 -DVMM_INFO=1 -DVMM_TRACE=1
+ JRLDEBUG= -DSERIAL_PRINT_DEBUG=1 -DSERIAL_PRINT_DEBUG_LEVEL=10 -DSERIAL_PRINT=1 -DVMM_DEBUG=1 -DVMM_INFO=1 -DVMM_TRACE=1
+#-DDEBUG_SHADOW_PAGING -DDEBUG_CTRL_REGS -DDEBUG_INTERRUPTS -DDEBUG_IO
else
JRLDEBUG= -DSERIAL_PRINT_DEBUG=0 -DSERIAL_PRINT_DEBUG_LEVEL=999999 -DSERIAL_PRINT=0 -DVMM_DEBUG=0 -DVMM_INFO=0 -DVMM_TRACE=0
endif
#endif
+
+#define PrintError(fmt, args...) \
+ do { \
+ extern struct vmm_os_hooks * os_hooks; \
+ if ((os_hooks) && (os_hooks)->print_debug) { \
+ (os_hooks)->print_debug((fmt), ##args); \
+ } \
+ } while (0)
+
+
+
#if VMM_INFO
#define PrintInfo(fmt, args...) \
do { \
nvram_state->mem_state[NVRAM_REG_EXT_MEMORY_2ND_LOW]= 0x00;
// Set the extended memory beyond 16 MB to 128-16 MB
- nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_HIGH]= 0x7;
- nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_LOW]= 0x00;
+ nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_HIGH] = 0x7;
+ nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_LOW] = 0x00;
//nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_HIGH]= 0x00;
//nvram_state->mem_state[NVRAM_REG_AMI_BIG_MEMORY_LOW]= 0x00;
//add_shadow_region_passthrough(&vm_info, 0x100000, 0x2000000, (addr_t)Allocate_VMM_Pages(8192));
add_shadow_region_passthrough(&vm_info, 0x100000, 0x1000000, (addr_t)Allocate_VMM_Pages(4096));
+ add_shadow_region_passthrough(&vm_info, 0x1000000, 0x8000000, (addr_t)Allocate_VMM_Pages(32768));
+
// test - give linux accesss to PCI space - PAD
add_shadow_region_passthrough(&vm_info, 0xc0000000,0xffffffff,0xc0000000);
mystate.should_ack=0;
mystate.opaque=my_opaque[mystate.irq];
- PrintBoth("translate_intr_handler: opaque=0x%x\n",mystate.opaque);
+ // PrintBoth("translate_intr_handler: opaque=0x%x\n",mystate.opaque);
deliver_interrupt_to_vmm(&mystate);
//if (!((exit_code == VMEXIT_IOIO) && ((ushort_t)(guest_ctrl->exit_info1 >> 16) == 0x402))) {
- PrintDebug("SVM Returned: Exit Code: 0x%x \t\t(tsc=%ul)\n",exit_code, (uint_t)info->time_state.guest_tsc);
+ // PrintDebug("SVM Returned: Exit Code: 0x%x \t\t(tsc=%ul)\n",exit_code, (uint_t)info->time_state.guest_tsc);
- if (exit_code < 0x4f) {
+ if ((0) && (exit_code < 0x4f)) {
char instr[32];
int ret;
// Dump out the instr stream
}
}
} else if (exit_code == VMEXIT_CR0_WRITE) {
+#ifdef DEBUG_CTRL_REGS
PrintDebug("CR0 Write\n");
-
+#endif
if (handle_cr0_write(info) == -1) {
return -1;
}
} else if (exit_code == VMEXIT_CR0_READ) {
+#ifdef DEBUG_CTRL_REGS
PrintDebug("CR0 Read\n");
-
+#endif
if (handle_cr0_read(info) == -1) {
return -1;
}
} else if (exit_code == VMEXIT_CR3_WRITE) {
+#ifdef DEBUG_CTRL_REGS
PrintDebug("CR3 Write\n");
-
+#endif
if (handle_cr3_write(info) == -1) {
return -1;
}
} else if (exit_code == VMEXIT_CR3_READ) {
+#ifdef DEBUG_CTRL_REGS
PrintDebug("CR3 Read\n");
-
+#endif
if (handle_cr3_read(info) == -1) {
return -1;
}
} else if (exit_code == VMEXIT_EXCP14) {
addr_t fault_addr = guest_ctrl->exit_info2;
pf_error_t * error_code = (pf_error_t *)&(guest_ctrl->exit_info1);
-
+#ifdef DEBUG_SHADOW_PAGING
PrintDebug("PageFault at %x (error=%d)\n", fault_addr, *error_code);
-
+#endif
if (info->shdw_pg_mode == SHADOW_PAGING) {
if (handle_shadow_pagefault(info, fault_addr, *error_code) == -1) {
return -1;
}
} else {
- PrintDebug("Page fault in un implemented paging mode\n");
+ PrintError("Page fault in un implemented paging mode\n");
return -1;
}
} else if (exit_code == VMEXIT_NPF) {
- PrintDebug("Currently unhandled Nested Page Fault\n");
+ PrintError("Currently unhandled Nested Page Fault\n");
return -1;
} else if (exit_code == VMEXIT_INVLPG) {
if (info->shdw_pg_mode == SHADOW_PAGING) {
+#ifdef DEBUG_SHADOW_PAGING
PrintDebug("Invlpg\n");
+#endif
if (handle_shadow_invlpg(info) == -1) {
return -1;
}
- PrintDebug("SVM Returned:(VMCB=%x)\n", info->vmm_data);
- PrintDebug("RIP: %x\n", guest_state->rip);
- PrintDebug("RIP Linear: %x\n", rip_addr);
+ PrintError("SVM Returned:(VMCB=%x)\n", info->vmm_data);
+ PrintError("RIP: %x\n", guest_state->rip);
+ PrintError("RIP Linear: %x\n", rip_addr);
- PrintDebug("SVM Returned: Exit Code: %x\n",exit_code);
+ PrintError("SVM Returned: Exit Code: %x\n",exit_code);
- PrintDebug("io_info1 low = 0x%.8x\n", *(uint_t*)&(guest_ctrl->exit_info1));
- PrintDebug("io_info1 high = 0x%.8x\n", *(uint_t *)(((uchar_t *)&(guest_ctrl->exit_info1)) + 4));
+ PrintError("io_info1 low = 0x%.8x\n", *(uint_t*)&(guest_ctrl->exit_info1));
+ PrintError("io_info1 high = 0x%.8x\n", *(uint_t *)(((uchar_t *)&(guest_ctrl->exit_info1)) + 4));
- PrintDebug("io_info2 low = 0x%.8x\n", *(uint_t*)&(guest_ctrl->exit_info2));
- PrintDebug("io_info2 high = 0x%.8x\n", *(uint_t *)(((uchar_t *)&(guest_ctrl->exit_info2)) + 4));
+ PrintError("io_info2 low = 0x%.8x\n", *(uint_t*)&(guest_ctrl->exit_info2));
+ PrintError("io_info2 high = 0x%.8x\n", *(uint_t *)(((uchar_t *)&(guest_ctrl->exit_info2)) + 4));
if (info->mem_mode == PHYSICAL_MEM) {
if (guest_pa_to_host_pa(info, guest_state->rip, &host_addr) == -1) {
- PrintDebug("Could not translate guest_state->rip to host address\n");
+ PrintError("Could not translate guest_state->rip to host address\n");
return -1;
}
} else if (info->mem_mode == VIRTUAL_MEM) {
if (guest_va_to_host_pa(info, guest_state->rip, &host_addr) == -1) {
- PrintDebug("Could not translate guest_state->rip to host address\n");
+ PrintError("Could not translate guest_state->rip to host address\n");
return -1;
}
} else {
- PrintDebug("Invalid memory mode\n");
+ PrintError("Invalid memory mode\n");
return -1;
}
- PrintDebug("Host Address of rip = 0x%x\n", host_addr);
+ PrintError("Host Address of rip = 0x%x\n", host_addr);
memset(buf, 0, 15);
- PrintDebug("Reading from 0x%x in guest\n", rip_addr);
+ PrintError("Reading from 0x%x in guest\n", rip_addr);
if (info->mem_mode == PHYSICAL_MEM) {
read_guest_pa_memory(info, rip_addr, 15, buf);
guest_ctrl->guest_ctrl.V_INTR_VECTOR = irq;
guest_ctrl->guest_ctrl.V_IGN_TPR = 1;
guest_ctrl->guest_ctrl.V_INTR_PRIO = 0xf;
-
+#ifdef DEBUG_INTERRUPTS
PrintDebug("Injecting Interrupt %d (EIP=%x)\n", guest_ctrl->guest_ctrl.V_INTR_VECTOR, info->rip);
-
+#endif
injecting_intr(info, irq, EXTERNAL_IRQ);
break;
if (info->intr_state.excp_error_code_valid) { //PAD
guest_ctrl->EVENTINJ.error_code = info->intr_state.excp_error_code;
guest_ctrl->EVENTINJ.ev = 1;
+#ifdef DEBUG_INTERRUPTS
PrintDebug("Injecting error code %x\n", guest_ctrl->EVENTINJ.error_code);
+#endif
}
guest_ctrl->EVENTINJ.vector = excp;
guest_ctrl->EVENTINJ.valid = 1;
+#ifdef DEBUG_INTERRUPTS
PrintDebug("Injecting Interrupt %d (EIP=%x)\n", guest_ctrl->EVENTINJ.vector, info->rip);
+#endif
injecting_intr(info, excp, EXCEPTION);
break;
}
case INVALID_INTR:
default:
- PrintDebug("Attempted to issue an invalid interrupt\n");
+ PrintError("Attempted to issue an invalid interrupt\n");
return -1;
}
#include <palacios/vmm_decoder.h>
#include <palacios/vm_guest_mem.h>
+#ifndef DEBUG_IO
+#undef PrintDebug
+#define PrintDebug(fmt, args...)
+#endif
+
// This should package up an IO request and call vmm_handle_io
int handle_svm_io_in(struct guest_info * info) {
uint_t read_size = 0;
if (hook == NULL) {
- PrintDebug("Hook Not present for in on port %x\n", io_info->port);
+ PrintError("Hook Not present for in on port %x\n", io_info->port);
// error, we should not have exited on this port
return -1;
}
if (hook->read(io_info->port, &(info->vm_regs.rax), read_size, hook->priv_data) != read_size) {
// not sure how we handle errors.....
- PrintDebug("Read Failure for in on port %x\n", io_info->port);
+ PrintError("Read Failure for in on port %x\n", io_info->port);
return -1;
}
if (hook == NULL) {
- PrintDebug("Hook Not present for ins on port %x\n", io_info->port);
+ PrintError("Hook Not present for ins on port %x\n", io_info->port);
// error, we should not have exited on this port
return -1;
}
addr_t inst_ptr;
if (guest_va_to_host_pa(info,get_addr_linear(info,info->rip,&(info->segments.cs)),&inst_ptr)==-1) {
- PrintDebug("Can't access instruction\n");
+ PrintError("Can't access instruction\n");
return -1;
}
} else if (io_info->sz32) {
read_size = 4;
} else {
- PrintDebug("io_info Invalid Size\n");
+ PrintError("io_info Invalid Size\n");
return -1;
}
if (guest_va_to_host_va(info, dst_addr, &host_addr) == -1) {
// either page fault or gpf...
- PrintDebug("Could not convert Guest VA to host VA\n");
+ PrintError("Could not convert Guest VA to host VA\n");
return -1;
}
if (hook->read(io_info->port, (char*)host_addr, read_size, hook->priv_data) != read_size) {
// not sure how we handle errors.....
- PrintDebug("Read Failure for ins on port %x\n", io_info->port);
+ PrintError("Read Failure for ins on port %x\n", io_info->port);
return -1;
}
uint_t write_size = 0;
if (hook == NULL) {
- PrintDebug("Hook Not present for out on port %x\n", io_info->port);
+ PrintError("Hook Not present for out on port %x\n", io_info->port);
// error, we should not have exited on this port
return -1;
}
if (hook->write(io_info->port, &(info->vm_regs.rax), write_size, hook->priv_data) != write_size) {
// not sure how we handle errors.....
- PrintDebug("Write Failure for out on port %x\n", io_info->port);
+ PrintError("Write Failure for out on port %x\n", io_info->port);
return -1;
}
if (hook == NULL) {
- PrintDebug("Hook Not present for outs on port %x\n", io_info->port);
+ PrintError("Hook Not present for outs on port %x\n", io_info->port);
// error, we should not have exited on this port
return -1;
}
addr_t inst_ptr;
if (guest_va_to_host_pa(info,get_addr_linear(info,info->rip,&(info->segments.cs)),&inst_ptr)==-1) {
- PrintDebug("Can't access instruction\n");
+ PrintError("Can't access instruction\n");
return -1;
}
if (hook->write(io_info->port, (char*)host_addr, write_size, hook->priv_data) != write_size) {
// not sure how we handle errors.....
- PrintDebug("Write Failure for outs on port %x\n", io_info->port);
+ PrintError("Write Failure for outs on port %x\n", io_info->port);
return -1;
}
PrintDebug("Real Mode write to CR0 at linear guest pa 0x%x\n",get_addr_linear(info,info->rip,&(info->segments.cs)));
- PrintV3Segments(info);
+ //PrintV3Segments(info);
// The real rip address is actually a combination of the rip + CS base
ret = read_guest_pa_memory(info, get_addr_linear(info, info->rip, &(info->segments.cs)), 15, instr);
index += 2;
- PrintDebug("MovToCR0 instr:\n");
- PrintTraceMemDump(instr, 15);
- PrintDebug("EAX=%x\n", *(uint_t*)&(info->vm_regs.rax));
-
+ /*
+ PrintDebug("MovToCR0 instr:\n");
+ PrintTraceMemDump(instr, 15);
+ PrintDebug("EAX=%x\n", *(uint_t*)&(info->vm_regs.rax));
+ */
addr_type = decode_operands32(&(info->vm_regs), instr + index, &index, &first_operand, &second_operand, REG32);
if (addr_type != REG_OPERAND) {
new_cr0 = (struct cr0_32 *)first_operand;
- PrintDebug("first operand=%x\n", *(uint_t *)first_operand);
+ //PrintDebug("first operand=%x\n", *(uint_t *)first_operand);
if (info->shdw_pg_mode == SHADOW_PAGING) {
struct cr0_32 * shadow_cr0 = (struct cr0_32 *)&(info->shdw_pg_state.guest_cr0);
info->mem_mode = PHYSICAL_MEM;
PrintDebug("Entering Real Mode\n");
- PrintV3CtrlRegs(info);
+ //PrintV3CtrlRegs(info);
// reinstate the identity mapped paged tables
// But keep the shadow tables around to handle TLB issues.... UGH...
//info->shdw_pg_state.shadow_cr3 &= 0x00000fff;
shadow_cr0->et = 1;
real_cr0->et = 1;
- PrintV3CtrlRegs(info);
+ //PrintV3CtrlRegs(info);
}
int ret;
PrintDebug("Real Mode read from CR0 at linear guest pa 0x%x\n",get_addr_linear(info,info->rip,&(info->segments.cs)));
- PrintV3Segments(info);
+ //PrintV3Segments(info);
// The real rip address is actually a combination of the rip + CS base
ret = read_guest_pa_memory(info, get_addr_linear(info, info->rip, &(info->segments.cs)), 15, instr);
}
- PrintDebug("Instr (15 bytes) at %x:\n", instr);
- PrintTraceMemDump((char*)instr, 15);
+ /*
+ PrintDebug("Instr (15 bytes) at %x:\n", instr);
+ PrintTraceMemDump((char*)instr, 15);
+ */
if (ret != 15) {
// I think we should inject a GPF into the guest
int ret;
char instr[15];
- PrintDebug("Real Mode Write to CR3??? What the fuck???\n");
+ PrintDebug("Real Mode Write to CR3.\n");
// We need to read the instruction, which is at CS:IP, but that
// linear address is guest physical without PG and guest virtual with PG
// linear address is guest physical without PG and guest virtual with PG
if (info->mem_mode == PHYSICAL_MEM) {
// The real rip address is actually a combination of the rip + CS base
- PrintDebug("Writing Guest CR3 Write (Physical Address)\n");
+ //PrintDebug("Writing Guest CR3 Write (Physical Address)\n");
ret = read_guest_pa_memory(info, get_addr_linear(info, info->rip, &(info->segments.cs)), 15, instr);
} else {
- PrintDebug("Writing Guest CR3 Write (Virtual Address)\n");
+ //PrintDebug("Writing Guest CR3 Write (Virtual Address)\n");
// The real rip address is actually a combination of the rip + CS base
ret = read_guest_va_memory(info, get_addr_linear(info, info->rip, &(info->segments.cs)), 15, instr);
}
linear_addr = get_addr_linear(info, info->rip, &(info->segments.cs));
- PrintDebug("RIP Linear: %x\n", linear_addr);
- PrintV3Segments(info);
+ //PrintDebug("RIP Linear: %x\n", linear_addr);
+ //PrintV3Segments(info);
ret = read_guest_pa_memory(info, linear_addr, 15, instr);
#include <palacios/vm_guest.h>
-
+#ifndef DEBUG_INTERRUPTS
+#undef PrintDebug
+#define PrintDebug(fmt, args...)
+#endif
void init_interrupt_state(struct guest_info * info) {
info->intr_state.excp_pending = 0;
d->opaque = opaque;
if (os_hooks->hook_interrupt_new(irq,d)) {
- PrintDebug("hook_irq_new: failed to hook irq 0x%x to decode 0x%x\n", irq,d);
+ PrintError("hook_irq_new: failed to hook irq 0x%x to decode 0x%x\n", irq,d);
return -1;
} else {
PrintDebug("hook_irq_new: hooked irq 0x%x to decode 0x%x\n", irq,d);
info);
if (rc) {
- PrintDebug("guest_irq_injection: failed to hook irq 0x%x for guest 0x%x\n", irq,info);
+ PrintError("guest_irq_injection: failed to hook irq 0x%x for guest 0x%x\n", irq,info);
return -1;
} else {
PrintDebug("guest_irq_injection: hooked irq 0x%x for guest 0x%x\n", irq,info);
intr_state->excp_error_code_valid = 1;
PrintDebug("Raising exception with error code: %x\n", error_code);
} else {
- PrintDebug("exception already pending, currently not implemented\n");
+ PrintError("exception already pending, currently not implemented\n");
return -1;
}
intr_state->excp_error_code = 0;
intr_state->excp_error_code_valid = 0;
} else {
- PrintDebug("exception already pending, currently not implemented\n");
+ PrintError("exception already pending, currently not implemented\n");
return -1;
}
extern struct vmm_os_hooks * os_hooks;
-
+#ifndef DEBUG_IO
+#undef PrintDebug
+#define PrintDebug(fmt, args...)
+#endif
void init_vmm_io_map(vmm_io_map_t * io_map) {
#include <palacios/vm_guest_mem.h>
#include <palacios/vmm_decoder.h>
+#ifndef DEBUG_SHADOW_PAGING
+#undef PrintDebug
+#define PrintDebug(fmt, args...)
+#endif
int init_shadow_page_state(struct shadow_page_state * state) {
case PROTECTED_PAE:
case LONG:
default:
- PrintDebug("Unhandled CPU Mode\n");
+ PrintError("Unhandled CPU Mode\n");
return -1;
}
} else {
- PrintDebug("Invalid Memory mode\n");
+ PrintError("Invalid Memory mode\n");
return -1;
}
}
if (host_page_type == HOST_REGION_INVALID) {
// Currently we don't support this, but in theory we could
- PrintDebug("Invalid Host Memory Type\n");
+ PrintError("Invalid Host Memory Type\n");
return -1;
} else if (host_page_type == HOST_REGION_PHYSICAL_MEMORY) {
addr_t shadow_pa = get_shadow_addr(info, guest_pa);
pte_cursor->global_page = 0;
} else {
- PrintDebug("Unsupported Host Memory Type\n");
+ PrintError("Unsupported Host Memory Type\n");
return -1;
}
}
pde32_t * shadow_pde = (pde32_t *)&(shadow_pd[PDE32_INDEX(fault_addr)]);
if (guest_pa_to_host_va(info, guest_cr3, (addr_t*)&guest_pd) == -1) {
- PrintDebug("Invalid Guest PDE Address: 0x%x\n", guest_cr3);
+ PrintError("Invalid Guest PDE Address: 0x%x\n", guest_cr3);
return -1;
}
return 0;
- /*
+#ifdef DEBUG_SHADOW_PAGING
PrintDebug("Guest CR3=%x\n", guest_cr3);
- PrintDebug("Guest PD\n");
+ PrintDebug("Guest PD\n");
PrintPD32(guest_pd);
PrintDebug("Shadow PD\n");
PrintPD32(shadow_pd);
- */
+#endif
return -1;
}
if (host_page_type == HOST_REGION_INVALID) {
raise_exception(info, MC_EXCEPTION);
- PrintDebug("Invalid guest address in large page (0x%x)\n", guest_start_addr);
+ PrintError("Invalid guest address in large page (0x%x)\n", guest_start_addr);
return -1;
} else if (host_page_type == HOST_REGION_PHYSICAL_MEMORY) {
addr_t host_start_addr = 0;
memset(shadow_pt, 0, PAGE_SIZE);
if (handle_pd32_nonaligned_4MB_page(info, shadow_pt, guest_start_addr, large_shadow_pde) == -1) {
- PrintDebug("Non Aligned Large Page Error\n");
+ PrintError("Non Aligned Large Page Error\n");
V3_Free(shadow_pt);
return -1;
}
- /*
+#ifdef DEBUG_SHADOW_PAGING
PrintDebug("non-aligned Shadow PT\n");
PrintPT32(PT32_PAGE_ADDR(fault_addr), shadow_pt);
- */
+#endif
shadow_pde->pt_base_addr = PD32_BASE_ADDR(shadow_pt);
}
} else {
// Handle hooked pages as well as other special pages
if (handle_special_page_fault(info, fault_addr, error_code) == -1) {
- PrintDebug("Special Page Fault handler returned error for address: %x\n", fault_addr);
+ PrintError("Special Page Fault handler returned error for address: %x\n", fault_addr);
return -1;
}
}
if (handle_shadow_pte32_fault(info, fault_addr, error_code, shadow_pt, guest_pt) == -1) {
- PrintDebug("Error handling Page fault caused by PTE\n");
+ PrintError("Error handling Page fault caused by PTE\n");
return -1;
}
// Check the shadow page permissions
shadow_pte_access = can_access_pte32(shadow_pt, fault_addr, error_code);
-
+#ifdef DEBUG_SHADOW_PAGING
PrintDebug("Guest PTE: (access=%d)\n\t", guest_pte_access);
PrintPTE32(fault_addr, guest_pte);
PrintDebug("Shadow PTE: (access=%d)\n\t", shadow_pte_access);
PrintPTE32(fault_addr, shadow_pte);
+#endif
+
/* This should be redone,
but basically the reasoning is that there can be multiple reasons for a page fault:
If there is a permissions failure for a page present in the guest _BUT_
// Inject a machine check in the guest
raise_exception(info, MC_EXCEPTION);
-
+#ifdef DEBUG_SHADOW_PAGING
PrintDebug("Invalid Guest Address in page table (0x%x)\n", guest_pa);
PrintDebug("fault_addr=0x%x next are guest and shadow ptes \n",fault_addr);
PrintPTE32(fault_addr,guest_pte);
PrintPTE32(fault_addr,shadow_pte);
PrintDebug("Done.\n");
+#endif
return 0;
} else if (host_page_type == HOST_REGION_PHYSICAL_MEMORY) {
} else {
// Page fault handled by hook functions
if (handle_special_page_fault(info, fault_addr, error_code) == -1) {
- PrintDebug("Special Page fault handler returned error for address: %x\n", fault_addr);
+ PrintError("Special Page fault handler returned error for address: %x\n", fault_addr);
return -1;
}
}
info->ctrl_regs.cr2 = fault_addr;
raise_exception_with_error(info, PF_EXCEPTION, *(uint_t *)&error_code);
- PrintDebug("PTE Page fault fell through... Not sure if this should ever happen\n");
- PrintDebug("Manual Says to inject page fault into guest\n");
+ PrintError("PTE Page fault fell through... Not sure if this should ever happen\n");
+ PrintError("Manual Says to inject page fault into guest\n");
return -1;
}
if (info->mem_mode != VIRTUAL_MEM) {
// Paging must be turned on...
// should handle with some sort of fault I think
- PrintDebug("ERROR: INVLPG called in non paged mode\n");
+ PrintError("ERROR: INVLPG called in non paged mode\n");
return -1;
}
ret = read_guest_va_memory(info, get_addr_linear(info, info->rip, &(info->segments.cs)), 15, instr);
if (ret != 15) {
- PrintDebug("Could not read instruction 0x%x (ret=%d)\n", info->rip, ret);
+ PrintError("Could not read instruction 0x%x (ret=%d)\n", info->rip, ret);
return -1;
}
pde32_t * guest_pd = NULL;
if (guest_pa_to_host_va(info, guest_cr3, (addr_t*)&guest_pd) == -1) {
- PrintDebug("Invalid Guest PDE Address: 0x%x\n", guest_cr3);
+ PrintError("Invalid Guest PDE Address: 0x%x\n", guest_cr3);
return -1;
}
if (shadow_pde->present == 1) {
pte32_t * shadow_pt = (pte32_t *)PDE32_T_ADDR((*shadow_pde));
pte32_t * shadow_pte = (pte32_t *)&shadow_pt[PTE32_INDEX(first_operand)];
+
+#ifdef DEBUG_SHADOW_PAGING
PrintDebug("Setting not present\n");
PrintPTE32(first_operand, shadow_pte);
+#endif
+
shadow_pte->present = 0;
}
}
info->rip += index;
} else {
- PrintDebug("Invalid Operand type\n");
+ PrintError("Invalid Operand type\n");
return -1;
}
} else {
- PrintDebug("invalid Instruction Opcode\n");
+ PrintError("invalid Instruction Opcode\n");
PrintTraceMemDump(instr, 15);
return -1;
}