51 #include <unordered_map> 55 #include "arch/isa_traits.hh" 59 #include "config/the_isa.hh" 61 #include "enums/MemoryMode.hh" 66 #include "params/System.hh" 97 {
panic(
"SystemPort does not receive timing!\n");
return false; }
99 {
panic(
"SystemPort does not expect retry!\n"); }
111 void init()
override;
161 return memoryMode == Enums::atomic_noncaching;
196 return threadContexts[tid];
295 #if THE_ISA != NULL_ISA 298 panic(
"The NULL ISA has no endianness.");
382 std::string submaster = std::string());
417 const std::string& master_name);
424 const std::string& submaster);
458 assert(index < activeCpus.size());
459 activeCpus[
index] =
true;
461 i < activeCpus.end();
i++) {
482 panic(
"Base fixFuncEventAddr not implemented.\n");
498 template <
class T,
typename... Args>
500 const std::string &desc, Args... args)
506 std::forward<Args>(args)...);
516 return addFuncEvent<T>(symtab, lbl, lbl);
519 template <
class T,
typename... Args>
523 T *
e(addFuncEvent<T>(symtab, lbl, std::forward<Args>(args)...));
525 panic(
"Failed to find symbol '%s'", lbl);
545 template <
class T,
typename... Args>
549 std::forward<Args>(args)...);
552 template <
class T,
typename... Args>
555 T *
e(addFuncEvent<T>(kernelSymtab, lbl,
556 std::forward<Args>(args)...));
558 panic(
"Failed to find kernel symbol '%s'", lbl);
681 #endif // __SYSTEM_HH__ bool schedule(PCEvent *event) override
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
#define panic(...)
This implements a cprintf based panic() function.
T * addKernelFuncEventOrPanic(const char *lbl, Args... args)
Ports are used to interface objects to each other.
ThermalModel * getThermalModel() const
The thermal model used for this system (if any).
virtual void unserializeSymtab(CheckpointIn &cp)
If needed, unserialize additional symbol table entries for a specific subclass of this system...
Addr getKernelEntry() const
Returns the address the entry point to the kernel code.
const PortID InvalidPortID
std::string getMasterName(MasterID master_id)
Get the name of an object for a given request id.
Enums::MemoryMode memoryMode
ContextID registerThreadContext(ThreadContext *tc, ContextID assigned=InvalidContextID)
Bitfield< 23, 20 > atomic
std::vector< RedirectPath * > redirectPaths
MasterPort & getSystemPort()
Get a reference to the system port that can be used by non-structural simulation objects like process...
const Params * params() const
Addr freeMemSize() const
Amount of physical memory that is still free.
static void printSystems()
uint64_t incWorkItemsEnd()
Called by pseudo_inst to track the number of work items completed by this system. ...
Addr allocPhysPages(int npages)
Allocate npages contiguous unused physical pages.
void workItemEnd(uint32_t tid, uint32_t workid)
Addr getPageShift() const
Get the number of bits worth of in-page address for the ISA.
ByteOrder getGuestByteOrder() const
Get the guest byte order.
T * addFuncEvent(const SymbolTable *symtab, const char *lbl)
std::list< PCEvent * > liveEvents
ThreadContext is the external interface to all thread state for anything outside of the CPU...
Declaration of Statistics objects.
const ByteOrder GuestByteOrder
void init() override
After all objects have been created and all ports are connected, check that the system port is connec...
int numRunningContexts()
Return number of running (non-halted) thread contexts in system.
ThreadContext * getThreadContext(ContextID tid) const
Addr kernelStart
Beginning of kernel code.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
void regStats() override
Callback to set stat parameters.
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
PortProxy Object Declaration.
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the peer.
bool isAtomicMode() const
Is the system in atomic mode?
Tick curTick()
The current simulated tick.
Addr memSize() const
Amount of physical memory that exists.
bool findAddress(const std::string &symbol, Addr &address) const
MasterID getGlobalMasterId(const std::string &master_name)
Registers a GLOBAL MasterID, which is a MasterID not related to any particular SimObject; since no Si...
Addr loadAddrMask
Mask that should be anded for binary/symbol loading.
void drainResume() override
Resume execution after a successful drain.
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...
uint64_t Tick
Tick count type.
std::set< int > PIDs
Process set to track which PIDs have already been allocated.
const unsigned int _cacheLineSize
int markWorkItem(int index)
Called by pseudo_inst to mark the cpus actively executing work items.
void serialize(CheckpointOut &cp) const override
Serialize an object.
MasterID getMasterId(const SimObject *master, std::string submaster=std::string())
Request an id used to create a request object in the system.
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
const AddrRange _m5opRange
Range for memory-mapped m5 pseudo ops.
KvmVM * getKvmVM()
Get a pointer to the Kernel Virtual Machine (KVM) SimObject, if present.
std::vector< ThreadContext * > threadContexts
ThermalModel * thermalModel
unsigned numContexts() const
Addr kernelEntry
Entry point in the kernel to start at.
ThreadContext * findFreeContext()
std::map< uint32_t, Stats::Histogram * > workItemStats
virtual Addr fixFuncEventAddr(Addr addr)
Fix up an address used to match PCs for hooking simulator events on to target function executions...
Addr getKernelStart() const
Returns the address the kernel starts at.
std::vector< ObjectFile * > kernelExtras
Additional object files.
The physical memory encapsulates all memories in the system and provides basic functionality for acce...
Enums::MemoryMode getMemoryMode() const
Get the memory mode of the system.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
int64_t Counter
Statistics counter type.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
std::list< BasicSignal > signalList
std::vector< bool > activeCpus
SymbolTable * kernelSymtab
kernel symbol table
MasterID maxMasters()
Get the number of masters registered in the system.
MasterID lookupMasterId(const SimObject *obj) const
Looks up the MasterID for a given SimObject returns an invalid MasterID (invldMasterId) if not found...
SystemPort(const std::string &_name, SimObject *_owner)
Create a system port with a name and an owner.
This object is a proxy for a port or other object which implements the functional response protocol...
ObjectFile * kernel
Object pointer for the kernel code.
const AddrRange & m5opRange() const
Range used by memory-mapped m5 pseudo-ops if enabled.
std::vector< MasterInfo > masters
This array is a per-system list of all devices capable of issuing a memory system request and an asso...
bool validKvmEnvironment() const
Verify gem5 configuration will support KVM emulation.
T * addFuncEvent(const SymbolTable *symtab, const char *lbl, const std::string &desc, Args... args)
Add a function-based event to the given function, to be looked up in the specified symbol table...
uint64_t incWorkItemsBegin()
Called by pseudo_inst to track the number of work items started by this system.
std::ostream CheckpointOut
static int numSystemsRunning
T * addKernelFuncEvent(const char *lbl, Args... args)
Add a function-based event to a kernel symbol.
void workItemBegin(uint32_t tid, uint32_t workid)
bool bypassCaches() const
Should caches be bypassed?
Private class for the system port which is only used as a master for debug access and for non-structu...
MasterID _getMasterId(const SimObject *master, const std::string &master_name)
helper function for getMasterId
const std::string name() const
Return port name (for DPRINTF).
FutexMap class holds a map of all futexes used in the system.
PhysicalMemory & getPhysMem()
Get a pointer to access the physical memory of the system.
const ContextID InvalidContextID
void replaceThreadContext(ThreadContext *tc, ContextID context_id)
void schedule(Event &event, Tick when)
virtual void serializeSymtab(CheckpointOut &os) const
If needed, serialize additional symbol table entries for a specific subclass of this system...
std::map< std::pair< uint32_t, uint32_t >, Tick > lastWorkItemStarted
std::vector< BaseRemoteGDB * > remoteGDB
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
std::string stripSystemName(const std::string &master_name) const
Strips off the system name from a master name.
bool isTimingMode() const
Is the system in timing mode?
Addr loadAddrOffset
Offset that should be used for binary/symbol loading.
static const int NumArgumentRegs M5_VAR_USED
Addr getKernelEnd() const
Returns the address the kernel ends at.
T * addFuncEventOrPanic(const SymbolTable *symtab, const char *lbl, Args... args)
Abstract superclass for simulation objects.
int ContextID
Globally unique thread context ID.
Addr kernelEnd
End of kernel code.
Addr getPageBytes() const
Get the page bytes for the ISA.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Additional function to return the Port of a memory object.
Arch getArch() const
Get the architecture.
std::string leafMasterName(const SimObject *master, const std::string &submaster)
Helper function for constructing the full (sub)master name by providing the root master and the relat...
void setMemoryMode(Enums::MemoryMode mode)
Change the memory mode of the system.
unsigned int cacheLineSize() const
Get the cache line size of the system.
static std::vector< System * > systemList