From 2a979ba25cb6ed78ade42560e79a486885cd1bc9 Mon Sep 17 00:00:00 2001 From: hellwig Date: Fri, 30 Mar 2012 14:32:26 +0000 Subject: [PATCH] interrupts can now be fired git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1010 8c4709b5-6ec9-48aa-a5cd-a96041d1645a --- core/SAL/bochs/BochsController.hpp | 10 ++++++++++ core/SAL/bochs/Controller.cc | 16 ++++++++++++++++ core/SAL/bochs/failbochs.hpp | 3 ++- core/config/AspectConfig.hpp.in | 1 + core/config/CMakeLists.txt | 1 + 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/core/SAL/bochs/BochsController.hpp b/core/SAL/bochs/BochsController.hpp index ecb9381a..284006d3 100644 --- a/core/SAL/bochs/BochsController.hpp +++ b/core/SAL/bochs/BochsController.hpp @@ -18,6 +18,7 @@ #include "../../../bochs/bochs.h" #include "../../../bochs/cpu/cpu.h" #include "../../../bochs/config.h" +#include "../../../bochs/iodev/iodev.h" using namespace std; @@ -91,6 +92,15 @@ class BochsController : public SimulatorController * @param exCode Individual exit code */ void terminate(int exCode = EXIT_SUCCESS); + /** + * Fire an interrupt. + * @param irq Interrupt to be fired + */ + void fireInterrupt(unsigned irq); + /** + * Fire done: Callback from Simulator + */ + void fireInterruptDone(); #ifdef DEBUG /** * Enables instruction pointer debugging output. diff --git a/core/SAL/bochs/Controller.cc b/core/SAL/bochs/Controller.cc index bcba4064..fccb943e 100644 --- a/core/SAL/bochs/Controller.cc +++ b/core/SAL/bochs/Controller.cc @@ -9,6 +9,8 @@ namespace sal bx_bool restore_bochs_request = false; bx_bool save_bochs_request = false; bx_bool reboot_bochs_request = false; +bx_bool interrupt_injection_request = false; +unsigned interrupt_to_fire = 0; std::string sr_path = ""; BochsController::BochsController() @@ -176,4 +178,18 @@ void BochsController::terminate(int exCode) exit(exCode); } +void BochsController::fireInterrupt(unsigned irq) +{ + interrupt_injection_request = true; + interrupt_to_fire = irq; + m_CurrFlow = m_Flows.getCurrent(); + m_Flows.resume(); +} + +void BochsController::fireInterruptDone() +{ + interrupt_injection_request = false; + m_Flows.toggle(m_CurrFlow); +} + } // end-of-namespace: sal diff --git a/core/SAL/bochs/failbochs.hpp b/core/SAL/bochs/failbochs.hpp index 8571b429..925028c2 100644 --- a/core/SAL/bochs/failbochs.hpp +++ b/core/SAL/bochs/failbochs.hpp @@ -8,11 +8,12 @@ namespace sal{ - //DanceOS Richard Hellwig #ifdef DANCEOS_RESTORE extern bx_bool restore_bochs_request; extern bx_bool save_bochs_request; extern bx_bool reboot_bochs_request; + extern bx_bool interrupt_injection_request; + extern unsigned interrupt_to_fire; extern std::string sr_path; #endif diff --git a/core/config/AspectConfig.hpp.in b/core/config/AspectConfig.hpp.in index e0dc02cb..ea030bac 100644 --- a/core/config/AspectConfig.hpp.in +++ b/core/config/AspectConfig.hpp.in @@ -22,6 +22,7 @@ // Miscellaneous #cmakedefine CONFIG_STFU #cmakedefine CONFIG_SUPPRESS_INTERRUPTS +#cmakedefine CONFIG_FIRE_INTERRUPTS #cmakedefine CONFIG_DISABLE_KEYB_INTERRUPTS // Fault injection diff --git a/core/config/CMakeLists.txt b/core/config/CMakeLists.txt index 8c4aebca..7eb0f2fc 100644 --- a/core/config/CMakeLists.txt +++ b/core/config/CMakeLists.txt @@ -14,6 +14,7 @@ OPTION(CONFIG_SR_SAVE "Target backend: State saving" OFF) OPTION(CONFIG_SR_REBOOT "Target backend: Reboot" OFF) OPTION(CONFIG_STFU "Misc: Reduced verbosity" OFF) OPTION(CONFIG_SUPPRESS_INTERRUPTS "Target backend: Suppress interrupts" OFF) +OPTION(CONFIG_FIRE_INTERRUPTS "Target backend: Fire interrupts" OFF) OPTION(CONFIG_DISABLE_KEYB_INTERRUPTS "Target backend: Suppress keyboard interrupts" OFF) OPTION(CONFIG_FI_MEM_ACCESS_BITFLIP "deprecated something" OFF)