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.


got the bios setup ok, now we have to handle the exits
[palacios.git] / palacios / src / palacios / vm_guest_mem.c
index 33cb5b2..d1c8bee 100644 (file)
@@ -283,7 +283,7 @@ int read_guest_va_memory(struct guest_info * guest_info, addr_t guest_va, int co
   int bytes_read = 0;
 
   while (count > 0) {
-    int dist_to_pg_edge = (PAGE_OFFSET(cursor) + PAGE_SIZE) - cursor;
+    int dist_to_pg_edge = (PAGE_ADDR(cursor) + PAGE_SIZE) - cursor;
     int bytes_to_copy = (dist_to_pg_edge > count) ? count : dist_to_pg_edge;
     addr_t host_addr;
 
@@ -314,7 +314,7 @@ int read_guest_pa_memory(struct guest_info * guest_info, addr_t guest_pa, int co
   int bytes_read = 0;
 
   while (count > 0) {
-    int dist_to_pg_edge = (PAGE_OFFSET(cursor) + PAGE_SIZE) - cursor;
+    int dist_to_pg_edge = (PAGE_ADDR(cursor) + PAGE_SIZE) - cursor;
     int bytes_to_copy = (dist_to_pg_edge > count) ? count : dist_to_pg_edge;
     addr_t host_addr;
 
@@ -322,11 +322,18 @@ int read_guest_pa_memory(struct guest_info * guest_info, addr_t guest_pa, int co
       return bytes_read;
     }
 
+    /*
+      PrintDebug("Trying to read %d bytes\n", bytes_to_copy);
+      PrintDebug("Dist to page edge=%d\n", dist_to_pg_edge);
+      PrintDebug("PAGE_ADDR=0x%x\n", PAGE_ADDR(cursor));
+      PrintDebug("guest_pa=0x%x\n", guest_pa);
+    */
+    
     memcpy(dest + bytes_read, (void*)host_addr, bytes_to_copy);
 
     bytes_read += bytes_to_copy;
     count -= bytes_to_copy;
-    cursor += bytes_to_copy;    
+    cursor += bytes_to_copy;
   }
 
   return bytes_read;
@@ -343,7 +350,7 @@ int write_guest_pa_memory(struct guest_info * guest_info, addr_t guest_pa, int c
   int bytes_written = 0;
 
   while (count > 0) {
-    int dist_to_pg_edge = (PAGE_OFFSET(cursor) + PAGE_SIZE) - cursor;
+    int dist_to_pg_edge = (PAGE_ADDR(cursor) + PAGE_SIZE) - cursor;
     int bytes_to_copy = (dist_to_pg_edge > count) ? count : dist_to_pg_edge;
     addr_t host_addr;
 
@@ -351,8 +358,9 @@ int write_guest_pa_memory(struct guest_info * guest_info, addr_t guest_pa, int c
       return bytes_written;
     }
 
+
     memcpy((void*)host_addr, src + bytes_written, bytes_to_copy);
-    
+
     bytes_written += bytes_to_copy;
     count -= bytes_to_copy;
     cursor += bytes_to_copy;