From 1403fa3828cd42eea40517cc398c54ffc5e65b18 Mon Sep 17 00:00:00 2001 From: friemel Date: Fri, 7 Sep 2012 22:35:52 +0000 Subject: [PATCH] Step 1 from experiment hsc-simple is now working with gem5 git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1604 8c4709b5-6ec9-48aa-a5cd-a96041d1645a --- src/core/sal/gem5/FailGem5Device.cc | 2 +- src/core/sal/gem5/Gem5Controller.cc | 25 +++++++++++++++++++++++++ src/core/sal/gem5/Gem5Controller.hpp | 2 ++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/core/sal/gem5/FailGem5Device.cc b/src/core/sal/gem5/FailGem5Device.cc index 0d864372..d10f6ebd 100644 --- a/src/core/sal/gem5/FailGem5Device.cc +++ b/src/core/sal/gem5/FailGem5Device.cc @@ -7,7 +7,7 @@ FailGem5Device::FailGem5Device(Params *p) : BasicPioDevice(p) { pioSize = 0x60; - DPRINTF(Fail, "Fail startup()\n"); + fail::simulator.startup(); } diff --git a/src/core/sal/gem5/Gem5Controller.cc b/src/core/sal/gem5/Gem5Controller.cc index bb4b56fb..969cdf2d 100644 --- a/src/core/sal/gem5/Gem5Controller.cc +++ b/src/core/sal/gem5/Gem5Controller.cc @@ -34,4 +34,29 @@ void Gem5Controller::reboot() } +void Gem5Controller::onBreakpoint(address_t instrPtr, address_t address_space) +{ + /*bp_cache_t &buffer_cache = m_LstList.getBPBuffer(); + bp_cache_t::iterator it = buffer_cache.begin(); + for (stringvector::iterator it = strings.begin(); it != strings.end(); it++)*/ + + bool do_fire = false; + // Check for active breakpoint-events: + bp_cache_t &buffer_cache = m_LstList.getBPBuffer(); + for(bp_cache_t::iterator it = buffer_cache.begin(); it != buffer_cache.end(); it++) + { + BPListener* pEvBreakpt = *it; + if(pEvBreakpt->isMatching(instrPtr, address_space)) { + pEvBreakpt->setTriggerInstructionPointer(instrPtr); + it = buffer_cache.makeActive(m_LstList, it); + do_fire = true; + // "it" has already been set to the next element (by calling + // makeActive()): + continue; // -> skip iterator increment + } + } + if (do_fire) + m_LstList.triggerActiveListeners(); +} + } // end-of-namespace: fail diff --git a/src/core/sal/gem5/Gem5Controller.hpp b/src/core/sal/gem5/Gem5Controller.hpp index 9a113454..fc1ed551 100644 --- a/src/core/sal/gem5/Gem5Controller.hpp +++ b/src/core/sal/gem5/Gem5Controller.hpp @@ -11,6 +11,8 @@ extern int interrupt_to_fire; class Gem5Controller : public SimulatorController { public: + void onBreakpoint(address_t instrPtr, address_t address_space); + virtual void save(const std::string &path); virtual void restore(const std::string &path); virtual void reboot();