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.


more work on the memory system
[palacios.git] / palacios / src / geekos / vmm_mem.c
index 4b2d6d9..b740788 100644 (file)
@@ -152,6 +152,28 @@ shadow_region_t * get_shadow_region_by_addr(shadow_map_t * map,
 
 
 
+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;
+    }
+  }
+}
+
+/*
 int guest_paddr_to_host_paddr(shadow_region_t * entry, 
                        addr_t guest_addr,
                        addr_t * host_addr) {
@@ -174,6 +196,8 @@ int guest_paddr_to_host_paddr(shadow_region_t * entry,
   }
 }
 
+*/
+
 
 void print_shadow_map(shadow_map_t * map) {
   shadow_region_t * cur = map->head;