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.


Minor tweak to fix handling of extensions without initializers
[palacios.git] / palacios / src / palacios / vmm_extensions.c
index e9f4a71..fb5d6e0 100644 (file)
@@ -58,6 +58,17 @@ int V3_init_extensions() {
     ext_table = v3_create_htable(0, ext_hash_fn, ext_eq_fn);
 
     while (tmp_ext != __stop__v3_extensions) {
+
+        if (!(*tmp_ext)) {
+           PrintError(VM_NONE, VCORE_NONE, "Impossible extension\n");
+           return -1;
+       }
+       
+       if ((*tmp_ext)->init && ((*tmp_ext)->init() != 0)) {
+           PrintError(VM_NONE, VCORE_NONE, "Could not initialize extension (%s)\n", (*tmp_ext)->name);
+           return -1;
+       } 
+
         V3_Print(VM_NONE, VCORE_NONE, "Registering Extension (%s)\n", (*tmp_ext)->name);
 
        if (v3_htable_search(ext_table, (addr_t)((*tmp_ext)->name))) {
@@ -70,11 +81,6 @@ int V3_init_extensions() {
            return -1;
        }
 
-        if ((*tmp_ext) && (*tmp_ext)->init && ((*tmp_ext)->init() != 0)) {
-           PrintError(VM_NONE, VCORE_NONE, "Could not initialize extension (%s)\n", (*tmp_ext)->name);
-           return -1;
-       } 
-
        tmp_ext = &(__start__v3_extensions[++i]);
     }
 
@@ -115,22 +121,24 @@ int v3_deinit_ext_manager(struct v3_vm_info * vm)  {
     list_for_each_entry_safe(ext, tmp, &(ext_state->extensions), node) {
         
        V3_Print(vm, VCORE_NONE, "Cleaning up Extension (%s)\n", ext->impl->name);
-       if ((ext->impl) && (ext->impl->vm_deinit)) {
-           if (ext->impl->vm_deinit(vm, ext->priv_data) == -1) {
-               PrintError(vm, VCORE_NONE, "Error cleaning up extension (%s)\n", ext->impl->name);
-               return -1;
+       if (ext->impl) { 
+           if (ext->impl->vm_deinit) {
+               if (ext->impl->vm_deinit(vm, ext->priv_data) == -1) {
+                   PrintError(vm, VCORE_NONE, "Error cleaning up extension (%s)\n", ext->impl->name);
+                   return -1;
+               }
            }
-       }
-
-        if (ext->impl->on_exit)
-            list_del(&ext->exit_node);
-
-        if (ext->impl->on_entry)
-            list_del(&ext->entry_node);
-
-        list_del(&ext->node);
-        V3_Free(ext);
 
+           if (ext->impl->on_exit)
+               list_del(&ext->exit_node);
+           
+           if (ext->impl->on_entry)
+               list_del(&ext->entry_node);
+       }
+           
+       list_del(&ext->node);
+       V3_Free(ext);
+           
     }
 
     return 0;