X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm.c;h=e16e2fa60f580e7b36f00f8e3fe1f66b393b7d4d;hb=6fa605075d1944da0a88a389122ea24bbc583329;hp=12766b919845527a63277f7a037aa038db35b29f;hpb=4454a172129d12e97793c9c353339b85d3335af4;p=palacios.git diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index 12766b9..e16e2fa 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -31,6 +31,7 @@ #include #include #include +#include #ifdef V3_CONFIG_SVM #include @@ -162,6 +163,10 @@ void Init_V3(struct v3_os_hooks * hooks, char * cpu_mask, int num_cpus, char *op // Register all shadow paging handlers V3_init_shdw_paging(); +#ifdef V3_CONFIG_SWAPPING + v3_init_swapping(); +#endif + // Initialize the cpu_mapper framework (must be before extensions) V3_init_cpu_mapper(); @@ -239,6 +244,10 @@ void Shutdown_V3() { V3_deinit_scheduling(); V3_deinit_cpu_mapper(); + +#ifdef V3_CONFIG_SWAPPING + v3_deinit_swapping(); +#endif V3_deinit_shdw_paging(); @@ -387,7 +396,14 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { PrintDebug(vm, VCORE_NONE, "run: core=%u, func=0x%p, arg=0x%p, name=%s\n", core->pcpu_id, start_core, core, core->exec_name); - core->core_run_state = CORE_STOPPED; // core zero will turn itself on + if (core->core_run_state==CORE_INVALID) { + // launch of a fresh VM + core->core_run_state = CORE_STOPPED; + // core zero will turn itself on + } else { + // this is a resume - use whatever its current run_state is + } + core->core_thread = V3_CREATE_THREAD_ON_CPU(core->pcpu_id, start_core, core, core->exec_name); if (core->core_thread == NULL) { @@ -587,7 +603,7 @@ int v3_move_vm_mem(struct v3_vm_info * vm, void *gpa, int target_cpu) { v3_invalidate_shadow_pts(&(vm->cores[i])); } else if (vm->cores[i].shdw_pg_mode==NESTED_PAGING) { // nested invalidator uses inclusive addressing [start,end], not [start,end) - v3_invalidate_nested_addr_range(&(vm->cores[i]),reg->guest_start,reg->guest_end-1); + v3_invalidate_nested_addr_range(&(vm->cores[i]),reg->guest_start,reg->guest_end-1,NULL,NULL); } else { PrintError(vm,VCORE_NONE, "Cannot determine how to invalidate paging structures! Reverting to previous region.\n"); // We'll restore things... @@ -846,6 +862,14 @@ int v3_get_state_vm(struct v3_vm_info *vm, for (i=0;imem_map.num_base_regions;i++) { mem->region[i].host_paddr = (void*)(vm->mem_map.base_regions[i].host_addr); mem->region[i].size = v3_mem_block_size; +#ifdef V3_CONFIG_SWAPPING + mem->region[i].swapped = vm->mem_map.base_regions[i].flags.swapped; + mem->region[i].pinned = vm->mem_map.base_regions[i].flags.pinned; +#else + mem->region[i].swapped = 0; + mem->region[i].pinned = 0; +#endif + } mem->num_regions=numregions;