Go to the documentation of this file.
46 #include "arch/remote_gdb.hh"
47 #include "arch/utility.hh"
53 #include "config/the_isa.hh"
54 #include "config/use_kvm.hh"
59 #if THE_ISA != NULL_ISA
63 #include "debug/Loader.hh"
64 #include "debug/Quiesce.hh"
65 #include "debug/WorkItems.hh"
68 #include "params/System.hh"
79 # if THE_ISA != NULL_ISA
89 return csprintf(
"%s.threads[%d]", context->getSystemPtr()->name(),
90 context->contextId());
97 auto *
workload = context->getSystemPtr()->workload;
106 for (
id = 0;
id <
size();
id++) {
116 "Cannot have two thread contexts with the same id (%d).",
id);
126 # if THE_ISA != NULL_ISA
129 t.gdb =
new TheISA::RemoteGDB(sys, tc, port +
id);
141 panic_if(!
t.context,
"Can't replace a context which doesn't exist.");
143 t.gdb->replaceThreadContext(tc);
144 # if THE_ISA != NULL_ISA
145 if (
t.resumeEvent->scheduled()) {
146 Tick when =
t.resumeEvent->when();
147 t.context->getCpuPtr()->deschedule(
t.resumeEvent);
182 # if THE_ISA != NULL_ISA
183 M5_VAR_USED
BaseCPU *cpu =
t.context->getCpuPtr();
184 DPRINTFS(Quiesce, cpu,
"quiesce()\n");
192 # if THE_ISA != NULL_ISA
194 BaseCPU *cpu =
t.context->getCpuPtr();
196 DPRINTFS(Quiesce, cpu,
"quiesceTick until %u\n", when);
217 physmem(
name() +
".physmem",
p.memories,
p.mmap_using_noreserve,
245 warn_once(
"Cache line size is neither 16, 32, 64 nor 128 bytes.\n");
260 for (
int x = 0;
x <
params().memories.size();
x++)
261 params().memories[
x]->system(
this);
277 #if THE_ISA != NULL_ISA
280 auto *cpu =
threads[
i]->getCpuPtr();
281 if (gdb && cpu->waitForRemoteGDB()) {
282 inform(
"%s: Waiting for a remote GDB connection on port %d.",
283 cpu->name(), gdb->port());
331 all = tc->schedule(
event) && all;
341 all = tc->remove(
event) && all;
348 auto *otc =
threads[context_id];
365 if (!
dynamic_cast<BaseKvmCPU *
>(tc->getCpuPtr()))
384 warn(
"Reached m5ops MMIO region\n");
385 return_addr = 0xffffffff;
390 fatal(
"Out of memory, please increase size of physical memory.");
416 deviceMemMap.insert(std::make_pair(requestor_id, deviceMemory));
433 "No device memory found for RequestorID %d\n",
id);
444 if (
t.resumeEvent &&
t.resumeEvent->scheduled())
445 when =
t.resumeEvent->when();
464 !when || !
t.resumeEvent) {
467 # if THE_ISA != NULL_ISA
468 t.context->getCpuPtr()->schedule(
t.resumeEvent, when);
483 std::stringstream namestr;
484 ccprintf(namestr,
"work_item_type%d",
j);
487 .desc(
"Run time stat for" + namestr.str())
500 DPRINTF(WorkItems,
"Work item end: %d\t%d\t%lld\n", tid, workid, samp);
503 fatal(
"Got workid greater than specified in system configuration\n");
512 std::ios::fmtflags flags(std::cerr.flags());
516 for (;
i != end; ++
i) {
518 std::cerr <<
"System " << sys->
name() <<
": " << std::hex << sys
522 std::cerr.flags(flags);
535 return requestor_name.substr(
name().size() + 1);
537 return requestor_name;
558 "Cannot lookup RequestorID by SimObject pointer: "
559 "More than one requestor is sharing the same SimObject\n");
593 const std::string& requestor_name)
609 fatal(
"Can't request a requestorId after regStats(). "
610 "You must do so in init().\n");
624 const std::string& subrequestor)
626 if (subrequestor.empty()) {
627 return requestor->
name();
631 return requestor->
name() +
"." + subrequestor;
639 fatal(
"Invalid requestor_id passed to getRequestorName()\n");
641 const auto& requestor_info =
requestors[requestor_id];
642 return requestor_info.req_name;
#define fatal(...)
This implements a cprintf based fatal() function.
std::unordered_map< RequestorID, AbstractMemory * > deviceMemMap
virtual void regStats()
Callback to set stat parameters.
RequestorID getRequestorId(const SimObject *requestor, std::string subrequestor=std::string())
Request an id used to create a request object in the system.
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
@ intRequestorId
This requestor id is used for message signaled interrupts.
std::list< PCEvent * > liveEvents
virtual void activate()=0
Set the status to Active.
#define UNSERIALIZE_SCALAR(scalar)
void startup() override
startup() is the final initialization call before simulation.
void workItemEnd(uint32_t tid, uint32_t workid)
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
void reschedule(Event &event, Tick when, bool always=false)
@ Halting
Trying to exit and waiting for an event to completely exit.
@ invldRequestorId
Invalid requestor id for assertion checking only.
int ContextID
Globally unique thread context ID.
RequestorID _getRequestorId(const SimObject *requestor, const std::string &requestor_name)
helper function for getRequestorId
uint64_t Tick
Tick count type.
ContextID registerThreadContext(ThreadContext *tc, ContextID assigned=InvalidContextID)
std::vector< RedirectPath * > redirectPaths
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
bool contains(const Addr &a) const
Determine if the range contains an address.
const unsigned int _cacheLineSize
RequestorID getGlobalRequestorId(const std::string &requestor_name)
Registers a GLOBAL RequestorID, which is a RequestorID not related to any particular SimObject; since...
RequestorID requestorId() const
const ContextID InvalidContextID
bool validKvmEnvironment() const
Verify gem5 configuration will support KVM emulation.
void replaceThreadContext(ThreadContext *tc, ContextID context_id)
static std::vector< System * > systemList
@ wbRequestorId
This requestor id is used for writeback requests by the caches.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
void replace(ThreadContext *tc, ContextID id)
ThreadContext * findFree()
static void printSystems()
std::string stripSystemName(const std::string &requestor_name) const
Strips off the system name from a requestor name.
RequestorID lookupRequestorId(const SimObject *obj) const
Looks up the RequestorID for a given SimObject returns an invalid RequestorID (invldRequestorId) if n...
@ Drained
Buffers drained, ready for serialization/handover.
Enums::MemoryMode memoryMode
virtual void startup()
startup() is the final initialization call before simulation.
An abstract memory represents a contiguous block of physical memory, with an associated address range...
bool optParamIn(CheckpointIn &cp, const std::string &name, T ¶m, bool do_warn=true)
This function is used for restoring optional parameters from the checkpoint.
void schedule(Event &event, Tick when)
Workload * workload
OS kernel.
Base class for KVM based CPU models.
void setMemoryMode(Enums::MemoryMode mode)
Change the memory mode of the system.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
virtual bool schedule(PCEvent *event)=0
uint64_t totalSize() const
Get the total physical memory size.
@ Halted
Permanently shut down.
Ports are used to interface objects to each other.
void quiesceTick(ContextID id, Tick when)
void quiesce(ContextID id)
void setSystem(System *s)
Initialize system pointer.
AddrRange RangeSize(Addr start, Addr size)
ContextID insert(ThreadContext *tc, ContextID id=InvalidContextID)
bool schedule(PCEvent *event) override
std::string leafRequestorName(const SimObject *requestor, const std::string &subrequestor)
Helper function for constructing the full (sub)requestor name by providing the root requestor and the...
Addr memSize() const
Amount of physical memory that exists.
static int numSystemsRunning
virtual Status status() const =0
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Thread & thread(ContextID id)
#define SERIALIZE_SCALAR(scalar)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
@ funcRequestorId
This requestor id is used for functional requests that don't come from a particular device.
DrainState drainState() const
Return the current drain state of an object.
Addr freeMemSize() const
Amount of physical memory that is still free.
virtual const std::string name() const
std::map< std::pair< uint32_t, uint32_t >, Tick > lastWorkItemStarted
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Additional function to return the Port of a memory object.
std::map< uint32_t, Stats::Histogram * > workItemStats
const AddrRange _m5opRange
Range for memory-mapped m5 pseudo ops.
bool isMemAddr(Addr addr) const
Check if a physical address is within a range of a memory that is part of the global address map.
bool isDeviceMemAddr(PacketPtr pkt) const
Similar to isMemAddr but for devices.
bool startswith(const char *s, const char *prefix)
Return true if 's' starts with the prefix string 'prefix'.
void serialize(CheckpointOut &cp) const override
Serialize an object.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void ccprintf(cp::Print &print)
std::vector< RequestorInfo > requestors
This array is a per-system list of all devices capable of issuing a memory system request and an asso...
std::ostream CheckpointOut
void addDeviceMemory(RequestorID requestorId, AbstractMemory *deviceMemory)
Add a physical memory range for a device.
bool remove(PCEvent *event) override
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
Addr allocPhysPages(int npages)
Allocate npages contiguous unused physical pages.
AbstractMemory * getDeviceMemory(RequestorID _id) const
Return a pointer to the device memory.
Tick curTick()
The universal simulation clock.
const Params & params() const
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
virtual BaseCPU * getCpuPtr()=0
void regStats() override
Callback to set stat parameters.
bool isMemAddr(Addr addr) const
Check if a physical address is within a range of a memory that is part of the global address map.
std::vector< Thread > threads
std::string csprintf(const char *format, const Args &...args)
virtual System * getSystemPtr()=0
ThermalModel * thermalModel
Abstract superclass for simulation objects.
Generated on Tue Mar 23 2021 19:41:20 for gem5 by doxygen 1.8.17