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.


small fixes to swint code, add proper cleanup
Kyle Hale [Thu, 19 Jul 2012 23:58:07 +0000 (18:58 -0500)]
palacios/include/gears/sw_intr.h
palacios/src/gears/ext_sw_intr.c

index 45c2bdc..327fdd0 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <palacios/vmm.h>
 
+#define MAX_SWINTR_HOOKS  256
+
 #define SW_INTR_SYSCALL_VEC 0x80
 
 int v3_handle_swintr (struct guest_info * core);
index 4739d51..9d9bebf 100644 (file)
 #endif
 
 
+struct v3_swintr_hook {
+    int (*handler)(struct guest_info * core, uint8_t vector, void * priv_data);
+    void * priv_data;
+};
+
+
+static struct v3_swintr_hook * swintr_hooks[MAX_SWINTR_HOOKS];
+
+
 static int init_swintr_intercept (struct v3_vm_info * vm, v3_cfg_tree_t * cfg, void ** priv_data) {
     return 0;
 }
 
 
+static int deinit_swintr_intercept (struct v3_vm_info * vm, void * priv_data) {
+    int i = 0;
+
+    for (; i < MAX_SWINTR_HOOKS; i++) {
+        if (swintr_hooks[i])
+            V3_Free(swintr_hooks[i]);
+    }
+
+    return 0;
+}
+
+
 static int init_swintr_core_svm (struct guest_info * core, void * priv_data) {
     vmcb_t * vmcb = (vmcb_t*)core->vmm_data;
     vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA(vmcb);
@@ -86,14 +107,6 @@ static int init_swintr_intercept_core (struct guest_info * core, void * priv_dat
 }
 
 
-struct v3_swintr_hook {
-    int (*handler)(struct guest_info * core, uint8_t vector, void * priv_data);
-    void * priv_data;
-};
-
-
-static struct v3_swintr_hook * swintr_hooks[256];
-
 static inline struct v3_swintr_hook * get_swintr_hook (struct guest_info * core, uint8_t vector) {
     return swintr_hooks[vector];
 }
@@ -102,7 +115,7 @@ static inline struct v3_swintr_hook * get_swintr_hook (struct guest_info * core,
 static struct v3_extension_impl swintr_impl = {
     .name = "swintr_intercept",
     .init = init_swintr_intercept,
-    .deinit = NULL,
+    .deinit = deinit_swintr_intercept,
     .core_init = init_swintr_intercept_core,
     .core_deinit = NULL,
     .on_entry = NULL,