syscall_emul: [patch 4/22] remove redundant M5_pid field from process
This commit is contained in:
parent
a928a438b8
commit
e387521527
|
@ -179,7 +179,7 @@ void
|
||||||
AlphaLiveProcess::setupASNReg()
|
AlphaLiveProcess::setupASNReg()
|
||||||
{
|
{
|
||||||
ThreadContext *tc = system->getThreadContext(contextIds[0]);
|
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)
|
AlphaLiveProcess::loadState(CheckpointIn &cp)
|
||||||
{
|
{
|
||||||
LiveProcess::loadState(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
|
// come from checkpoint
|
||||||
setupASNReg();
|
setupASNReg();
|
||||||
}
|
}
|
||||||
|
|
|
@ -630,7 +630,7 @@ FastInstructionAccessMMUMiss::invoke(ThreadContext *tc,
|
||||||
} else {
|
} else {
|
||||||
Addr alignedVaddr = p->pTable->pageAlign(vaddr);
|
Addr alignedVaddr = p->pTable->pageAlign(vaddr);
|
||||||
tc->getITBPtr()->insert(alignedVaddr, 0 /*partition id*/,
|
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 {
|
} else {
|
||||||
Addr alignedVaddr = p->pTable->pageAlign(vaddr);
|
Addr alignedVaddr = p->pTable->pageAlign(vaddr);
|
||||||
tc->getDTBPtr()->insert(alignedVaddr, 0 /*partition id*/,
|
tc->getDTBPtr()->insert(alignedVaddr, 0 /*partition id*/,
|
||||||
p->M5_pid /*context id*/, false, entry.pte);
|
p->_pid /*context id*/, false, entry.pte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,13 @@ class Process(SimObject):
|
||||||
kvmInSE = Param.Bool('false', 'initialize the process for KvmCPU in SE')
|
kvmInSE = Param.Bool('false', 'initialize the process for KvmCPU in SE')
|
||||||
max_stack_size = Param.MemorySize('64MB', 'maximum size of the stack')
|
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
|
@classmethod
|
||||||
def export_methods(cls, code):
|
def export_methods(cls, code):
|
||||||
code('bool map(Addr vaddr, Addr paddr, int size, bool cacheable=true);')
|
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)")
|
cmd = VectorParam.String("command line (executable plus arguments)")
|
||||||
env = VectorParam.String([], "environment settings")
|
env = VectorParam.String([], "environment settings")
|
||||||
cwd = Param.String('', "current working directory")
|
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')
|
simpoint = Param.UInt64(0, 'simulation point at which to start simulation')
|
||||||
drivers = VectorParam.EmulatedDriver([], 'Available emulated drivers')
|
drivers = VectorParam.EmulatedDriver([], 'Available emulated drivers')
|
||||||
|
|
||||||
|
|
|
@ -131,12 +131,11 @@ Process::Process(ProcessParams * params)
|
||||||
brk_point(0), stack_base(0), stack_size(0), stack_min(0),
|
brk_point(0), stack_base(0), stack_size(0), stack_min(0),
|
||||||
max_stack_size(params->max_stack_size),
|
max_stack_size(params->max_stack_size),
|
||||||
next_thread_stack_base(0),
|
next_thread_stack_base(0),
|
||||||
M5_pid(system->allocatePID()),
|
|
||||||
useArchPT(params->useArchPT),
|
useArchPT(params->useArchPT),
|
||||||
kvmInSE(params->kvmInSE),
|
kvmInSE(params->kvmInSE),
|
||||||
pTable(useArchPT ?
|
pTable(useArchPT ?
|
||||||
static_cast<PageTableBase *>(new ArchPageTable(name(), M5_pid, system)) :
|
static_cast<PageTableBase *>(new ArchPageTable(name(), _pid, system)) :
|
||||||
static_cast<PageTableBase *>(new FuncPageTable(name(), M5_pid)) ),
|
static_cast<PageTableBase *>(new FuncPageTable(name(), _pid))),
|
||||||
initVirtMem(system->getSystemPort(), this,
|
initVirtMem(system->getSystemPort(), this,
|
||||||
SETranslatingPortProxy::Always),
|
SETranslatingPortProxy::Always),
|
||||||
fd_array(make_shared<array<FDEntry, NUM_FDS>>()),
|
fd_array(make_shared<array<FDEntry, NUM_FDS>>()),
|
||||||
|
@ -147,7 +146,10 @@ Process::Process(ProcessParams * params)
|
||||||
{"cout", STDOUT_FILENO},
|
{"cout", STDOUT_FILENO},
|
||||||
{"stdout", STDOUT_FILENO},
|
{"stdout", STDOUT_FILENO},
|
||||||
{"cerr", STDERR_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;
|
int sim_fd;
|
||||||
std::map<string,int>::iterator it;
|
std::map<string,int>::iterator it;
|
||||||
|
@ -457,7 +459,6 @@ Process::serialize(CheckpointOut &cp) const
|
||||||
for (int x = 0; x < fd_array->size(); x++) {
|
for (int x = 0; x < fd_array->size(); x++) {
|
||||||
(*fd_array)[x].serializeSection(cp, csprintf("FDEntry%d", 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));
|
fde->unserializeSection(cp, csprintf("FDEntry%d", x));
|
||||||
}
|
}
|
||||||
fixFileOffsets();
|
fixFileOffsets();
|
||||||
UNSERIALIZE_OPT_SCALAR(M5_pid);
|
|
||||||
// The above returns a bool so that you could do something if you don't
|
// 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
|
// 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
|
// 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),
|
: Process(params), objFile(_objFile),
|
||||||
argv(params->cmd), envp(params->env), cwd(params->cwd),
|
argv(params->cmd), envp(params->env), cwd(params->cwd),
|
||||||
executable(params->executable),
|
executable(params->executable),
|
||||||
__uid(params->uid), __euid(params->euid),
|
|
||||||
__gid(params->gid), __egid(params->egid),
|
|
||||||
__pid(params->pid), __ppid(params->ppid),
|
|
||||||
drivers(params->drivers)
|
drivers(params->drivers)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -132,10 +132,6 @@ class Process : public SimObject
|
||||||
|
|
||||||
public:
|
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
|
// flag for using architecture specific page table
|
||||||
bool useArchPT;
|
bool useArchPT;
|
||||||
// running KvmCPU in SE mode requires special initialization
|
// running KvmCPU in SE mode requires special initialization
|
||||||
|
@ -231,6 +227,18 @@ class Process : public SimObject
|
||||||
|
|
||||||
void serialize(CheckpointOut &cp) const override;
|
void serialize(CheckpointOut &cp) const override;
|
||||||
void unserialize(CheckpointIn &cp) 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);
|
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
|
// Emulated drivers available to this process
|
||||||
std::vector<EmulatedDriver *> drivers;
|
std::vector<EmulatedDriver *> drivers;
|
||||||
|
|
||||||
|
@ -293,12 +291,12 @@ class LiveProcess : public Process
|
||||||
M5_AT_VECTOR_SIZE = 44
|
M5_AT_VECTOR_SIZE = 44
|
||||||
};
|
};
|
||||||
|
|
||||||
inline uint64_t uid() {return __uid;}
|
inline uint64_t uid() { return _uid; }
|
||||||
inline uint64_t euid() {return __euid;}
|
inline uint64_t euid() { return _euid; }
|
||||||
inline uint64_t gid() {return __gid;}
|
inline uint64_t gid() { return _gid; }
|
||||||
inline uint64_t egid() {return __egid;}
|
inline uint64_t egid() { return _egid; }
|
||||||
inline uint64_t pid() {return __pid;}
|
inline uint64_t pid() { return _pid; }
|
||||||
inline uint64_t ppid() {return __ppid;}
|
inline uint64_t ppid() { return _ppid; }
|
||||||
|
|
||||||
// provide program name for debug messages
|
// provide program name for debug messages
|
||||||
virtual const char *progName() const { return executable.c_str(); }
|
virtual const char *progName() const { return executable.c_str(); }
|
||||||
|
|
|
@ -90,7 +90,6 @@ System::System(Params *p)
|
||||||
kernel(nullptr),
|
kernel(nullptr),
|
||||||
loadAddrMask(p->load_addr_mask),
|
loadAddrMask(p->load_addr_mask),
|
||||||
loadAddrOffset(p->load_offset),
|
loadAddrOffset(p->load_offset),
|
||||||
nextPID(0),
|
|
||||||
physmem(name() + ".physmem", p->memories, p->mmap_using_noreserve),
|
physmem(name() + ".physmem", p->memories, p->mmap_using_noreserve),
|
||||||
memoryMode(p->mem_mode),
|
memoryMode(p->mem_mode),
|
||||||
_cacheLineSize(p->cache_line_size),
|
_cacheLineSize(p->cache_line_size),
|
||||||
|
@ -371,7 +370,6 @@ System::serialize(CheckpointOut &cp) const
|
||||||
if (FullSystem)
|
if (FullSystem)
|
||||||
kernelSymtab->serialize("kernel_symtab", cp);
|
kernelSymtab->serialize("kernel_symtab", cp);
|
||||||
SERIALIZE_SCALAR(pagePtr);
|
SERIALIZE_SCALAR(pagePtr);
|
||||||
SERIALIZE_SCALAR(nextPID);
|
|
||||||
serializeSymtab(cp);
|
serializeSymtab(cp);
|
||||||
|
|
||||||
// also serialize the memories in the system
|
// also serialize the memories in the system
|
||||||
|
@ -385,7 +383,6 @@ System::unserialize(CheckpointIn &cp)
|
||||||
if (FullSystem)
|
if (FullSystem)
|
||||||
kernelSymtab->unserialize("kernel_symtab", cp);
|
kernelSymtab->unserialize("kernel_symtab", cp);
|
||||||
UNSERIALIZE_SCALAR(pagePtr);
|
UNSERIALIZE_SCALAR(pagePtr);
|
||||||
UNSERIALIZE_SCALAR(nextPID);
|
|
||||||
unserializeSymtab(cp);
|
unserializeSymtab(cp);
|
||||||
|
|
||||||
// also unserialize the memories in the system
|
// also unserialize the memories in the system
|
||||||
|
|
|
@ -248,15 +248,7 @@ class System : public MemObject
|
||||||
*/
|
*/
|
||||||
Addr loadAddrOffset;
|
Addr loadAddrOffset;
|
||||||
|
|
||||||
protected:
|
|
||||||
uint64_t nextPID;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
uint64_t allocatePID()
|
|
||||||
{
|
|
||||||
return nextPID++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get a pointer to access the physical memory of the system */
|
/** Get a pointer to access the physical memory of the system */
|
||||||
PhysicalMemory& getPhysMem() { return physmem; }
|
PhysicalMemory& getPhysMem() { return physmem; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue