From 3886c4a8f2e1bfe17cbf7a5a76ba0fc978c6bb48 Mon Sep 17 00:00:00 2001 From: Brandon Potter Date: Wed, 9 Nov 2016 14:27:40 -0600 Subject: syscall_emul: [patch 5/22] remove LiveProcess class and use Process instead The EIOProcess class was removed recently and it was the only other class which derived from Process. Since every Process invocation is also a LiveProcess invocation, it makes sense to simplify the organization by combining the fields from LiveProcess into Process. --- src/arch/alpha/linux/process.cc | 10 +++++----- src/arch/alpha/linux/process.hh | 4 ++-- src/arch/alpha/process.cc | 24 +++++++++++------------- src/arch/alpha/process.hh | 8 ++++---- 4 files changed, 22 insertions(+), 24 deletions(-) (limited to 'src/arch/alpha') diff --git a/src/arch/alpha/linux/process.cc b/src/arch/alpha/linux/process.cc index c5e25c4d1..4a5dbd24f 100644 --- a/src/arch/alpha/linux/process.cc +++ b/src/arch/alpha/linux/process.cc @@ -46,7 +46,7 @@ using namespace AlphaISA; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +unameFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -66,7 +66,7 @@ unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// borrowed from Tru64, the subcases that get used appear to be /// different in practice from those used by Tru64 processes. static SyscallReturn -osf_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +osf_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -95,7 +95,7 @@ osf_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target osf_setsysinfo() handler. static SyscallReturn -osf_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +osf_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -572,9 +572,9 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = { /* 441 */ SyscallDesc("keyctl", unimplementedFunc) }; -AlphaLinuxProcess::AlphaLinuxProcess(LiveProcessParams * params, +AlphaLinuxProcess::AlphaLinuxProcess(ProcessParams * params, ObjectFile *objFile) - : AlphaLiveProcess(params, objFile), + : AlphaProcess(params, objFile), Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) { //init_regs->intRegFile[0] = 0; diff --git a/src/arch/alpha/linux/process.hh b/src/arch/alpha/linux/process.hh index 9ab7b0501..46c22d288 100644 --- a/src/arch/alpha/linux/process.hh +++ b/src/arch/alpha/linux/process.hh @@ -36,11 +36,11 @@ namespace AlphaISA { /// A process with emulated Alpha/Linux syscalls. -class AlphaLinuxProcess : public AlphaLiveProcess +class AlphaLinuxProcess : public AlphaProcess { public: /// Constructor. - AlphaLinuxProcess(LiveProcessParams * params, ObjectFile *objFile); + AlphaLinuxProcess(ProcessParams * params, ObjectFile *objFile); virtual SyscallDesc* getDesc(int callnum); diff --git a/src/arch/alpha/process.cc b/src/arch/alpha/process.cc index 669f7da80..2ed6a5f21 100644 --- a/src/arch/alpha/process.cc +++ b/src/arch/alpha/process.cc @@ -46,9 +46,8 @@ using namespace AlphaISA; using namespace std; -AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams *params, - ObjectFile *objFile) - : LiveProcess(params, objFile) +AlphaProcess::AlphaProcess(ProcessParams *params, ObjectFile *objFile) + : Process(params, objFile) { brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); brk_point = roundUp(brk_point, PageBytes); @@ -67,7 +66,7 @@ AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams *params, } void -AlphaLiveProcess::argsInit(int intSize, int pageSize) +AlphaProcess::argsInit(int intSize, int pageSize) { // Patch the ld_bias for dynamic executables. updateBias(); @@ -176,7 +175,7 @@ AlphaLiveProcess::argsInit(int intSize, int pageSize) } void -AlphaLiveProcess::setupASNReg() +AlphaProcess::setupASNReg() { ThreadContext *tc = system->getThreadContext(contextIds[0]); tc->setMiscRegNoEffect(IPR_DTB_ASN, _pid << 57); @@ -184,9 +183,9 @@ AlphaLiveProcess::setupASNReg() void -AlphaLiveProcess::loadState(CheckpointIn &cp) +AlphaProcess::loadState(CheckpointIn &cp) { - LiveProcess::loadState(cp); + Process::loadState(cp); // need to set up ASN after unserialization since _pid value may // come from checkpoint setupASNReg(); @@ -194,13 +193,13 @@ AlphaLiveProcess::loadState(CheckpointIn &cp) void -AlphaLiveProcess::initState() +AlphaProcess::initState() { // need to set up ASN before further initialization since init // will involve writing to virtual memory addresses setupASNReg(); - LiveProcess::initState(); + Process::initState(); argsInit(MachineBytes, PageBytes); @@ -214,22 +213,21 @@ AlphaLiveProcess::initState() } AlphaISA::IntReg -AlphaLiveProcess::getSyscallArg(ThreadContext *tc, int &i) +AlphaProcess::getSyscallArg(ThreadContext *tc, int &i) { assert(i < 6); return tc->readIntReg(FirstArgumentReg + i++); } void -AlphaLiveProcess::setSyscallArg(ThreadContext *tc, - int i, AlphaISA::IntReg val) +AlphaProcess::setSyscallArg(ThreadContext *tc, int i, AlphaISA::IntReg val) { assert(i < 6); tc->setIntReg(FirstArgumentReg + i, val); } void -AlphaLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) +AlphaProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) { // check for error condition. Alpha syscall convention is to // indicate success/failure in reg a3 (r19) and put the diff --git a/src/arch/alpha/process.hh b/src/arch/alpha/process.hh index e5320564f..5851c866d 100644 --- a/src/arch/alpha/process.hh +++ b/src/arch/alpha/process.hh @@ -35,13 +35,13 @@ #include "mem/page_table.hh" #include "sim/process.hh" -class AlphaLiveProcess : public LiveProcess +class AlphaProcess : public Process { private: void setupASNReg(); protected: - AlphaLiveProcess(LiveProcessParams *params, ObjectFile *objFile); + AlphaProcess(ProcessParams *params, ObjectFile *objFile); void loadState(CheckpointIn &cp) override; void initState() override; @@ -51,12 +51,12 @@ class AlphaLiveProcess : public LiveProcess public: AlphaISA::IntReg getSyscallArg(ThreadContext *tc, int &i) override; /// Explicitly import the otherwise hidden getSyscallArg - using LiveProcess::getSyscallArg; + using Process::getSyscallArg; void setSyscallArg(ThreadContext *tc, int i, AlphaISA::IntReg val) override; void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value) override; - // override default implementation in LiveProcess as the mmap + // override default implementation in Process as the mmap // region for Alpha platforms grows upward virtual bool mmapGrowsDown() const override { return false; } }; -- cgit v1.2.3