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.


Correct memory addition calculations
Peter Dinda [Fri, 2 Aug 2013 01:27:10 +0000 (20:27 -0500)]
linux_module/mm.c

index 8fbc297..a855261 100644 (file)
@@ -54,10 +54,10 @@ void free_palacios_pgs(uintptr_t pg_addr, u64 num_pages) {
 }
 
 
-int pow2(int i)
+unsigned long long pow2(int i)
 {
-    int x=1;
-    for (;i>0;i--) { x*=2; } 
+    unsigned long long x=1;
+    for (;i!=0;i--) { x*=2; } 
     return x;
 }
 
@@ -72,9 +72,10 @@ int add_palacios_memory(struct v3_mem_region *r) {
        WARNING("Allocating a memory pool smaller than the Palacios block size - may not be useful\n");
     }
 
-    if (pow2(get_order(r->num_pages)) != r->num_pages) { 
-       WARNING("Allocating a memory pool that is not a power of two - it will be rounded down!\n");
-       r->num_pages=pow2(get_order(r->num_pages));
+    if (pow2(get_order(r->num_pages*PAGE_SIZE)) != r->num_pages*PAGE_SIZE) { 
+       WARNING("Allocating a memory pool that is not a power of two (is %llu) - it will be rounded down!\n", r->num_pages*PAGE_SIZE);
+       r->num_pages=pow2(get_order(r->num_pages*PAGE_SIZE));
+       WARNING("Rounded power Allocating a memory pool that is not a power of two (rounded to %llu)\n", r->num_pages*PAGE_SIZE);
     }