Revert "gem5: save/restore moved to Gem5Controller"
This reverts commit d525005990.
This commit is contained in:
28
src/core/sal/gem5/Gem5Connector.cc
Normal file
28
src/core/sal/gem5/Gem5Connector.cc
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#if 0
|
||||||
|
#include "Gem5Connector.hpp"
|
||||||
|
|
||||||
|
#include "base/trace.hh"
|
||||||
|
#include "debug/FailState.hh"
|
||||||
|
#include "sim/root.hh"
|
||||||
|
|
||||||
|
Gem5Connector connector;
|
||||||
|
|
||||||
|
void Gem5Connector::save(const std::string &path)
|
||||||
|
{
|
||||||
|
DPRINTF(FailState, "Saving state to %s.\n", path);
|
||||||
|
|
||||||
|
Root* root = Root::root();
|
||||||
|
root->Serializable::serializeAll(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Gem5Connector::restore(const std::string &path)
|
||||||
|
{
|
||||||
|
DPRINTF(FailState, "Restoring state from %s.\n", path);
|
||||||
|
|
||||||
|
Root* root = Root::root();
|
||||||
|
Checkpoint cp(path);
|
||||||
|
|
||||||
|
root->loadState(&cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
23
src/core/sal/gem5/Gem5Connector.hpp
Normal file
23
src/core/sal/gem5/Gem5Connector.hpp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#if 0
|
||||||
|
// TODO: Incorporate this code into Gem5Controller.{hpp,cc}
|
||||||
|
|
||||||
|
#ifndef __GEM5_CONNECTOR_HPP__
|
||||||
|
#define __GEM5_CONNECTOR_HPP__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \class Gem5Connector
|
||||||
|
* This class will be compiled inside the gem5 context and provides the
|
||||||
|
* Gem5Controller a way to call gem5 functions.
|
||||||
|
*/
|
||||||
|
class Gem5Connector {
|
||||||
|
public:
|
||||||
|
void save(const std::string &path);
|
||||||
|
void restore(const std::string &path);
|
||||||
|
};
|
||||||
|
|
||||||
|
extern Gem5Connector connector;
|
||||||
|
|
||||||
|
#endif // __GEM5_CONNECTOR_HPP__
|
||||||
|
#endif
|
||||||
@ -1,13 +1,10 @@
|
|||||||
#include "Gem5Controller.hpp"
|
#include "Gem5Controller.hpp"
|
||||||
|
//#include "Gem5Connector.hpp"
|
||||||
|
|
||||||
#include "../Listener.hpp"
|
#include "../Listener.hpp"
|
||||||
|
|
||||||
#include "Gem5Wrapper.hpp"
|
#include "Gem5Wrapper.hpp"
|
||||||
|
|
||||||
#include "base/trace.hh"
|
|
||||||
#include "debug/FailState.hh"
|
|
||||||
#include "sim/root.hh"
|
|
||||||
|
|
||||||
namespace fail {
|
namespace fail {
|
||||||
|
|
||||||
void Gem5Controller::startup()
|
void Gem5Controller::startup()
|
||||||
@ -37,23 +34,16 @@ Gem5Controller::~Gem5Controller()
|
|||||||
delete m_Mem;
|
delete m_Mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gem5Controller::save(const std::string &path)
|
bool Gem5Controller::save(const std::string &path)
|
||||||
{
|
{
|
||||||
DPRINTF(FailState, "Saving state to %s.\n", path);
|
// connector.save(path); // FIXME: not working?!
|
||||||
|
|
||||||
Root* root = Root::root();
|
|
||||||
root->Serializable::serializeAll(path);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Gem5Controller::restore(const std::string &path)
|
void Gem5Controller::restore(const std::string &path)
|
||||||
{
|
{
|
||||||
// FIXME: not working currently
|
// connector.restore(path); // FIXME: not working?!
|
||||||
Root* root = Root::root();
|
|
||||||
Checkpoint cp(path);
|
|
||||||
|
|
||||||
root->loadState(&cp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement reboot
|
// TODO: Implement reboot
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public:
|
|||||||
void startup();
|
void startup();
|
||||||
~Gem5Controller();
|
~Gem5Controller();
|
||||||
|
|
||||||
void save(const std::string &path);
|
bool save(const std::string &path);
|
||||||
void restore(const std::string &path);
|
void restore(const std::string &path);
|
||||||
void reboot();
|
void reboot();
|
||||||
#if defined(CONFIG_EVENT_BREAKPOINTS) ||\
|
#if defined(CONFIG_EVENT_BREAKPOINTS) ||\
|
||||||
|
|||||||
Reference in New Issue
Block a user