summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2016-11-09 14:27:40 -0600
committerBrandon Potter <brandon.potter@amd.com>2016-11-09 14:27:40 -0600
commite3875215270220e5142a93848f74ccde9d61b244 (patch)
treeb0b6c47320a35d3b7661f54932229611b4a06150
parenta928a438b8a005e5b6059bc5db0687bf64abcfa6 (diff)
downloadgem5-e3875215270220e5142a93848f74ccde9d61b244.tar.xz
syscall_emul: [patch 4/22] remove redundant M5_pid field from process
-rw-r--r--src/arch/alpha/process.cc4
-rw-r--r--src/arch/sparc/faults.cc4
-rw-r--r--src/sim/Process.py13
-rw-r--r--src/sim/process.cc15
-rw-r--r--src/sim/process.hh38
-rw-r--r--src/sim/system.cc3
-rw-r--r--src/sim/system.hh8
7 files changed, 35 insertions, 50 deletions
diff --git a/src/arch/alpha/process.cc b/src/arch/alpha/process.cc
index 4e9f1e9dd..669f7da80 100644
--- a/src/arch/alpha/process.cc
+++ b/src/arch/alpha/process.cc
@@ -179,7 +179,7 @@ void
AlphaLiveProcess::setupASNReg()
{
ThreadContext *tc = system->getThreadContext(contextIds[0]);
- tc->setMiscRegNoEffect(IPR_DTB_ASN, M5_pid << 57);
+ tc->setMiscRegNoEffect(IPR_DTB_ASN, _pid << 57);
}
@@ -187,7 +187,7 @@ void
AlphaLiveProcess::loadState(CheckpointIn &cp)
{
LiveProcess::loadState(cp);
- // need to set up ASN after unserialization since M5_pid value may
+ // need to set up ASN after unserialization since _pid value may
// come from checkpoint
setupASNReg();
}
diff --git a/src/arch/sparc/faults.cc b/src/arch/sparc/faults.cc
index c181e3021..27a928f48 100644
--- a/src/arch/sparc/faults.cc
+++ b/src/arch/sparc/faults.cc
@@ -630,7 +630,7 @@ FastInstructionAccessMMUMiss::invoke(ThreadContext *tc,
} else {
Addr alignedVaddr = p->pTable->pageAlign(vaddr);
tc->getITBPtr()->insert(alignedVaddr, 0 /*partition id*/,
- p->M5_pid /*context id*/, false, entry.pte);
+ p->_pid /*context id*/, false, entry.pte);
}
}
@@ -654,7 +654,7 @@ FastDataAccessMMUMiss::invoke(ThreadContext *tc, const StaticInstPtr &inst)
} else {
Addr alignedVaddr = p->pTable->pageAlign(vaddr);
tc->getDTBPtr()->insert(alignedVaddr, 0 /*partition id*/,
- p->M5_pid /*context id*/, false, entry.pte);
+ p->_pid /*context id*/, false, entry.pte);
}
}
diff --git a/src/sim/Process.py b/src/sim/Process.py
index ca9aaf5b1..fb1450107 100644
--- a/src/sim/Process.py
+++ b/src/sim/Process.py
@@ -43,6 +43,13 @@ class Process(SimObject):
kvmInSE = Param.Bool('false', 'initialize the process for KvmCPU in SE')
max_stack_size = Param.MemorySize('64MB', 'maximum size of the stack')
+ uid = Param.Int(100, 'user id')
+ euid = Param.Int(100, 'effective user id')
+ gid = Param.Int(100, 'group id')
+ egid = Param.Int(100, 'effective group id')
+ pid = Param.Int(100, 'process id')
+ ppid = Param.Int(99, 'parent process id')
+
@classmethod
def export_methods(cls, code):
code('bool map(Addr vaddr, Addr paddr, int size, bool cacheable=true);')
@@ -60,12 +67,6 @@ class LiveProcess(Process):
cmd = VectorParam.String("command line (executable plus arguments)")
env = VectorParam.String([], "environment settings")
cwd = Param.String('', "current working directory")
- uid = Param.Int(100, 'user id')
- euid = Param.Int(100, 'effective user id')
- gid = Param.Int(100, 'group id')
- egid = Param.Int(100, 'effective group id')
- pid = Param.Int(100, 'process id')
- ppid = Param.Int(99, 'parent process id')
simpoint = Param.UInt64(0, 'simulation point at which to start simulation')
drivers = VectorParam.EmulatedDriver([], 'Available emulated drivers')
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 560870c96..ff6297bbb 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -131,12 +131,11 @@ Process::Process(ProcessParams * params)
brk_point(0), stack_base(0), stack_size(0), stack_min(0),
max_stack_size(params->max_stack_size),
next_thread_stack_base(0),
- M5_pid(system->allocatePID()),
useArchPT(params->useArchPT),
kvmInSE(params->kvmInSE),
pTable(useArchPT ?
- static_cast<PageTableBase *>(new ArchPageTable(name(), M5_pid, system)) :
- static_cast<PageTableBase *>(new FuncPageTable(name(), M5_pid)) ),
+ static_cast<PageTableBase *>(new ArchPageTable(name(), _pid, system)) :
+ static_cast<PageTableBase *>(new FuncPageTable(name(), _pid))),
initVirtMem(system->getSystemPort(), this,
SETranslatingPortProxy::Always),
fd_array(make_shared<array<FDEntry, NUM_FDS>>()),
@@ -147,7 +146,10 @@ Process::Process(ProcessParams * params)
{"cout", STDOUT_FILENO},
{"stdout", STDOUT_FILENO},
{"cerr", STDERR_FILENO},
- {"stderr", STDERR_FILENO}}
+ {"stderr", STDERR_FILENO}},
+ _uid(params->uid), _euid(params->euid),
+ _gid(params->gid), _egid(params->egid),
+ _pid(params->pid), _ppid(params->ppid)
{
int sim_fd;
std::map<string,int>::iterator it;
@@ -457,7 +459,6 @@ Process::serialize(CheckpointOut &cp) const
for (int x = 0; x < fd_array->size(); x++) {
(*fd_array)[x].serializeSection(cp, csprintf("FDEntry%d", x));
}
- SERIALIZE_SCALAR(M5_pid);
}
@@ -478,7 +479,6 @@ Process::unserialize(CheckpointIn &cp)
fde->unserializeSection(cp, csprintf("FDEntry%d", x));
}
fixFileOffsets();
- UNSERIALIZE_OPT_SCALAR(M5_pid);
// The above returns a bool so that you could do something if you don't
// find the param in the checkpoint if you wanted to, like set a default
// but in this case we'll just stick with the instantiated value if not
@@ -506,9 +506,6 @@ LiveProcess::LiveProcess(LiveProcessParams *params, ObjectFile *_objFile)
: Process(params), objFile(_objFile),
argv(params->cmd), envp(params->env), cwd(params->cwd),
executable(params->executable),
- __uid(params->uid), __euid(params->euid),
- __gid(params->gid), __egid(params->egid),
- __pid(params->pid), __ppid(params->ppid),
drivers(params->drivers)
{
diff --git a/src/sim/process.hh b/src/sim/process.hh
index 30852f6af..87536830b 100644
--- a/src/sim/process.hh
+++ b/src/sim/process.hh
@@ -132,10 +132,6 @@ class Process : public SimObject
public:
- //This id is assigned by m5 and is used to keep process' tlb entries
- //separated.
- uint64_t M5_pid;
-
// flag for using architecture specific page table
bool useArchPT;
// running KvmCPU in SE mode requires special initialization
@@ -231,6 +227,18 @@ class Process : public SimObject
void serialize(CheckpointOut &cp) const override;
void unserialize(CheckpointIn &cp) override;
+
+ public:
+ // Id of the owner of the process
+ uint64_t _uid;
+ uint64_t _euid;
+ uint64_t _gid;
+ uint64_t _egid;
+
+ // pid of the process and it's parent
+ uint64_t _pid;
+ uint64_t _ppid;
+
};
//
@@ -248,16 +256,6 @@ class LiveProcess : public Process
LiveProcess(LiveProcessParams *params, ObjectFile *objFile);
- // Id of the owner of the process
- uint64_t __uid;
- uint64_t __euid;
- uint64_t __gid;
- uint64_t __egid;
-
- // pid of the process and it's parent
- uint64_t __pid;
- uint64_t __ppid;
-
// Emulated drivers available to this process
std::vector<EmulatedDriver *> drivers;
@@ -293,12 +291,12 @@ class LiveProcess : public Process
M5_AT_VECTOR_SIZE = 44
};
- inline uint64_t uid() {return __uid;}
- inline uint64_t euid() {return __euid;}
- inline uint64_t gid() {return __gid;}
- inline uint64_t egid() {return __egid;}
- inline uint64_t pid() {return __pid;}
- inline uint64_t ppid() {return __ppid;}
+ inline uint64_t uid() { return _uid; }
+ inline uint64_t euid() { return _euid; }
+ inline uint64_t gid() { return _gid; }
+ inline uint64_t egid() { return _egid; }
+ inline uint64_t pid() { return _pid; }
+ inline uint64_t ppid() { return _ppid; }
// provide program name for debug messages
virtual const char *progName() const { return executable.c_str(); }
diff --git a/src/sim/system.cc b/src/sim/system.cc
index c0fb08318..3aba5afcb 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -90,7 +90,6 @@ System::System(Params *p)
kernel(nullptr),
loadAddrMask(p->load_addr_mask),
loadAddrOffset(p->load_offset),
- nextPID(0),
physmem(name() + ".physmem", p->memories, p->mmap_using_noreserve),
memoryMode(p->mem_mode),
_cacheLineSize(p->cache_line_size),
@@ -371,7 +370,6 @@ System::serialize(CheckpointOut &cp) const
if (FullSystem)
kernelSymtab->serialize("kernel_symtab", cp);
SERIALIZE_SCALAR(pagePtr);
- SERIALIZE_SCALAR(nextPID);
serializeSymtab(cp);
// also serialize the memories in the system
@@ -385,7 +383,6 @@ System::unserialize(CheckpointIn &cp)
if (FullSystem)
kernelSymtab->unserialize("kernel_symtab", cp);
UNSERIALIZE_SCALAR(pagePtr);
- UNSERIALIZE_SCALAR(nextPID);
unserializeSymtab(cp);
// also unserialize the memories in the system
diff --git a/src/sim/system.hh b/src/sim/system.hh
index 2d491e8c3..9010723c0 100644
--- a/src/sim/system.hh
+++ b/src/sim/system.hh
@@ -248,15 +248,7 @@ class System : public MemObject
*/
Addr loadAddrOffset;
- protected:
- uint64_t nextPID;
-
public:
- uint64_t allocatePID()
- {
- return nextPID++;
- }
-
/** Get a pointer to access the physical memory of the system */
PhysicalMemory& getPhysMem() { return physmem; }