diff --git a/src/arch/arm/freebsd/system.cc b/src/arch/arm/freebsd/system.cc index 3f38f2e0d0..b77126790b 100644 --- a/src/arch/arm/freebsd/system.cc +++ b/src/arch/arm/freebsd/system.cc @@ -147,8 +147,3 @@ FreebsdArmSystemParams::create() { return new FreebsdArmSystem(this); } - -void -FreebsdArmSystem::startup() -{ -} diff --git a/src/arch/arm/freebsd/system.hh b/src/arch/arm/freebsd/system.hh index 50c405d15c..f4f19a3262 100644 --- a/src/arch/arm/freebsd/system.hh +++ b/src/arch/arm/freebsd/system.hh @@ -74,8 +74,6 @@ class FreebsdArmSystem : public GenericArmSystem void initState(); - void startup(); - /** This function creates a new task Id for the given pid. * @param tc thread context that is currentyl executing */ void mapPid(ThreadContext* tc, uint32_t pid); diff --git a/src/arch/arm/linux/system.cc b/src/arch/arm/linux/system.cc index 1c1ade65ff..30393c43ac 100644 --- a/src/arch/arm/linux/system.cc +++ b/src/arch/arm/linux/system.cc @@ -223,6 +223,8 @@ LinuxArmSystemParams::create() void LinuxArmSystem::startup() { + GenericArmSystem::startup(); + if (enableContextSwitchStatsDump) { if (!highestELIs64()) { dumpStatsPCEvent = diff --git a/src/sim/system.cc b/src/sim/system.cc index 39b9495aaa..51e9d6dfbf 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -228,6 +228,31 @@ System::init() panic("System port on %s is not connected.\n", name()); } +void +System::startup() +{ + SimObject::startup(); + + // Now that we're about to start simulation, wait for GDB connections if + // requested. +#if THE_ISA != NULL_ISA + for (auto *tc: threadContexts) { + auto *cpu = tc->getCpuPtr(); + auto id = tc->contextId(); + if (remoteGDB.size() <= id) + continue; + auto *rgdb = remoteGDB[id]; + + if (cpu->waitForRemoteGDB()) { + inform("%s: Waiting for a remote GDB connection on port %d.\n", + cpu->name(), rgdb->port()); + + rgdb->connect(); + } + } +#endif +} + Port & System::getPort(const std::string &if_name, PortID idx) { @@ -276,16 +301,8 @@ System::registerThreadContext(ThreadContext *tc, ContextID assigned) RemoteGDB *rgdb = new RemoteGDB(this, tc, port + id); rgdb->listen(); - BaseCPU *cpu = tc->getCpuPtr(); - if (cpu->waitForRemoteGDB()) { - inform("%s: Waiting for a remote GDB connection on port %d.\n", - cpu->name(), rgdb->port()); - - rgdb->connect(); - } - if (remoteGDB.size() <= id) { + if (remoteGDB.size() <= id) remoteGDB.resize(id + 1); - } remoteGDB[id] = rgdb; } diff --git a/src/sim/system.hh b/src/sim/system.hh index 3e908e01ba..ae96be1a02 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -99,11 +99,8 @@ class System : public SimObject, public PCEventScope public: - /** - * After all objects have been created and all ports are - * connected, check that the system port is connected. - */ void init() override; + void startup() override; /** * Get a reference to the system port that can be used by