sim,systemc: Use slightly non-standard constructors for custom create()
Rather than rely on the default create() method being a weak symbol, we
can just not have a compliant constructor signature which means we need
to (and therefore can) define our own custom create().
Change-Id: I6009d72db0c103b5724d1ba7e20c0bd4a2b761e5
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42588
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Earl Ou <shunhsingou@google.com>
diff --git a/src/sim/root.cc b/src/sim/root.cc
index 57212b2..35afe70 100644
--- a/src/sim/root.cc
+++ b/src/sim/root.cc
@@ -166,7 +166,7 @@
timeSyncEnable(en);
}
-Root::Root(const RootParams &p)
+Root::Root(const RootParams &p, int)
: SimObject(p), _enabled(false), _periodTick(p.time_sync_period),
syncEvent([this]{ timeSync(); }, name())
{
@@ -216,5 +216,5 @@
FullSystem = full_system;
FullSystemInt = full_system ? 1 : 0;
- return new Root(*this);
+ return new Root(*this, 0);
}
diff --git a/src/sim/root.hh b/src/sim/root.hh
index e2c58fd..fd3b97d 100644
--- a/src/sim/root.hh
+++ b/src/sim/root.hh
@@ -134,7 +134,9 @@
PARAMS(Root);
- Root(const Params &p);
+ // The int parameter is ignored, it's just so we can define a custom
+ // create() method.
+ Root(const Params &p, int);
/** Schedule the timesync event at startup().
*/
diff --git a/src/systemc/core/kernel.cc b/src/systemc/core/kernel.cc
index 75e5bc9..3bb27f2 100644
--- a/src/systemc/core/kernel.cc
+++ b/src/systemc/core/kernel.cc
@@ -54,7 +54,7 @@
sc_core::sc_status Kernel::status() { return _status; }
void Kernel::status(sc_core::sc_status s) { _status = s; }
-Kernel::Kernel(const Params ¶ms) :
+Kernel::Kernel(const Params ¶ms, int) :
SimObject(params), t0Event(this, false, EventBase::Default_Pri - 1)
{
// Install ourselves as the scheduler's event manager.
@@ -187,6 +187,6 @@
{
panic_if(sc_gem5::kernel,
"Only one systemc kernel object may be defined.\n");
- sc_gem5::kernel = new sc_gem5::Kernel(*this);
+ sc_gem5::kernel = new sc_gem5::Kernel(*this, 0);
return sc_gem5::kernel;
}
diff --git a/src/systemc/core/kernel.hh b/src/systemc/core/kernel.hh
index c58e0f1..9bea0db 100644
--- a/src/systemc/core/kernel.hh
+++ b/src/systemc/core/kernel.hh
@@ -46,7 +46,7 @@
{
public:
typedef SystemC_KernelParams Params;
- Kernel(const Params ¶ms);
+ Kernel(const Params ¶ms, int);
void init() override;
void regStats() override;