X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_direct_paging.c;h=b044b1f1342723fac393edcc1b8aa19790a395be;hb=6cff7c8b0ec58e3b94d9583f709ca9056ae928dd;hp=674fc56999e14e36185e9cee2905dc5746be2361;hpb=78818a71a31b4cbe264c1292f7bcbdbfd2ceb544;p=palacios.git diff --git a/palacios/src/palacios/vmm_direct_paging.c b/palacios/src/palacios/vmm_direct_paging.c index 674fc56..b044b1f 100644 --- a/palacios/src/palacios/vmm_direct_paging.c +++ b/palacios/src/palacios/vmm_direct_paging.c @@ -25,7 +25,7 @@ #include -#ifndef DEBUG_NESTED_PAGING +#ifndef V3_CONFIG_DEBUG_NESTED_PAGING #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -49,33 +49,44 @@ int v3_init_passthrough_pts(struct guest_info * info) { return 0; } -int v3_reset_passthrough_pts(struct guest_info * info) { - v3_cpu_mode_t mode = v3_get_vm_cpu_mode(info); + +int v3_free_passthrough_pts(struct guest_info * core) { + v3_cpu_mode_t mode = v3_get_vm_cpu_mode(core); // Delete the old direct map page tables switch(mode) { case REAL: case PROTECTED: - delete_page_tables_32((pde32_t *)V3_VAddr((void *)(info->direct_map_pt))); + delete_page_tables_32((pde32_t *)V3_VAddr((void *)(core->direct_map_pt))); break; case PROTECTED_PAE: case LONG: case LONG_32_COMPAT: // Long mode will only use 32PAE page tables... - delete_page_tables_32pae((pdpe32pae_t *)V3_VAddr((void *)(info->direct_map_pt))); + delete_page_tables_32pae((pdpe32pae_t *)V3_VAddr((void *)(core->direct_map_pt))); break; default: PrintError("Unknown CPU Mode\n"); + return -1; break; } - + + return 0; +} + + +int v3_reset_passthrough_pts(struct guest_info * core) { + + v3_free_passthrough_pts(core); + // create new direct map page table - v3_init_passthrough_pts(info); + v3_init_passthrough_pts(core); return 0; } + int v3_activate_passthrough_pt(struct guest_info * info) { // For now... But we need to change this.... // As soon as shadow paging becomes active the passthrough tables are hosed @@ -158,7 +169,12 @@ int v3_invalidate_passthrough_addr(struct guest_info * info, addr_t inv_addr) { int v3_invalidate_nested_addr(struct guest_info * info, addr_t inv_addr) { + +#ifdef __V3_64BIT__ v3_cpu_mode_t mode = LONG; +#else + v3_cpu_mode_t mode = PROTECTED; +#endif switch(mode) { case REAL: