Go to the documentation of this file.
54 #include "debug/Loader.hh"
55 #include "debug/Quiesce.hh"
56 #include "debug/WorkItems.hh"
59 #include "params/System.hh"
81 return csprintf(
"%s.threads[%d]", context->getSystemPtr()->name(),
82 context->contextId());
89 context->getSystemPtr()->workload->recordQuiesce();
111 panic_if(!
t.context,
"Can't replace a context which doesn't exist.");
112 if (
t.resumeEvent->scheduled()) {
113 Tick when =
t.resumeEvent->when();
114 t.context->getCpuPtr()->deschedule(
t.resumeEvent);
148 [[maybe_unused]]
BaseCPU *cpu =
t.context->getCpuPtr();
149 DPRINTFS(Quiesce, cpu,
"quiesce()\n");
157 BaseCPU *cpu =
t.context->getCpuPtr();
159 DPRINTFS(Quiesce, cpu,
"quiesceTick until %u\n", when);
173 physmem(
name() +
".physmem",
p.memories,
p.mmap_using_noreserve,
174 p.shared_backstore,
p.auto_unlink_shared_backstore),
176 p.shadow_rom_ranges.
end()),
187 "(could use StubWorkload?).",
name());
196 warn_once(
"Cache line size is neither 16, 32, 64 nor 128 bytes.\n");
212 for (
int x = 0;
x <
params().memories.size();
x++)
213 params().memories[
x]->system(
this);
270 auto *otc =
threads[context_id];
316 "No device memory found for Requestor %d\n", rid);
332 if (
t.resumeEvent &&
t.resumeEvent->scheduled())
333 when =
t.resumeEvent->when();
350 !when || !
t.resumeEvent) {
353 t.context->getCpuPtr()->schedule(
t.resumeEvent, when);
367 std::stringstream namestr;
368 ccprintf(namestr,
"work_item_type%d",
j);
371 .desc(
"Run time stat for" + namestr.str())
384 DPRINTF(WorkItems,
"Work item end: %d\t%d\t%lld\n", tid, workid, samp);
387 fatal(
"Got workid greater than specified in system configuration\n");
406 for (;
i != end; ++
i) {
408 std::cerr <<
"System " << sys->
name() <<
": " << std::hex << sys
412 std::cerr.flags(
flags);
425 return requestor_name.substr(
name().size() + 1);
427 return requestor_name;
448 "Cannot lookup RequestorID by SimObject pointer: "
449 "More than one requestor is sharing the same SimObject\n");
483 const std::string& requestor_name)
499 fatal(
"Can't request a requestorId after regStats(). "
500 "You must do so in init().\n");
514 const std::string& subrequestor)
516 if (subrequestor.empty()) {
517 return requestor->
name();
521 return requestor->
name() +
"." + subrequestor;
529 fatal(
"Invalid requestor_id passed to getRequestorName()\n");
531 const auto& requestor_info =
requestors[requestor_id];
532 return requestor_info.req_name;
Tick curTick()
The universal simulation clock.
#define fatal(...)
This implements a cprintf based fatal() function.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
@ funcRequestorId
This requestor id is used for functional requests that don't come from a particular device.
void addDeviceMemory(RequestorID requestorId, memory::AbstractMemory *deviceMemory)
Add a physical memory range for a device.
std::map< std::pair< uint32_t, uint32_t >, Tick > lastWorkItemStarted
virtual System * getSystemPtr()=0
void workItemEnd(uint32_t tid, uint32_t workid)
RequestorID lookupRequestorId(const SimObject *obj) const
Looks up the RequestorID for a given SimObject returns an invalid RequestorID (invldRequestorId) if n...
@ Halted
Permanently shut down.
DrainState drainState() const
Return the current drain state of an object.
std::list< PCEvent * > liveEvents
AddrRange RangeSize(Addr start, Addr size)
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
bool schedule(PCEvent *event) override
void quiesce(ContextID id)
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Additional function to return the Port of a memory object.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
bool trapToGdb(GDBSignal signal, ContextID ctx_id) const
std::map< uint32_t, statistics::Histogram * > workItemStats
bool startswith(const char *s, const char *prefix)
Return true if 's' starts with the prefix string 'prefix'.
Workload * workload
OS kernel.
void replace(ThreadContext *tc, ContextID id)
const_iterator end() const
void setMemoryMode(enums::MemoryMode mode)
Change the memory mode of the system.
void schedule(Event &event, Tick when)
virtual void activate()=0
Set the status to Active.
static int numSystemsRunning
void registerThreadContext(ThreadContext *tc)
std::string csprintf(const char *format, const Args &...args)
void regStats() override
Callback to set stat parameters.
memory::AbstractMemory * getDeviceMemory(const PacketPtr &pkt) const
Return a pointer to the device memory.
bool isSubset(const AddrRange &r) const
Determine if this range is a subset of another range, i.e.
bool trapToGdb(GDBSignal sig, ContextID ctx_id)
void ccprintf(cp::Print &print)
virtual Status status() const =0
RequestorID _getRequestorId(const SimObject *requestor, const std::string &requestor_name)
helper function for getRequestorId
std::string stripSystemName(const std::string &requestor_name) const
Strips off the system name from a requestor name.
void quiesceTick(ContextID id, Tick when)
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::vector< RedirectPath * > redirectPaths
std::vector< Thread > threads
std::unordered_map< RequestorID, std::vector< memory::AbstractMemory * > > deviceMemMap
ThreadContext is the external interface to all thread state for anything outside of the CPU.
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.
virtual std::string name() const
RequestorID requestorId() const
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
memory::PhysicalMemory physmem
const Params & params() const
@ invldRequestorId
Invalid requestor id for assertion checking only.
static std::vector< System * > systemList
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
@ wbRequestorId
This requestor id is used for writeback requests by the caches.
An abstract memory represents a contiguous block of physical memory, with an associated address range...
uint64_t Tick
Tick count type.
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
RequestorID getGlobalRequestorId(const std::string &requestor_name)
Registers a GLOBAL RequestorID, which is a RequestorID not related to any particular SimObject; since...
RequestorID getRequestorId(const SimObject *requestor, std::string subrequestor={})
Request an id used to create a request object in the system.
void reschedule(Event &event, Tick when, bool always=false)
Addr memSize() const
Amount of physical memory that exists.
enums::MemoryMode memoryMode
Abstract superclass for simulation objects.
@ Drained
Buffers drained, ready for serialization/handover.
const_iterator begin() const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool remove(PCEvent *event) override
virtual void setContextId(ContextID id)=0
#define DPRINTFS(x, s,...)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
virtual void regStats()
Callback to set stat parameters.
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...
bool isDeviceMemAddr(const PacketPtr &pkt) const
Similar to isMemAddr but for devices.
void insert(ThreadContext *tc)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
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 paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
Ports are used to interface objects to each other.
AddrRangeList ShadowRomRanges
virtual void replaceThreadContext(ThreadContext *tc)
Thread & thread(ContextID id)
@ Halting
Trying to exit and waiting for an event to completely exit.
int ContextID
Globally unique thread context ID.
void serialize(CheckpointOut &cp) const override
Serialize an object.
const AddrRange _m5opRange
Range for memory-mapped m5 pseudo ops.
static void printSystems()
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::ostream CheckpointOut
void replaceThreadContext(ThreadContext *tc, ContextID context_id)
virtual BaseCPU * getCpuPtr()=0
uint64_t totalSize() const
Get the total physical memory size.
virtual bool schedule(PCEvent *event)=0
virtual void setSystem(System *sys)
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
virtual void registerThreadContext(ThreadContext *tc)
ThreadContext * findFree()
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
AddrRange getAddrRange() const
Get address range to which this packet belongs.
@ intRequestorId
This requestor id is used for message signaled interrupts.
const unsigned int _cacheLineSize
ThermalModel * thermalModel
Generated on Sun Jul 30 2023 01:56:49 for gem5 by doxygen 1.8.17