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.


Check to make sure extension name is provided
[palacios.git] / palacios / src / palacios / vmx.c
index 649181b..a80b8f2 100644 (file)
@@ -34,6 +34,7 @@
 #include <palacios/vmm_decoder.h>
 #include <palacios/vmm_barrier.h>
 #include <palacios/vmm_timeout.h>
+#include <palacios/vmm_debug.h>
 
 #ifdef V3_CONFIG_CHECKPOINT
 #include <palacios/vmm_checkpoint.h>
@@ -91,11 +92,17 @@ static int inline check_vmcs_read(vmcs_field_t field, void * val) {
 
 
 static addr_t allocate_vmcs() {
+    void *temp;
     struct vmcs_data * vmcs_page = NULL;
 
     PrintDebug("Allocating page\n");
 
-    vmcs_page = (struct vmcs_data *)V3_VAddr(V3_AllocPages(1));
+    temp = V3_AllocPages(1);
+    if (!temp) { 
+       PrintError("Cannot allocate VMCS\n");
+       return -1;
+    }
+    vmcs_page = (struct vmcs_data *)V3_VAddr(temp);
     memset(vmcs_page, 0, 4096);
 
     vmcs_page->revision = hw_info.basic_info.revision;
@@ -399,7 +406,7 @@ static int init_vmcs_bios(struct guest_info * core, struct vmx_data * vmx_state)
        vmx_ret |= check_vmcs_write(VMCS_CR4_MASK, CR4_VMXE);
 #define CR0_NE 0x00000020
        vmx_ret |= check_vmcs_write(VMCS_CR0_MASK, CR0_NE);
-       //((struct cr0_32 *)&(core->shdw_pg_state.guest_cr0))->ne = 1;
+       ((struct cr0_32 *)&(core->shdw_pg_state.guest_cr0))->ne = 1;
 
        if (v3_init_ept(core, &hw_info) == -1) {
            PrintError("Error initializing EPT\n");
@@ -546,6 +553,12 @@ static void __init_vmx_vmcs(void * arg) {
     int vmx_ret = 0;
     
     vmx_state = (struct vmx_data *)V3_Malloc(sizeof(struct vmx_data));
+
+    if (!vmx_state) {
+       PrintError("Unable to allocate in initializing vmx vmcs\n");
+       return;
+    }
+
     memset(vmx_state, 0, sizeof(struct vmx_data));
 
     PrintDebug("vmx_data pointer: %p\n", (void *)vmx_state);