diff --git a/src/arch/arm/fastmodel/remote_gdb.cc b/src/arch/arm/fastmodel/remote_gdb.cc index d8dddaddf9..555439ed75 100644 --- a/src/arch/arm/fastmodel/remote_gdb.cc +++ b/src/arch/arm/fastmodel/remote_gdb.cc @@ -61,8 +61,9 @@ FastmodelRemoteGDB::AArch64GdbRegCache::setRegs(ThreadContext *context) const context->setMiscRegNoEffect(MISCREG_FPCR, r.fpcr); } -FastmodelRemoteGDB::FastmodelRemoteGDB(System *_system, int port) - : gem5::ArmISA::RemoteGDB(_system, port), regCache64(this) +FastmodelRemoteGDB::FastmodelRemoteGDB(System *_system, + ListenSocketConfig _listen_config) + : gem5::ArmISA::RemoteGDB(_system, _listen_config) { } diff --git a/src/arch/arm/fastmodel/remote_gdb.hh b/src/arch/arm/fastmodel/remote_gdb.hh index 75dc6580e3..15b4e672a0 100644 --- a/src/arch/arm/fastmodel/remote_gdb.hh +++ b/src/arch/arm/fastmodel/remote_gdb.hh @@ -39,7 +39,7 @@ namespace fastmodel class FastmodelRemoteGDB : public ArmISA::RemoteGDB { public: - FastmodelRemoteGDB(System *_system, int port); + FastmodelRemoteGDB(System *_system, ListenSocketConfig _listen_config); protected: class AArch64GdbRegCache : public ArmISA::RemoteGDB::AArch64GdbRegCache diff --git a/src/arch/arm/remote_gdb.cc b/src/arch/arm/remote_gdb.cc index c357f02e08..7dd3c3d7bc 100644 --- a/src/arch/arm/remote_gdb.cc +++ b/src/arch/arm/remote_gdb.cc @@ -201,8 +201,9 @@ tryTranslate(ThreadContext *tc, Addr addr) mmu->translateFunctional(req, tc, BaseMMU::Execute) == NoFault; } -RemoteGDB::RemoteGDB(System *_system, int _port) - : BaseRemoteGDB(_system, _port), regCache32(this), regCache64(this) +RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config) + : BaseRemoteGDB(_system, _listen_config), + regCache32(this), regCache64(this) { } diff --git a/src/arch/arm/remote_gdb.hh b/src/arch/arm/remote_gdb.hh index aeb2db6754..f6ec3db2ad 100644 --- a/src/arch/arm/remote_gdb.hh +++ b/src/arch/arm/remote_gdb.hh @@ -118,7 +118,7 @@ class RemoteGDB : public BaseRemoteGDB AArch64GdbRegCache regCache64; public: - RemoteGDB(System *_system, int _port); + RemoteGDB(System *_system, ListenSocketConfig _listen_config); BaseGdbRegCache *gdbRegs() override; bool checkBpKind(size_t kind) override; std::vector diff --git a/src/arch/mips/remote_gdb.cc b/src/arch/mips/remote_gdb.cc index fcf31e109d..f14305a317 100644 --- a/src/arch/mips/remote_gdb.cc +++ b/src/arch/mips/remote_gdb.cc @@ -151,8 +151,8 @@ namespace gem5 using namespace MipsISA; -RemoteGDB::RemoteGDB(System *_system, int _port) - : BaseRemoteGDB(_system, _port), regCache(this) +RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config) + : BaseRemoteGDB(_system, _listen_config), regCache(this) { } diff --git a/src/arch/mips/remote_gdb.hh b/src/arch/mips/remote_gdb.hh index 6a38956339..6fd193a0b8 100644 --- a/src/arch/mips/remote_gdb.hh +++ b/src/arch/mips/remote_gdb.hh @@ -80,7 +80,7 @@ class RemoteGDB : public BaseRemoteGDB MipsGdbRegCache regCache; public: - RemoteGDB(System *_system, int _port); + RemoteGDB(System *_system, ListenSocketConfig _listen_config); BaseGdbRegCache *gdbRegs(); std::vector availableFeatures() const diff --git a/src/arch/power/remote_gdb.cc b/src/arch/power/remote_gdb.cc index c69c571979..14b9df47d4 100644 --- a/src/arch/power/remote_gdb.cc +++ b/src/arch/power/remote_gdb.cc @@ -155,8 +155,9 @@ namespace gem5 using namespace PowerISA; -RemoteGDB::RemoteGDB(System *_system, int _port) - : BaseRemoteGDB(_system, _port), regCache32(this), regCache64(this) +RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config) + : BaseRemoteGDB(_system, _listen_config), + regCache32(this), regCache64(this) { } diff --git a/src/arch/power/remote_gdb.hh b/src/arch/power/remote_gdb.hh index 138913e6b8..fedb91d4a9 100644 --- a/src/arch/power/remote_gdb.hh +++ b/src/arch/power/remote_gdb.hh @@ -112,7 +112,7 @@ class RemoteGDB : public BaseRemoteGDB Power64GdbRegCache regCache64; public: - RemoteGDB(System *_system, int _port); + RemoteGDB(System *_system, ListenSocketConfig _listen_config); BaseGdbRegCache *gdbRegs(); std::vector diff --git a/src/arch/riscv/remote_gdb.cc b/src/arch/riscv/remote_gdb.cc index 54ecde061f..48ce1d5d3b 100644 --- a/src/arch/riscv/remote_gdb.cc +++ b/src/arch/riscv/remote_gdb.cc @@ -190,8 +190,9 @@ setRegWithMask(ThreadContext *context, RiscvType type, CSRIndex idx, xint val) context->setMiscReg(CSRData.at(idx).physIndex, newVal); } -RemoteGDB::RemoteGDB(System *_system, int _port) - : BaseRemoteGDB(_system, _port), regCache32(this), regCache64(this) +RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config) + : BaseRemoteGDB(_system, _listen_config), + regCache32(this), regCache64(this) { } diff --git a/src/arch/riscv/remote_gdb.hh b/src/arch/riscv/remote_gdb.hh index 8f8abb0587..b2f90c32be 100644 --- a/src/arch/riscv/remote_gdb.hh +++ b/src/arch/riscv/remote_gdb.hh @@ -232,7 +232,7 @@ class RemoteGDB : public BaseRemoteGDB Riscv64GdbRegCache regCache64; public: - RemoteGDB(System *_system, int _port); + RemoteGDB(System *_system, ListenSocketConfig _listen_config); BaseGdbRegCache *gdbRegs() override; /** * Informs GDB remote serial protocol that XML features are supported diff --git a/src/arch/sparc/remote_gdb.cc b/src/arch/sparc/remote_gdb.cc index 481332d311..1b348aacab 100644 --- a/src/arch/sparc/remote_gdb.cc +++ b/src/arch/sparc/remote_gdb.cc @@ -148,8 +148,9 @@ namespace gem5 using namespace SparcISA; -RemoteGDB::RemoteGDB(System *_system, int _port) - : BaseRemoteGDB(_system, _port), regCache32(this), regCache64(this) +RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config) + : BaseRemoteGDB(_system, _listen_config), + regCache32(this), regCache64(this) {} /////////////////////////////////////////////////////////// diff --git a/src/arch/sparc/remote_gdb.hh b/src/arch/sparc/remote_gdb.hh index 7129ecd966..851699e294 100644 --- a/src/arch/sparc/remote_gdb.hh +++ b/src/arch/sparc/remote_gdb.hh @@ -108,7 +108,7 @@ class RemoteGDB : public BaseRemoteGDB SPARC64GdbRegCache regCache64; public: - RemoteGDB(System *_system, int _port); + RemoteGDB(System *_system, ListenSocketConfig _listen_config); BaseGdbRegCache *gdbRegs(); }; } // namespace SparcISA diff --git a/src/arch/x86/remote_gdb.cc b/src/arch/x86/remote_gdb.cc index 244f80dad9..20eb4e89f4 100644 --- a/src/arch/x86/remote_gdb.cc +++ b/src/arch/x86/remote_gdb.cc @@ -66,8 +66,9 @@ namespace gem5 using namespace X86ISA; -RemoteGDB::RemoteGDB(System *_system, int _port) : - BaseRemoteGDB(_system, _port), regCache32(this), regCache64(this) +RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config) : + BaseRemoteGDB(_system, _listen_config), + regCache32(this), regCache64(this) {} bool diff --git a/src/arch/x86/remote_gdb.hh b/src/arch/x86/remote_gdb.hh index dfa9177f1e..a5d47c2865 100644 --- a/src/arch/x86/remote_gdb.hh +++ b/src/arch/x86/remote_gdb.hh @@ -146,7 +146,7 @@ class RemoteGDB : public BaseRemoteGDB AMD64GdbRegCache regCache64; public: - RemoteGDB(System *system, int _port); + RemoteGDB(System *system, ListenSocketConfig _listen_config); BaseGdbRegCache *gdbRegs(); }; diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc index 095b2bd38c..abac3437ea 100644 --- a/src/base/remote_gdb.cc +++ b/src/base/remote_gdb.cc @@ -390,12 +390,13 @@ std::map hardBreakMap; } -BaseRemoteGDB::BaseRemoteGDB(System *_system, int _port) : +BaseRemoteGDB::BaseRemoteGDB(System *_system, + ListenSocketConfig _listen_config) : incomingConnectionEvent(nullptr), incomingDataEvent(nullptr), fd(-1), sys(_system), connectEvent(*this), disconnectEvent(*this), trapEvent(this), singleStepEvent(*this) { - listener = listenSocketInetConfig(_port).build(name()); + listener = _listen_config.build(name()); } BaseRemoteGDB::~BaseRemoteGDB() diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh index 9f09582721..02802e7a85 100644 --- a/src/base/remote_gdb.hh +++ b/src/base/remote_gdb.hh @@ -153,7 +153,7 @@ class BaseRemoteGDB /** * Interface to other parts of the simulator. */ - BaseRemoteGDB(System *system, int _port); + BaseRemoteGDB(System *system, ListenSocketConfig _listen_config); virtual ~BaseRemoteGDB(); std::string name(); @@ -180,10 +180,10 @@ class BaseRemoteGDB template static BaseRemoteGDB * - build(int port, Args... args) + build(ListenSocketConfig listen_config, Args... args) { - if (port) - return new GDBStub(args..., port); + if (listen_config) + return new GDBStub(args..., listen_config); else return nullptr; } diff --git a/src/base/vnc/Vnc.py b/src/base/vnc/Vnc.py index c0d621283c..e7012ecb06 100644 --- a/src/base/vnc/Vnc.py +++ b/src/base/vnc/Vnc.py @@ -50,5 +50,5 @@ class VncServer(VncInput): type = "VncServer" cxx_header = "base/vnc/vncserver.hh" cxx_class = "gem5::VncServer" - port = Param.TcpPort(5900, "listen port") + port = Param.HostSocket(5900, "listen port/socket") number = Param.Int(0, "vnc client number") diff --git a/src/base/vnc/vncserver.cc b/src/base/vnc/vncserver.cc index 4e5c951191..f34241968e 100644 --- a/src/base/vnc/vncserver.cc +++ b/src/base/vnc/vncserver.cc @@ -117,7 +117,7 @@ VncServer::DataEvent::process(int revent) */ VncServer::VncServer(const Params &p) : VncInput(p), listenEvent(NULL), dataEvent(NULL), number(p.number), - listener(listenSocketInetConfig(p.port).build(p.name)), + listener(p.port.build(p.name)), sendUpdate(false), supportsRawEnc(false), supportsResizeEnc(false) { if (p.port) diff --git a/src/dev/net/Ethernet.py b/src/dev/net/Ethernet.py index 608f25b617..72f2061b2b 100644 --- a/src/dev/net/Ethernet.py +++ b/src/dev/net/Ethernet.py @@ -147,7 +147,7 @@ class EtherTapStub(EtherTapBase): cxx_header = "dev/net/ethertap.hh" cxx_class = "gem5::EtherTapStub" - port = Param.UInt16(3500, "Port helper should send packets to") + port = Param.HostSocket(3500, "Port/socket helper should send packets to") class EtherDump(SimObject): diff --git a/src/dev/net/ethertap.cc b/src/dev/net/ethertap.cc index 7c7a8dcb11..c66723b55c 100644 --- a/src/dev/net/ethertap.cc +++ b/src/dev/net/ethertap.cc @@ -249,8 +249,8 @@ class TapListener EtherTapStub *tap; public: - TapListener(EtherTapStub *t, int p) : - listener(listenSocketInetConfig(p).build(t->name())), tap(t) {} + TapListener(EtherTapStub *t, ListenSocketPtr _listener) : + listener(std::move(_listener)), tap(t) {} ~TapListener() { delete event; } void listen(); @@ -287,7 +287,7 @@ EtherTapStub::EtherTapStub(const Params &p) : EtherTapBase(p), socket(-1) if (ListenSocket::allDisabled()) fatal("All listeners are disabled! EtherTapStub can't work!"); - listener = new TapListener(this, p.port); + listener = new TapListener(this, p.port.build(name())); listener->listen(); } diff --git a/src/dev/serial/Terminal.py b/src/dev/serial/Terminal.py index c77437906c..a08a18fe1e 100644 --- a/src/dev/serial/Terminal.py +++ b/src/dev/serial/Terminal.py @@ -51,7 +51,7 @@ class Terminal(SerialDevice): type = "Terminal" cxx_header = "dev/serial/terminal.hh" cxx_class = "gem5::Terminal" - port = Param.TcpPort(3456, "listen port") + port = Param.HostSocket(3456, "listen port/socket") number = Param.Int(0, "terminal number") outfile = Param.TerminalDump( "file", "Selects if and where the terminal is dumping its output" diff --git a/src/dev/serial/terminal.cc b/src/dev/serial/terminal.cc index 6e8e435b07..db4906a973 100644 --- a/src/dev/serial/terminal.cc +++ b/src/dev/serial/terminal.cc @@ -121,8 +121,7 @@ Terminal::DataEvent::process(int revent) */ Terminal::Terminal(const Params &p) : SerialDevice(p), listenEvent(NULL), dataEvent(NULL), - number(p.number), data_fd(-1), - listener(listenSocketInetConfig(p.port).build(p.name)), + number(p.number), data_fd(-1), listener(p.port.build(p.name)), txbuf(16384), rxbuf(16384), outfile(terminalDump(p)) #if TRACING_ON == 1 , linebuf(16384) diff --git a/src/sim/Workload.py b/src/sim/Workload.py index f5139e1dd8..31ea7382dd 100644 --- a/src/sim/Workload.py +++ b/src/sim/Workload.py @@ -36,8 +36,8 @@ class Workload(SimObject): abstract = True wait_for_remote_gdb = Param.Bool(False, "Wait for a remote GDB connection") - remote_gdb_port = Param.Int( - 7000, "Default port number used for remote GDB connection" + remote_gdb_port = Param.HostSocket( + 7000, "Default port/socket used for remote GDB connection" ) @cxxMethod