Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


various fixes. Hopefully this fixes the transient shutdown bug...
[palacios.git] / palacios / src / palacios / vmm_mem.c
index dc3f1ae..182e563 100644 (file)
@@ -49,11 +49,15 @@ void v3_init_shadow_map(struct guest_info * info) {
     map->hook_hva = (addr_t)V3_VAddr(V3_AllocPages(1));
 
     // There is an underlying region that contains all of the guest memory
+    // PrintDebug("Mapping %d pages of memory (%u bytes)\n", (int)mem_pages, (uint_t)info->mem_size);
+
     map->base_region.guest_start = 0;
-    map->base_region.guest_end = info->mem_size;
+    map->base_region.guest_end = mem_pages * PAGE_SIZE_4KB;
     map->base_region.host_type = SHDW_REGION_ALLOCATED;
     map->base_region.host_addr = (addr_t)V3_AllocPages(mem_pages);
 
+    //memset(V3_VAddr((void *)map->base_region.host_addr), 0xffffffff, map->base_region.guest_end);
+
     v3_register_hypercall(info, MEM_OFFSET_HCALL, mem_offset_hypercall, NULL);
 }
 
@@ -161,7 +165,9 @@ int v3_unhook_mem(struct guest_info * info, addr_t guest_addr_start) {
        return -1;
     }
 
-    return v3_delete_shadow_region(info, reg);
+    v3_delete_shadow_region(info, reg);
+
+    return 0;
 }
 
 
@@ -208,7 +214,7 @@ struct v3_shadow_region * insert_shadow_region(struct guest_info * info,
     // flush virtual page tables 
     // 3 cases shadow, shadow passthrough, and nested
     if (info->shdw_pg_mode == SHADOW_PAGING) {
-       v3_vm_mem_mode_t mem_mode = v3_get_mem_mode(info);
+       v3_mem_mode_t mem_mode = v3_get_vm_mem_mode(info);
 
        if (mem_mode == PHYSICAL_MEM) {
            addr_t cur_addr;
@@ -336,7 +342,7 @@ void v3_delete_shadow_region(struct guest_info * info, struct v3_shadow_region *
     // flush virtual page tables 
     // 3 cases shadow, shadow passthrough, and nested
     if (info->shdw_pg_mode == SHADOW_PAGING) {
-       v3_vm_mem_mode_t mem_mode = v3_get_mem_mode(info);
+       v3_mem_mode_t mem_mode = v3_get_vm_mem_mode(info);
            
        if (mem_mode == PHYSICAL_MEM) {
            addr_t cur_addr;
@@ -379,7 +385,7 @@ addr_t v3_get_shadow_addr(struct v3_shadow_region * reg, addr_t guest_addr) {
          (reg->host_type != SHDW_REGION_FULL_HOOK)) {
         return (guest_addr - reg->guest_start) + reg->host_addr;
     } else {
-        PrintDebug("MEM Region Invalid\n");
+        PrintError("MEM Region Invalid\n");
         return 0;
     }