diff options
Diffstat (limited to 'src/sim')
-rw-r--r-- | src/sim/insttracer.hh | 2 | ||||
-rw-r--r-- | src/sim/process.cc | 2 | ||||
-rw-r--r-- | src/sim/sim_object.cc | 14 | ||||
-rw-r--r-- | src/sim/sim_object.hh | 7 | ||||
-rw-r--r-- | src/sim/system.cc | 2 | ||||
-rw-r--r-- | src/sim/tlb.hh | 2 |
6 files changed, 11 insertions, 18 deletions
diff --git a/src/sim/insttracer.hh b/src/sim/insttracer.hh index 82b86ca84..9a20c7c56 100644 --- a/src/sim/insttracer.hh +++ b/src/sim/insttracer.hh @@ -129,7 +129,7 @@ class InstRecord class InstTracer : public SimObject { public: - InstTracer(const std::string & name) : SimObject(name) + InstTracer(const Params *p) : SimObject(p) {} virtual ~InstTracer() diff --git a/src/sim/process.cc b/src/sim/process.cc index 1e6395d55..4fa5c7aad 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -88,7 +88,7 @@ Process::Process(const string &nm, int stdin_fd, // initial I/O descriptors int stdout_fd, int stderr_fd) - : SimObject(nm), system(_system) + : SimObject(makeParams(nm)), system(_system) { M5_pid = system->allocatePID(); // initialize first 3 fds (stdin, stdout, stderr) diff --git a/src/sim/sim_object.cc b/src/sim/sim_object.cc index 67604e24c..907f015dc 100644 --- a/src/sim/sim_object.cc +++ b/src/sim/sim_object.cc @@ -70,25 +70,13 @@ SimObject::SimObject(const Params *p) } SimObjectParams * -makeParams(const string &name) +SimObject::makeParams(const std::string &name) { SimObjectParams *params = new SimObjectParams; params->name = name; - return params; } -SimObject::SimObject(const string &_name) - : _params(makeParams(_name)) -{ -#ifdef DEBUG - doDebugBreak = false; -#endif - - simObjectList.push_back(this); - state = Running; -} - void SimObject::init() { diff --git a/src/sim/sim_object.hh b/src/sim/sim_object.hh index 2e99a85bf..b70f1d5d3 100644 --- a/src/sim/sim_object.hh +++ b/src/sim/sim_object.hh @@ -84,9 +84,14 @@ class SimObject : public Serializable, protected StartupCallback typedef SimObjectParams Params; const Params *params() const { return _params; } SimObject(const Params *_params); - SimObject(const std::string &_name); virtual ~SimObject() {} + protected: + // static: support for old-style constructors (call manually) + static Params *makeParams(const std::string &name); + + public: + virtual const std::string name() const { return params()->name; } // initialization pass of all objects. diff --git a/src/sim/system.cc b/src/sim/system.cc index 512d4bdb5..41c1b94e3 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -57,7 +57,7 @@ vector<System *> System::systemList; int System::numSystemsRunning = 0; System::System(Params *p) - : SimObject(p->name), physmem(p->physmem), numcpus(0), + : SimObject(p), physmem(p->physmem), numcpus(0), #if FULL_SYSTEM init_param(p->init_param), functionalPort(p->name + "-fport"), diff --git a/src/sim/tlb.hh b/src/sim/tlb.hh index 4239b4cf3..b5e341185 100644 --- a/src/sim/tlb.hh +++ b/src/sim/tlb.hh @@ -42,7 +42,7 @@ class Packet; class GenericTLB : public SimObject { protected: - GenericTLB(const std::string &name) : SimObject(name) + GenericTLB(const Params *p) : SimObject(p) {} public: |