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 <fcrh@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
This commit is contained in:
Gabe Black
2023-03-18 20:27:55 -07:00
committed by Gabe Black
parent 2a44f3bfc7
commit 716c154b51
23 changed files with 44 additions and 38 deletions

View File

@@ -61,8 +61,9 @@ FastmodelRemoteGDB::AArch64GdbRegCache::setRegs(ThreadContext *context) const
context->setMiscRegNoEffect(MISCREG_FPCR, r.fpcr); context->setMiscRegNoEffect(MISCREG_FPCR, r.fpcr);
} }
FastmodelRemoteGDB::FastmodelRemoteGDB(System *_system, int port) FastmodelRemoteGDB::FastmodelRemoteGDB(System *_system,
: gem5::ArmISA::RemoteGDB(_system, port), regCache64(this) ListenSocketConfig _listen_config)
: gem5::ArmISA::RemoteGDB(_system, _listen_config)
{ {
} }

View File

@@ -39,7 +39,7 @@ namespace fastmodel
class FastmodelRemoteGDB : public ArmISA::RemoteGDB class FastmodelRemoteGDB : public ArmISA::RemoteGDB
{ {
public: public:
FastmodelRemoteGDB(System *_system, int port); FastmodelRemoteGDB(System *_system, ListenSocketConfig _listen_config);
protected: protected:
class AArch64GdbRegCache : public ArmISA::RemoteGDB::AArch64GdbRegCache class AArch64GdbRegCache : public ArmISA::RemoteGDB::AArch64GdbRegCache

View File

@@ -201,8 +201,9 @@ tryTranslate(ThreadContext *tc, Addr addr)
mmu->translateFunctional(req, tc, BaseMMU::Execute) == NoFault; mmu->translateFunctional(req, tc, BaseMMU::Execute) == NoFault;
} }
RemoteGDB::RemoteGDB(System *_system, int _port) RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config)
: BaseRemoteGDB(_system, _port), regCache32(this), regCache64(this) : BaseRemoteGDB(_system, _listen_config),
regCache32(this), regCache64(this)
{ {
} }

View File

@@ -118,7 +118,7 @@ class RemoteGDB : public BaseRemoteGDB
AArch64GdbRegCache regCache64; AArch64GdbRegCache regCache64;
public: public:
RemoteGDB(System *_system, int _port); RemoteGDB(System *_system, ListenSocketConfig _listen_config);
BaseGdbRegCache *gdbRegs() override; BaseGdbRegCache *gdbRegs() override;
bool checkBpKind(size_t kind) override; bool checkBpKind(size_t kind) override;
std::vector<std::string> std::vector<std::string>

View File

@@ -151,8 +151,8 @@ namespace gem5
using namespace MipsISA; using namespace MipsISA;
RemoteGDB::RemoteGDB(System *_system, int _port) RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config)
: BaseRemoteGDB(_system, _port), regCache(this) : BaseRemoteGDB(_system, _listen_config), regCache(this)
{ {
} }

View File

@@ -80,7 +80,7 @@ class RemoteGDB : public BaseRemoteGDB
MipsGdbRegCache regCache; MipsGdbRegCache regCache;
public: public:
RemoteGDB(System *_system, int _port); RemoteGDB(System *_system, ListenSocketConfig _listen_config);
BaseGdbRegCache *gdbRegs(); BaseGdbRegCache *gdbRegs();
std::vector<std::string> std::vector<std::string>
availableFeatures() const availableFeatures() const

View File

@@ -155,8 +155,9 @@ namespace gem5
using namespace PowerISA; using namespace PowerISA;
RemoteGDB::RemoteGDB(System *_system, int _port) RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config)
: BaseRemoteGDB(_system, _port), regCache32(this), regCache64(this) : BaseRemoteGDB(_system, _listen_config),
regCache32(this), regCache64(this)
{ {
} }

View File

@@ -112,7 +112,7 @@ class RemoteGDB : public BaseRemoteGDB
Power64GdbRegCache regCache64; Power64GdbRegCache regCache64;
public: public:
RemoteGDB(System *_system, int _port); RemoteGDB(System *_system, ListenSocketConfig _listen_config);
BaseGdbRegCache *gdbRegs(); BaseGdbRegCache *gdbRegs();
std::vector<std::string> std::vector<std::string>

View File

@@ -190,8 +190,9 @@ setRegWithMask(ThreadContext *context, RiscvType type, CSRIndex idx, xint val)
context->setMiscReg(CSRData.at(idx).physIndex, newVal); context->setMiscReg(CSRData.at(idx).physIndex, newVal);
} }
RemoteGDB::RemoteGDB(System *_system, int _port) RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config)
: BaseRemoteGDB(_system, _port), regCache32(this), regCache64(this) : BaseRemoteGDB(_system, _listen_config),
regCache32(this), regCache64(this)
{ {
} }

View File

@@ -232,7 +232,7 @@ class RemoteGDB : public BaseRemoteGDB
Riscv64GdbRegCache regCache64; Riscv64GdbRegCache regCache64;
public: public:
RemoteGDB(System *_system, int _port); RemoteGDB(System *_system, ListenSocketConfig _listen_config);
BaseGdbRegCache *gdbRegs() override; BaseGdbRegCache *gdbRegs() override;
/** /**
* Informs GDB remote serial protocol that XML features are supported * Informs GDB remote serial protocol that XML features are supported

View File

@@ -148,8 +148,9 @@ namespace gem5
using namespace SparcISA; using namespace SparcISA;
RemoteGDB::RemoteGDB(System *_system, int _port) RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config)
: BaseRemoteGDB(_system, _port), regCache32(this), regCache64(this) : BaseRemoteGDB(_system, _listen_config),
regCache32(this), regCache64(this)
{} {}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////

View File

@@ -108,7 +108,7 @@ class RemoteGDB : public BaseRemoteGDB
SPARC64GdbRegCache regCache64; SPARC64GdbRegCache regCache64;
public: public:
RemoteGDB(System *_system, int _port); RemoteGDB(System *_system, ListenSocketConfig _listen_config);
BaseGdbRegCache *gdbRegs(); BaseGdbRegCache *gdbRegs();
}; };
} // namespace SparcISA } // namespace SparcISA

View File

@@ -66,8 +66,9 @@ namespace gem5
using namespace X86ISA; using namespace X86ISA;
RemoteGDB::RemoteGDB(System *_system, int _port) : RemoteGDB::RemoteGDB(System *_system, ListenSocketConfig _listen_config) :
BaseRemoteGDB(_system, _port), regCache32(this), regCache64(this) BaseRemoteGDB(_system, _listen_config),
regCache32(this), regCache64(this)
{} {}
bool bool

View File

@@ -146,7 +146,7 @@ class RemoteGDB : public BaseRemoteGDB
AMD64GdbRegCache regCache64; AMD64GdbRegCache regCache64;
public: public:
RemoteGDB(System *system, int _port); RemoteGDB(System *system, ListenSocketConfig _listen_config);
BaseGdbRegCache *gdbRegs(); BaseGdbRegCache *gdbRegs();
}; };

View File

@@ -390,12 +390,13 @@ std::map<Addr, HardBreakpoint *> hardBreakMap;
} }
BaseRemoteGDB::BaseRemoteGDB(System *_system, int _port) : BaseRemoteGDB::BaseRemoteGDB(System *_system,
ListenSocketConfig _listen_config) :
incomingConnectionEvent(nullptr), incomingDataEvent(nullptr), incomingConnectionEvent(nullptr), incomingDataEvent(nullptr),
fd(-1), sys(_system), connectEvent(*this), disconnectEvent(*this), fd(-1), sys(_system), connectEvent(*this), disconnectEvent(*this),
trapEvent(this), singleStepEvent(*this) trapEvent(this), singleStepEvent(*this)
{ {
listener = listenSocketInetConfig(_port).build(name()); listener = _listen_config.build(name());
} }
BaseRemoteGDB::~BaseRemoteGDB() BaseRemoteGDB::~BaseRemoteGDB()

View File

@@ -153,7 +153,7 @@ class BaseRemoteGDB
/** /**
* Interface to other parts of the simulator. * Interface to other parts of the simulator.
*/ */
BaseRemoteGDB(System *system, int _port); BaseRemoteGDB(System *system, ListenSocketConfig _listen_config);
virtual ~BaseRemoteGDB(); virtual ~BaseRemoteGDB();
std::string name(); std::string name();
@@ -180,10 +180,10 @@ class BaseRemoteGDB
template <class GDBStub, class ...Args> template <class GDBStub, class ...Args>
static BaseRemoteGDB * static BaseRemoteGDB *
build(int port, Args... args) build(ListenSocketConfig listen_config, Args... args)
{ {
if (port) if (listen_config)
return new GDBStub(args..., port); return new GDBStub(args..., listen_config);
else else
return nullptr; return nullptr;
} }

View File

@@ -50,5 +50,5 @@ class VncServer(VncInput):
type = "VncServer" type = "VncServer"
cxx_header = "base/vnc/vncserver.hh" cxx_header = "base/vnc/vncserver.hh"
cxx_class = "gem5::VncServer" cxx_class = "gem5::VncServer"
port = Param.TcpPort(5900, "listen port") port = Param.HostSocket(5900, "listen port/socket")
number = Param.Int(0, "vnc client number") number = Param.Int(0, "vnc client number")

View File

@@ -117,7 +117,7 @@ VncServer::DataEvent::process(int revent)
*/ */
VncServer::VncServer(const Params &p) VncServer::VncServer(const Params &p)
: VncInput(p), listenEvent(NULL), dataEvent(NULL), number(p.number), : 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) sendUpdate(false), supportsRawEnc(false), supportsResizeEnc(false)
{ {
if (p.port) if (p.port)

View File

@@ -147,7 +147,7 @@ class EtherTapStub(EtherTapBase):
cxx_header = "dev/net/ethertap.hh" cxx_header = "dev/net/ethertap.hh"
cxx_class = "gem5::EtherTapStub" 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): class EtherDump(SimObject):

View File

@@ -249,8 +249,8 @@ class TapListener
EtherTapStub *tap; EtherTapStub *tap;
public: public:
TapListener(EtherTapStub *t, int p) : TapListener(EtherTapStub *t, ListenSocketPtr _listener) :
listener(listenSocketInetConfig(p).build(t->name())), tap(t) {} listener(std::move(_listener)), tap(t) {}
~TapListener() { delete event; } ~TapListener() { delete event; }
void listen(); void listen();
@@ -287,7 +287,7 @@ EtherTapStub::EtherTapStub(const Params &p) : EtherTapBase(p), socket(-1)
if (ListenSocket::allDisabled()) if (ListenSocket::allDisabled())
fatal("All listeners are disabled! EtherTapStub can't work!"); 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(); listener->listen();
} }

View File

@@ -51,7 +51,7 @@ class Terminal(SerialDevice):
type = "Terminal" type = "Terminal"
cxx_header = "dev/serial/terminal.hh" cxx_header = "dev/serial/terminal.hh"
cxx_class = "gem5::Terminal" cxx_class = "gem5::Terminal"
port = Param.TcpPort(3456, "listen port") port = Param.HostSocket(3456, "listen port/socket")
number = Param.Int(0, "terminal number") number = Param.Int(0, "terminal number")
outfile = Param.TerminalDump( outfile = Param.TerminalDump(
"file", "Selects if and where the terminal is dumping its output" "file", "Selects if and where the terminal is dumping its output"

View File

@@ -121,8 +121,7 @@ Terminal::DataEvent::process(int revent)
*/ */
Terminal::Terminal(const Params &p) Terminal::Terminal(const Params &p)
: SerialDevice(p), listenEvent(NULL), dataEvent(NULL), : SerialDevice(p), listenEvent(NULL), dataEvent(NULL),
number(p.number), data_fd(-1), number(p.number), data_fd(-1), listener(p.port.build(p.name)),
listener(listenSocketInetConfig(p.port).build(p.name)),
txbuf(16384), rxbuf(16384), outfile(terminalDump(p)) txbuf(16384), rxbuf(16384), outfile(terminalDump(p))
#if TRACING_ON == 1 #if TRACING_ON == 1
, linebuf(16384) , linebuf(16384)

View File

@@ -36,8 +36,8 @@ class Workload(SimObject):
abstract = True abstract = True
wait_for_remote_gdb = Param.Bool(False, "Wait for a remote GDB connection") wait_for_remote_gdb = Param.Bool(False, "Wait for a remote GDB connection")
remote_gdb_port = Param.Int( remote_gdb_port = Param.HostSocket(
7000, "Default port number used for remote GDB connection" 7000, "Default port/socket used for remote GDB connection"
) )
@cxxMethod @cxxMethod