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/mips/linux/process.cc | 16 ++++++++-------- src/arch/mips/linux/process.hh | 4 ++-- src/arch/mips/process.cc | 18 ++++++++---------- src/arch/mips/process.hh | 8 +++----- 4 files changed, 21 insertions(+), 25 deletions(-) (limited to 'src/arch/mips') diff --git a/src/arch/mips/linux/process.cc b/src/arch/mips/linux/process.cc index 170a3edcc..b36a26fbf 100644 --- a/src/arch/mips/linux/process.cc +++ b/src/arch/mips/linux/process.cc @@ -49,7 +49,7 @@ using namespace MipsISA; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +unameFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -69,7 +69,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 -sys_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +sys_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -98,7 +98,7 @@ sys_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target sys_setsysinfo() handler. static SyscallReturn -sys_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +sys_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -128,7 +128,7 @@ sys_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, } static SyscallReturn -setThreadAreaFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +setThreadAreaFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -460,10 +460,10 @@ SyscallDesc MipsLinuxProcess::syscallDescs[] = { /* 319 */ SyscallDesc("eventfd", unimplementedFunc) }; -MipsLinuxProcess::MipsLinuxProcess(LiveProcessParams * params, - ObjectFile *objFile) - : MipsLiveProcess(params, objFile), - Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) +MipsLinuxProcess::MipsLinuxProcess(ProcessParams * params, + ObjectFile *objFile) + : MipsProcess(params, objFile), + Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) { } SyscallDesc* diff --git a/src/arch/mips/linux/process.hh b/src/arch/mips/linux/process.hh index fd96be4c1..cbf0d78ea 100644 --- a/src/arch/mips/linux/process.hh +++ b/src/arch/mips/linux/process.hh @@ -37,11 +37,11 @@ #include "sim/eventq.hh" /// A process with emulated Mips/Linux syscalls. -class MipsLinuxProcess : public MipsLiveProcess +class MipsLinuxProcess : public MipsProcess { public: /// Constructor. - MipsLinuxProcess(LiveProcessParams * params, ObjectFile *objFile); + MipsLinuxProcess(ProcessParams * params, ObjectFile *objFile); virtual SyscallDesc* getDesc(int callnum); diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc index d26850604..9abe410c7 100644 --- a/src/arch/mips/process.cc +++ b/src/arch/mips/process.cc @@ -47,9 +47,8 @@ using namespace std; using namespace MipsISA; -MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params, - ObjectFile *objFile) - : LiveProcess(params, objFile) +MipsProcess::MipsProcess(ProcessParams * params, ObjectFile *objFile) + : Process(params, objFile) { // Set up stack. On MIPS, stack starts at the top of kuseg // user address space. MIPS stack grows down from here @@ -67,16 +66,16 @@ MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params, } void -MipsLiveProcess::initState() +MipsProcess::initState() { - LiveProcess::initState(); + Process::initState(); argsInit(PageBytes); } template void -MipsLiveProcess::argsInit(int pageSize) +MipsProcess::argsInit(int pageSize) { int intSize = sizeof(IntType); @@ -191,22 +190,21 @@ MipsLiveProcess::argsInit(int pageSize) MipsISA::IntReg -MipsLiveProcess::getSyscallArg(ThreadContext *tc, int &i) +MipsProcess::getSyscallArg(ThreadContext *tc, int &i) { assert(i < 6); return tc->readIntReg(FirstArgumentReg + i++); } void -MipsLiveProcess::setSyscallArg(ThreadContext *tc, - int i, MipsISA::IntReg val) +MipsProcess::setSyscallArg(ThreadContext *tc, int i, MipsISA::IntReg val) { assert(i < 6); tc->setIntReg(FirstArgumentReg + i, val); } void -MipsLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) +MipsProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) { if (sysret.successful()) { // no error diff --git a/src/arch/mips/process.hh b/src/arch/mips/process.hh index e05118e9f..ed6561c1a 100644 --- a/src/arch/mips/process.hh +++ b/src/arch/mips/process.hh @@ -38,14 +38,12 @@ #include "mem/page_table.hh" #include "sim/process.hh" -class LiveProcess; class ObjectFile; -class System; -class MipsLiveProcess : public LiveProcess +class MipsProcess : public Process { protected: - MipsLiveProcess(LiveProcessParams * params, ObjectFile *objFile); + MipsProcess(ProcessParams * params, ObjectFile *objFile); void initState(); @@ -55,7 +53,7 @@ class MipsLiveProcess : public LiveProcess public: MipsISA::IntReg getSyscallArg(ThreadContext *tc, int &i); /// Explicitly import the otherwise hidden getSyscallArg - using LiveProcess::getSyscallArg; + using Process::getSyscallArg; void setSyscallArg(ThreadContext *tc, int i, MipsISA::IntReg val); void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value); }; -- cgit v1.2.3