#include <palacios/vmm_direct_paging.h>
#include <palacios/vmm_ctrl_regs.h>
-#ifndef CONFIG_DEBUG_VMX
+#ifndef V3_CONFIG_DEBUG_VMX
#undef PrintDebug
#define PrintDebug(fmt, args...)
#endif
return -1;
}
- if (vmx_info->state == VMXASSIST_ENABLED) {
+ if (vmx_info->assist_state == VMXASSIST_ENABLED) {
PrintDebug("Loading VMXASSIST at RIP: %p\n", (void *)(addr_t)info->rip);
} else {
PrintDebug("Leaving VMXASSIST and entering protected mode at RIP: %p\n",
guest_cr0->pg = 1;
guest_cr0->ne = 1;
- if (paging_transition) {
+ if ((paging_transition)) {
// Paging transition
if (v3_get_vm_mem_mode(info) == VIRTUAL_MEM) {
// PrintDebug("Activating Shadow Page tables\n");
- if (v3_activate_shadow_pt(info) == -1) {
- PrintError("Failed to activate shadow page tables\n");
- return -1;
+ if (info->shdw_pg_mode == SHADOW_PAGING) {
+ if (v3_activate_shadow_pt(info) == -1) {
+ PrintError("Failed to activate shadow page tables\n");
+ return -1;
+ }
}
- } else if (v3_activate_passthrough_pt(info) == -1) {
- PrintError("Failed to activate passthrough page tables\n");
- return -1;
+ } else {
+
+ if (info->shdw_pg_mode == SHADOW_PAGING) {
+ if (v3_activate_passthrough_pt(info) == -1) {
+ PrintError("Failed to activate passthrough page tables\n");
+ return -1;
+ }
+ } else {
+ // This is hideous... Let's hope that the 1to1 page table has not been nuked...
+ info->ctrl_regs.cr3 = VMXASSIST_1to1_PT;
+ }
}
}
}