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.


Changes for software interrupt extension code
Kyle Hale [Wed, 22 Jun 2011 00:08:05 +0000 (19:08 -0500)]
Added code to register the extension. Also added an interface header file.
Added a case statement for exits on software interrupts in svm_handler.c. Also included
a compilation option for enabling swintr-specific debugging.

palacios/include/interfaces/sw_intr.h [new file with mode: 0644]
palacios/src/extensions/Kconfig
palacios/src/extensions/ext_sw_intr.c
palacios/src/palacios/svm_handler.c

diff --git a/palacios/include/interfaces/sw_intr.h b/palacios/include/interfaces/sw_intr.h
new file mode 100644 (file)
index 0000000..eb63cc9
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2011, Kyle C. Hale <kh@u.northwestern.edu> 
+ * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Kyle C. Hale <kh@u.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+
+#ifndef __SW_INTR_H__
+#define __SW_INTR_H__
+
+#include <palacios/vmm.h>
+
+
+int v3_handle_swintr (struct guest_info * core);
+int v3_signal_swintr (struct guest_info * core, int vec);
+
+
+#endif
index cc5f7ef..7a04e6b 100644 (file)
@@ -52,6 +52,14 @@ config EXT_SW_INTERRUPTS
       of software interrupts (i.e. the INTn instruction) and enable
       any INT vector to be hooked
 
+config DEBUG_EXT_SW_INTERRUPTS
+    bool "Enable debugging of software interrupt interception code"
+    depends on EXT_SW_INTERRUPTS
+    default n
+    help
+      This will enable useful debugging printouts for software
+      intercept code
+
 config EXT_SWINTR_PASSTHROUGH
     bool "Hook all unhandled sofware interrupts for passthrough"
     depends on EXT_SW_INTERRUPTS
index d34f382..26e8bb4 100644 (file)
  */
 
 #include <palacios/vmm.h>
+#include <palacios/vmcb.h>
 #include <palacios/vm_guest.h>
 #include <palacios/vmm_extensions.h>
 
-
+#include <interfaces/sw_intr.h>
 
 static int init_swintr_intercept (struct v3_vm_info * vm, v3_cfg_tree_t * cfg, void ** priv_data);
 
@@ -36,6 +37,10 @@ static int deinit_swintr_intercept (struct v3_vm_info * vm, void * priv_data) {
 
 
 static int init_swintr_intercept_core (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);
+
+    ctrl_rea->instrs.INTn = 1;
 
     return 0;
 }
index a84d2e1..1854c53 100644 (file)
@@ -43,7 +43,9 @@
 #include <palacios/vmm_telemetry.h>
 #endif
 
-
+#ifdef V3_CONFIG_EXT_SW_INTERRUPTS
+#include <interfaces/sw_intr.h>
+#endif
 
 int v3_handle_svm_exit(struct guest_info * info, addr_t exit_code, addr_t exit_info1, addr_t exit_info2) {
 
@@ -275,6 +277,17 @@ int v3_handle_svm_exit(struct guest_info * info, addr_t exit_code, addr_t exit_i
            // Force exit on other cores
 
            break;
+#ifdef V3_CONFIG_EXT_SW_INTERRUPTS
+    case VMEXIT_SWINT:
+#ifdef V3_CONFIG_DEBUG_EXT_SW_INTERRUPTS
+        PrintDebug("Intercepted a software interrupt\n");
+#endif
+        if (v3_handle_swintr(info) == -1) {
+            PrintError("Error handling software interrupt\n");
+            return -1;
+        }
+        break;
+#endif
 
 
            /* Exits Following this line are NOT HANDLED */