Files
fail/src/core/sal/gem5/Gem5Controller.cc
friemel e0e95faa5b Restructured the gem5 backend:
- FailGem5Device is gone.
- There are now changes directly made to the gem5 source.
- Gem5Connector is a helper class that is compiled inside the gem5 context to workaround problems with gem5 header in fail.

Things that are working:
- BPSingleListener
- MemAccessListener
- Save and restore simulator state

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1820 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
2012-10-24 19:19:14 +00:00

50 lines
1.1 KiB
C++

#include "Gem5Controller.hpp"
#include "Gem5Connector.hpp"
#include "../Listener.hpp"
namespace fail {
bool Gem5Controller::save(const std::string &path)
{
connector.save(path);
return true;
}
void Gem5Controller::restore(const std::string &path)
{
connector.restore(path);
}
// TODO: Implement reboot
void Gem5Controller::reboot()
{
}
void Gem5Controller::onBreakpoint(address_t instrPtr, address_t address_space)
{
bool do_fire = false;
// Check for active breakpoint-events:
ListenerManager::iterator it = m_LstList.begin();
BPEvent tmp(instrPtr, address_space);
while (it != m_LstList.end()) {
BaseListener* pLi = *it;
BPListener* pBreakpt = dynamic_cast<BPListener*>(pLi);
if (pBreakpt != NULL && pBreakpt->isMatching(&tmp)) {
pBreakpt->setTriggerInstructionPointer(instrPtr);
it = m_LstList.makeActive(it);
do_fire = true;
// "it" has already been set to the next element (by calling
// makeActive()):
continue; // -> skip iterator increment
}
it++;
}
if (do_fire)
m_LstList.triggerActiveListeners();
}
} // end-of-namespace: fail