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:
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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<std::string>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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<std::string>
|
||||
availableFeatures() const
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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<std::string>
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -146,7 +146,7 @@ class RemoteGDB : public BaseRemoteGDB
|
||||
AMD64GdbRegCache regCache64;
|
||||
|
||||
public:
|
||||
RemoteGDB(System *system, int _port);
|
||||
RemoteGDB(System *system, ListenSocketConfig _listen_config);
|
||||
BaseGdbRegCache *gdbRegs();
|
||||
};
|
||||
|
||||
|
||||
@@ -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),
|
||||
fd(-1), sys(_system), connectEvent(*this), disconnectEvent(*this),
|
||||
trapEvent(this), singleStepEvent(*this)
|
||||
{
|
||||
listener = listenSocketInetConfig(_port).build(name());
|
||||
listener = _listen_config.build(name());
|
||||
}
|
||||
|
||||
BaseRemoteGDB::~BaseRemoteGDB()
|
||||
|
||||
@@ -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 <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;
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user