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.


Disallow startup with shadow paging + memory region outside 4GB boundary
[palacios.git] / palacios / src / palacios / vmm_symspy.c
index 53f3e89..1698d0b 100644 (file)
@@ -56,7 +56,7 @@ static int symspy_msr_write(struct guest_info * core, uint_t msr, struct v3_msr
 
        if (global_state->active == 1) {
            // unmap page
-           struct v3_shadow_region * old_reg = v3_get_shadow_region(core->vm_info, core->cpu_id, 
+           struct v3_mem_region * old_reg = v3_get_mem_region(core->vm_info, core->vcpu_id, 
                                                                     (addr_t)global_state->global_guest_pa);
 
            if (old_reg == NULL) {
@@ -65,7 +65,7 @@ static int symspy_msr_write(struct guest_info * core, uint_t msr, struct v3_msr
                return -1;
            }
 
-           v3_delete_shadow_region(core->vm_info, old_reg);
+           v3_delete_mem_region(core->vm_info, old_reg);
        }
 
        global_state->global_guest_pa = src.value;
@@ -84,7 +84,7 @@ static int symspy_msr_write(struct guest_info * core, uint_t msr, struct v3_msr
 
        if (local_state->active == 1) {
            // unmap page
-           struct v3_shadow_region * old_reg = v3_get_shadow_region(core->vm_info, core->cpu_id,
+           struct v3_mem_region * old_reg = v3_get_mem_region(core->vm_info, core->vcpu_id,
                                                                     (addr_t)local_state->local_guest_pa);
 
            if (old_reg == NULL) {
@@ -93,7 +93,7 @@ static int symspy_msr_write(struct guest_info * core, uint_t msr, struct v3_msr
                return -1;
            }
 
-           v3_delete_shadow_region(core->vm_info, old_reg);
+           v3_delete_mem_region(core->vm_info, old_reg);
        }
 
        local_state->local_guest_pa = src.value;
@@ -102,7 +102,7 @@ static int symspy_msr_write(struct guest_info * core, uint_t msr, struct v3_msr
        local_state->active = 1;
 
        // map page
-       v3_add_shadow_mem(core->vm_info, core->cpu_id, (addr_t)local_state->local_guest_pa, 
+       v3_add_shadow_mem(core->vm_info, core->vcpu_id, (addr_t)local_state->local_guest_pa, 
                          (addr_t)(local_state->local_guest_pa + PAGE_SIZE_4KB - 1), 
                          local_state->local_page_pa);
     } else {
@@ -118,6 +118,11 @@ static int symspy_msr_write(struct guest_info * core, uint_t msr, struct v3_msr
 int v3_init_symspy_vm(struct v3_vm_info * vm, struct v3_symspy_global_state * state) {
 
     state->global_page_pa = (addr_t)V3_AllocPages(1);
+    if (!state->global_page_pa) { 
+       PrintError("Cannot allocate page\n");
+       return -1;
+    }
+
     state->sym_page = (struct v3_symspy_global_page *)V3_VAddr((void *)state->global_page_pa);
     memset(state->sym_page, 0, PAGE_SIZE_4KB);
 
@@ -133,10 +138,15 @@ int v3_init_symspy_vm(struct v3_vm_info * vm, struct v3_symspy_global_state * st
 
 int v3_init_symspy_core(struct guest_info * core, struct v3_symspy_local_state * state) {
     state->local_page_pa = (addr_t)V3_AllocPages(1);
+
+    if (!state->local_page_pa) { 
+       PrintError("Cannot allocate page\n");
+       return -1;
+    }
     state->local_page = (struct v3_symspy_local_page *)V3_VAddr((void *)state->local_page_pa);
     memset(state->local_page, 0, PAGE_SIZE_4KB);
 
-    snprintf((uint8_t *)&(state->local_page->magic), 8, "V3V.%d", core->cpu_id);
+    snprintf((uint8_t *)&(state->local_page->magic), 8, "V3V.%d", core->vcpu_id);
 
     return 0;
 }
@@ -180,3 +190,12 @@ int v3_sym_unmap_pci_passthrough(struct v3_vm_info * vm, uint_t bus, uint_t dev,
 
     return 0;
 }
+
+
+struct v3_symspy_global_page * v3_sym_get_symspy_vm(struct v3_vm_info * vm) {
+    return vm->sym_vm_state.symspy_state.sym_page;
+}
+
+struct v3_symspy_local_page * v3_sym_get_symspy_core(struct guest_info * core) {
+    return core->sym_core_state.symspy_state.local_page;
+}