#include <unistd.h>
#include <array>
+#include <csignal>
#include <map>
#include <string>
#include <vector>
#if THE_ISA == ALPHA_ISA
#include "arch/alpha/linux/process.hh"
+
#elif THE_ISA == SPARC_ISA
#include "arch/sparc/linux/process.hh"
#include "arch/sparc/solaris/process.hh"
+
#elif THE_ISA == MIPS_ISA
#include "arch/mips/linux/process.hh"
+
#elif THE_ISA == ARM_ISA
-#include "arch/arm/linux/process.hh"
#include "arch/arm/freebsd/process.hh"
+#include "arch/arm/linux/process.hh"
+
#elif THE_ISA == X86_ISA
#include "arch/x86/linux/process.hh"
+
#elif THE_ISA == POWER_ISA
#include "arch/power/linux/process.hh"
+
#elif THE_ISA == RISCV_ISA
#include "arch/riscv/linux/process.hh"
+
#else
#error "THE_ISA not set"
#endif
using namespace std;
using namespace TheISA;
-Process::Process(ProcessParams * params, ObjectFile * obj_file)
+Process::Process(ProcessParams *params, EmulationPageTable *pTable,
+ ObjectFile *obj_file)
: SimObject(params), system(params->system),
useArchPT(params->useArchPT),
kvmInSE(params->kvmInSE),
- pTable(useArchPT ?
- static_cast<PageTableBase *>(new ArchPageTable(name(), params->pid,
- system)) :
- static_cast<PageTableBase *>(new FuncPageTable(name(), params->pid))),
+ pTable(pTable),
initVirtMem(system->getSystemPort(), this,
SETranslatingPortProxy::Always),
objFile(obj_file),
!objFile->loadLocalSymbols(debugSymbolTable) ||
!objFile->loadWeakSymbols(debugSymbolTable)) {
delete debugSymbolTable;
- debugSymbolTable = NULL;
+ debugSymbolTable = nullptr;
}
}
}
Process::clone(ThreadContext *otc, ThreadContext *ntc,
Process *np, TheISA::IntReg flags)
{
+#ifndef CLONE_VM
+#define CLONE_VM 0
+#endif
+#ifndef CLONE_FILES
+#define CLONE_FILES 0
+#endif
+#ifndef CLONE_THREAD
+#define CLONE_THREAD 0
+#endif
if (CLONE_VM & flags) {
/**
* Share the process memory address space between the new process
if (ThreadContext::Halted == it->status())
return it;
}
- return NULL;
+ return nullptr;
}
void
int npages = divCeil(size, (int64_t)PageBytes);
Addr paddr = system->allocPhysPages(npages);
pTable->map(vaddr, paddr, size,
- clobber ? PageTableBase::Clobber : PageTableBase::Zero);
+ clobber ? EmulationPageTable::Clobber :
+ EmulationPageTable::Zero);
}
void
void
Process::serialize(CheckpointOut &cp) const
{
+ memState->serialize(cp);
pTable->serialize(cp);
/**
* Checkpoints for file descriptors currently do not work. Need to
void
Process::unserialize(CheckpointIn &cp)
{
+ memState->unserialize(cp);
pTable->unserialize(cp);
/**
* Checkpoints for file descriptors currently do not work. Need to
Process::map(Addr vaddr, Addr paddr, int size, bool cacheable)
{
pTable->map(vaddr, paddr, size,
- cacheable ? PageTableBase::Zero : PageTableBase::Uncacheable);
+ cacheable ? EmulationPageTable::Zero :
+ EmulationPageTable::Uncacheable);
return true;
}
numSyscalls++;
SyscallDesc *desc = getDesc(callnum);
- if (desc == NULL)
+ if (desc == nullptr)
fatal("Syscall %d out of range", callnum);
desc->doSyscall(callnum, this, tc, fault);
return d;
}
- return NULL;
+ return nullptr;
}
void
Process *
ProcessParams::create()
{
- Process *process = NULL;
+ Process *process = nullptr;
// If not specified, set the executable parameter equal to the
// simulated system's zeroth command line parameter
}
ObjectFile *obj_file = createObjectFile(executable);
- if (obj_file == NULL) {
+ if (obj_file == nullptr) {
fatal("Can't load object file %s", executable);
}
#error "THE_ISA not set"
#endif
- if (process == NULL)
+ if (process == nullptr)
fatal("Unknown error creating process object.");
return process;
}