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.


Linux user updates for more recent distros (Ubuntu 14.04 as target)
[palacios.git] / linux_usr / v3_guest_mem.c
index f1fe9de..479d1c1 100644 (file)
@@ -22,6 +22,7 @@ struct v3_guest_mem_map * v3_guest_mem_get_map(char *vmdev)
   uint64_t start, end, num;
   uint64_t guest_cur;
   uint64_t num_regions;
+  uint64_t num_regions_shown;
   
 
   if (!(f=fopen(GUEST_FILE,"r"))) { 
@@ -48,10 +49,15 @@ struct v3_guest_mem_map * v3_guest_mem_get_map(char *vmdev)
          fprintf(stderr,"Could not find number of regions for %s\n",vmdev);
          return 0;
       }
-      if (sscanf(buf,"Regions: %llu",&num_regions)==1) {
+      if (sscanf(buf,"Regions: %lu (%lu shown)",&num_regions,&num_regions_shown)==2) {
          break;
       }
   }
+
+  if (num_regions != num_regions_shown) { 
+      fprintf(stderr,"Cannot see all regions for %s\n",vmdev);
+      return 0;
+  }
  
   struct v3_guest_mem_map *m = 
       (struct v3_guest_mem_map *) malloc(sizeof(struct v3_guest_mem_map)+num_regions*sizeof(struct v3_guest_mem_block));
@@ -67,18 +73,19 @@ struct v3_guest_mem_map * v3_guest_mem_get_map(char *vmdev)
 
   // Now collect the region info
   guest_cur=0;
+  i=0;
   while (i<num_regions) { 
       if (!fgets(buf,MAXLINE,f)) {
          fprintf(stderr,"Did not find all regions...\n");
          free(m);
          return 0;
       }
-      if (sscanf(buf," region %d has HPAs %llx-%llx",&num,&start,&end)==3) { 
+      if (sscanf(buf," region %lu has HPAs %lx-%lx",&num,&start,&end)==3) { 
          m->block[i].gpa = (void*)guest_cur;
          m->block[i].hpa = (void*)start;
          m->block[i].numpages = (end-start) / 4096 + !!((end-start) % 4096);
          if ((end-start)%4096) { 
-             fprintf(stderr,"Odd, region %d is a non-integral number of pages");
+             fprintf(stderr,"Odd, region %d is a non-integral number of pages",i);
          }
          guest_cur+=end-start;
          m->block[i].cumgpa=(void*)(guest_cur-1);
@@ -120,7 +127,7 @@ int v3_map_guest_mem(struct v3_guest_mem_map *map)
                             (off_t) (map->block[i].hpa));
 
     if (map->block[i].uva == MAP_FAILED) { 
-      fprintf(stderr, "Failed to map block %llu\n",i);
+      fprintf(stderr, "Failed to map block %lu\n",i);
       map->block[i].uva=0;
       v3_unmap_guest_mem(map);
       return -1;