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.


fixed null memory list bug in print_shadow_map
[palacios.git] / palacios / src / palacios / vmm_mem.c
index 2bdf5aa..000dac0 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);
 }
 
@@ -202,7 +206,7 @@ struct v3_shadow_region * insert_shadow_region(struct guest_info * info,
     if ((ret = __insert_shadow_region(info, region))) {
        return ret;
     }
-  
+
     v3_rb_insert_color(&(region->tree_node), &(info->mem_map.shdw_regions));
 
 
@@ -381,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;
     }
 
@@ -402,6 +406,12 @@ void print_shadow_map(struct guest_info * info) {
               (void *)(reg->guest_end - 1), 
               (void *)(reg->host_addr));
     
+
+    // If the memory map is empty, don't print it
+    if (node == NULL) {
+       return;
+    }
+
     do {
        reg = rb_entry(node, struct v3_shadow_region, tree_node);