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.


added memory conversions and copies for the guest/host contexts
[palacios.git] / palacios / src / geekos / vmm_mem.c
index 4b2d6d9..0551675 100644 (file)
@@ -152,25 +152,24 @@ shadow_region_t * get_shadow_region_by_addr(shadow_map_t * map,
 
 
 
-int guest_paddr_to_host_paddr(shadow_region_t * entry, 
-                       addr_t guest_addr,
-                       addr_t * host_addr) {
-
-  if (!((guest_addr >= entry->guest_start) && 
-       (guest_addr < entry->guest_end))) { 
-    return -1;
-  }
-
-  switch (entry->host_type) { 
-  case HOST_REGION_PHYSICAL_MEMORY:
-  case HOST_REGION_MEMORY_MAPPED_DEVICE:
-  case HOST_REGION_UNALLOCATED:
-    *host_addr = (guest_addr-entry->guest_start) + entry->host_addr.phys_addr.host_start;
-    return 0;
-    break;
-  default:
-    return -1;
-    break;
+host_region_type_t lookup_shadow_map_addr(shadow_map_t * map, addr_t guest_addr, addr_t * host_addr) {
+  shadow_region_t * reg = get_shadow_region_by_addr(map, guest_addr);
+
+  if (!reg) {
+    // No mapping exists
+    return HOST_REGION_INVALID;
+  } else {
+    switch (reg->host_type) {
+    case HOST_REGION_PHYSICAL_MEMORY:
+     *host_addr = (guest_addr - reg->guest_start) + reg->host_addr.phys_addr.host_start;
+     return reg->host_type;
+    case HOST_REGION_MEMORY_MAPPED_DEVICE:
+    case HOST_REGION_UNALLOCATED:
+      // ... 
+    default:
+      *host_addr = 0;
+      return reg->host_type;
+    }
   }
 }