gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
process.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2016 Advanced Micro Devices, Inc.
3  * Copyright (c) 2012 ARM Limited
4  * All rights reserved
5  *
6  * The license below extends only to copyright in the software and shall
7  * not be construed as granting a license to any other intellectual
8  * property including but not limited to intellectual property relating
9  * to a hardware implementation of the functionality of the software
10  * licensed hereunder. You may use the software subject to the license
11  * terms below provided that you ensure that this notice is replicated
12  * unmodified and in its entirety in all distributions of the software,
13  * modified or unmodified, in source code or in binary form.
14  *
15  * Copyright (c) 2001-2005 The Regents of The University of Michigan
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: Nathan Binkert
42  * Steve Reinhardt
43  * Ali Saidi
44  * Brandon Potter
45  */
46 
47 #include "sim/process.hh"
48 
49 #include <fcntl.h>
50 #include <unistd.h>
51 
52 #include <array>
53 #include <csignal>
54 #include <map>
55 #include <string>
56 #include <vector>
57 
58 #include "base/intmath.hh"
60 #include "base/loader/symtab.hh"
61 #include "base/statistics.hh"
62 #include "config/the_isa.hh"
63 #include "cpu/thread_context.hh"
64 #include "mem/page_table.hh"
66 #include "params/Process.hh"
67 #include "sim/emul_driver.hh"
68 #include "sim/fd_array.hh"
69 #include "sim/fd_entry.hh"
70 #include "sim/syscall_desc.hh"
71 #include "sim/system.hh"
72 
73 #if THE_ISA == ALPHA_ISA
75 
76 #elif THE_ISA == SPARC_ISA
79 
80 #elif THE_ISA == MIPS_ISA
82 
83 #elif THE_ISA == ARM_ISA
86 
87 #elif THE_ISA == X86_ISA
89 
90 #elif THE_ISA == POWER_ISA
92 
93 #elif THE_ISA == RISCV_ISA
95 
96 #else
97 #error "THE_ISA not set"
98 #endif
99 
100 
101 using namespace std;
102 using namespace TheISA;
103 
104 Process::Process(ProcessParams * params, ObjectFile * obj_file)
105  : SimObject(params), system(params->system),
106  useArchPT(params->useArchPT),
107  kvmInSE(params->kvmInSE),
108  pTable(useArchPT ?
109  static_cast<PageTableBase *>(new ArchPageTable(name(), params->pid,
110  system)) :
111  static_cast<PageTableBase *>(new FuncPageTable(name(), params->pid))),
112  initVirtMem(system->getSystemPort(), this,
113  SETranslatingPortProxy::Always),
114  objFile(obj_file),
115  argv(params->cmd), envp(params->env), cwd(params->cwd),
116  executable(params->executable),
117  _uid(params->uid), _euid(params->euid),
118  _gid(params->gid), _egid(params->egid),
119  _pid(params->pid), _ppid(params->ppid),
120  _pgid(params->pgid), drivers(params->drivers),
121  fds(make_shared<FDArray>(params->input, params->output, params->errout)),
122  childClearTID(0)
123 {
124  if (_pid >= System::maxPID)
125  fatal("_pid is too large: %d", _pid);
126 
127  auto ret_pair = system->PIDs.emplace(_pid);
128  if (!ret_pair.second)
129  fatal("_pid %d is already used", _pid);
130 
143  _tgid = params->pid;
144 
145  exitGroup = new bool();
146  sigchld = new bool();
147 
148  if (!debugSymbolTable) {
153  delete debugSymbolTable;
154  debugSymbolTable = nullptr;
155  }
156  }
157 }
158 
159 void
161  Process *np, TheISA::IntReg flags)
162 {
163 #ifndef CLONE_VM
164 #define CLONE_VM 0
165 #endif
166 #ifndef CLONE_FILES
167 #define CLONE_FILES 0
168 #endif
169 #ifndef CLONE_THREAD
170 #define CLONE_THREAD 0
171 #endif
172  if (CLONE_VM & flags) {
178  delete np->pTable;
179  np->pTable = pTable;
180  ntc->getMemProxy().setPageTable(np->pTable);
181 
182  np->memState = memState;
183  } else {
188  typedef std::vector<pair<Addr,Addr>> MapVec;
189  MapVec mappings;
190  pTable->getMappings(&mappings);
191 
192  for (auto map : mappings) {
193  Addr paddr, vaddr = map.first;
194  bool alloc_page = !(np->pTable->translate(vaddr, paddr));
195  np->replicatePage(vaddr, paddr, otc, ntc, alloc_page);
196  }
197 
198  *np->memState = *memState;
199  }
200 
201  if (CLONE_FILES & flags) {
207  np->fds = fds;
208  } else {
216  for (int tgt_fd = 0; tgt_fd < fds->getSize(); tgt_fd++) {
217  std::shared_ptr<FDArray> nfds = np->fds;
218  std::shared_ptr<FDEntry> this_fde = (*fds)[tgt_fd];
219  if (!this_fde) {
220  nfds->setFDEntry(tgt_fd, nullptr);
221  continue;
222  }
223  nfds->setFDEntry(tgt_fd, this_fde->clone());
224 
225  auto this_hbfd = std::dynamic_pointer_cast<HBFDEntry>(this_fde);
226  if (!this_hbfd)
227  continue;
228 
229  int this_sim_fd = this_hbfd->getSimFD();
230  if (this_sim_fd <= 2)
231  continue;
232 
233  int np_sim_fd = dup(this_sim_fd);
234  assert(np_sim_fd != -1);
235 
236  auto nhbfd = std::dynamic_pointer_cast<HBFDEntry>((*nfds)[tgt_fd]);
237  nhbfd->setSimFD(np_sim_fd);
238  }
239  }
240 
241  if (CLONE_THREAD & flags) {
242  np->_tgid = _tgid;
243  delete np->exitGroup;
244  np->exitGroup = exitGroup;
245  }
246 
247  np->argv.insert(np->argv.end(), argv.begin(), argv.end());
248  np->envp.insert(np->envp.end(), envp.begin(), envp.end());
249 }
250 
251 void
253 {
255 
256  using namespace Stats;
257 
259  .name(name() + ".numSyscalls")
260  .desc("Number of system calls")
261  ;
262 }
263 
266 {
267  for (auto &it : system->threadContexts) {
268  if (ThreadContext::Halted == it->status())
269  return it;
270  }
271  return nullptr;
272 }
273 
274 void
276 {
278  for (it = contextIds.begin(); it != contextIds.end(); it++) {
279  if (*it == context_id) {
280  contextIds.erase(it);
281  return;
282  }
283  }
284  warn("Unable to find thread context to revoke");
285 }
286 
287 void
289 {
290  if (contextIds.empty())
291  fatal("Process %s is not associated with any HW contexts!\n", name());
292 
293  // first thread context for this process... initialize & enable
295 
296  // mark this context as active so it will start ticking.
297  tc->activate();
298 
299  pTable->initState(tc);
300 }
301 
304 {
305  fds->updateFileOffsets();
306  return DrainState::Drained;
307 }
308 
309 void
310 Process::allocateMem(Addr vaddr, int64_t size, bool clobber)
311 {
312  int npages = divCeil(size, (int64_t)PageBytes);
313  Addr paddr = system->allocPhysPages(npages);
314  pTable->map(vaddr, paddr, size,
316 }
317 
318 void
320  ThreadContext *new_tc, bool allocate_page)
321 {
322  if (allocate_page)
323  new_paddr = system->allocPhysPages(1);
324 
325  // Read from old physical page.
326  uint8_t *buf_p = new uint8_t[PageBytes];
327  old_tc->getMemProxy().readBlob(vaddr, buf_p, PageBytes);
328 
329  // Create new mapping in process address space by clobbering existing
330  // mapping (if any existed) and then write to the new physical page.
331  bool clobber = true;
332  pTable->map(vaddr, new_paddr, PageBytes, clobber);
333  new_tc->getMemProxy().writeBlob(vaddr, buf_p, PageBytes);
334  delete[] buf_p;
335 }
336 
337 bool
339 {
340  Addr stack_min = memState->getStackMin();
341  Addr stack_base = memState->getStackBase();
342  Addr max_stack_size = memState->getMaxStackSize();
343 
344  // Check if this is already on the stack and there's just no page there
345  // yet.
346  if (vaddr >= stack_min && vaddr < stack_base) {
348  return true;
349  }
350 
351  // We've accessed the next page of the stack, so extend it to include
352  // this address.
353  if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) {
354  while (vaddr < stack_min) {
355  stack_min -= TheISA::PageBytes;
356  if (stack_base - stack_min > max_stack_size)
357  fatal("Maximum stack size exceeded\n");
358  allocateMem(stack_min, TheISA::PageBytes);
359  inform("Increasing stack size by one page.");
360  }
361  memState->setStackMin(stack_min);
362  return true;
363  }
364  return false;
365 }
366 
367 void
369 {
370  pTable->serialize(cp);
376  warn("Checkpoints for file descriptors currently do not work.");
377 #if 0
378  for (int x = 0; x < fds->getSize(); x++)
379  (*fds)[x].serializeSection(cp, csprintf("FDEntry%d", x));
380 #endif
381 
382 }
383 
384 void
386 {
387  pTable->unserialize(cp);
392  warn("Checkpoints for file descriptors currently do not work.");
393 #if 0
394  for (int x = 0; x < fds->getSize(); x++)
395  (*fds)[x]->unserializeSection(cp, csprintf("FDEntry%d", x));
396  fds->restoreFileOffsets();
397 #endif
398  // The above returns a bool so that you could do something if you don't
399  // find the param in the checkpoint if you wanted to, like set a default
400  // but in this case we'll just stick with the instantiated value if not
401  // found.
402 }
403 
404 bool
405 Process::map(Addr vaddr, Addr paddr, int size, bool cacheable)
406 {
407  pTable->map(vaddr, paddr, size,
409  return true;
410 }
411 
412 void
413 Process::syscall(int64_t callnum, ThreadContext *tc, Fault *fault)
414 {
415  numSyscalls++;
416 
417  SyscallDesc *desc = getDesc(callnum);
418  if (desc == nullptr)
419  fatal("Syscall %d out of range", callnum);
420 
421  desc->doSyscall(callnum, this, tc, fault);
422 }
423 
424 IntReg
426 {
427  return getSyscallArg(tc, i);
428 }
429 
431 Process::findDriver(std::string filename)
432 {
433  for (EmulatedDriver *d : drivers) {
434  if (d->match(filename))
435  return d;
436  }
437 
438  return nullptr;
439 }
440 
441 void
443 {
444  ObjectFile *interp = objFile->getInterpreter();
445 
446  if (!interp || !interp->relocatable())
447  return;
448 
449  // Determine how large the interpreters footprint will be in the process
450  // address space.
451  Addr interp_mapsize = roundUp(interp->mapSize(), TheISA::PageBytes);
452 
453  // We are allocating the memory area; set the bias to the lowest address
454  // in the allocated memory region.
455  Addr mmap_end = memState->getMmapEnd();
456  Addr ld_bias = mmapGrowsDown() ? mmap_end - interp_mapsize : mmap_end;
457 
458  // Adjust the process mmap area to give the interpreter room; the real
459  // execve system call would just invoke the kernel's internal mmap
460  // functions to make these adjustments.
461  mmap_end = mmapGrowsDown() ? ld_bias : mmap_end + interp_mapsize;
462  memState->setMmapEnd(mmap_end);
463 
464  interp->updateBias(ld_bias);
465 }
466 
467 ObjectFile *
469 {
470  return objFile->getInterpreter();
471 }
472 
473 Addr
475 {
476  ObjectFile *interp = getInterpreter();
477 
478  return interp ? interp->bias() : objFile->bias();
479 }
480 
481 Addr
483 {
484  ObjectFile *interp = getInterpreter();
485 
486  return interp ? interp->entryPoint() : objFile->entryPoint();
487 }
488 
489 Process *
490 ProcessParams::create()
491 {
492  Process *process = nullptr;
493 
494  // If not specified, set the executable parameter equal to the
495  // simulated system's zeroth command line parameter
496  if (executable == "") {
497  executable = cmd[0];
498  }
499 
501  if (obj_file == nullptr) {
502  fatal("Can't load object file %s", executable);
503  }
504 
505 #if THE_ISA == ALPHA_ISA
506  if (obj_file->getArch() != ObjectFile::Alpha)
507  fatal("Object file architecture does not match compiled ISA (Alpha).");
508 
509  switch (obj_file->getOpSys()) {
511  warn("Unknown operating system; assuming Linux.");
512  // fall through
513  case ObjectFile::Linux:
514  process = new AlphaLinuxProcess(this, obj_file);
515  break;
516 
517  default:
518  fatal("Unknown/unsupported operating system.");
519  }
520 #elif THE_ISA == SPARC_ISA
521  if (obj_file->getArch() != ObjectFile::SPARC64 &&
522  obj_file->getArch() != ObjectFile::SPARC32)
523  fatal("Object file architecture does not match compiled ISA (SPARC).");
524  switch (obj_file->getOpSys()) {
526  warn("Unknown operating system; assuming Linux.");
527  // fall through
528  case ObjectFile::Linux:
529  if (obj_file->getArch() == ObjectFile::SPARC64) {
530  process = new Sparc64LinuxProcess(this, obj_file);
531  } else {
532  process = new Sparc32LinuxProcess(this, obj_file);
533  }
534  break;
535 
536  case ObjectFile::Solaris:
537  process = new SparcSolarisProcess(this, obj_file);
538  break;
539 
540  default:
541  fatal("Unknown/unsupported operating system.");
542  }
543 #elif THE_ISA == X86_ISA
544  if (obj_file->getArch() != ObjectFile::X86_64 &&
545  obj_file->getArch() != ObjectFile::I386)
546  fatal("Object file architecture does not match compiled ISA (x86).");
547  switch (obj_file->getOpSys()) {
549  warn("Unknown operating system; assuming Linux.");
550  // fall through
551  case ObjectFile::Linux:
552  if (obj_file->getArch() == ObjectFile::X86_64) {
553  process = new X86_64LinuxProcess(this, obj_file);
554  } else {
555  process = new I386LinuxProcess(this, obj_file);
556  }
557  break;
558 
559  default:
560  fatal("Unknown/unsupported operating system.");
561  }
562 #elif THE_ISA == MIPS_ISA
563  if (obj_file->getArch() != ObjectFile::Mips)
564  fatal("Object file architecture does not match compiled ISA (MIPS).");
565  switch (obj_file->getOpSys()) {
567  warn("Unknown operating system; assuming Linux.");
568  // fall through
569  case ObjectFile::Linux:
570  process = new MipsLinuxProcess(this, obj_file);
571  break;
572 
573  default:
574  fatal("Unknown/unsupported operating system.");
575  }
576 #elif THE_ISA == ARM_ISA
577  ObjectFile::Arch arch = obj_file->getArch();
578  if (arch != ObjectFile::Arm && arch != ObjectFile::Thumb &&
579  arch != ObjectFile::Arm64)
580  fatal("Object file architecture does not match compiled ISA (ARM).");
581  switch (obj_file->getOpSys()) {
583  warn("Unknown operating system; assuming Linux.");
584  // fall through
585  case ObjectFile::Linux:
586  if (arch == ObjectFile::Arm64) {
587  process = new ArmLinuxProcess64(this, obj_file,
588  obj_file->getArch());
589  } else {
590  process = new ArmLinuxProcess32(this, obj_file,
591  obj_file->getArch());
592  }
593  break;
594  case ObjectFile::FreeBSD:
595  if (arch == ObjectFile::Arm64) {
596  process = new ArmFreebsdProcess64(this, obj_file,
597  obj_file->getArch());
598  } else {
599  process = new ArmFreebsdProcess32(this, obj_file,
600  obj_file->getArch());
601  }
602  break;
604  fatal("M5 does not support ARM OABI binaries. Please recompile with an"
605  " EABI compiler.");
606  default:
607  fatal("Unknown/unsupported operating system.");
608  }
609 #elif THE_ISA == POWER_ISA
610  if (obj_file->getArch() != ObjectFile::Power)
611  fatal("Object file architecture does not match compiled ISA (Power).");
612  switch (obj_file->getOpSys()) {
614  warn("Unknown operating system; assuming Linux.");
615  // fall through
616  case ObjectFile::Linux:
617  process = new PowerLinuxProcess(this, obj_file);
618  break;
619 
620  default:
621  fatal("Unknown/unsupported operating system.");
622  }
623 #elif THE_ISA == RISCV_ISA
624  if (obj_file->getArch() != ObjectFile::Riscv)
625  fatal("Object file architecture does not match compiled ISA (RISCV).");
626  switch (obj_file->getOpSys()) {
628  warn("Unknown operating system; assuming Linux.");
629  // fall through
630  case ObjectFile::Linux:
631  process = new RiscvLinuxProcess(this, obj_file);
632  break;
633  default:
634  fatal("Unknown/unsupported operating system.");
635  }
636 #else
637 #error "THE_ISA not set"
638 #endif
639 
640  if (process == nullptr)
641  fatal("Unknown error creating process object.");
642  return process;
643 }
644 
645 std::string
646 Process::fullPath(const std::string &file_name)
647 {
648  if (file_name[0] == '/' || cwd.empty())
649  return file_name;
650 
651  std::string full = cwd;
652 
653  if (cwd[cwd.size() - 1] != '/')
654  full += '/';
655 
656  return full + file_name;
657 }
virtual SyscallDesc * getDesc(int callnum)=0
Declaration of functional page table.
Definition: page_table.hh:205
ObjectFile * objFile
Definition: process.hh:182
void revokeThreadContext(int context_id)
After delegating a thread context to a child process no longer should relate to the ThreadContext...
Definition: process.cc:275
const std::string & name()
Definition: trace.cc:49
static void output(const char *filename)
Definition: debug.cc:63
virtual void getMappings(std::vector< std::pair< Addr, Addr >> *addr_mappings)
Definition: page_table.hh:198
Bitfield< 7 > i
Definition: miscregs.hh:1378
DrainState
Object drain/handover states.
Definition: drain.hh:71
std::string cwd
Definition: process.hh:185
Arch getArch() const
Definition: object_file.hh:111
virtual bool loadGlobalSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=maxAddr)=0
virtual void map(Addr vaddr, Addr paddr, int64_t size, uint64_t flags=0)=0
Maps a virtual memory region to a physical memory region.
std::vector< ContextID > contextIds
Definition: process.hh:168
A process with emulated Arm/Linux syscalls.
Definition: process.hh:68
A process with emulated Mips/Linux syscalls.
Definition: process.hh:40
void doSyscall(int callnum, Process *proc, ThreadContext *tc, Fault *fault)
Interface for invoking the system call funcion pointer.
Definition: syscall_desc.cc:49
void allocateMem(Addr vaddr, int64_t size, bool clobber=false)
Definition: process.cc:310
virtual bool mmapGrowsDown() const
Does mmap region grow upward or downward from mmapEnd? Most platforms grow downward, but a few (such as Alpha) grow upward instead, so they can override this method to return false.
Definition: process.hh:144
bool * sigchld
Definition: process.hh:215
#define CLONE_VM
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Definition: process.cc:385
void regStats() override
Register statistics for this object.
Definition: process.cc:252
Stats::Scalar numSyscalls
Definition: process.hh:173
uint64_t _tgid
Definition: process.hh:198
virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i)=0
Addr allocPhysPages(int npages)
Allocate npages contiguous unused physical pages.
Definition: system.cc:339
A process with emulated Arm/Freebsd syscalls.
Definition: process.hh:58
void setSimFD(int sim_fd)
Definition: fd_entry.hh:87
virtual void readBlob(Addr addr, uint8_t *p, int size) const
Read size bytes memory at address and store in p.
SymbolTable * debugSymbolTable
Global unified debugging symbol table (for target).
Definition: symtab.cc:45
int getSimFD() const
Definition: fd_entry.hh:84
ObjectFile * getInterpreter()
Definition: process.cc:468
void initState() override
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:288
std::string executable
Definition: process.hh:186
virtual bool loadLocalSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=maxAddr)=0
virtual void regStats()
Register statistics for this object.
Definition: sim_object.cc:105
T roundUp(const T &val, const U &align)
Definition: intmath.hh:205
std::shared_ptr< MemState > memState
Definition: process.hh:206
ThreadContext is the external interface to all thread state for anything outside of the CPU...
virtual ObjectFile * getInterpreter() const
Definition: object_file.hh:101
Declaration of Statistics objects.
STL vector class.
Definition: stl.hh:40
virtual bool loadWeakSymbols(SymbolTable *symtab, Addr base=0, Addr offset=0, Addr mask=maxAddr)
Definition: object_file.hh:97
DrainState drain() override
Notify an object that it needs to drain its state.
Definition: process.cc:303
void replicatePage(Addr vaddr, Addr new_paddr, ThreadContext *old_tc, ThreadContext *new_tc, bool alloc_page)
Definition: process.cc:319
#define warn(...)
Definition: misc.hh:219
virtual void updateBias(Addr bias_addr)
Definition: object_file.hh:105
system
Definition: isa.cc:226
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
static const int maxPID
Definition: system.hh:557
bool map(Addr vaddr, Addr paddr, int size, bool cacheable=true)
Maps a contiguous range of virtual addresses in this process's address space to a contiguous range of...
Definition: process.cc:405
uint64_t _pid
Definition: process.hh:195
bool translate(Addr vaddr, Addr &paddr)
Translate function.
Definition: page_table.cc:173
std::set< int > PIDs
Process set to track which PIDs have already been allocated.
Definition: system.hh:560
void setPageTable(PageTableBase *p)
Faux page table class indended to stop the usage of an architectural page table, when there is none d...
Definition: page_table.hh:254
Bitfield< 9 > d
Definition: miscregs.hh:1375
std::vector< ThreadContext * > threadContexts
Definition: system.hh:199
ThreadContext * findFreeContext()
Definition: process.cc:265
#define fatal(...)
Definition: misc.hh:163
Addr getStartPC()
Definition: process.cc:482
Extends the base class to include a host-backed file descriptor field that records the integer used t...
Definition: fd_entry.hh:76
System * system
Definition: process.hh:171
T roundDown(const T &val, const U &align)
Definition: intmath.hh:213
Addr entryPoint() const
Definition: object_file.hh:134
virtual void serialize(CheckpointOut &cp) const =0
Serialize an object.
virtual SETranslatingPortProxy & getMemProxy()=0
std::vector< std::string > envp
Definition: process.hh:184
ThreadContext * getThreadContext(ContextID tid)
Definition: system.hh:203
virtual void activate()=0
Set the status to Active.
A process with emulated Arm/Linux syscalls.
Definition: process.hh:86
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
Draining buffers pending serialization/handover.
EmulatedDriver * findDriver(std::string filename)
Find an emulated device driver.
Definition: process.cc:431
virtual void syscall(int64_t callnum, ThreadContext *tc, Fault *fault)
Definition: process.cc:413
virtual void initState(ThreadContext *tc)=0
const Addr PageBytes
Definition: isa_traits.hh:52
PageTableBase * pTable
Definition: process.hh:178
A process with emulated PPC/Linux syscalls.
Definition: process.hh:39
Declaration of base class for page table.
Definition: page_table.hh:57
A process with emulated Riscv/Linux syscalls.
Definition: process.hh:44
std::string fullPath(const std::string &filename)
Definition: process.cc:646
uint64_t IntReg
Definition: registers.hh:47
This class provides the wrapper interface for the system call implementations which are defined in th...
Definition: syscall_desc.hh:63
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Definition: statistics.hh:254
virtual Addr bias() const
Definition: object_file.hh:107
bool fixupStackFault(Addr vaddr)
Attempt to fix up a fault at vaddr by allocating a page on the stack.
Definition: process.cc:338
int size()
Definition: pagetable.hh:146
virtual const std::string name() const
Definition: sim_object.hh:117
Declarations of a non-full system Page Table.
A process with emulated Arm/Freebsd syscalls.
Definition: process.hh:76
std::ostream CheckpointOut
Definition: serialize.hh:67
Permanently shut down.
Process(ProcessParams *params, ObjectFile *obj_file)
Definition: process.cc:104
ObjectFile * createObjectFile(const string &fname, bool raw)
Definition: object_file.cc:157
void updateBias()
Definition: process.cc:442
T divCeil(const T &a, const U &b)
Definition: intmath.hh:198
TranslatingPortProxy Object Declaration for SE.
Bitfield< 4 > width
Definition: miscregs.hh:1383
#define CLONE_FILES
EmulatedDriver is an abstract base class for fake SE-mode device drivers.
Definition: emul_driver.hh:52
virtual void unserialize(CheckpointIn &cp)=0
Unserialize an object.
#define CLONE_THREAD
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
Definition: statistics.hh:287
void serialize(CheckpointOut &cp) const override
Serialize an object.
Definition: process.cc:368
std::vector< std::string > argv
Definition: process.hh:183
virtual Addr mapSize() const
Definition: object_file.hh:103
void clone(ThreadContext *old_tc, ThreadContext *new_tc, Process *new_p, TheISA::IntReg flags)
Definition: process.cc:160
#define inform(...)
Definition: misc.hh:221
virtual bool relocatable() const
Definition: object_file.hh:102
Bitfield< 1 > x
Definition: types.hh:105
std::shared_ptr< FaultBase > Fault
Definition: types.hh:184
Abstract superclass for simulation objects.
Definition: sim_object.hh:94
Addr getBias()
Definition: process.cc:474
bool * exitGroup
Definition: process.hh:205
virtual void writeBlob(Addr addr, const uint8_t *p, int size) const
Write size bytes from p to address.
std::shared_ptr< FDArray > fds
Definition: process.hh:203
std::vector< EmulatedDriver * > drivers
Definition: process.hh:201
OpSys getOpSys() const
Definition: object_file.hh:112

Generated on Fri Jun 9 2017 13:03:35 for gem5 by doxygen 1.8.6