50 #include "arch/remote_gdb.hh"
51 #include "arch/utility.hh"
56 #include "config/use_kvm.hh"
61 #include "debug/Loader.hh"
62 #include "debug/WorkItems.hh"
65 #include "params/System.hh"
74 #if THE_ISA != NULL_ISA
80 using namespace TheISA;
87 :
MemObject(p), _systemPort(
"system_port", this),
89 multiThread(p->multi_thread),
91 init_param(p->init_param),
92 physProxy(_systemPort, p->cache_line_size),
93 kernelSymtab(nullptr),
95 loadAddrMask(p->load_addr_mask),
96 loadAddrOffset(p->load_offset),
102 physmem(
name() +
".physmem", p->memories, p->mmap_using_noreserve),
103 memoryMode(p->mem_mode),
104 _cacheLineSize(p->cache_line_size),
107 numWorkIds(p->num_work_ids),
108 thermalModel(p->thermal_model),
111 instEventQueue(
"system instruction-based event queue")
131 warn_once(
"Cache line size is neither 16, 32, 64 nor 128 bytes.\n");
144 inform(
"No kernel set for full system simulation. "
145 "Assuming you know what you're doing\n");
161 fatal(
"could not load kernel symbols\n");
164 fatal(
"could not load kernel local symbols\n");
167 fatal(
"could not load kernel symbols\n");
170 fatal(
"could not load kernel local symbols\n");
181 for (
int x = 0;
x <
params()->memories.size();
x++)
182 params()->memories[
x]->system(
this);
199 panic(
"System port on %s is not connected.\n",
name());
249 fatal(
"Cannot have two CPUs with the same id (%d)\n",
id);
254 #if THE_ISA != NULL_ISA
257 RemoteGDB *rgdb =
new RemoteGDB(
this, tc);
299 if (
params()->kernel !=
"") {
300 if (
params()->kernel_addr_check) {
306 fatal(
"Kernel is mapped to invalid location (not memory). "
307 "kernelStart 0x(%x) - kernelEnd 0x(%x) %#x:%#x\n",
320 DPRINTF(Loader,
"Kernel loaded...\n");
329 panic(
"replaceThreadContext: bad id, %d >= %d\n",
346 AddrRange m5opRange(0xffff0000, 0xffffffff);
347 if (m5opRange.
contains(next_return_addr)) {
348 warn(
"Reached m5ops MMIO region\n");
349 return_addr = 0xffffffff;
354 fatal(
"Out of memory, please increase size of physical memory.");
414 stringstream namestr;
415 ccprintf(namestr,
"work_item_type%d",
j);
417 .name(
name() +
"." + namestr.str())
418 .desc(
"Run time stat for" + namestr.str())
431 DPRINTF(WorkItems,
"Work item end: %d\t%d\t%lld\n", tid, workid, samp);
434 fatal(
"Got workid greater than specified in system configuration\n");
443 ios::fmtflags flags(cerr.flags());
447 for (; i != end; ++
i) {
449 cerr <<
"System " << sys->
name() <<
": " << hex << sys << endl;
466 master_name = master_name.erase(0,
name().
size() + 1);
480 fatal(
"Can't request a masterId after regStats(). "
481 "You must do so in init().\n");
493 fatal(
"Invalid master_id passed to getMasterName()\n");
499 SystemParams::create()
void ccprintf(cp::Print &print)
This master id is used for functional requests that don't come from a particular device.
virtual void unserializeSymtab(CheckpointIn &cp)
If needed, unserialize additional symbol table entries for a specific subclass of this system...
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...
const std::string & name()
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)
virtual bool loadGlobalSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=maxAddr)=0
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
const Params * params() const
static void printSystems()
uint64_t totalSize() const
Get the total physical memory size.
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Addr freeMemSize() const
Amount of physical memory that is still free.
Addr allocPhysPages(int npages)
Allocate npages contiguous unused physical pages.
void workItemEnd(uint32_t tid, uint32_t workid)
SymbolTable * debugSymbolTable
Global unified debugging symbol table (for target).
bool contains(const Addr &a) const
Determine if the range contains an address.
virtual bool loadLocalSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=maxAddr)=0
This master id is used for writeback requests by the caches.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
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.
void setSystem(System *s)
Initialize system pointer.
AbstractMemory declaration.
Addr kernelStart
Beginning of kernel code.
void startupCPU(ThreadContext *tc, int cpuId)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID) override
Additional function to return the Port of a memory 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
Register statistics for this object.
#define UNSERIALIZE_SCALAR(scalar)
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Tick curTick()
The current simulated tick.
void serialize(const std::string &base, CheckpointOut &cp) const
Addr loadAddrMask
Mask that should be anded for binary/symbol loading.
void drainResume() override
Resume execution after a successful drain.
uint64_t Tick
Tick count type.
const unsigned int _cacheLineSize
void serialize(CheckpointOut &cp) const override
Serialize an object.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
std::vector< ThreadContext * > threadContexts
Addr kernelEntry
Entry point in the kernel to start at.
std::map< uint32_t, Stats::Histogram * > workItemStats
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Draining buffers pending serialization/handover.
virtual bool loadSections(PortProxy &mem_proxy, Addr mask=maxAddr, Addr offset=0)
std::vector< bool > activeCpus
SymbolTable * kernelSymtab
kernel symbol table
bool startswith(const char *s, const char *prefix)
Return true if 's' starts with the prefix string 'prefix'.
#define SERIALIZE_SCALAR(scalar)
static const int NumArgumentRegs M5_VAR_USED
Addr memSize() const
Amount of physical memory that exists.
ObjectFile * kernel
Object pointer for the kernel code.
virtual const std::string name() const
std::vector< std::string > masterIds
This array is a per-system list of all devices capable of issuing a memory system request and an asso...
virtual void serializeSymtab(CheckpointOut &os) const
If needed, serialize additional symbol table entries for a specific subclass of this system...
std::ostream CheckpointOut
static int numSystemsRunning
ObjectFile * createObjectFile(const string &fname, bool raw)
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
const ContextID InvalidContextID
void replaceThreadContext(ThreadContext *tc, ContextID context_id)
MasterID getMasterId(std::string req_name)
Request an id used to create a request object in the system.
void unserialize(const std::string &base, CheckpointIn &cp)
DrainState drainState() const
Return the current drain state of an object.
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.
Addr loadAddrOffset
Offset that should be used for binary/symbol loading.
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...
int rgdb_wait
Setting rgdb_wait to a positive integer waits for a remote debugger to connect to that context ID bef...
void regStats() override
Register statistics for this object.
int ContextID
Globally unique thread context ID.
if(it_gpu==gpuTypeMap.end())
Addr kernelEnd
End of kernel code.
This master id is used for message signaled interrupts.
void setMemoryMode(Enums::MemoryMode mode)
Change the memory mode of the system.
static std::vector< System * > systemList