From: Kyle Hale Date: Wed, 22 Jun 2011 00:08:05 +0000 (-0500) Subject: Changes for software interrupt extension code X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=e5649c2775438bbb04baf9a8bd53fa70363c4235 Changes for software interrupt extension code 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. --- diff --git a/palacios/include/interfaces/sw_intr.h b/palacios/include/interfaces/sw_intr.h new file mode 100644 index 0000000..eb63cc9 --- /dev/null +++ b/palacios/include/interfaces/sw_intr.h @@ -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 + * Copyright (c) 2011, The V3VEE Project + * All rights reserved. + * + * Author: Kyle C. Hale + * + * 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 + + +int v3_handle_swintr (struct guest_info * core); +int v3_signal_swintr (struct guest_info * core, int vec); + + +#endif diff --git a/palacios/src/extensions/Kconfig b/palacios/src/extensions/Kconfig index cc5f7ef..7a04e6b 100644 --- a/palacios/src/extensions/Kconfig +++ b/palacios/src/extensions/Kconfig @@ -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 diff --git a/palacios/src/extensions/ext_sw_intr.c b/palacios/src/extensions/ext_sw_intr.c index d34f382..26e8bb4 100644 --- a/palacios/src/extensions/ext_sw_intr.c +++ b/palacios/src/extensions/ext_sw_intr.c @@ -18,10 +18,11 @@ */ #include +#include #include #include - +#include 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; } diff --git a/palacios/src/palacios/svm_handler.c b/palacios/src/palacios/svm_handler.c index a84d2e1..1854c53 100644 --- a/palacios/src/palacios/svm_handler.c +++ b/palacios/src/palacios/svm_handler.c @@ -43,7 +43,9 @@ #include #endif - +#ifdef V3_CONFIG_EXT_SW_INTERRUPTS +#include +#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 */