gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
system.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2014,2017-2019 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 2003-2006 The Regents of The University of Michigan
15  * Copyright (c) 2011 Regents of the University of California
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Authors: Steve Reinhardt
42  * Lisa Hsu
43  * Nathan Binkert
44  * Ali Saidi
45  * Rick Strong
46  */
47 
48 #include "sim/system.hh"
49 
50 #include <algorithm>
51 
52 #include "arch/remote_gdb.hh"
53 #include "arch/utility.hh"
55 #include "base/loader/symtab.hh"
56 #include "base/str.hh"
57 #include "base/trace.hh"
58 #include "config/use_kvm.hh"
59 #if USE_KVM
60 #include "cpu/kvm/base.hh"
61 #include "cpu/kvm/vm.hh"
62 #endif
63 #include "cpu/base.hh"
64 #include "cpu/thread_context.hh"
65 #include "debug/Loader.hh"
66 #include "debug/WorkItems.hh"
67 #include "mem/abstract_mem.hh"
68 #include "mem/physical.hh"
69 #include "params/System.hh"
70 #include "sim/byteswap.hh"
71 #include "sim/debug.hh"
72 #include "sim/full_system.hh"
73 #include "sim/redirect_path.hh"
74 
79 #if THE_ISA != NULL_ISA
80 #include "kern/kernel_stats.hh"
81 
82 #endif
83 
84 using namespace std;
85 using namespace TheISA;
86 
88 
90 
92  : SimObject(p), _systemPort("system_port", this),
93  multiThread(p->multi_thread),
94  pagePtr(0),
95  init_param(p->init_param),
96  physProxy(_systemPort, p->cache_line_size),
97  kernelSymtab(nullptr),
98  kernel(nullptr),
99  loadAddrMask(p->load_addr_mask),
100  loadAddrOffset(p->load_offset),
101 #if USE_KVM
102  kvmVM(p->kvm_vm),
103 #else
104  kvmVM(nullptr),
105 #endif
106  physmem(name() + ".physmem", p->memories, p->mmap_using_noreserve),
107  memoryMode(p->mem_mode),
108  _cacheLineSize(p->cache_line_size),
109  workItemsBegin(0),
110  workItemsEnd(0),
111  numWorkIds(p->num_work_ids),
112  thermalModel(p->thermal_model),
113  _params(p),
114  _m5opRange(p->m5ops_base ?
115  RangeSize(p->m5ops_base, 0x10000) :
116  AddrRange(1, 0)), // Create an empty range if disabled
117  totalNumInsts(0),
118  redirectPaths(p->redirect_paths)
119 {
120 
121  // add self to global system list
122  systemList.push_back(this);
123 
124 #if USE_KVM
125  if (kvmVM) {
126  kvmVM->setSystem(this);
127  }
128 #endif
129 
130  if (FullSystem) {
132  if (!debugSymbolTable)
134  }
135 
136  // check if the cache line size is a value known to work
137  if (!(_cacheLineSize == 16 || _cacheLineSize == 32 ||
138  _cacheLineSize == 64 || _cacheLineSize == 128))
139  warn_once("Cache line size is neither 16, 32, 64 nor 128 bytes.\n");
140 
141  // Get the generic system master IDs
142  MasterID tmp_id M5_VAR_USED;
143  tmp_id = getMasterId(this, "writebacks");
144  assert(tmp_id == Request::wbMasterId);
145  tmp_id = getMasterId(this, "functional");
146  assert(tmp_id == Request::funcMasterId);
147  tmp_id = getMasterId(this, "interrupt");
148  assert(tmp_id == Request::intMasterId);
149 
150  if (FullSystem) {
151  if (params()->kernel == "") {
152  inform("No kernel set for full system simulation. "
153  "Assuming you know what you're doing\n");
154  } else {
155  // Get the kernel code
157  inform("kernel located at: %s", params()->kernel);
158 
159  if (kernel == NULL)
160  fatal("Could not load kernel file %s", params()->kernel);
161 
163 
164  // setup entry points
168 
169  // If load_addr_mask is set to 0x0, then auto-calculate
170  // the smallest mask to cover all kernel addresses so gem5
171  // can relocate the kernel to a new offset.
172  if (loadAddrMask == 0) {
173  Addr shift_amt = findMsbSet(kernelEnd - kernelStart) + 1;
174  loadAddrMask = ((Addr)1 << shift_amt) - 1;
175  }
176 
177  kernelImage.move([this](Addr a) {
178  return (a & loadAddrMask) + loadAddrOffset;
179  });
180 
181  // load symbols
183  fatal("could not load kernel symbols\n");
184 
186  fatal("could not load kernel local symbols\n");
187 
189  fatal("could not load kernel symbols\n");
190 
192  fatal("could not load kernel local symbols\n");
193 
194  // Loading only needs to happen once and after memory system is
195  // connected so it will happen in initState()
196  }
197 
198  if (p->kernel_extras_addrs.empty())
199  p->kernel_extras_addrs.resize(p->kernel_extras.size(), MaxAddr);
200  fatal_if(p->kernel_extras.size() != p->kernel_extras_addrs.size(),
201  "Additional kernel objects, not all load addresses specified\n");
202  for (int ker_idx = 0; ker_idx < p->kernel_extras.size(); ker_idx++) {
203  const std::string &obj_name = p->kernel_extras[ker_idx];
204  const bool raw = p->kernel_extras_addrs[ker_idx] != MaxAddr;
205  ObjectFile *obj = createObjectFile(obj_name, raw);
206  fatal_if(!obj, "Failed to build additional kernel object '%s'.\n",
207  obj_name);
208  kernelExtras.push_back(obj);
209  }
210  }
211 
212  // increment the number of running systems
214 
215  // Set back pointers to the system in all memories
216  for (int x = 0; x < params()->memories.size(); x++)
217  params()->memories[x]->system(this);
218 }
219 
221 {
222  delete kernelSymtab;
223  delete kernel;
224 
225  for (uint32_t j = 0; j < numWorkIds; j++)
226  delete workItemStats[j];
227 }
228 
229 void
231 {
232  // check that the system port is connected
233  if (!_systemPort.isConnected())
234  panic("System port on %s is not connected.\n", name());
235 }
236 
237 Port &
238 System::getPort(const std::string &if_name, PortID idx)
239 {
240  // no need to distinguish at the moment (besides checking)
241  return _systemPort;
242 }
243 
244 void
245 System::setMemoryMode(Enums::MemoryMode mode)
246 {
247  assert(drainState() == DrainState::Drained);
248  memoryMode = mode;
249 }
250 
252 {
253  if (remoteGDB.size())
254  return remoteGDB[0]->breakpoint();
255  return false;
256 }
257 
258 ContextID
260 {
261  int id = assigned;
262  if (id == InvalidContextID) {
263  // Find an unused context ID for this thread.
264  id = 0;
265  while (id < threadContexts.size() && threadContexts[id])
266  id++;
267  }
268 
269  if (threadContexts.size() <= id)
270  threadContexts.resize(id + 1);
271 
273  "Cannot have two CPUs with the same id (%d)\n", id);
274 
275  threadContexts[id] = tc;
276  for (auto *e: liveEvents)
277  tc->schedule(e);
278 
279 #if THE_ISA != NULL_ISA
280  int port = getRemoteGDBPort();
281  if (port) {
282  RemoteGDB *rgdb = new RemoteGDB(this, tc, port + id);
283  rgdb->listen();
284 
285  BaseCPU *cpu = tc->getCpuPtr();
286  if (cpu->waitForRemoteGDB()) {
287  inform("%s: Waiting for a remote GDB connection on port %d.\n",
288  cpu->name(), rgdb->port());
289 
290  rgdb->connect();
291  }
292  if (remoteGDB.size() <= id) {
293  remoteGDB.resize(id + 1);
294  }
295 
296  remoteGDB[id] = rgdb;
297  }
298 #endif
299 
300  activeCpus.push_back(false);
301 
302  return id;
303 }
304 
307 {
308  for (auto &it : threadContexts) {
309  if (ThreadContext::Halted == it->status())
310  return it;
311  }
312  return nullptr;
313 }
314 
315 bool
317 {
318  bool all = true;
319  liveEvents.push_back(event);
320  for (auto *tc: threadContexts)
321  all = tc->schedule(event) && all;
322  return all;
323 }
324 
325 bool
327 {
328  bool all = true;
329  liveEvents.remove(event);
330  for (auto *tc: threadContexts)
331  all = tc->remove(event) && all;
332  return all;
333 }
334 
335 int
337 {
338  return std::count_if(
339  threadContexts.cbegin(),
340  threadContexts.cend(),
341  [] (ThreadContext* tc) {
342  return ((tc->status() != ThreadContext::Halted) &&
343  (tc->status() != ThreadContext::Halting));
344  }
345  );
346 }
347 
348 void
350 {
351  if (FullSystem) {
352  // Moved from the constructor to here since it relies on the
353  // address map being resolved in the interconnect
357  auto mapper = [this](Addr a) {
358  return (a & loadAddrMask) + loadAddrOffset;
359  };
360  if (params()->kernel != "") {
361  if (params()->kernel_addr_check) {
362  // Validate kernel mapping before loading binary
363  if (!isMemAddr(mapper(kernelStart)) ||
364  !isMemAddr(mapper(kernelEnd))) {
365  fatal("Kernel is mapped to invalid location (not memory). "
366  "kernelStart 0x(%x) - kernelEnd 0x(%x) %#x:%#x\n",
368  mapper(kernelStart), mapper(kernelEnd));
369  }
370  }
371  // Load program sections into memory
373 
374  DPRINTF(Loader, "Kernel start = %#x\n", kernelStart);
375  DPRINTF(Loader, "Kernel end = %#x\n", kernelEnd);
376  DPRINTF(Loader, "Kernel entry = %#x\n", kernelEntry);
377  DPRINTF(Loader, "Kernel loaded...\n");
378  }
379  std::function<Addr(Addr)> extra_mapper;
380  for (auto ker_idx = 0; ker_idx < kernelExtras.size(); ker_idx++) {
381  const Addr load_addr = params()->kernel_extras_addrs[ker_idx];
382  auto image = kernelExtras[ker_idx]->buildImage();
383  if (load_addr != MaxAddr)
384  image = image.offset(load_addr);
385  else
386  image = image.move(mapper);
387  image.write(physProxy);
388  }
389  }
390 }
391 
392 void
394 {
395  if (context_id >= threadContexts.size()) {
396  panic("replaceThreadContext: bad id, %d >= %d\n",
397  context_id, threadContexts.size());
398  }
399 
400  for (auto *e: liveEvents) {
401  threadContexts[context_id]->remove(e);
402  tc->schedule(e);
403  }
404  threadContexts[context_id] = tc;
405  if (context_id < remoteGDB.size())
406  remoteGDB[context_id]->replaceThreadContext(tc);
407 }
408 
409 bool
411 {
412 #if USE_KVM
413  if (threadContexts.empty())
414  return false;
415 
416  for (auto tc : threadContexts) {
417  if (dynamic_cast<BaseKvmCPU*>(tc->getCpuPtr()) == nullptr) {
418  return false;
419  }
420  }
421  return true;
422 #else
423  return false;
424 #endif
425 }
426 
427 Addr
429 {
430  Addr return_addr = pagePtr << PageShift;
431  pagePtr += npages;
432 
433  Addr next_return_addr = pagePtr << PageShift;
434 
435  if (_m5opRange.contains(next_return_addr)) {
436  warn("Reached m5ops MMIO region\n");
437  return_addr = 0xffffffff;
438  pagePtr = 0xffffffff >> PageShift;
439  }
440 
441  if ((pagePtr << PageShift) > physmem.totalSize())
442  fatal("Out of memory, please increase size of physical memory.");
443  return return_addr;
444 }
445 
446 Addr
448 {
449  return physmem.totalSize();
450 }
451 
452 Addr
454 {
455  return physmem.totalSize() - (pagePtr << PageShift);
456 }
457 
458 bool
460 {
461  return physmem.isMemAddr(addr);
462 }
463 
464 void
466 {
467  totalNumInsts = 0;
468 }
469 
470 void
472 {
473  if (FullSystem)
474  kernelSymtab->serialize("kernel_symtab", cp);
476  serializeSymtab(cp);
477 
478  // also serialize the memories in the system
479  physmem.serializeSection(cp, "physmem");
480 }
481 
482 
483 void
485 {
486  if (FullSystem)
487  kernelSymtab->unserialize("kernel_symtab", cp);
489  unserializeSymtab(cp);
490 
491  // also unserialize the memories in the system
492  physmem.unserializeSection(cp, "physmem");
493 }
494 
495 void
497 {
499 
500  for (uint32_t j = 0; j < numWorkIds ; j++) {
502  stringstream namestr;
503  ccprintf(namestr, "work_item_type%d", j);
504  workItemStats[j]->init(20)
505  .name(name() + "." + namestr.str())
506  .desc("Run time stat for" + namestr.str())
507  .prereq(*workItemStats[j]);
508  }
509 }
510 
511 void
512 System::workItemEnd(uint32_t tid, uint32_t workid)
513 {
514  std::pair<uint32_t,uint32_t> p(tid, workid);
515  if (!lastWorkItemStarted.count(p))
516  return;
517 
518  Tick samp = curTick() - lastWorkItemStarted[p];
519  DPRINTF(WorkItems, "Work item end: %d\t%d\t%lld\n", tid, workid, samp);
520 
521  if (workid >= numWorkIds)
522  fatal("Got workid greater than specified in system configuration\n");
523 
524  workItemStats[workid]->sample(samp);
525  lastWorkItemStarted.erase(p);
526 }
527 
528 void
530 {
531  ios::fmtflags flags(cerr.flags());
532 
535  for (; i != end; ++i) {
536  System *sys = *i;
537  cerr << "System " << sys->name() << ": " << hex << sys << endl;
538  }
539 
540  cerr.flags(flags);
541 }
542 
543 void
545 {
547 }
548 
549 std::string
550 System::stripSystemName(const std::string& master_name) const
551 {
552  if (startswith(master_name, name())) {
553  return master_name.substr(name().size());
554  } else {
555  return master_name;
556  }
557 }
558 
559 MasterID
561 {
563 
564  // number of occurrences of the SimObject pointer
565  // in the master list.
566  auto obj_number = 0;
567 
568  for (int i = 0; i < masters.size(); i++) {
569  if (masters[i].obj == obj) {
570  id = i;
571  obj_number++;
572  }
573  }
574 
575  fatal_if(obj_number > 1,
576  "Cannot lookup MasterID by SimObject pointer: "
577  "More than one master is sharing the same SimObject\n");
578 
579  return id;
580 }
581 
582 MasterID
583 System::lookupMasterId(const std::string& master_name) const
584 {
585  std::string name = stripSystemName(master_name);
586 
587  for (int i = 0; i < masters.size(); i++) {
588  if (masters[i].masterName == name) {
589  return i;
590  }
591  }
592 
593  return Request::invldMasterId;
594 }
595 
596 MasterID
597 System::getGlobalMasterId(const std::string& master_name)
598 {
599  return _getMasterId(nullptr, master_name);
600 }
601 
602 MasterID
603 System::getMasterId(const SimObject* master, std::string submaster)
604 {
605  auto master_name = leafMasterName(master, submaster);
606  return _getMasterId(master, master_name);
607 }
608 
609 MasterID
610 System::_getMasterId(const SimObject* master, const std::string& master_name)
611 {
612  std::string name = stripSystemName(master_name);
613 
614  // CPUs in switch_cpus ask for ids again after switching
615  for (int i = 0; i < masters.size(); i++) {
616  if (masters[i].masterName == name) {
617  return i;
618  }
619  }
620 
621  // Verify that the statistics haven't been enabled yet
622  // Otherwise objects will have sized their stat buckets and
623  // they will be too small
624 
625  if (Stats::enabled()) {
626  fatal("Can't request a masterId after regStats(). "
627  "You must do so in init().\n");
628  }
629 
630  // Generate a new MasterID incrementally
631  MasterID master_id = masters.size();
632 
633  // Append the new Master metadata to the group of system Masters.
634  masters.emplace_back(master, name, master_id);
635 
636  return masters.back().masterId;
637 }
638 
639 std::string
640 System::leafMasterName(const SimObject* master, const std::string& submaster)
641 {
642  if (submaster.empty()) {
643  return master->name();
644  } else {
645  // Get the full master name by appending the submaster name to
646  // the root SimObject master name
647  return master->name() + "." + submaster;
648  }
649 }
650 
651 std::string
653 {
654  if (master_id >= masters.size())
655  fatal("Invalid master_id passed to getMasterName()\n");
656 
657  const auto& master_info = masters[master_id];
658  return master_info.masterName;
659 }
660 
661 System *
662 SystemParams::create()
663 {
664  return new System(this);
665 }
bool schedule(PCEvent *event) override
Definition: system.cc:316
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:167
void ccprintf(cp::Print &print)
Definition: cprintf.hh:131
#define DPRINTF(x,...)
Definition: trace.hh:229
This master id is used for message signaled interrupts.
Definition: request.hh:214
AddrRange RangeSize(Addr start, Addr size)
Definition: addr_range.hh:584
Ports are used to interface objects to each other.
Definition: port.hh:60
MemoryImage & move(std::function< Addr(Addr)> mapper)
Definition: memory_image.cc:59
virtual void unserializeSymtab(CheckpointIn &cp)
If needed, unserialize additional symbol table entries for a specific subclass of this system...
Definition: system.hh:676
#define fatal(...)
This implements a cprintf based fatal() function.
Definition: logging.hh:175
const std::string & name()
Definition: trace.cc:54
const Addr MaxAddr
Definition: types.hh:166
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
Definition: serialize.cc:176
Bitfield< 7 > i
std::string getMasterName(MasterID master_id)
Get the name of an object for a given request id.
Definition: system.cc:652
Enums::MemoryMode memoryMode
Definition: system.hh:323
ContextID registerThreadContext(ThreadContext *tc, ContextID assigned=InvalidContextID)
Definition: system.cc:259
bool write(const PortProxy &proxy) const
Definition: memory_image.cc:50
Trying to exit and waiting for an event to completely exit.
SimObjectParams Params
Definition: sim_object.hh:113
System(Params *p)
Definition: system.cc:91
uint64_t totalSize() const
Get the total physical memory size.
Definition: physical.hh:200
const Params * params() const
Definition: system.hh:585
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
Definition: serialize.cc:183
ObjectFile * createObjectFile(const std::string &fname, bool raw)
Definition: object_file.cc:64
Addr freeMemSize() const
Amount of physical memory that is still free.
Definition: system.cc:453
const Addr PageShift
Definition: isa_traits.hh:46
bool contains(const Addr &a) const
Determine if the range contains an address.
Definition: addr_range.hh:406
Bitfield< 8 > a
static void printSystems()
Definition: system.cc:529
ip6_addr_t addr
Definition: inet.hh:335
int getRemoteGDBPort()
Definition: debug.cc:121
DrainState drainState() const
Return the current drain state of an object.
Definition: drain.hh:282
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
Definition: root.cc:136
PhysicalMemory physmem
Definition: system.hh:321
Addr allocPhysPages(int npages)
Allocate npages contiguous unused physical pages.
Definition: system.cc:428
virtual void regStats()
Callback to set stat parameters.
Definition: group.cc:66
void workItemEnd(uint32_t tid, uint32_t workid)
Definition: system.cc:512
SymbolTable * debugSymbolTable
Global unified debugging symbol table (for target).
Definition: symtab.cc:45
Definition: system.hh:77
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:586
virtual BaseCPU * getCpuPtr()=0
bool isConnected() const
Is this port currently connected to a peer?
Definition: port.hh:128
SystemPort _systemPort
Definition: system.hh:103
Definition: cprintf.cc:42
Bitfield< 4, 0 > mode
std::list< PCEvent * > liveEvents
Definition: system.hh:102
ThreadContext is the external interface to all thread state for anything outside of the CPU...
This master id is used for writeback requests by the caches.
Definition: request.hh:207
STL vector class.
Definition: stl.hh:40
Bitfield< 33 > id
void init() override
After all objects have been created and all ports are connected, check that the system port is connec...
Definition: system.cc:230
virtual bool schedule(PCEvent *event)=0
int numRunningContexts()
Return number of running (non-halted) thread contexts in system.
Definition: system.cc:336
void setSystem(System *s)
Initialize system pointer.
Definition: vm.cc:532
AbstractMemory declaration.
Addr kernelStart
Beginning of kernel code.
Definition: system.hh:231
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: system.cc:484
PortProxy physProxy
Port to physical memory used for writing object files into ram at boot.
Definition: system.hh:218
Addr minAddr() const
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition: addr_range.hh:72
void regStats() override
Callback to set stat parameters.
Definition: system.cc:496
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:645
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: system.cc:349
virtual MemoryImage buildImage() const =0
#define inform(...)
Definition: logging.hh:213
Tick curTick()
The current simulated tick.
Definition: core.hh:47
Addr memSize() const
Amount of physical memory that exists.
Definition: system.cc:447
MasterID getGlobalMasterId(const std::string &master_name)
Registers a GLOBAL MasterID, which is a MasterID not related to any particular SimObject; since no Si...
Definition: system.cc:597
Addr loadAddrMask
Mask that should be anded for binary/symbol loading.
Definition: system.hh:245
void drainResume() override
Resume execution after a successful drain.
Definition: system.cc:465
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...
Definition: system.cc:459
uint64_t Tick
Tick count type.
Definition: types.hh:63
const unsigned int _cacheLineSize
Definition: system.hh:325
Addr maxAddr() const
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: system.cc:471
MasterID getMasterId(const SimObject *master, std::string submaster=std::string())
Request an id used to create a request object in the system.
Definition: system.cc:603
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...
Definition: physical.cc:236
const AddrRange _m5opRange
Range for memory-mapped m5 pseudo ops.
Definition: system.hh:577
virtual bool loadLocalSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=MaxAddr)
Definition: object_file.hh:96
Addr pagePtr
Definition: system.hh:212
std::vector< ThreadContext * > threadContexts
Definition: system.hh:190
A simple histogram stat.
Definition: statistics.hh:2629
Addr kernelEntry
Entry point in the kernel to start at.
Definition: system.hh:237
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Definition: logging.hh:203
ThreadContext * findFreeContext()
Definition: system.cc:306
std::map< uint32_t, Stats::Histogram * > workItemStats
Definition: system.hh:629
std::vector< ObjectFile * > kernelExtras
Additional object files.
Definition: system.hh:228
void serialize(const std::string &base, CheckpointOut &cp) const
Definition: symtab.cc:113
~System()
Definition: system.cc:220
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
uint16_t MasterID
Definition: request.hh:86
Draining buffers pending serialization/handover.
virtual const std::string name() const
Definition: sim_object.hh:120
bool waitForRemoteGDB() const
Definition: base.cc:783
Bitfield< 10, 5 > event
#define warn_once(...)
Definition: logging.hh:216
This master id is used for functional requests that don&#39;t come from a particular device.
Definition: request.hh:212
std::vector< bool > activeCpus
Definition: system.hh:330
bool enabled()
Definition: statistics.cc:546
SymbolTable * kernelSymtab
kernel symbol table
Definition: system.hh:221
bool startswith(const char *s, const char *prefix)
Return true if &#39;s&#39; starts with the prefix string &#39;prefix&#39;.
Definition: str.hh:227
uint32_t numWorkIds
Definition: system.hh:329
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:643
Bitfield< 24 > j
MasterID lookupMasterId(const SimObject *obj) const
Looks up the MasterID for a given SimObject returns an invalid MasterID (invldMasterId) if not found...
Definition: system.cc:560
Bitfield< 9 > e
ObjectFile * kernel
Object pointer for the kernel code.
Definition: system.hh:224
std::vector< MasterInfo > masters
This array is a per-system list of all devices capable of issuing a memory system request and an asso...
Definition: system.hh:337
bool validKvmEnvironment() const
Verify gem5 configuration will support KVM emulation.
Definition: system.cc:410
std::ostream CheckpointOut
Definition: serialize.hh:68
bool remove(PCEvent *event) override
Definition: system.cc:326
static int numSystemsRunning
Definition: system.hh:638
Permanently shut down.
MasterID _getMasterId(const SimObject *master, const std::string &master_name)
helper function for getMasterId
Definition: system.cc:610
const ContextID InvalidContextID
Definition: types.hh:232
Addr entryPoint() const
Definition: object_file.hh:131
Invalid master id for assertion checking only.
Definition: request.hh:219
int findMsbSet(uint64_t val)
Returns the bit position of the MSB that is set in the input.
Definition: bitfield.hh:204
void replaceThreadContext(ThreadContext *tc, ContextID context_id)
Definition: system.cc:393
void unserialize(const std::string &base, CheckpointIn &cp)
Definition: symtab.cc:127
virtual void serializeSymtab(CheckpointOut &os) const
If needed, serialize additional symbol table entries for a specific subclass of this system...
Definition: system.hh:667
std::map< std::pair< uint32_t, uint32_t >, Tick > lastWorkItemStarted
Definition: system.hh:628
std::vector< BaseRemoteGDB * > remoteGDB
Definition: system.hh:564
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
std::string stripSystemName(const std::string &master_name) const
Strips off the system name from a master name.
Definition: system.cc:550
#define warn(...)
Definition: logging.hh:212
MemoryImage kernelImage
Definition: system.hh:225
bool breakpoint()
Definition: system.cc:251
Addr loadAddrOffset
Offset that should be used for binary/symbol loading.
Definition: system.hh:252
static const int NumArgumentRegs M5_VAR_USED
Definition: process.cc:84
KvmVM *const kvmVM
Definition: system.hh:319
Bitfield< 0 > p
Bitfield< 1 > x
Definition: types.hh:105
virtual bool loadGlobalSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=MaxAddr)
Definition: object_file.hh:90
Abstract superclass for simulation objects.
Definition: sim_object.hh:96
int ContextID
Globally unique thread context ID.
Definition: types.hh:231
Addr kernelEnd
End of kernel code.
Definition: system.hh:234
Counter totalNumInsts
Definition: system.hh:627
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Additional function to return the Port of a memory object.
Definition: system.cc:238
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...
Definition: system.cc:640
void setMemoryMode(Enums::MemoryMode mode)
Change the memory mode of the system.
Definition: system.cc:245
static std::vector< System * > systemList
Definition: system.hh:637

Generated on Fri Feb 28 2020 16:26:56 for gem5 by doxygen 1.8.13