Gabe Black has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/69166?usp=email )
Change subject: arch,base,dev,sim: Convert objects to use the HostSocket
param type.
......................................................................
arch,base,dev,sim: Convert objects to use the HostSocket param type.
This will make it possible to connect any of these objects with a
named socket, in addition to the usual port numbers.
Change-Id: Id441c3628f62d60608a07c5cb697786e33199981
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69166
Reviewed-by: Jui-min Lee <f...@google.com>
Tested-by: kokoro <noreply+kok...@google.com>
Maintainer: Gabe Black <gabebl...@google.com>
Reviewed-by: Yu-hsin Wang <yuhsi...@google.com>
---
M src/arch/arm/fastmodel/remote_gdb.cc
M src/arch/arm/fastmodel/remote_gdb.hh
M src/arch/arm/remote_gdb.cc
M src/arch/arm/remote_gdb.hh
M src/arch/mips/remote_gdb.cc
M src/arch/mips/remote_gdb.hh
M src/arch/power/remote_gdb.cc
M src/arch/power/remote_gdb.hh
M src/arch/riscv/remote_gdb.cc
M src/arch/riscv/remote_gdb.hh
M src/arch/sparc/remote_gdb.cc
M src/arch/sparc/remote_gdb.hh
M src/arch/x86/remote_gdb.cc
M src/arch/x86/remote_gdb.hh
M src/base/remote_gdb.cc
M src/base/remote_gdb.hh
M src/base/vnc/Vnc.py
M src/base/vnc/vncserver.cc
M src/dev/net/Ethernet.py
M src/dev/net/ethertap.cc
M src/dev/serial/Terminal.py
M src/dev/serial/terminal.cc
M src/sim/Workload.py
23 files changed, 44 insertions(+), 38 deletions(-)
Approvals:
Jui-min Lee: Looks good to me, but someone else must approve
kokoro: Regressions pass
Yu-hsin Wang: Looks good to me, approved
Gabe Black: Looks good to me, approved
diff --git a/src/arch/arm/fastmodel/remote_gdb.cc
b/src/arch/arm/fastmodel/remote_gdb.cc
index d8dddad..555439e 100644
--- a/src/arch/arm/fastmodel/remote_gdb.cc
+++ b/src/arch/arm/fastmodel/remote_gdb.cc
@@ -61,8 +61,9 @@
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 75dc658..15b4e67 100644
--- a/src/arch/arm/fastmodel/remote_gdb.hh
+++ b/src/arch/arm/fastmodel/remote_gdb.hh
@@ -39,7 +39,7 @@
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 c357f02..7dd3c3d 100644
--- a/src/arch/arm/remote_gdb.cc
+++ b/src/arch/arm/remote_gdb.cc
@@ -201,8 +201,9 @@
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 aeb2db6..f6ec3db 100644
--- a/src/arch/arm/remote_gdb.hh
+++ b/src/arch/arm/remote_gdb.hh
@@ -118,7 +118,7 @@
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<std::string>
diff --git a/src/arch/mips/remote_gdb.cc b/src/arch/mips/remote_gdb.cc
index fcf31e1..f14305a 100644
--- a/src/arch/mips/remote_gdb.cc
+++ b/src/arch/mips/remote_gdb.cc
@@ -151,8 +151,8 @@
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 6a38956..6fd193a 100644
--- a/src/arch/mips/remote_gdb.hh
+++ b/src/arch/mips/remote_gdb.hh
@@ -80,7 +80,7 @@
MipsGdbRegCache regCache;
public:
- RemoteGDB(System *_system, int _port);
+ RemoteGDB(System *_system, ListenSocketConfig _listen_config);
BaseGdbRegCache *gdbRegs();
std::vector<std::string>
availableFeatures() const
diff --git a/src/arch/power/remote_gdb.cc b/src/arch/power/remote_gdb.cc
index c69c571..14b9df4 100644
--- a/src/arch/power/remote_gdb.cc
+++ b/src/arch/power/remote_gdb.cc
@@ -155,8 +155,9 @@
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 138913e..fedb91d 100644
--- a/src/arch/power/remote_gdb.hh
+++ b/src/arch/power/remote_gdb.hh
@@ -112,7 +112,7 @@
Power64GdbRegCache regCache64;
public:
- RemoteGDB(System *_system, int _port);
+ RemoteGDB(System *_system, ListenSocketConfig _listen_config);
BaseGdbRegCache *gdbRegs();
std::vector<std::string>
diff --git a/src/arch/riscv/remote_gdb.cc b/src/arch/riscv/remote_gdb.cc
index 54ecde0..48ce1d5 100644
--- a/src/arch/riscv/remote_gdb.cc
+++ b/src/arch/riscv/remote_gdb.cc
@@ -190,8 +190,9 @@
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 8f8abb0..b2f90c3 100644
--- a/src/arch/riscv/remote_gdb.hh
+++ b/src/arch/riscv/remote_gdb.hh
@@ -232,7 +232,7 @@
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 481332d..1b348aa 100644
--- a/src/arch/sparc/remote_gdb.cc
+++ b/src/arch/sparc/remote_gdb.cc
@@ -148,8 +148,9 @@
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 7129ecd..851699e 100644
--- a/src/arch/sparc/remote_gdb.hh
+++ b/src/arch/sparc/remote_gdb.hh
@@ -108,7 +108,7 @@
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 244f80da..20eb4e8 100644
--- a/src/arch/x86/remote_gdb.cc
+++ b/src/arch/x86/remote_gdb.cc
@@ -66,8 +66,9 @@
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 dfa9177..a5d47c2 100644
--- a/src/arch/x86/remote_gdb.hh
+++ b/src/arch/x86/remote_gdb.hh
@@ -146,7 +146,7 @@
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 095b2bd..abac343 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -390,12 +390,13 @@
}
-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 9f09582..02802e7 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -153,7 +153,7 @@
/**
* 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 @@
template <class GDBStub, class ...Args>
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 c0d6212..e7012ec 100644
--- a/src/base/vnc/Vnc.py
+++ b/src/base/vnc/Vnc.py
@@ -50,5 +50,5 @@
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 4e5c951..f342419 100644
--- a/src/base/vnc/vncserver.cc
+++ b/src/base/vnc/vncserver.cc
@@ -117,7 +117,7 @@
*/
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 608f25b..72f2061 100644
--- a/src/dev/net/Ethernet.py
+++ b/src/dev/net/Ethernet.py
@@ -147,7 +147,7 @@
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 7c7a8dc..c66723b 100644
--- a/src/dev/net/ethertap.cc
+++ b/src/dev/net/ethertap.cc
@@ -249,8 +249,8 @@
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 @@
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 c774379..a08a18f 100644
--- a/src/dev/serial/Terminal.py
+++ b/src/dev/serial/Terminal.py
@@ -51,7 +51,7 @@
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 6e8e435..db4906a 100644
--- a/src/dev/serial/terminal.cc
+++ b/src/dev/serial/terminal.cc
@@ -121,8 +121,7 @@
*/
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 f5139e1..31ea738 100644
--- a/src/sim/Workload.py
+++ b/src/sim/Workload.py
@@ -36,8 +36,8 @@
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
--
To view, visit
https://gem5-review.googlesource.com/c/public/gem5/+/69166?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id441c3628f62d60608a07c5cb697786e33199981
Gerrit-Change-Number: 69166
Gerrit-PatchSet: 7
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Jui-min Lee <f...@google.com>
Gerrit-Reviewer: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org