Skip to content
Snippets Groups Projects
Commit 171d1783 authored by Adrian Böckenkamp's avatar Adrian Böckenkamp
Browse files

SimCon interface update: save returns a boolean, now (+ redundant virtual keywords removed).

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1724 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
parent 37f030b9
No related branches found
No related tags found
No related merge requests found
......@@ -108,8 +108,9 @@ public:
/**
* Save simulator state.
* @param path Location to store state information
* @return \c true if the state has been successfully saved, \c false otherwise
*/
virtual void save(const std::string& path) = 0;
virtual bool save(const std::string& path) = 0;
/**
* Restore simulator state. Implicitly discards all previously
* registered listeners.
......
......@@ -159,20 +159,23 @@ void BochsController::onIOPort(unsigned char data, unsigned port, bool out) {
m_LstList.triggerActiveListeners();
}
void BochsController::save(const std::string& path)
bool BochsController::save(const std::string& path)
{
int stat;
stat = mkdir(path.c_str(), 0777);
if (!(stat == 0 || errno == EEXIST))
std::cout << "[FAIL] Can not create target-directory to save!" << std::endl;
if (!(stat == 0 || errno == EEXIST)) {
return false;
// std::cout << "[FAIL] Can not create target-directory to save!" << std::endl;
// TODO: (Non-)Verbose-Mode? Log-level? Maybe better: use return value to indicate failure?
}
save_bochs_request = true;
BX_CPU(0)->async_event |= 1;
sr_path = path;
m_CurrFlow = m_Flows.getCurrent();
m_Flows.resume();
return true;
}
void BochsController::saveDone()
......
......@@ -87,8 +87,9 @@ public:
/**
* Save simulator state.
* @param path Location to store state information
* @return \c true if the state has been successfully saved, \c false otherwise
*/
void save(const std::string& path);
bool save(const std::string& path);
/**
* Save finished: Callback from Simulator
*/
......
......@@ -10,7 +10,7 @@
namespace fail {
void Gem5Controller::save(const std::string &path)
bool Gem5Controller::save(const std::string &path)
{
// Takes a snapshot in the m5out dir
Tick when = curTick() + 1;
......@@ -22,6 +22,7 @@ void Gem5Controller::save(const std::string &path)
std::ofstream file(path.c_str());
root->serialize(file);
file.close();*/
return false; // TODO
}
void Gem5Controller::restore(const std::string &path)
......
......@@ -11,9 +11,9 @@ 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();
bool save(const std::string &path);
void restore(const std::string &path);
void reboot();
};
} // end-of-namespace: fail
......
......@@ -109,10 +109,11 @@ void OVPController::onInstrPtrChanged(address_t instrPtr)
m_EvList.fireActiveListeners();
}
void OVPController::save(const string& path)
bool OVPController::save(const string& path)
{
// TODO!
ovpplatform.save(path);
return false; // TODO
}
void OVPController::restore(const string& path)
......
......@@ -35,22 +35,23 @@ public:
* Initialize the controller.
*/
OVPController();
virtual ~OVPController();
virtual void onInstrPtrChanged(address_t instrPtr);
~OVPController();
void onInstrPtrChanged(address_t instrPtr);
/**
* Save simulator state.
* @param path Location to store state information
* @return \c true if the state has been successfully saved, \c false otherwise
*/
virtual void save(const std::string& path);
bool save(const std::string& path);
/**
* Restore simulator state.
* @param path Location to previously saved state information
*/
virtual void restore(const std::string& path);
void restore(const std::string& path);
/**
* Reboot simulator.
*/
virtual void reboot();
void reboot();
/**
* Returns the current instruction pointer.
* @return the current eip
......
......@@ -47,8 +47,9 @@ public:
/**
* Save simulator state. TODO.
* @param path Location to store state information
* @return \c true if the state has been successfully saved, \c false otherwise
*/
void save(const std::string& path) {}
bool save(const std::string& path) { return false; }
/**
* Restore simulator state. Clears all Listeners. TODO.
* @param path Location to previously saved state information
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment