core/sal: move command-line parameter passing to SC::startup()
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
#include "SALInst.hpp"
|
#include "SALInst.hpp"
|
||||||
#include "Event.hpp"
|
#include "Event.hpp"
|
||||||
#include "Listener.hpp"
|
#include "Listener.hpp"
|
||||||
|
#include "util/CommandLine.hpp"
|
||||||
|
|
||||||
namespace fail {
|
namespace fail {
|
||||||
|
|
||||||
@ -35,12 +36,16 @@ BaseListener* SimulatorController::resume(void)
|
|||||||
return m_LstList.getLastFired();
|
return m_LstList.getLastFired();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulatorController::startup()
|
void SimulatorController::startup(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// Some greetings to the user:
|
// Some greetings to the user:
|
||||||
std::cout << "[SimulatorController] Initializing..." << std::endl;
|
std::cout << "[SimulatorController] Initializing..." << std::endl;
|
||||||
// TODO: Log-Level?
|
// TODO: Log-Level?
|
||||||
|
|
||||||
|
if (argv) {
|
||||||
|
CommandLine::Inst().collect_args(bx_startup_flags.argc, bx_startup_flags.argv);
|
||||||
|
}
|
||||||
|
|
||||||
// Activate previously added experiments to allow initialization:
|
// Activate previously added experiments to allow initialization:
|
||||||
initExperiments();
|
initExperiments();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,8 +48,11 @@ public:
|
|||||||
* This function needs to be invoked once the simulator starts, and
|
* This function needs to be invoked once the simulator starts, and
|
||||||
* allows the SimulatorController to instantiate all needed experiment
|
* allows the SimulatorController to instantiate all needed experiment
|
||||||
* components.
|
* components.
|
||||||
|
*
|
||||||
|
* @param argc main()'s argument counter
|
||||||
|
* @param argv main()'s argument value vector
|
||||||
*/
|
*/
|
||||||
void startup();
|
void startup(int argc = 0, char **argv = 0);
|
||||||
/**
|
/**
|
||||||
* Experiments need to hook here.
|
* Experiments need to hook here.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -4,7 +4,6 @@
|
|||||||
#include "BochsMemory.hpp"
|
#include "BochsMemory.hpp"
|
||||||
#include "../SALInst.hpp"
|
#include "../SALInst.hpp"
|
||||||
#include "../Listener.hpp"
|
#include "../Listener.hpp"
|
||||||
#include "util/CommandLine.hpp"
|
|
||||||
|
|
||||||
namespace fail {
|
namespace fail {
|
||||||
|
|
||||||
@ -174,9 +173,4 @@ ConcreteCPU& BochsController::detectCPU(BX_CPU_C* pCPU) const
|
|||||||
return getCPU(i);
|
return getCPU(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BochsController::collectCommandLineArguments(int argc, char **argv) const
|
|
||||||
{
|
|
||||||
CommandLine::Inst().collect_args(bx_startup_flags.argc, bx_startup_flags.argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end-of-namespace: fail
|
} // end-of-namespace: fail
|
||||||
|
|||||||
@ -150,20 +150,6 @@ public:
|
|||||||
* @see The uses SimulatorController::getCPU().
|
* @see The uses SimulatorController::getCPU().
|
||||||
*/
|
*/
|
||||||
ConcreteCPU& detectCPU(BX_CPU_C* pCPU) const;
|
ConcreteCPU& detectCPU(BX_CPU_C* pCPU) const;
|
||||||
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* Hack: Indirection for commandline argument collection
|
|
||||||
*
|
|
||||||
* This prevents CommandLine.hpp (and optionparser.h) from being pulled
|
|
||||||
* inbe to every single Bochs translation unit via FailBochsInit.ah,
|
|
||||||
* leading to compilation errors in some of them.
|
|
||||||
* TODO: Move this upwards to SimulatorController?
|
|
||||||
*
|
|
||||||
* @param argc main()'s argument counter
|
|
||||||
* @param argv main()'s argument value vector
|
|
||||||
*/
|
|
||||||
void collectCommandLineArguments(int argc, char **argv) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end-of-namespace: fail
|
} // end-of-namespace: fail
|
||||||
|
|||||||
@ -10,8 +10,7 @@
|
|||||||
aspect FailBochsInit {
|
aspect FailBochsInit {
|
||||||
advice call("int bxmain()") : before ()
|
advice call("int bxmain()") : before ()
|
||||||
{
|
{
|
||||||
fail::simulator.collectCommandLineArguments(bx_startup_flags.argc, bx_startup_flags.argv);
|
fail::simulator.startup(bx_startup_flags.argc, bx_startup_flags.argv);
|
||||||
fail::simulator.startup();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,7 @@ void Gem5Controller::startup()
|
|||||||
addCPU(cpu);
|
addCPU(cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO pass on command-line parameters
|
||||||
SimulatorController::startup();
|
SimulatorController::startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ aspect FailOVPInit {
|
|||||||
{
|
{
|
||||||
std::cout << "OVP init aspect!" << std::endl;
|
std::cout << "OVP init aspect!" << std::endl;
|
||||||
// TODO: Log-Level?
|
// TODO: Log-Level?
|
||||||
|
// TODO pass on command-line parameters
|
||||||
fail::simulator.startup();
|
fail::simulator.startup();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -14,6 +14,7 @@ void fail_init(struct CPUX86State *env)
|
|||||||
{
|
{
|
||||||
std::cout << "FailQEMU v" FAIL_VERSION << std::endl;
|
std::cout << "FailQEMU v" FAIL_VERSION << std::endl;
|
||||||
fail::simulator.setCPUEnv(env);
|
fail::simulator.setCPUEnv(env);
|
||||||
|
// TODO pass on command-line parameters
|
||||||
fail::simulator.startup();
|
fail::simulator.startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ void T32Controller::startup(){
|
|||||||
// Do some T32-specific startup
|
// Do some T32-specific startup
|
||||||
addCPU(new ConcreteCPU(0));
|
addCPU(new ConcreteCPU(0));
|
||||||
// Startup generic SimulatorController
|
// Startup generic SimulatorController
|
||||||
|
// TODO pass on command-line parameters
|
||||||
SimulatorController::startup();
|
SimulatorController::startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user