Added mechanism to specialize listener + basic BPSingleListener for gem5
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1603 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -1,12 +1,27 @@
|
||||
#include "Gem5Controller.hpp"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include "sim/core.hh"
|
||||
#include "sim/sim_exit.hh"
|
||||
//#include "sim/root.hh"
|
||||
|
||||
namespace fail {
|
||||
|
||||
int interrupt_to_fire = -1;
|
||||
|
||||
void Gem5Controller::save(const std::string &path)
|
||||
{
|
||||
// Takes a snapshot in the m5out dir
|
||||
Tick when = curTick() + 1;
|
||||
exitSimLoop("checkpoint", 0, when, 0);
|
||||
|
||||
// This could be a version to take snapshots with a specified name
|
||||
/*Root* root = Root::root();
|
||||
|
||||
std::ofstream file(path.c_str());
|
||||
root->serialize(file);
|
||||
file.close();*/
|
||||
}
|
||||
|
||||
void Gem5Controller::restore(const std::string &path)
|
||||
|
||||
33
src/core/sal/gem5/Gem5Listener.cc
Normal file
33
src/core/sal/gem5/Gem5Listener.cc
Normal file
@ -0,0 +1,33 @@
|
||||
#include "Gem5Listener.hpp"
|
||||
#include "../SALInst.hpp"
|
||||
|
||||
#include "sim/system.hh"
|
||||
|
||||
namespace fail {
|
||||
|
||||
Gem5BPSingleListener::Gem5BPSingleListener(address_t ip)
|
||||
: GenericBPSingleListener(ip)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool Gem5BPSingleListener::onAddition()
|
||||
{
|
||||
if(!m_Breakpoint)
|
||||
{
|
||||
System* sys = *System::systemList.begin();
|
||||
m_Breakpoint = new Gem5PCEvent(&sys->pcEventQueue, this->m_WatchInstrPtr);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Gem5BPSingleListener::~Gem5BPSingleListener()
|
||||
{
|
||||
if(m_Breakpoint)
|
||||
{
|
||||
delete m_Breakpoint;
|
||||
}
|
||||
}
|
||||
|
||||
} // end-of-namespace: fail
|
||||
23
src/core/sal/gem5/Gem5Listener.hpp
Normal file
23
src/core/sal/gem5/Gem5Listener.hpp
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef __GEM5_LISTENER_HPP__
|
||||
#define __GEM5_LISTENER_HPP__
|
||||
|
||||
#include "../Listener.hpp"
|
||||
#include "Gem5PCEvent.hh"
|
||||
|
||||
namespace fail {
|
||||
|
||||
class Gem5BPSingleListener : public GenericBPSingleListener
|
||||
{
|
||||
public:
|
||||
Gem5BPSingleListener(address_t ip = 0);
|
||||
virtual bool onAddition();
|
||||
~Gem5BPSingleListener();
|
||||
private:
|
||||
Gem5PCEvent* m_Breakpoint;
|
||||
};
|
||||
|
||||
typedef Gem5BPSingleListener BPSingleListener;
|
||||
|
||||
} // end-of-namespace: fail
|
||||
|
||||
#endif // __GEM5_LISTENER_HPP__
|
||||
7
src/core/sal/gem5/Gem5PCEvent.cc
Normal file
7
src/core/sal/gem5/Gem5PCEvent.cc
Normal file
@ -0,0 +1,7 @@
|
||||
#include "Gem5PCEvent.hh"
|
||||
#include "../SALInst.hpp"
|
||||
|
||||
void Gem5PCEvent::process(ThreadContext *tc)
|
||||
{
|
||||
fail::simulator.onBreakpoint(this->evpc, fail::ANY_ADDR);
|
||||
}
|
||||
14
src/core/sal/gem5/Gem5PCEvent.hh
Normal file
14
src/core/sal/gem5/Gem5PCEvent.hh
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef __GEM5_PCEVENT_HPP__
|
||||
#define __GEM5_PCEVENT_HPP__
|
||||
|
||||
#include "cpu/pc_event.hh"
|
||||
|
||||
class Gem5PCEvent : public PCEvent
|
||||
{
|
||||
public:
|
||||
Gem5PCEvent(PCEventQueue* queue, Addr ip)
|
||||
: PCEvent(queue, "Fail Breakpoint", ip) {}
|
||||
virtual void process(ThreadContext *tc);
|
||||
};
|
||||
|
||||
#endif // __GEM5_PCEVENT_HPP__
|
||||
Reference in New Issue
Block a user