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 +- src/arch/arm/freebsd/process.cc | 16 ++-- src/arch/arm/freebsd/process.hh | 14 +-- src/arch/arm/linux/process.cc | 20 ++--- src/arch/arm/linux/process.hh | 10 +-- src/arch/arm/process.cc | 45 +++++----- src/arch/arm/process.hh | 20 ++--- 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 +- src/arch/power/linux/process.cc | 10 +-- src/arch/power/linux/process.hh | 6 +- src/arch/power/process.cc | 16 ++-- src/arch/power/process.hh | 8 +- src/arch/riscv/linux/process.cc | 6 +- src/arch/riscv/linux/process.hh | 4 +- src/arch/riscv/process.cc | 16 ++-- src/arch/riscv/process.hh | 7 +- src/arch/sparc/faults.cc | 20 ++--- src/arch/sparc/linux/process.cc | 12 +-- src/arch/sparc/linux/process.hh | 10 +-- src/arch/sparc/linux/syscalls.cc | 8 +- src/arch/sparc/process.cc | 44 +++++----- src/arch/sparc/process.hh | 23 +++-- src/arch/sparc/solaris/process.cc | 8 +- src/arch/sparc/solaris/process.hh | 4 +- src/arch/x86/linux/process.cc | 31 ++++--- src/arch/x86/linux/process.hh | 8 +- src/arch/x86/process.cc | 58 ++++++------- src/arch/x86/process.hh | 20 ++--- src/gpu-compute/cl_driver.cc | 4 +- src/gpu-compute/cl_driver.hh | 6 +- src/kern/freebsd/freebsd.hh | 2 +- src/kern/linux/linux.cc | 4 +- src/kern/linux/linux.hh | 5 +- src/kern/operatingsystem.cc | 2 +- src/kern/operatingsystem.hh | 5 +- src/sim/Process.py | 21 ++--- src/sim/emul_driver.hh | 8 +- src/sim/process.cc | 156 +++++++++++++++------------------ src/sim/process.hh | 44 +++------- src/sim/syscall_desc.cc | 2 +- src/sim/syscall_desc.hh | 6 +- src/sim/syscall_emul.cc | 116 ++++++++++++------------- src/sim/syscall_emul.hh | 177 +++++++++++++++++++------------------- 49 files changed, 516 insertions(+), 578 deletions(-) (limited to 'src') 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; } }; diff --git a/src/arch/arm/freebsd/process.cc b/src/arch/arm/freebsd/process.cc index 266bab8bf..1ecbdd678 100644 --- a/src/arch/arm/freebsd/process.cc +++ b/src/arch/arm/freebsd/process.cc @@ -53,7 +53,7 @@ using namespace std; using namespace ArmISA; static SyscallReturn -issetugidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +issetugidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { @@ -61,7 +61,7 @@ issetugidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, } static SyscallReturn -sysctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +sysctlFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -1206,9 +1206,9 @@ static SyscallDesc syscallDescs64[] = { /* 547 */ SyscallDesc("unused#547", unimplementedFunc), }; -ArmFreebsdProcess32::ArmFreebsdProcess32(LiveProcessParams * params, +ArmFreebsdProcess32::ArmFreebsdProcess32(ProcessParams * params, ObjectFile *objFile, ObjectFile::Arch _arch) - : ArmLiveProcess32(params, objFile, _arch) + : ArmProcess32(params, objFile, _arch) { SyscallTable table; @@ -1218,9 +1218,9 @@ ArmFreebsdProcess32::ArmFreebsdProcess32(LiveProcessParams * params, syscallTables.push_back(table); } -ArmFreebsdProcess64::ArmFreebsdProcess64(LiveProcessParams * params, +ArmFreebsdProcess64::ArmFreebsdProcess64(ProcessParams * params, ObjectFile *objFile, ObjectFile::Arch _arch) - : ArmLiveProcess64(params, objFile, _arch) + : ArmProcess64(params, objFile, _arch) { SyscallTable table; @@ -1269,13 +1269,13 @@ ArmFreebsdProcess64::getDesc(int callnum) void ArmFreebsdProcess32::initState() { - ArmLiveProcess32::initState(); + ArmProcess32::initState(); // The 32 bit equivalent of the comm page would be set up here. } void ArmFreebsdProcess64::initState() { - ArmLiveProcess64::initState(); + ArmProcess64::initState(); // The 64 bit equivalent of the comm page would be set up here. } diff --git a/src/arch/arm/freebsd/process.hh b/src/arch/arm/freebsd/process.hh index 4907c2020..28504d7d8 100644 --- a/src/arch/arm/freebsd/process.hh +++ b/src/arch/arm/freebsd/process.hh @@ -55,16 +55,16 @@ class ArmFreebsdProcessBits }; /// A process with emulated Arm/Freebsd syscalls. -class ArmFreebsdProcess32 : public ArmLiveProcess32, public ArmFreebsdProcessBits +class ArmFreebsdProcess32 : public ArmProcess32, public ArmFreebsdProcessBits { public: - ArmFreebsdProcess32(LiveProcessParams * params, ObjectFile *objFile, - ObjectFile::Arch _arch); + ArmFreebsdProcess32(ProcessParams * params, ObjectFile *objFile, + ObjectFile::Arch _arch); void initState(); /// Explicitly import the otherwise hidden getSyscallArg - using ArmLiveProcess::getSyscallArg; + using ArmProcess::getSyscallArg; /// A page to hold "kernel" provided functions. The name might be wrong. static const Addr commPage; @@ -73,11 +73,11 @@ class ArmFreebsdProcess32 : public ArmLiveProcess32, public ArmFreebsdProcessBit }; /// A process with emulated Arm/Freebsd syscalls. -class ArmFreebsdProcess64 : public ArmLiveProcess64, public ArmFreebsdProcessBits +class ArmFreebsdProcess64 : public ArmProcess64, public ArmFreebsdProcessBits { public: - ArmFreebsdProcess64(LiveProcessParams * params, ObjectFile *objFile, - ObjectFile::Arch _arch); + ArmFreebsdProcess64(ProcessParams * params, ObjectFile *objFile, + ObjectFile::Arch _arch); void initState(); SyscallDesc* getDesc(int callnum); diff --git a/src/arch/arm/linux/process.cc b/src/arch/arm/linux/process.cc index 36a628d52..b8f40be81 100644 --- a/src/arch/arm/linux/process.cc +++ b/src/arch/arm/linux/process.cc @@ -61,7 +61,7 @@ using namespace ArmISA; /// Target uname() handler. static SyscallReturn -unameFunc32(SyscallDesc *desc, int callnum, LiveProcess *process, +unameFunc32(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -79,7 +79,7 @@ unameFunc32(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target uname() handler. static SyscallReturn -unameFunc64(SyscallDesc *desc, int callnum, LiveProcess *process, +unameFunc64(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -97,7 +97,7 @@ unameFunc64(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target set_tls() handler. static SyscallReturn -setTLSFunc32(SyscallDesc *desc, int callnum, LiveProcess *process, +setTLSFunc32(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -110,7 +110,7 @@ setTLSFunc32(SyscallDesc *desc, int callnum, LiveProcess *process, } static SyscallReturn -setTLSFunc64(SyscallDesc *desc, int callnum, LiveProcess *process, +setTLSFunc64(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -1589,9 +1589,9 @@ static SyscallDesc privSyscallDescs64[] = { /* 5 */ SyscallDesc("set_tls", setTLSFunc64) }; -ArmLinuxProcess32::ArmLinuxProcess32(LiveProcessParams * params, +ArmLinuxProcess32::ArmLinuxProcess32(ProcessParams * params, ObjectFile *objFile, ObjectFile::Arch _arch) - : ArmLiveProcess32(params, objFile, _arch) + : ArmProcess32(params, objFile, _arch) { SyscallTable table; @@ -1608,9 +1608,9 @@ ArmLinuxProcess32::ArmLinuxProcess32(LiveProcessParams * params, syscallTables.push_back(table); } -ArmLinuxProcess64::ArmLinuxProcess64(LiveProcessParams * params, +ArmLinuxProcess64::ArmLinuxProcess64(ProcessParams * params, ObjectFile *objFile, ObjectFile::Arch _arch) - : ArmLiveProcess64(params, objFile, _arch) + : ArmProcess64(params, objFile, _arch) { SyscallTable table; @@ -1667,7 +1667,7 @@ ArmLinuxProcess64::getDesc(int callnum) void ArmLinuxProcess32::initState() { - ArmLiveProcess32::initState(); + ArmProcess32::initState(); allocateMem(commPage, PageBytes); ThreadContext *tc = system->getThreadContext(contextIds[0]); @@ -1714,6 +1714,6 @@ ArmLinuxProcess32::initState() void ArmLinuxProcess64::initState() { - ArmLiveProcess64::initState(); + ArmProcess64::initState(); // The 64 bit equivalent of the comm page would be set up here. } diff --git a/src/arch/arm/linux/process.hh b/src/arch/arm/linux/process.hh index 670739438..d4b7ca7d3 100644 --- a/src/arch/arm/linux/process.hh +++ b/src/arch/arm/linux/process.hh @@ -65,16 +65,16 @@ class ArmLinuxProcessBits }; /// A process with emulated Arm/Linux syscalls. -class ArmLinuxProcess32 : public ArmLiveProcess32, public ArmLinuxProcessBits +class ArmLinuxProcess32 : public ArmProcess32, public ArmLinuxProcessBits { public: - ArmLinuxProcess32(LiveProcessParams * params, ObjectFile *objFile, + ArmLinuxProcess32(ProcessParams * params, ObjectFile *objFile, ObjectFile::Arch _arch); void initState(); /// Explicitly import the otherwise hidden getSyscallArg - using ArmLiveProcess::getSyscallArg; + using ArmProcess::getSyscallArg; /// A page to hold "kernel" provided functions. The name might be wrong. static const Addr commPage; @@ -83,10 +83,10 @@ class ArmLinuxProcess32 : public ArmLiveProcess32, public ArmLinuxProcessBits }; /// A process with emulated Arm/Linux syscalls. -class ArmLinuxProcess64 : public ArmLiveProcess64, public ArmLinuxProcessBits +class ArmLinuxProcess64 : public ArmProcess64, public ArmLinuxProcessBits { public: - ArmLinuxProcess64(LiveProcessParams * params, ObjectFile *objFile, + ArmLinuxProcess64(ProcessParams * params, ObjectFile *objFile, ObjectFile::Arch _arch); void initState(); diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc index 41bfa5b13..0bedcb58c 100644 --- a/src/arch/arm/process.cc +++ b/src/arch/arm/process.cc @@ -59,15 +59,15 @@ using namespace std; using namespace ArmISA; -ArmLiveProcess::ArmLiveProcess(LiveProcessParams *params, ObjectFile *objFile, - ObjectFile::Arch _arch) - : LiveProcess(params, objFile), arch(_arch) +ArmProcess::ArmProcess(ProcessParams *params, ObjectFile *objFile, + ObjectFile::Arch _arch) + : Process(params, objFile), arch(_arch) { } -ArmLiveProcess32::ArmLiveProcess32(LiveProcessParams *params, - ObjectFile *objFile, ObjectFile::Arch _arch) - : ArmLiveProcess(params, objFile, _arch) +ArmProcess32::ArmProcess32(ProcessParams *params, ObjectFile *objFile, + ObjectFile::Arch _arch) + : ArmProcess(params, objFile, _arch) { stack_base = 0xbf000000L; @@ -82,9 +82,9 @@ ArmLiveProcess32::ArmLiveProcess32(LiveProcessParams *params, mmap_end = 0x40000000L; } -ArmLiveProcess64::ArmLiveProcess64(LiveProcessParams *params, - ObjectFile *objFile, ObjectFile::Arch _arch) - : ArmLiveProcess(params, objFile, _arch) +ArmProcess64::ArmProcess64(ProcessParams *params, ObjectFile *objFile, + ObjectFile::Arch _arch) + : ArmProcess(params, objFile, _arch) { stack_base = 0x7fffff0000L; @@ -100,9 +100,9 @@ ArmLiveProcess64::ArmLiveProcess64(LiveProcessParams *params, } void -ArmLiveProcess32::initState() +ArmProcess32::initState() { - LiveProcess::initState(); + Process::initState(); argsInit(PageBytes, INTREG_SP); for (int i = 0; i < contextIds.size(); i++) { ThreadContext * tc = system->getThreadContext(contextIds[i]); @@ -119,9 +119,9 @@ ArmLiveProcess32::initState() } void -ArmLiveProcess64::initState() +ArmProcess64::initState() { - LiveProcess::initState(); + Process::initState(); argsInit(PageBytes, INTREG_SP0); for (int i = 0; i < contextIds.size(); i++) { ThreadContext * tc = system->getThreadContext(contextIds[i]); @@ -142,7 +142,7 @@ ArmLiveProcess64::initState() template void -ArmLiveProcess::argsInit(int pageSize, IntRegIndex spIndex) +ArmProcess::argsInit(int pageSize, IntRegIndex spIndex) { int intSize = sizeof(IntType); @@ -405,21 +405,21 @@ ArmLiveProcess::argsInit(int pageSize, IntRegIndex spIndex) } ArmISA::IntReg -ArmLiveProcess32::getSyscallArg(ThreadContext *tc, int &i) +ArmProcess32::getSyscallArg(ThreadContext *tc, int &i) { assert(i < 6); return tc->readIntReg(ArgumentReg0 + i++); } ArmISA::IntReg -ArmLiveProcess64::getSyscallArg(ThreadContext *tc, int &i) +ArmProcess64::getSyscallArg(ThreadContext *tc, int &i) { assert(i < 8); return tc->readIntReg(ArgumentReg0 + i++); } ArmISA::IntReg -ArmLiveProcess32::getSyscallArg(ThreadContext *tc, int &i, int width) +ArmProcess32::getSyscallArg(ThreadContext *tc, int &i, int width) { assert(width == 32 || width == 64); if (width == 32) @@ -438,29 +438,28 @@ ArmLiveProcess32::getSyscallArg(ThreadContext *tc, int &i, int width) } ArmISA::IntReg -ArmLiveProcess64::getSyscallArg(ThreadContext *tc, int &i, int width) +ArmProcess64::getSyscallArg(ThreadContext *tc, int &i, int width) { return getSyscallArg(tc, i); } void -ArmLiveProcess32::setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val) +ArmProcess32::setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val) { assert(i < 6); tc->setIntReg(ArgumentReg0 + i, val); } void -ArmLiveProcess64::setSyscallArg(ThreadContext *tc, - int i, ArmISA::IntReg val) +ArmProcess64::setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val) { assert(i < 8); tc->setIntReg(ArgumentReg0 + i, val); } void -ArmLiveProcess32::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) +ArmProcess32::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) { if (objFile->getOpSys() == ObjectFile::FreeBSD) { @@ -477,7 +476,7 @@ ArmLiveProcess32::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) } void -ArmLiveProcess64::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) +ArmProcess64::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) { if (objFile->getOpSys() == ObjectFile::FreeBSD) { diff --git a/src/arch/arm/process.hh b/src/arch/arm/process.hh index 657f30af8..f8e6542ff 100644 --- a/src/arch/arm/process.hh +++ b/src/arch/arm/process.hh @@ -51,25 +51,23 @@ #include "mem/page_table.hh" #include "sim/process.hh" -class LiveProcess; class ObjectFile; -class System; -class ArmLiveProcess : public LiveProcess +class ArmProcess : public Process { protected: ObjectFile::Arch arch; - ArmLiveProcess(LiveProcessParams * params, ObjectFile *objFile, - ObjectFile::Arch _arch); + ArmProcess(ProcessParams * params, ObjectFile *objFile, + ObjectFile::Arch _arch); template void argsInit(int pageSize, ArmISA::IntRegIndex spIndex); }; -class ArmLiveProcess32 : public ArmLiveProcess +class ArmProcess32 : public ArmProcess { protected: - ArmLiveProcess32(LiveProcessParams * params, ObjectFile *objFile, - ObjectFile::Arch _arch); + ArmProcess32(ProcessParams * params, ObjectFile *objFile, + ObjectFile::Arch _arch); void initState(); @@ -81,11 +79,11 @@ class ArmLiveProcess32 : public ArmLiveProcess void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value); }; -class ArmLiveProcess64 : public ArmLiveProcess +class ArmProcess64 : public ArmProcess { protected: - ArmLiveProcess64(LiveProcessParams * params, ObjectFile *objFile, - ObjectFile::Arch _arch); + ArmProcess64(ProcessParams * params, ObjectFile *objFile, + ObjectFile::Arch _arch); void initState(); 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); }; diff --git a/src/arch/power/linux/process.cc b/src/arch/power/linux/process.cc index b39027dee..801274969 100644 --- a/src/arch/power/linux/process.cc +++ b/src/arch/power/linux/process.cc @@ -49,7 +49,7 @@ using namespace PowerISA; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +unameFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -415,10 +415,10 @@ SyscallDesc PowerLinuxProcess::syscallDescs[] = { /* 346 */ SyscallDesc("epoll_pwait", unimplementedFunc), }; -PowerLinuxProcess::PowerLinuxProcess(LiveProcessParams * params, +PowerLinuxProcess::PowerLinuxProcess(ProcessParams * params, ObjectFile *objFile) - : PowerLiveProcess(params, objFile), - Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) + : PowerProcess(params, objFile), + Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) { } @@ -434,7 +434,7 @@ PowerLinuxProcess::getDesc(int callnum) void PowerLinuxProcess::initState() { - PowerLiveProcess::initState(); + PowerProcess::initState(); } PowerISA::IntReg diff --git a/src/arch/power/linux/process.hh b/src/arch/power/linux/process.hh index e3f3071b8..9874123dc 100644 --- a/src/arch/power/linux/process.hh +++ b/src/arch/power/linux/process.hh @@ -36,10 +36,10 @@ #include "arch/power/process.hh" /// A process with emulated PPC/Linux syscalls. -class PowerLinuxProcess : public PowerLiveProcess +class PowerLinuxProcess : public PowerProcess { public: - PowerLinuxProcess(LiveProcessParams * params, ObjectFile *objFile); + PowerLinuxProcess(ProcessParams * params, ObjectFile *objFile); virtual SyscallDesc* getDesc(int callnum); @@ -47,7 +47,7 @@ class PowerLinuxProcess : public PowerLiveProcess PowerISA::IntReg getSyscallArg(ThreadContext *tc, int &i); /// Explicitly import the otherwise hidden getSyscallArg - using LiveProcess::getSyscallArg; + using Process::getSyscallArg; void setSyscallArg(ThreadContext *tc, int i, PowerISA::IntReg val); /// Array of syscall descriptors, indexed by call number. diff --git a/src/arch/power/process.cc b/src/arch/power/process.cc index f7cb41dbb..91e91b672 100644 --- a/src/arch/power/process.cc +++ b/src/arch/power/process.cc @@ -47,9 +47,8 @@ using namespace std; using namespace PowerISA; -PowerLiveProcess::PowerLiveProcess(LiveProcessParams *params, - ObjectFile *objFile) - : LiveProcess(params, objFile) +PowerProcess::PowerProcess(ProcessParams *params, ObjectFile *objFile) + : Process(params, objFile) { stack_base = 0xbf000000L; @@ -65,7 +64,7 @@ PowerLiveProcess::PowerLiveProcess(LiveProcessParams *params, } void -PowerLiveProcess::initState() +PowerProcess::initState() { Process::initState(); @@ -73,7 +72,7 @@ PowerLiveProcess::initState() } void -PowerLiveProcess::argsInit(int intSize, int pageSize) +PowerProcess::argsInit(int intSize, int pageSize) { typedef AuxVector auxv_t; std::vector auxv; @@ -266,22 +265,21 @@ PowerLiveProcess::argsInit(int intSize, int pageSize) } PowerISA::IntReg -PowerLiveProcess::getSyscallArg(ThreadContext *tc, int &i) +PowerProcess::getSyscallArg(ThreadContext *tc, int &i) { assert(i < 5); return tc->readIntReg(ArgumentReg0 + i++); } void -PowerLiveProcess::setSyscallArg(ThreadContext *tc, - int i, PowerISA::IntReg val) +PowerProcess::setSyscallArg(ThreadContext *tc, int i, PowerISA::IntReg val) { assert(i < 5); tc->setIntReg(ArgumentReg0 + i, val); } void -PowerLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) +PowerProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) { Cr cr = tc->readIntReg(INTREG_CR); if (sysret.successful()) { diff --git a/src/arch/power/process.hh b/src/arch/power/process.hh index cc023e2c9..08efdfeec 100644 --- a/src/arch/power/process.hh +++ b/src/arch/power/process.hh @@ -39,14 +39,12 @@ #include "mem/page_table.hh" #include "sim/process.hh" -class LiveProcess; class ObjectFile; -class System; -class PowerLiveProcess : public LiveProcess +class PowerProcess : public Process { protected: - PowerLiveProcess(LiveProcessParams * params, ObjectFile *objFile); + PowerProcess(ProcessParams * params, ObjectFile *objFile); void initState(); @@ -54,7 +52,7 @@ class PowerLiveProcess : public LiveProcess void argsInit(int intSize, int pageSize); PowerISA::IntReg getSyscallArg(ThreadContext *tc, int &i); /// Explicitly import the otherwise hidden getSyscallArg - using LiveProcess::getSyscallArg; + using Process::getSyscallArg; void setSyscallArg(ThreadContext *tc, int i, PowerISA::IntReg val); void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value); }; diff --git a/src/arch/riscv/linux/process.cc b/src/arch/riscv/linux/process.cc index c6c61c751..24ea056cd 100644 --- a/src/arch/riscv/linux/process.cc +++ b/src/arch/riscv/linux/process.cc @@ -53,7 +53,7 @@ using namespace RiscvISA; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +unameFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -126,8 +126,8 @@ std::map RiscvLinuxProcess::syscallDescs = { {2011, SyscallDesc("getmainvars", unimplementedFunc)}, }; -RiscvLinuxProcess::RiscvLinuxProcess(LiveProcessParams * params, - ObjectFile *objFile) : RiscvLiveProcess(params, objFile) +RiscvLinuxProcess::RiscvLinuxProcess(ProcessParams * params, + ObjectFile *objFile) : RiscvProcess(params, objFile) {} SyscallDesc* diff --git a/src/arch/riscv/linux/process.hh b/src/arch/riscv/linux/process.hh index 5edc0e149..f83037fd4 100644 --- a/src/arch/riscv/linux/process.hh +++ b/src/arch/riscv/linux/process.hh @@ -41,11 +41,11 @@ #include "sim/eventq.hh" /// A process with emulated Riscv/Linux syscalls. -class RiscvLinuxProcess : public RiscvLiveProcess +class RiscvLinuxProcess : public RiscvProcess { public: /// Constructor. - RiscvLinuxProcess(LiveProcessParams * params, ObjectFile *objFile); + RiscvLinuxProcess(ProcessParams * params, ObjectFile *objFile); virtual SyscallDesc* getDesc(int callnum); diff --git a/src/arch/riscv/process.cc b/src/arch/riscv/process.cc index 4eb3159af..8629a57d6 100644 --- a/src/arch/riscv/process.cc +++ b/src/arch/riscv/process.cc @@ -50,8 +50,8 @@ using namespace std; using namespace RiscvISA; -RiscvLiveProcess::RiscvLiveProcess(LiveProcessParams * params, - ObjectFile *objFile) : LiveProcess(params, objFile) +RiscvProcess::RiscvProcess(ProcessParams * params, + ObjectFile *objFile) : Process(params, objFile) { // Set up stack. On RISC-V, stack starts at the top of kuseg // user address space. RISC-V stack grows down from here @@ -68,15 +68,15 @@ RiscvLiveProcess::RiscvLiveProcess(LiveProcessParams * params, } void -RiscvLiveProcess::initState() +RiscvProcess::initState() { - LiveProcess::initState(); + Process::initState(); argsInit(PageBytes); } template void -RiscvLiveProcess::argsInit(int pageSize) +RiscvProcess::argsInit(int pageSize) { updateBias(); @@ -215,7 +215,7 @@ RiscvLiveProcess::argsInit(int pageSize) } RiscvISA::IntReg -RiscvLiveProcess::getSyscallArg(ThreadContext *tc, int &i) +RiscvProcess::getSyscallArg(ThreadContext *tc, int &i) { // RISC-V only has four system call argument registers by convention, so // if a larger index is requested return 0 @@ -227,13 +227,13 @@ RiscvLiveProcess::getSyscallArg(ThreadContext *tc, int &i) } void -RiscvLiveProcess::setSyscallArg(ThreadContext *tc, int i, RiscvISA::IntReg val) +RiscvProcess::setSyscallArg(ThreadContext *tc, int i, RiscvISA::IntReg val) { tc->setIntReg(SyscallArgumentRegs[i], val); } void -RiscvLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) +RiscvProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) { if (sysret.successful()) { // no error diff --git a/src/arch/riscv/process.hh b/src/arch/riscv/process.hh index 53aa7c00a..8275a118a 100644 --- a/src/arch/riscv/process.hh +++ b/src/arch/riscv/process.hh @@ -38,14 +38,13 @@ #include "mem/page_table.hh" #include "sim/process.hh" -class LiveProcess; class ObjectFile; class System; -class RiscvLiveProcess : public LiveProcess +class RiscvProcess : public Process { protected: - RiscvLiveProcess(LiveProcessParams * params, ObjectFile *objFile); + RiscvProcess(ProcessParams * params, ObjectFile *objFile); void initState(); @@ -55,7 +54,7 @@ class RiscvLiveProcess : public LiveProcess public: RiscvISA::IntReg getSyscallArg(ThreadContext *tc, int &i); /// Explicitly import the otherwise hidden getSyscallArg - using LiveProcess::getSyscallArg; + using Process::getSyscallArg; void setSyscallArg(ThreadContext *tc, int i, RiscvISA::IntReg val); void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value); }; diff --git a/src/arch/sparc/faults.cc b/src/arch/sparc/faults.cc index e2ff87726..6c3b35c9a 100644 --- a/src/arch/sparc/faults.cc +++ b/src/arch/sparc/faults.cc @@ -768,12 +768,11 @@ SpillNNormal::invoke(ThreadContext *tc, const StaticInstPtr &inst) Process *p = tc->getProcessPtr(); - //XXX This will only work in faults from a SparcLiveProcess - SparcLiveProcess *lp = dynamic_cast(p); - assert(lp); + SparcProcess *sp = dynamic_cast(p); + assert(sp); // Then adjust the PC and NPC - tc->pcState(lp->readSpillStart()); + tc->pcState(sp->readSpillStart()); } void @@ -788,12 +787,11 @@ FillNNormal::invoke(ThreadContext *tc, const StaticInstPtr &inst) Process *p = tc->getProcessPtr(); - //XXX This will only work in faults from a SparcLiveProcess - SparcLiveProcess *lp = dynamic_cast(p); - assert(lp); + SparcProcess *sp = dynamic_cast(p); + assert(sp); // Then adjust the PC and NPC - tc->pcState(lp->readFillStart()); + tc->pcState(sp->readFillStart()); } void @@ -810,10 +808,10 @@ TrapInstruction::invoke(ThreadContext *tc, const StaticInstPtr &inst) Process *p = tc->getProcessPtr(); - SparcLiveProcess *lp = dynamic_cast(p); - assert(lp); + SparcProcess *sp = dynamic_cast(p); + assert(sp); - lp->handleTrap(_n, tc); + sp->handleTrap(_n, tc); // We need to explicitly advance the pc, since that's not done for us // on a faulting instruction diff --git a/src/arch/sparc/linux/process.cc b/src/arch/sparc/linux/process.cc index a95498ea0..0f72c69c7 100644 --- a/src/arch/sparc/linux/process.cc +++ b/src/arch/sparc/linux/process.cc @@ -60,9 +60,9 @@ SparcLinuxProcess::getDesc32(int callnum) return &syscall32Descs[callnum]; } -Sparc32LinuxProcess::Sparc32LinuxProcess(LiveProcessParams * params, +Sparc32LinuxProcess::Sparc32LinuxProcess(ProcessParams * params, ObjectFile *objFile) - : Sparc32LiveProcess(params, objFile) + : Sparc32Process(params, objFile) {} void Sparc32LinuxProcess::handleTrap(int trapNum, ThreadContext *tc) @@ -72,13 +72,13 @@ void Sparc32LinuxProcess::handleTrap(int trapNum, ThreadContext *tc) tc->syscall(tc->readIntReg(1)); break; default: - SparcLiveProcess::handleTrap(trapNum, tc); + SparcProcess::handleTrap(trapNum, tc); } } -Sparc64LinuxProcess::Sparc64LinuxProcess(LiveProcessParams * params, +Sparc64LinuxProcess::Sparc64LinuxProcess(ProcessParams * params, ObjectFile *objFile) - : Sparc64LiveProcess(params, objFile) + : Sparc64Process(params, objFile) {} void Sparc64LinuxProcess::handleTrap(int trapNum, ThreadContext *tc) @@ -89,6 +89,6 @@ void Sparc64LinuxProcess::handleTrap(int trapNum, ThreadContext *tc) tc->syscall(tc->readIntReg(1)); break; default: - SparcLiveProcess::handleTrap(trapNum, tc); + SparcProcess::handleTrap(trapNum, tc); } } diff --git a/src/arch/sparc/linux/process.hh b/src/arch/sparc/linux/process.hh index 022b1176d..1c38576fd 100644 --- a/src/arch/sparc/linux/process.hh +++ b/src/arch/sparc/linux/process.hh @@ -58,11 +58,11 @@ class SparcLinuxProcess }; /// A process with emulated SPARC/Linux syscalls. -class Sparc32LinuxProcess : public SparcLinuxProcess, public Sparc32LiveProcess +class Sparc32LinuxProcess : public SparcLinuxProcess, public Sparc32Process { public: /// Constructor. - Sparc32LinuxProcess(LiveProcessParams * params, ObjectFile *objFile); + Sparc32LinuxProcess(ProcessParams * params, ObjectFile *objFile); SyscallDesc* getDesc(int callnum) @@ -74,11 +74,11 @@ class Sparc32LinuxProcess : public SparcLinuxProcess, public Sparc32LiveProcess }; /// A process with emulated 32 bit SPARC/Linux syscalls. -class Sparc64LinuxProcess : public SparcLinuxProcess, public Sparc64LiveProcess +class Sparc64LinuxProcess : public SparcLinuxProcess, public Sparc64Process { public: /// Constructor. - Sparc64LinuxProcess(LiveProcessParams * params, ObjectFile *objFile); + Sparc64LinuxProcess(ProcessParams * params, ObjectFile *objFile); SyscallDesc* getDesc(int callnum) @@ -90,7 +90,7 @@ class Sparc64LinuxProcess : public SparcLinuxProcess, public Sparc64LiveProcess }; SyscallReturn getresuidFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); } // namespace SparcISA #endif // __SPARC_LINUX_PROCESS_HH__ diff --git a/src/arch/sparc/linux/syscalls.cc b/src/arch/sparc/linux/syscalls.cc index 33140f1b8..6825b2abb 100644 --- a/src/arch/sparc/linux/syscalls.cc +++ b/src/arch/sparc/linux/syscalls.cc @@ -32,15 +32,15 @@ #include "sim/syscall_desc.hh" #include "sim/syscall_emul.hh" -class LiveProcess; +class Process; class ThreadContext; namespace SparcISA { /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +unameFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { int index = 0; TypedBufferArg name(process->getSyscallArg(tc, index)); @@ -58,7 +58,7 @@ unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, SyscallReturn -getresuidFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +getresuidFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { const IntReg id = htog(100); int index = 0; diff --git a/src/arch/sparc/process.cc b/src/arch/sparc/process.cc index 75c2529ef..87790e9c3 100644 --- a/src/arch/sparc/process.cc +++ b/src/arch/sparc/process.cc @@ -52,9 +52,9 @@ using namespace SparcISA; static const int FirstArgumentReg = 8; -SparcLiveProcess::SparcLiveProcess(LiveProcessParams * params, - ObjectFile *objFile, Addr _StackBias) - : LiveProcess(params, objFile), StackBias(_StackBias) +SparcProcess::SparcProcess(ProcessParams * params, ObjectFile *objFile, + Addr _StackBias) + : Process(params, objFile), StackBias(_StackBias) { // XXX all the below need to be updated for SPARC - Ali @@ -70,7 +70,7 @@ SparcLiveProcess::SparcLiveProcess(LiveProcessParams * params, } void -SparcLiveProcess::handleTrap(int trapNum, ThreadContext *tc) +SparcProcess::handleTrap(int trapNum, ThreadContext *tc) { PCState pc = tc->pcState(); switch (trapNum) { @@ -111,9 +111,9 @@ SparcLiveProcess::handleTrap(int trapNum, ThreadContext *tc) } void -SparcLiveProcess::initState() +SparcProcess::initState() { - LiveProcess::initState(); + Process::initState(); ThreadContext *tc = system->getThreadContext(contextIds[0]); // From the SPARC ABI @@ -160,9 +160,9 @@ SparcLiveProcess::initState() } void -Sparc32LiveProcess::initState() +Sparc32Process::initState() { - SparcLiveProcess::initState(); + SparcProcess::initState(); ThreadContext *tc = system->getThreadContext(contextIds[0]); // The process runs in user mode with 32 bit addresses @@ -175,9 +175,9 @@ Sparc32LiveProcess::initState() } void -Sparc64LiveProcess::initState() +Sparc64Process::initState() { - SparcLiveProcess::initState(); + SparcProcess::initState(); ThreadContext *tc = system->getThreadContext(contextIds[0]); // The process runs in user mode @@ -190,7 +190,7 @@ Sparc64LiveProcess::initState() template void -SparcLiveProcess::argsInit(int pageSize) +SparcProcess::argsInit(int pageSize) { int intSize = sizeof(IntType); @@ -419,9 +419,9 @@ SparcLiveProcess::argsInit(int pageSize) } void -Sparc64LiveProcess::argsInit(int intSize, int pageSize) +Sparc64Process::argsInit(int intSize, int pageSize) { - SparcLiveProcess::argsInit(pageSize); + SparcProcess::argsInit(pageSize); // Stuff the trap handlers into the process address space initVirtMem.writeBlob(fillStart, @@ -431,9 +431,9 @@ Sparc64LiveProcess::argsInit(int intSize, int pageSize) } void -Sparc32LiveProcess::argsInit(int intSize, int pageSize) +Sparc32Process::argsInit(int intSize, int pageSize) { - SparcLiveProcess::argsInit(pageSize); + SparcProcess::argsInit(pageSize); // Stuff the trap handlers into the process address space initVirtMem.writeBlob(fillStart, @@ -442,7 +442,7 @@ Sparc32LiveProcess::argsInit(int intSize, int pageSize) (uint8_t*)spillHandler32, sizeof(MachInst) * numSpillInsts); } -void Sparc32LiveProcess::flushWindows(ThreadContext *tc) +void Sparc32Process::flushWindows(ThreadContext *tc) { IntReg Cansave = tc->readIntReg(NumIntArchRegs + 3); IntReg Canrestore = tc->readIntReg(NumIntArchRegs + 4); @@ -477,7 +477,7 @@ void Sparc32LiveProcess::flushWindows(ThreadContext *tc) } void -Sparc64LiveProcess::flushWindows(ThreadContext *tc) +Sparc64Process::flushWindows(ThreadContext *tc) { IntReg Cansave = tc->readIntReg(NumIntArchRegs + 3); IntReg Canrestore = tc->readIntReg(NumIntArchRegs + 4); @@ -512,35 +512,35 @@ Sparc64LiveProcess::flushWindows(ThreadContext *tc) } IntReg -Sparc32LiveProcess::getSyscallArg(ThreadContext *tc, int &i) +Sparc32Process::getSyscallArg(ThreadContext *tc, int &i) { assert(i < 6); return bits(tc->readIntReg(FirstArgumentReg + i++), 31, 0); } void -Sparc32LiveProcess::setSyscallArg(ThreadContext *tc, int i, IntReg val) +Sparc32Process::setSyscallArg(ThreadContext *tc, int i, IntReg val) { assert(i < 6); tc->setIntReg(FirstArgumentReg + i, bits(val, 31, 0)); } IntReg -Sparc64LiveProcess::getSyscallArg(ThreadContext *tc, int &i) +Sparc64Process::getSyscallArg(ThreadContext *tc, int &i) { assert(i < 6); return tc->readIntReg(FirstArgumentReg + i++); } void -Sparc64LiveProcess::setSyscallArg(ThreadContext *tc, int i, IntReg val) +Sparc64Process::setSyscallArg(ThreadContext *tc, int i, IntReg val) { assert(i < 6); tc->setIntReg(FirstArgumentReg + i, val); } void -SparcLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) +SparcProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) { // check for error condition. SPARC syscall convention is to // indicate success/failure in reg the carry bit of the ccr diff --git a/src/arch/sparc/process.hh b/src/arch/sparc/process.hh index 23a1a8c52..69ea6b41f 100644 --- a/src/arch/sparc/process.hh +++ b/src/arch/sparc/process.hh @@ -40,9 +40,8 @@ #include "sim/process.hh" class ObjectFile; -class System; -class SparcLiveProcess : public LiveProcess +class SparcProcess : public Process { protected: @@ -51,8 +50,8 @@ class SparcLiveProcess : public LiveProcess // The locations of the fill and spill handlers Addr fillStart, spillStart; - SparcLiveProcess(LiveProcessParams * params, - ObjectFile *objFile, Addr _StackBias); + SparcProcess(ProcessParams * params, ObjectFile *objFile, + Addr _StackBias); void initState(); @@ -71,12 +70,12 @@ class SparcLiveProcess : public LiveProcess void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value); }; -class Sparc32LiveProcess : public SparcLiveProcess +class Sparc32Process : public SparcProcess { protected: - Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) : - SparcLiveProcess(params, objFile, 0) + Sparc32Process(ProcessParams * params, ObjectFile *objFile) + : SparcProcess(params, objFile, 0) { // Set up stack. On SPARC Linux, stack goes from the top of memory // downward, less the hole for the kernel address space. @@ -96,17 +95,17 @@ class Sparc32LiveProcess : public SparcLiveProcess SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i); /// Explicitly import the otherwise hidden getSyscallArg - using LiveProcess::getSyscallArg; + using Process::getSyscallArg; void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val); }; -class Sparc64LiveProcess : public SparcLiveProcess +class Sparc64Process : public SparcProcess { protected: - Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) : - SparcLiveProcess(params, objFile, 2047) + Sparc64Process(ProcessParams * params, ObjectFile *objFile) + : SparcProcess(params, objFile, 2047) { // Set up stack. On SPARC Linux, stack goes from the top of memory // downward, less the hole for the kernel address space. @@ -126,7 +125,7 @@ class Sparc64LiveProcess : public SparcLiveProcess SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i); /// Explicitly import the otherwise hidden getSyscallArg - using LiveProcess::getSyscallArg; + using Process::getSyscallArg; void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val); }; diff --git a/src/arch/sparc/solaris/process.cc b/src/arch/sparc/solaris/process.cc index b26d37fe7..1afa35398 100644 --- a/src/arch/sparc/solaris/process.cc +++ b/src/arch/sparc/solaris/process.cc @@ -45,7 +45,7 @@ using namespace SparcISA; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +unameFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -322,9 +322,9 @@ SyscallDesc SparcSolarisProcess::syscallDescs[] = { /* 255 */ SyscallDesc("umount2", unimplementedFunc) }; -SparcSolarisProcess::SparcSolarisProcess(LiveProcessParams * params, - ObjectFile *objFile) - : Sparc64LiveProcess(params, objFile), +SparcSolarisProcess::SparcSolarisProcess(ProcessParams * params, + ObjectFile *objFile) + : Sparc64Process(params, objFile), Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) { // The sparc syscall table must be <= 284 entries because that is all there diff --git a/src/arch/sparc/solaris/process.hh b/src/arch/sparc/solaris/process.hh index 2cf56f6ba..660802cef 100644 --- a/src/arch/sparc/solaris/process.hh +++ b/src/arch/sparc/solaris/process.hh @@ -38,11 +38,11 @@ namespace SparcISA { /// A process with emulated SPARC/Solaris syscalls. -class SparcSolarisProcess : public Sparc64LiveProcess +class SparcSolarisProcess : public Sparc64Process { public: /// Constructor. - SparcSolarisProcess(LiveProcessParams * params, ObjectFile *objFile); + SparcSolarisProcess(ProcessParams * params, ObjectFile *objFile); virtual SyscallDesc* getDesc(int callnum); diff --git a/src/arch/x86/linux/process.cc b/src/arch/x86/linux/process.cc index e4221511d..cf3a1d3d0 100644 --- a/src/arch/x86/linux/process.cc +++ b/src/arch/x86/linux/process.cc @@ -54,7 +54,7 @@ using namespace X86ISA; /// Target uname() handler. static SyscallReturn -unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +unameFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -72,7 +72,7 @@ unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, } static SyscallReturn -archPrctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +archPrctlFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { enum ArchPrctlCodes @@ -139,22 +139,22 @@ struct UserDesc64 { static SyscallReturn setThreadArea32Func(SyscallDesc *desc, int callnum, - LiveProcess *process, ThreadContext *tc) + Process *process, ThreadContext *tc) { const int minTLSEntry = 6; const int numTLSEntries = 3; const int maxTLSEntry = minTLSEntry + numTLSEntries - 1; - X86LiveProcess *x86lp = dynamic_cast(process); - assert(x86lp); + X86Process *x86p = dynamic_cast(process); + assert(x86p); - assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86lp->gdtSize()); + assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86p->gdtSize()); int argIndex = 0; TypedBufferArg userDesc(process->getSyscallArg(tc, argIndex)); TypedBufferArg - gdt(x86lp->gdtStart() + minTLSEntry * sizeof(uint64_t), - numTLSEntries * sizeof(uint64_t)); + gdt(x86p->gdtStart() + minTLSEntry * sizeof(uint64_t), + numTLSEntries * sizeof(uint64_t)); if (!userDesc.copyIn(tc->getMemProxy())) return -EFAULT; @@ -536,10 +536,10 @@ static SyscallDesc syscallDescs64[] = { /* 313 */ SyscallDesc("finit_module", unimplementedFunc), }; -X86_64LinuxProcess::X86_64LinuxProcess(LiveProcessParams * params, - ObjectFile *objFile) - : X86_64LiveProcess(params, objFile, syscallDescs64, - sizeof(syscallDescs64) / sizeof(SyscallDesc)) +X86_64LinuxProcess::X86_64LinuxProcess(ProcessParams * params, + ObjectFile *objFile) + : X86_64Process(params, objFile, syscallDescs64, + sizeof(syscallDescs64) / sizeof(SyscallDesc)) {} static SyscallDesc syscallDescs32[] = { @@ -869,8 +869,7 @@ static SyscallDesc syscallDescs32[] = { /* 323 */ SyscallDesc("eventfd", unimplementedFunc) }; -I386LinuxProcess::I386LinuxProcess(LiveProcessParams * params, - ObjectFile *objFile) - : I386LiveProcess(params, objFile, syscallDescs32, - sizeof(syscallDescs32) / sizeof(SyscallDesc)) +I386LinuxProcess::I386LinuxProcess(ProcessParams * params, ObjectFile *objFile) + : I386Process(params, objFile, syscallDescs32, + sizeof(syscallDescs32) / sizeof(SyscallDesc)) {} diff --git a/src/arch/x86/linux/process.hh b/src/arch/x86/linux/process.hh index 69cdf01f2..70370960b 100644 --- a/src/arch/x86/linux/process.hh +++ b/src/arch/x86/linux/process.hh @@ -46,18 +46,18 @@ namespace X86ISA { -class X86_64LinuxProcess : public X86_64LiveProcess +class X86_64LinuxProcess : public X86_64Process { public: /// Constructor. - X86_64LinuxProcess(LiveProcessParams * params, ObjectFile *objFile); + X86_64LinuxProcess(ProcessParams * params, ObjectFile *objFile); }; -class I386LinuxProcess : public I386LiveProcess +class I386LinuxProcess : public I386Process { public: /// Constructor. - I386LinuxProcess(LiveProcessParams * params, ObjectFile *objFile); + I386LinuxProcess(ProcessParams * params, ObjectFile *objFile); }; } // namespace X86ISA diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc index a37468a88..a774dd000 100644 --- a/src/arch/x86/process.cc +++ b/src/arch/x86/process.cc @@ -91,19 +91,18 @@ static const int ArgumentReg32[] = { static const int NumArgumentRegs32 M5_VAR_USED = sizeof(ArgumentReg) / sizeof(const int); -X86LiveProcess::X86LiveProcess(LiveProcessParams * params, ObjectFile *objFile, - SyscallDesc *_syscallDescs, int _numSyscallDescs) : - LiveProcess(params, objFile), syscallDescs(_syscallDescs), - numSyscallDescs(_numSyscallDescs) +X86Process::X86Process(ProcessParams * params, ObjectFile *objFile, + SyscallDesc *_syscallDescs, int _numSyscallDescs) + : Process(params, objFile), syscallDescs(_syscallDescs), + numSyscallDescs(_numSyscallDescs) { brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize(); brk_point = roundUp(brk_point, PageBytes); } -X86_64LiveProcess::X86_64LiveProcess(LiveProcessParams *params, - ObjectFile *objFile, SyscallDesc *_syscallDescs, - int _numSyscallDescs) : - X86LiveProcess(params, objFile, _syscallDescs, _numSyscallDescs) +X86_64Process::X86_64Process(ProcessParams *params, ObjectFile *objFile, + SyscallDesc *_syscallDescs, int _numSyscallDescs) + : X86Process(params, objFile, _syscallDescs, _numSyscallDescs) { vsyscallPage.base = 0xffffffffff600000ULL; @@ -131,7 +130,7 @@ X86_64LiveProcess::X86_64LiveProcess(LiveProcessParams *params, } void -I386LiveProcess::syscall(int64_t callnum, ThreadContext *tc) +I386Process::syscall(int64_t callnum, ThreadContext *tc) { TheISA::PCState pc = tc->pcState(); Addr eip = pc.pc(); @@ -140,14 +139,13 @@ I386LiveProcess::syscall(int64_t callnum, ThreadContext *tc) pc.npc(vsyscallPage.base + vsyscallPage.vsysexitOffset); tc->pcState(pc); } - X86LiveProcess::syscall(callnum, tc); + X86Process::syscall(callnum, tc); } -I386LiveProcess::I386LiveProcess(LiveProcessParams *params, - ObjectFile *objFile, SyscallDesc *_syscallDescs, - int _numSyscallDescs) : - X86LiveProcess(params, objFile, _syscallDescs, _numSyscallDescs) +I386Process::I386Process(ProcessParams *params, ObjectFile *objFile, + SyscallDesc *_syscallDescs, int _numSyscallDescs) + : X86Process(params, objFile, _syscallDescs, _numSyscallDescs) { _gdtStart = ULL(0xffffd000); _gdtSize = PageBytes; @@ -174,7 +172,7 @@ I386LiveProcess::I386LiveProcess(LiveProcessParams *params, } SyscallDesc* -X86LiveProcess::getDesc(int callnum) +X86Process::getDesc(int callnum) { if (callnum < 0 || callnum >= numSyscallDescs) return NULL; @@ -182,9 +180,9 @@ X86LiveProcess::getDesc(int callnum) } void -X86_64LiveProcess::initState() +X86_64Process::initState() { - X86LiveProcess::initState(); + X86Process::initState(); argsInit(sizeof(uint64_t), PageBytes); @@ -626,9 +624,9 @@ X86_64LiveProcess::initState() } void -I386LiveProcess::initState() +I386Process::initState() { - X86LiveProcess::initState(); + X86Process::initState(); argsInit(sizeof(uint32_t), PageBytes); @@ -746,7 +744,7 @@ I386LiveProcess::initState() template void -X86LiveProcess::argsInit(int pageSize, +X86Process::argsInit(int pageSize, std::vector > extraAuxvs) { int intSize = sizeof(IntType); @@ -1034,16 +1032,16 @@ X86LiveProcess::argsInit(int pageSize, } void -X86_64LiveProcess::argsInit(int intSize, int pageSize) +X86_64Process::argsInit(int intSize, int pageSize) { std::vector > extraAuxvs; extraAuxvs.push_back(AuxVector(M5_AT_SYSINFO_EHDR, vsyscallPage.base)); - X86LiveProcess::argsInit(pageSize, extraAuxvs); + X86Process::argsInit(pageSize, extraAuxvs); } void -I386LiveProcess::argsInit(int intSize, int pageSize) +I386Process::argsInit(int intSize, int pageSize) { std::vector > extraAuxvs; //Tell the binary where the vsyscall part of the vsyscall page is. @@ -1051,38 +1049,38 @@ I386LiveProcess::argsInit(int intSize, int pageSize) vsyscallPage.base + vsyscallPage.vsyscallOffset)); extraAuxvs.push_back(AuxVector(M5_AT_SYSINFO_EHDR, vsyscallPage.base)); - X86LiveProcess::argsInit(pageSize, extraAuxvs); + X86Process::argsInit(pageSize, extraAuxvs); } void -X86LiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn retval) +X86Process::setSyscallReturn(ThreadContext *tc, SyscallReturn retval) { tc->setIntReg(INTREG_RAX, retval.encodedValue()); } X86ISA::IntReg -X86_64LiveProcess::getSyscallArg(ThreadContext *tc, int &i) +X86_64Process::getSyscallArg(ThreadContext *tc, int &i) { assert(i < NumArgumentRegs); return tc->readIntReg(ArgumentReg[i++]); } void -X86_64LiveProcess::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val) +X86_64Process::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val) { assert(i < NumArgumentRegs); return tc->setIntReg(ArgumentReg[i], val); } X86ISA::IntReg -I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i) +I386Process::getSyscallArg(ThreadContext *tc, int &i) { assert(i < NumArgumentRegs32); return tc->readIntReg(ArgumentReg32[i++]); } X86ISA::IntReg -I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width) +I386Process::getSyscallArg(ThreadContext *tc, int &i, int width) { assert(width == 32 || width == 64); assert(i < NumArgumentRegs); @@ -1093,7 +1091,7 @@ I386LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width) } void -I386LiveProcess::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val) +I386Process::setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val) { assert(i < NumArgumentRegs); return tc->setIntReg(ArgumentReg[i], val); diff --git a/src/arch/x86/process.hh b/src/arch/x86/process.hh index ab513d839..34a275095 100644 --- a/src/arch/x86/process.hh +++ b/src/arch/x86/process.hh @@ -55,7 +55,7 @@ namespace X86ISA M5_AT_SYSINFO_EHDR = 33 }; - class X86LiveProcess : public LiveProcess + class X86Process : public Process { protected: Addr _gdtStart; @@ -64,8 +64,8 @@ namespace X86ISA SyscallDesc *syscallDescs; const int numSyscallDescs; - X86LiveProcess(LiveProcessParams * params, ObjectFile *objFile, - SyscallDesc *_syscallDescs, int _numSyscallDescs); + X86Process(ProcessParams * params, ObjectFile *objFile, + SyscallDesc *_syscallDescs, int _numSyscallDescs); template void argsInit(int pageSize, @@ -83,11 +83,11 @@ namespace X86ISA void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value); }; - class X86_64LiveProcess : public X86LiveProcess + class X86_64Process : public X86Process { protected: - X86_64LiveProcess(LiveProcessParams *params, ObjectFile *objFile, - SyscallDesc *_syscallDescs, int _numSyscallDescs); + X86_64Process(ProcessParams *params, ObjectFile *objFile, + SyscallDesc *_syscallDescs, int _numSyscallDescs); class VSyscallPage { @@ -105,15 +105,15 @@ namespace X86ISA X86ISA::IntReg getSyscallArg(ThreadContext *tc, int &i); /// Explicitly import the otherwise hidden getSyscallArg - using LiveProcess::getSyscallArg; + using Process::getSyscallArg; void setSyscallArg(ThreadContext *tc, int i, X86ISA::IntReg val); }; - class I386LiveProcess : public X86LiveProcess + class I386Process : public X86Process { protected: - I386LiveProcess(LiveProcessParams *params, ObjectFile *objFile, - SyscallDesc *_syscallDescs, int _numSyscallDescs); + I386Process(ProcessParams *params, ObjectFile *objFile, + SyscallDesc *_syscallDescs, int _numSyscallDescs); class VSyscallPage { diff --git a/src/gpu-compute/cl_driver.cc b/src/gpu-compute/cl_driver.cc index d6d1b1334..41ae3ab9a 100644 --- a/src/gpu-compute/cl_driver.cc +++ b/src/gpu-compute/cl_driver.cc @@ -91,7 +91,7 @@ ClDriver::handshake(GpuDispatcher *_dispatcher) } int -ClDriver::open(LiveProcess *p, ThreadContext *tc, int mode, int flags) +ClDriver::open(Process *p, ThreadContext *tc, int mode, int flags) { int fd = p->allocFD(-1, filename, 0, 0, false); FDEntry *fde = p->getFDEntry(fd); @@ -101,7 +101,7 @@ ClDriver::open(LiveProcess *p, ThreadContext *tc, int mode, int flags) } int -ClDriver::ioctl(LiveProcess *process, ThreadContext *tc, unsigned req) +ClDriver::ioctl(Process *process, ThreadContext *tc, unsigned req) { int index = 2; Addr buf_addr = process->getSyscallArg(tc, index); diff --git a/src/gpu-compute/cl_driver.hh b/src/gpu-compute/cl_driver.hh index 03567bab5..595aa029a 100644 --- a/src/gpu-compute/cl_driver.hh +++ b/src/gpu-compute/cl_driver.hh @@ -43,7 +43,7 @@ class GpuDispatcher; class HsaCode; -class LiveProcess; +class Process; class ThreadContext; struct ClDriverParams; @@ -53,8 +53,8 @@ class ClDriver final : public EmulatedDriver public: ClDriver(ClDriverParams *p); void handshake(GpuDispatcher *_dispatcher); - int open(LiveProcess *p, ThreadContext *tc, int mode, int flags); - int ioctl(LiveProcess *p, ThreadContext *tc, unsigned req); + int open(Process *p, ThreadContext *tc, int mode, int flags); + int ioctl(Process *p, ThreadContext *tc, unsigned req); const char* codeOffToKernelName(uint64_t code_ptr); private: diff --git a/src/kern/freebsd/freebsd.hh b/src/kern/freebsd/freebsd.hh index e3d5cf5be..de5da9d3b 100644 --- a/src/kern/freebsd/freebsd.hh +++ b/src/kern/freebsd/freebsd.hh @@ -39,7 +39,7 @@ #include "kern/operatingsystem.hh" class ThreadContext; -class LiveProcess; +class Process; /// /// This class encapsulates the types, structures, constants, diff --git a/src/kern/linux/linux.cc b/src/kern/linux/linux.cc index 6618fdbd9..493be9611 100644 --- a/src/kern/linux/linux.cc +++ b/src/kern/linux/linux.cc @@ -38,7 +38,7 @@ #include "sim/system.hh" int -Linux::openSpecialFile(std::string path, LiveProcess *process, +Linux::openSpecialFile(std::string path, Process *process, ThreadContext *tc) { DPRINTF(SyscallVerbose, "Opening special file: %s\n", path.c_str()); @@ -59,7 +59,7 @@ Linux::openSpecialFile(std::string path, LiveProcess *process, } std::string -Linux::procMeminfo(LiveProcess *process, ThreadContext *tc) +Linux::procMeminfo(Process *process, ThreadContext *tc) { return csprintf("MemTotal:%12d kB\nMemFree: %12d kB\n", process->system->memSize() >> 10, diff --git a/src/kern/linux/linux.hh b/src/kern/linux/linux.hh index 52a3bcd7b..e6899a9ca 100644 --- a/src/kern/linux/linux.hh +++ b/src/kern/linux/linux.hh @@ -223,8 +223,9 @@ class Linux : public OperatingSystem int64_t ru_nivcsw; //!< involuntary " }; - static int openSpecialFile(std::string path, LiveProcess *process, ThreadContext *tc); - static std::string procMeminfo(LiveProcess *process, ThreadContext *tc); + static int openSpecialFile(std::string path, Process *process, + ThreadContext *tc); + static std::string procMeminfo(Process *process, ThreadContext *tc); // For futex system call static const unsigned TGT_FUTEX_WAIT = 0; diff --git a/src/kern/operatingsystem.cc b/src/kern/operatingsystem.cc index 1ecc94c15..553ceaf66 100644 --- a/src/kern/operatingsystem.cc +++ b/src/kern/operatingsystem.cc @@ -34,7 +34,7 @@ #include "base/misc.hh" int -OperatingSystem::openSpecialFile(std::string path, LiveProcess *process, +OperatingSystem::openSpecialFile(std::string path, Process *process, ThreadContext *tc) { warn("Attempting to open special file: %s. Ignoring. Simulation may" diff --git a/src/kern/operatingsystem.hh b/src/kern/operatingsystem.hh index 12aff946c..e097f6451 100644 --- a/src/kern/operatingsystem.hh +++ b/src/kern/operatingsystem.hh @@ -35,7 +35,7 @@ #include -class LiveProcess; +class Process; class ThreadContext; /// This struct is used to build target-OS-dependent tables that @@ -114,7 +114,8 @@ class OperatingSystem { int64_t ru_nivcsw; //!< involuntary " } rusage; - static int openSpecialFile(std::string path, LiveProcess *process, ThreadContext *tc); + static int openSpecialFile(std::string path, Process *process, + ThreadContext *tc); }; // class OperatingSystem diff --git a/src/sim/Process.py b/src/sim/Process.py index fb1450107..2d7c7d22c 100644 --- a/src/sim/Process.py +++ b/src/sim/Process.py @@ -32,7 +32,6 @@ from m5.proxy import * class Process(SimObject): type = 'Process' - abstract = True cxx_header = "sim/process.hh" input = Param.String('cin', "filename for stdin") output = Param.String('cout', 'filename for stdout') @@ -50,23 +49,19 @@ class Process(SimObject): pid = Param.Int(100, 'process id') ppid = Param.Int(99, 'parent process id') + executable = Param.String('', "executable (overrides cmd[0] if set)") + cmd = VectorParam.String("command line (executable plus arguments)") + env = VectorParam.String([], "environment settings") + cwd = Param.String('', "current working directory") + simpoint = Param.UInt64(0, 'simulation point at which to start simulation') + drivers = VectorParam.EmulatedDriver([], 'Available emulated drivers') + @classmethod 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 sz, bool cacheable=true);') class EmulatedDriver(SimObject): type = 'EmulatedDriver' cxx_header = "sim/emul_driver.hh" abstract = True filename = Param.String("device file name (under /dev)") - -class LiveProcess(Process): - type = 'LiveProcess' - cxx_header = "sim/process.hh" - executable = Param.String('', "executable (overrides cmd[0] if set)") - cmd = VectorParam.String("command line (executable plus arguments)") - env = VectorParam.String([], "environment settings") - cwd = Param.String('', "current working directory") - simpoint = Param.UInt64(0, 'simulation point at which to start simulation') - drivers = VectorParam.EmulatedDriver([], 'Available emulated drivers') - diff --git a/src/sim/emul_driver.hh b/src/sim/emul_driver.hh index 62ba61507..97ba57224 100644 --- a/src/sim/emul_driver.hh +++ b/src/sim/emul_driver.hh @@ -36,7 +36,7 @@ #include "params/EmulatedDriver.hh" #include "sim/sim_object.hh" -class LiveProcess; +class Process; class ThreadContext; /** @@ -74,7 +74,7 @@ class EmulatedDriver : public SimObject * to openFunc() (q.v.). * @return A newly allocated target fd, or -1 on error. */ - virtual int open(LiveProcess *p, ThreadContext *tc, + virtual int open(Process *p, ThreadContext *tc, int mode, int flags) = 0; /** @@ -84,7 +84,7 @@ class EmulatedDriver : public SimObject * @return The return code for the ioctl, or the negation of the errno * (see the SyscallReturn class). */ - virtual int ioctl(LiveProcess *p, ThreadContext *tc, unsigned req) = 0; + virtual int ioctl(Process *p, ThreadContext *tc, unsigned req) = 0; /** * Virtual method, invoked when the user program calls mmap() on @@ -93,7 +93,7 @@ class EmulatedDriver : public SimObject * @return The return ptr for the mmap, or the negation of the errno * (see the SyscallReturn class). */ - virtual Addr mmap(LiveProcess *p, ThreadContext *tc, Addr start, + virtual Addr mmap(Process *p, ThreadContext *tc, Addr start, uint64_t length, int prot, int tgtFlags, int tgtFd, int offset) { return -EBADF; } }; diff --git a/src/sim/process.cc b/src/sim/process.cc index 961da1ecd..ceec47ce4 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -61,7 +61,6 @@ #include "cpu/thread_context.hh" #include "mem/page_table.hh" #include "mem/se_translating_port_proxy.hh" -#include "params/LiveProcess.hh" #include "params/Process.hh" #include "sim/emul_driver.hh" #include "sim/syscall_desc.hh" @@ -126,7 +125,7 @@ openOutputFile(const string &filename) return openFile(filename, O_WRONLY | O_CREAT | O_TRUNC, 0664); } -Process::Process(ProcessParams * params) +Process::Process(ProcessParams * params, ObjectFile * obj_file) : SimObject(params), system(params->system), brk_point(0), stack_base(0), stack_size(0), stack_min(0), max_stack_size(params->max_stack_size), @@ -148,9 +147,13 @@ Process::Process(ProcessParams * params) {"stdout", STDOUT_FILENO}, {"cerr", STDERR_FILENO}, {"stderr", STDERR_FILENO}}, + objFile(obj_file), + 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) + _pid(params->pid), _ppid(params->ppid), + drivers(params->drivers) { int sim_fd; std::map::iterator it; @@ -188,6 +191,19 @@ Process::Process(ProcessParams * params) mmap_end = 0; nxm_start = nxm_end = 0; // other parameters will be initialized when the program is loaded + + // load up symbols, if any... these may be used for debugging or + // profiling. + if (!debugSymbolTable) { + debugSymbolTable = new SymbolTable(); + if (!objFile->loadGlobalSymbols(debugSymbolTable) || + !objFile->loadLocalSymbols(debugSymbolTable) || + !objFile->loadWeakSymbols(debugSymbolTable)) { + // didn't load any symbols + delete debugSymbolTable; + debugSymbolTable = NULL; + } + } } @@ -496,36 +512,8 @@ Process::map(Addr vaddr, Addr paddr, int size, bool cacheable) } -//////////////////////////////////////////////////////////////////////// -// -// LiveProcess member definitions -// -//////////////////////////////////////////////////////////////////////// - - -LiveProcess::LiveProcess(LiveProcessParams *params, ObjectFile *_objFile) - : Process(params), objFile(_objFile), - argv(params->cmd), envp(params->env), cwd(params->cwd), - executable(params->executable), - drivers(params->drivers) -{ - - // load up symbols, if any... these may be used for debugging or - // profiling. - if (!debugSymbolTable) { - debugSymbolTable = new SymbolTable(); - if (!objFile->loadGlobalSymbols(debugSymbolTable) || - !objFile->loadLocalSymbols(debugSymbolTable) || - !objFile->loadWeakSymbols(debugSymbolTable)) { - // didn't load any symbols - delete debugSymbolTable; - debugSymbolTable = NULL; - } - } -} - void -LiveProcess::syscall(int64_t callnum, ThreadContext *tc) +Process::syscall(int64_t callnum, ThreadContext *tc) { num_syscalls++; @@ -537,14 +525,14 @@ LiveProcess::syscall(int64_t callnum, ThreadContext *tc) } IntReg -LiveProcess::getSyscallArg(ThreadContext *tc, int &i, int width) +Process::getSyscallArg(ThreadContext *tc, int &i, int width) { return getSyscallArg(tc, i); } EmulatedDriver * -LiveProcess::findDriver(std::string filename) +Process::findDriver(std::string filename) { for (EmulatedDriver *d : drivers) { if (d->match(filename)) @@ -555,7 +543,7 @@ LiveProcess::findDriver(std::string filename) } void -LiveProcess::updateBias() +Process::updateBias() { ObjectFile *interp = objFile->getInterpreter(); @@ -580,14 +568,14 @@ LiveProcess::updateBias() ObjectFile * -LiveProcess::getInterpreter() +Process::getInterpreter() { return objFile->getInterpreter(); } Addr -LiveProcess::getBias() +Process::getBias() { ObjectFile *interp = getInterpreter(); @@ -596,7 +584,7 @@ LiveProcess::getBias() Addr -LiveProcess::getStartPC() +Process::getStartPC() { ObjectFile *interp = getInterpreter(); @@ -604,74 +592,74 @@ LiveProcess::getStartPC() } -LiveProcess * -LiveProcess::create(LiveProcessParams * params) +Process * +ProcessParams::create() { - LiveProcess *process = NULL; + Process *process = NULL; // If not specified, set the executable parameter equal to the // simulated system's zeroth command line parameter - if (params->executable == "") { - params->executable = params->cmd[0]; + if (executable == "") { + executable = cmd[0]; } - ObjectFile *objFile = createObjectFile(params->executable); - if (objFile == NULL) { - fatal("Can't load object file %s", params->executable); + ObjectFile *obj_file = createObjectFile(executable); + if (obj_file == NULL) { + fatal("Can't load object file %s", executable); } #if THE_ISA == ALPHA_ISA - if (objFile->getArch() != ObjectFile::Alpha) + if (obj_file->getArch() != ObjectFile::Alpha) fatal("Object file architecture does not match compiled ISA (Alpha)."); - switch (objFile->getOpSys()) { + switch (obj_file->getOpSys()) { case ObjectFile::UnknownOpSys: warn("Unknown operating system; assuming Linux."); // fall through case ObjectFile::Linux: - process = new AlphaLinuxProcess(params, objFile); + process = new AlphaLinuxProcess(this, obj_file); break; default: fatal("Unknown/unsupported operating system."); } #elif THE_ISA == SPARC_ISA - if (objFile->getArch() != ObjectFile::SPARC64 && - objFile->getArch() != ObjectFile::SPARC32) + if (obj_file->getArch() != ObjectFile::SPARC64 && + obj_file->getArch() != ObjectFile::SPARC32) fatal("Object file architecture does not match compiled ISA (SPARC)."); - switch (objFile->getOpSys()) { + switch (obj_file->getOpSys()) { case ObjectFile::UnknownOpSys: warn("Unknown operating system; assuming Linux."); // fall through case ObjectFile::Linux: - if (objFile->getArch() == ObjectFile::SPARC64) { - process = new Sparc64LinuxProcess(params, objFile); + if (obj_file->getArch() == ObjectFile::SPARC64) { + process = new Sparc64LinuxProcess(this, obj_file); } else { - process = new Sparc32LinuxProcess(params, objFile); + process = new Sparc32LinuxProcess(this, obj_file); } break; case ObjectFile::Solaris: - process = new SparcSolarisProcess(params, objFile); + process = new SparcSolarisProcess(this, obj_file); break; default: fatal("Unknown/unsupported operating system."); } #elif THE_ISA == X86_ISA - if (objFile->getArch() != ObjectFile::X86_64 && - objFile->getArch() != ObjectFile::I386) + if (obj_file->getArch() != ObjectFile::X86_64 && + obj_file->getArch() != ObjectFile::I386) fatal("Object file architecture does not match compiled ISA (x86)."); - switch (objFile->getOpSys()) { + switch (obj_file->getOpSys()) { case ObjectFile::UnknownOpSys: warn("Unknown operating system; assuming Linux."); // fall through case ObjectFile::Linux: - if (objFile->getArch() == ObjectFile::X86_64) { - process = new X86_64LinuxProcess(params, objFile); + if (obj_file->getArch() == ObjectFile::X86_64) { + process = new X86_64LinuxProcess(this, obj_file); } else { - process = new I386LinuxProcess(params, objFile); + process = new I386LinuxProcess(this, obj_file); } break; @@ -679,44 +667,44 @@ LiveProcess::create(LiveProcessParams * params) fatal("Unknown/unsupported operating system."); } #elif THE_ISA == MIPS_ISA - if (objFile->getArch() != ObjectFile::Mips) + if (obj_file->getArch() != ObjectFile::Mips) fatal("Object file architecture does not match compiled ISA (MIPS)."); - switch (objFile->getOpSys()) { + switch (obj_file->getOpSys()) { case ObjectFile::UnknownOpSys: warn("Unknown operating system; assuming Linux."); // fall through case ObjectFile::Linux: - process = new MipsLinuxProcess(params, objFile); + process = new MipsLinuxProcess(this, obj_file); break; default: fatal("Unknown/unsupported operating system."); } #elif THE_ISA == ARM_ISA - ObjectFile::Arch arch = objFile->getArch(); + ObjectFile::Arch arch = obj_file->getArch(); if (arch != ObjectFile::Arm && arch != ObjectFile::Thumb && arch != ObjectFile::Arm64) fatal("Object file architecture does not match compiled ISA (ARM)."); - switch (objFile->getOpSys()) { + switch (obj_file->getOpSys()) { case ObjectFile::UnknownOpSys: warn("Unknown operating system; assuming Linux."); // fall through case ObjectFile::Linux: if (arch == ObjectFile::Arm64) { - process = new ArmLinuxProcess64(params, objFile, - objFile->getArch()); + process = new ArmLinuxProcess64(this, obj_file, + obj_file->getArch()); } else { - process = new ArmLinuxProcess32(params, objFile, - objFile->getArch()); + process = new ArmLinuxProcess32(this, obj_file, + obj_file->getArch()); } break; case ObjectFile::FreeBSD: if (arch == ObjectFile::Arm64) { - process = new ArmFreebsdProcess64(params, objFile, - objFile->getArch()); + process = new ArmFreebsdProcess64(this, obj_file, + obj_file->getArch()); } else { - process = new ArmFreebsdProcess32(params, objFile, - objFile->getArch()); + process = new ArmFreebsdProcess32(this, obj_file, + obj_file->getArch()); } break; case ObjectFile::LinuxArmOABI: @@ -726,28 +714,28 @@ LiveProcess::create(LiveProcessParams * params) fatal("Unknown/unsupported operating system."); } #elif THE_ISA == POWER_ISA - if (objFile->getArch() != ObjectFile::Power) + if (obj_file->getArch() != ObjectFile::Power) fatal("Object file architecture does not match compiled ISA (Power)."); - switch (objFile->getOpSys()) { + switch (obj_file->getOpSys()) { case ObjectFile::UnknownOpSys: warn("Unknown operating system; assuming Linux."); // fall through case ObjectFile::Linux: - process = new PowerLinuxProcess(params, objFile); + process = new PowerLinuxProcess(this, obj_file); break; default: fatal("Unknown/unsupported operating system."); } #elif THE_ISA == RISCV_ISA - if (objFile->getArch() != ObjectFile::Riscv) + if (obj_file->getArch() != ObjectFile::Riscv) fatal("Object file architecture does not match compiled ISA (RISCV)."); - switch (objFile->getOpSys()) { + switch (obj_file->getOpSys()) { case ObjectFile::UnknownOpSys: warn("Unknown operating system; assuming Linux."); // fall through case ObjectFile::Linux: - process = new RiscvLinuxProcess(params, objFile); + process = new RiscvLinuxProcess(this, obj_file); break; default: fatal("Unknown/unsupported operating system."); @@ -760,9 +748,3 @@ LiveProcess::create(LiveProcessParams * params) fatal("Unknown error creating process object."); return process; } - -LiveProcess * -LiveProcessParams::create() -{ - return LiveProcess::create(this); -} diff --git a/src/sim/process.hh b/src/sim/process.hh index 87536830b..4b0428585 100644 --- a/src/sim/process.hh +++ b/src/sim/process.hh @@ -46,10 +46,10 @@ #include "sim/fd_entry.hh" #include "sim/sim_object.hh" -struct LiveProcessParams; struct ProcessParams; class EmulatedDriver; +class ObjectFile; class PageTableBase; class SyscallDesc; class SyscallReturn; @@ -170,9 +170,6 @@ class Process : public SimObject // Find a free context to use ThreadContext *findFreeContext(); - // provide program name for debug messages - virtual const char *progName() const { return ""; } - // generate new target fd for sim_fd int allocFD(int sim_fd, const std::string& filename, int flags, int mode, bool pipe); @@ -202,7 +199,6 @@ class Process : public SimObject // set the source of this read pipe for a checkpoint resume void setReadPipeSource(int read_pipe_fd, int source_fd); - virtual void syscall(int64_t callnum, ThreadContext *tc) = 0; void allocateMem(Addr vaddr, int64_t size, bool clobber = false); @@ -228,6 +224,15 @@ class Process : public SimObject void serialize(CheckpointOut &cp) const override; void unserialize(CheckpointIn &cp) override; + protected: + ObjectFile *objFile; + std::vector argv; + std::vector envp; + std::string cwd; + std::string executable; + + Process(ProcessParams *params, ObjectFile *obj_file); + public: // Id of the owner of the process uint64_t _uid; @@ -239,28 +244,9 @@ class Process : public SimObject uint64_t _pid; uint64_t _ppid; -}; - -// -// "Live" process with system calls redirected to host system -// -class ObjectFile; -class LiveProcess : public Process -{ - protected: - ObjectFile *objFile; - std::vector argv; - std::vector envp; - std::string cwd; - std::string executable; - - LiveProcess(LiveProcessParams *params, ObjectFile *objFile); - // Emulated drivers available to this process std::vector drivers; - public: - enum AuxiliaryVectorType { M5_AT_NULL = 0, M5_AT_IGNORE = 1, @@ -299,7 +285,7 @@ class LiveProcess : public Process inline uint64_t ppid() { return _ppid; } // provide program name for debug messages - virtual const char *progName() const { return executable.c_str(); } + const char *progName() const { return executable.c_str(); } std::string fullPath(const std::string &filename) @@ -317,7 +303,7 @@ class LiveProcess : public Process std::string getcwd() const { return cwd; } - virtual void syscall(int64_t callnum, ThreadContext *tc); + void syscall(int64_t callnum, ThreadContext *tc); virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i) = 0; virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i, int width); @@ -345,12 +331,6 @@ class LiveProcess : public Process Addr getBias(); Addr getStartPC(); - - // this function is used to create the LiveProcess object, since - // we can't tell which subclass of LiveProcess to use until we - // open and look at the object file. - static LiveProcess *create(LiveProcessParams *params); }; - #endif // __PROCESS_HH__ diff --git a/src/sim/syscall_desc.cc b/src/sim/syscall_desc.cc index 9251b1c14..bb0e80f5f 100644 --- a/src/sim/syscall_desc.cc +++ b/src/sim/syscall_desc.cc @@ -42,7 +42,7 @@ #include "sim/syscall_return.hh" void -SyscallDesc::doSyscall(int callnum, LiveProcess *process, ThreadContext *tc) +SyscallDesc::doSyscall(int callnum, Process *process, ThreadContext *tc) { TheISA::IntReg arg[6] M5_VAR_USED; diff --git a/src/sim/syscall_desc.hh b/src/sim/syscall_desc.hh index 4c3ae0463..37aaad14d 100644 --- a/src/sim/syscall_desc.hh +++ b/src/sim/syscall_desc.hh @@ -48,7 +48,7 @@ #include -class LiveProcess; +class Process; class SyscallReturn; class ThreadContext; @@ -62,7 +62,7 @@ class SyscallDesc { public: /** Typedef the function pointer here to clean up code below */ typedef SyscallReturn (*SyscallExecutor)(SyscallDesc*, int num, - LiveProcess*, ThreadContext*); + Process*, ThreadContext*); SyscallDesc(const char *name, SyscallExecutor sys_exec, int flags = 0) : _name(name), executor(sys_exec), _flags(flags), _warned(false) @@ -91,7 +91,7 @@ class SyscallDesc { * @param proc Handle for the owning Process to pass information * @param tc Handle for owning ThreadContext to pass information */ - void doSyscall(int callnum, LiveProcess *proc, ThreadContext *tc); + void doSyscall(int callnum, Process *proc, ThreadContext *tc); /** * Return false if WarnOnce is set and a warning has already been issued. diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index 56518726c..d77901fa7 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -53,7 +53,7 @@ using namespace std; using namespace TheISA; SyscallReturn -unimplementedFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +unimplementedFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { fatal("syscall %s (#%d) unimplemented.", desc->name(), callnum); @@ -63,7 +63,7 @@ unimplementedFunc(SyscallDesc *desc, int callnum, LiveProcess *process, SyscallReturn -ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +ignoreFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { if (desc->needWarning()) { @@ -76,7 +76,7 @@ ignoreFunc(SyscallDesc *desc, int callnum, LiveProcess *process, SyscallReturn -exitFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +exitFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { if (process->system->numRunningContexts() == 1) { @@ -94,7 +94,7 @@ exitFunc(SyscallDesc *desc, int callnum, LiveProcess *process, SyscallReturn -exitGroupFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +exitGroupFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { // halt all threads belonging to this process @@ -114,14 +114,14 @@ exitGroupFunc(SyscallDesc *desc, int callnum, LiveProcess *process, SyscallReturn -getpagesizeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +getpagesizeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { return (int)PageBytes; } SyscallReturn -brkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +brkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { // change brk addr to first arg int index = 0; @@ -167,7 +167,7 @@ brkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) SyscallReturn -closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +closeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 0; int tgt_fd = p->getSyscallArg(tc, index); @@ -186,7 +186,7 @@ closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) SyscallReturn -readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +readFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 0; int tgt_fd = p->getSyscallArg(tc, index); @@ -207,7 +207,7 @@ readFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) } SyscallReturn -writeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +writeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 0; int tgt_fd = p->getSyscallArg(tc, index); @@ -230,7 +230,7 @@ writeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) SyscallReturn -lseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +lseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 0; int tgt_fd = p->getSyscallArg(tc, index); @@ -248,7 +248,7 @@ lseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) SyscallReturn -_llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +_llseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 0; int tgt_fd = p->getSyscallArg(tc, index); @@ -277,7 +277,7 @@ _llseekFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) SyscallReturn -munmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +munmapFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { // With mmap more fully implemented, it might be worthwhile to bite // the bullet and implement munmap. Should allow us to reuse simulated @@ -289,7 +289,7 @@ munmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) const char *hostname = "m5.eecs.umich.edu"; SyscallReturn -gethostnameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +gethostnameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 0; Addr bufPtr = p->getSyscallArg(tc, index); @@ -304,7 +304,7 @@ gethostnameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) } SyscallReturn -getcwdFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +getcwdFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int result = 0; int index = 0; @@ -336,15 +336,15 @@ getcwdFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) /// Target open() handler. SyscallReturn -readlinkFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +readlinkFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { return readlinkFunc(desc, callnum, process, tc, 0); } SyscallReturn -readlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc, - int index) +readlinkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc, + int index) { string path; @@ -365,7 +365,7 @@ readlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc, } else { // Emulate readlink() called on '/proc/self/exe' should return the // absolute path of the binary running in the simulated system (the - // LiveProcess' executable). It is possible that using this path in + // Process' executable). It is possible that using this path in // the simulated system will result in unexpected behavior if: // 1) One binary runs another (e.g., -c time -o "my_binary"), and // called binary calls readlink(). @@ -403,14 +403,14 @@ readlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc, } SyscallReturn -unlinkFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +unlinkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { return unlinkHelper(desc, num, p, tc, 0); } SyscallReturn -unlinkHelper(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc, - int index) +unlinkHelper(SyscallDesc *desc, int num, Process *p, ThreadContext *tc, + int index) { string path; @@ -426,7 +426,7 @@ unlinkHelper(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc, SyscallReturn -mkdirFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +mkdirFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { string path; @@ -444,7 +444,7 @@ mkdirFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) } SyscallReturn -renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +renameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { string old_name; @@ -466,7 +466,7 @@ renameFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) } SyscallReturn -truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +truncateFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { string path; @@ -485,7 +485,7 @@ truncateFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) SyscallReturn ftruncateFunc(SyscallDesc *desc, int num, - LiveProcess *process, ThreadContext *tc) + Process *process, ThreadContext *tc) { int index = 0; int tgt_fd = process->getSyscallArg(tc, index); @@ -501,7 +501,7 @@ ftruncateFunc(SyscallDesc *desc, int num, SyscallReturn truncate64Func(SyscallDesc *desc, int num, - LiveProcess *process, ThreadContext *tc) + Process *process, ThreadContext *tc) { int index = 0; string path; @@ -524,7 +524,7 @@ truncate64Func(SyscallDesc *desc, int num, SyscallReturn ftruncate64Func(SyscallDesc *desc, int num, - LiveProcess *process, ThreadContext *tc) + Process *process, ThreadContext *tc) { int index = 0; int tgt_fd = process->getSyscallArg(tc, index); @@ -543,7 +543,7 @@ ftruncate64Func(SyscallDesc *desc, int num, } SyscallReturn -umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) +umaskFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc) { // Letting the simulated program change the simulator's umask seems like // a bad idea. Compromise by just returning the current umask but not @@ -554,7 +554,7 @@ umaskFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) } SyscallReturn -chownFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +chownFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { string path; @@ -576,7 +576,7 @@ chownFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) } SyscallReturn -fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) +fchownFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc) { int index = 0; int tgt_fd = process->getSyscallArg(tc, index); @@ -597,7 +597,7 @@ fchownFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) SyscallReturn -dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) +dupFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc) { int index = 0; int tgt_fd = process->getSyscallArg(tc, index); @@ -615,7 +615,7 @@ dupFunc(SyscallDesc *desc, int num, LiveProcess *process, ThreadContext *tc) SyscallReturn -fcntlFunc(SyscallDesc *desc, int num, LiveProcess *process, +fcntlFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc) { int index = 0; @@ -659,7 +659,7 @@ fcntlFunc(SyscallDesc *desc, int num, LiveProcess *process, } SyscallReturn -fcntl64Func(SyscallDesc *desc, int num, LiveProcess *process, +fcntl64Func(SyscallDesc *desc, int num, Process *process, ThreadContext *tc) { int index = 0; @@ -691,8 +691,8 @@ fcntl64Func(SyscallDesc *desc, int num, LiveProcess *process, } SyscallReturn -pipePseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +pipePseudoFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { int fds[2], sim_fds[2]; int pipe_retval = pipe(fds); @@ -714,8 +714,8 @@ pipePseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, SyscallReturn -getpidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +getpidPseudoFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { // Make up a PID. There's no interprocess communication in // fake_syscall mode, so there's no way for a process to know it's @@ -727,8 +727,8 @@ getpidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, SyscallReturn -getuidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +getuidPseudoFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { // Make up a UID and EUID... it shouldn't matter, and we want the // simulation to be deterministic. @@ -740,8 +740,8 @@ getuidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, SyscallReturn -getgidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +getgidPseudoFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { // Get current group ID. EGID goes in r20. tc->setIntReg(SyscallPseudoReturnReg, process->egid()); //EGID @@ -750,7 +750,7 @@ getgidPseudoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, SyscallReturn -setuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +setuidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { // can't fathom why a benchmark would call this. @@ -760,7 +760,7 @@ setuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, } SyscallReturn -getpidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +getpidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { // Make up a PID. There's no interprocess communication in @@ -772,44 +772,44 @@ getpidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, } SyscallReturn -getppidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +getppidFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { return process->ppid(); } SyscallReturn -getuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +getuidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { return process->uid(); // UID } SyscallReturn -geteuidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +geteuidFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { return process->euid(); // UID } SyscallReturn -getgidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +getgidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { return process->gid(); } SyscallReturn -getegidFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +getegidFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { return process->egid(); } SyscallReturn -cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +cloneFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { int index = 0; IntReg flags = process->getSyscallArg(tc, index); @@ -890,7 +890,7 @@ cloneFunc(SyscallDesc *desc, int callnum, LiveProcess *process, } SyscallReturn -fallocateFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +fallocateFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { #if NO_FALLOCATE @@ -914,8 +914,8 @@ fallocateFunc(SyscallDesc *desc, int callnum, LiveProcess *process, } SyscallReturn -accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc, - int index) +accessFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc, + int index) { string path; if (!tc->getMemProxy().tryReadString(path, p->getSyscallArg(tc, index))) @@ -931,7 +931,7 @@ accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc, } SyscallReturn -accessFunc(SyscallDesc *desc, int callnum, LiveProcess *p, ThreadContext *tc) +accessFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc) { return accessFunc(desc, callnum, p, tc, 0); } diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 7c225e000..c75784f79 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -108,180 +108,180 @@ class SyscallDesc; /// Handler for unimplemented syscalls that we haven't thought about. SyscallReturn unimplementedFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Handler for unimplemented syscalls that we never intend to /// implement (signal handling, etc.) and should not affect the correct /// behavior of the program. Print a warning only if the appropriate /// trace flag is enabled. Return success to the target program. SyscallReturn ignoreFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); // Target fallocateFunc() handler. SyscallReturn fallocateFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target exit() handler: terminate current context. SyscallReturn exitFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target exit_group() handler: terminate simulation. (exit all threads) SyscallReturn exitGroupFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target getpagesize() handler. SyscallReturn getpagesizeFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target brk() handler: set brk address. SyscallReturn brkFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target close() handler. SyscallReturn closeFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target read() handler. SyscallReturn readFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target write() handler. SyscallReturn writeFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target lseek() handler. SyscallReturn lseekFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target _llseek() handler. SyscallReturn _llseekFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target munmap() handler. SyscallReturn munmapFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target gethostname() handler. SyscallReturn gethostnameFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target getcwd() handler. SyscallReturn getcwdFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target readlink() handler. SyscallReturn readlinkFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc, + Process *p, ThreadContext *tc, int index = 0); SyscallReturn readlinkFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target unlink() handler. SyscallReturn unlinkHelper(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc, + Process *p, ThreadContext *tc, int index); SyscallReturn unlinkFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target mkdir() handler. SyscallReturn mkdirFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target rename() handler. SyscallReturn renameFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target truncate() handler. SyscallReturn truncateFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target ftruncate() handler. SyscallReturn ftruncateFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target truncate64() handler. SyscallReturn truncate64Func(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target ftruncate64() handler. SyscallReturn ftruncate64Func(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target umask() handler. SyscallReturn umaskFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target chown() handler. SyscallReturn chownFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target fchown() handler. SyscallReturn fchownFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target dup() handler. SyscallReturn dupFunc(SyscallDesc *desc, int num, - LiveProcess *process, ThreadContext *tc); + Process *process, ThreadContext *tc); /// Target fnctl() handler. SyscallReturn fcntlFunc(SyscallDesc *desc, int num, - LiveProcess *process, ThreadContext *tc); + Process *process, ThreadContext *tc); /// Target fcntl64() handler. SyscallReturn fcntl64Func(SyscallDesc *desc, int num, - LiveProcess *process, ThreadContext *tc); + Process *process, ThreadContext *tc); /// Target setuid() handler. SyscallReturn setuidFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target getpid() handler. SyscallReturn getpidFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target getuid() handler. SyscallReturn getuidFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target getgid() handler. SyscallReturn getgidFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target getppid() handler. SyscallReturn getppidFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target geteuid() handler. SyscallReturn geteuidFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target getegid() handler. SyscallReturn getegidFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target clone() handler. SyscallReturn cloneFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target access() handler SyscallReturn accessFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); SyscallReturn accessFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc, - int index); + Process *p, ThreadContext *tc, + int index); /// Futex system call /// Implemented by Daniel Sanchez /// Used by printf's in multi-threaded apps template SyscallReturn -futexFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +futexFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index_uaddr = 0; @@ -362,19 +362,19 @@ futexFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Pseudo Funcs - These functions use a different return convension, /// returning a second value in a register other than the normal return register SyscallReturn pipePseudoFunc(SyscallDesc *desc, int num, - LiveProcess *process, ThreadContext *tc); + Process *process, ThreadContext *tc); /// Target getpidPseudo() handler. SyscallReturn getpidPseudoFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target getuidPseudo() handler. SyscallReturn getuidPseudoFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// Target getgidPseudo() handler. SyscallReturn getgidPseudoFunc(SyscallDesc *desc, int num, - LiveProcess *p, ThreadContext *tc); + Process *p, ThreadContext *tc); /// A readable name for 1,000,000, for converting microseconds to seconds. @@ -570,7 +570,7 @@ copyOutStatfsBuf(SETranslatingPortProxy &mem, Addr addr, /// not TTYs to provide repeatable results. template SyscallReturn -ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +ioctlFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -601,7 +601,7 @@ ioctlFunc(SyscallDesc *desc, int callnum, LiveProcess *process, template static SyscallReturn -openFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +openFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc, int index) { std::string path; @@ -677,7 +677,7 @@ openFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target open() handler. template SyscallReturn -openFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +openFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { return openFunc(desc, callnum, process, tc, 0); @@ -686,8 +686,8 @@ openFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target openat() handler. template SyscallReturn -openatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +openatFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { int index = 0; int dirfd = process->getSyscallArg(tc, index); @@ -699,7 +699,7 @@ openatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target unlinkat() handler. template SyscallReturn -unlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +unlinkatFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -713,8 +713,8 @@ unlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target facessat() handler template SyscallReturn -faccessatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +faccessatFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { int index = 0; int dirfd = process->getSyscallArg(tc, index); @@ -726,8 +726,8 @@ faccessatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target readlinkat() handler template SyscallReturn -readlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +readlinkatFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { int index = 0; int dirfd = process->getSyscallArg(tc, index); @@ -739,7 +739,7 @@ readlinkatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target renameat() handler. template SyscallReturn -renameatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +renameatFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -775,8 +775,8 @@ renameatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target sysinfo() handler. template SyscallReturn -sysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +sysinfoFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { int index = 0; @@ -795,7 +795,7 @@ sysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target chmod() handler. template SyscallReturn -chmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +chmodFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { std::string path; @@ -827,7 +827,7 @@ chmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target fchmod() handler. template SyscallReturn -fchmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +fchmodFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -854,7 +854,7 @@ fchmodFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target mremap() handler. template SyscallReturn -mremapFunc(SyscallDesc *desc, int callnum, LiveProcess *process, ThreadContext *tc) +mremapFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; Addr start = process->getSyscallArg(tc, index); @@ -920,7 +920,7 @@ mremapFunc(SyscallDesc *desc, int callnum, LiveProcess *process, ThreadContext * /// Target stat() handler. template SyscallReturn -statFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +statFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { std::string path; @@ -950,7 +950,7 @@ statFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target stat64() handler. template SyscallReturn -stat64Func(SyscallDesc *desc, int callnum, LiveProcess *process, +stat64Func(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { std::string path; @@ -984,7 +984,7 @@ stat64Func(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target fstatat64() handler. template SyscallReturn -fstatat64Func(SyscallDesc *desc, int callnum, LiveProcess *process, +fstatat64Func(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -1021,7 +1021,7 @@ fstatat64Func(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target fstat64() handler. template SyscallReturn -fstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process, +fstat64Func(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -1052,7 +1052,7 @@ fstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target lstat() handler. template SyscallReturn -lstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +lstatFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { std::string path; @@ -1081,7 +1081,7 @@ lstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target lstat64() handler. template SyscallReturn -lstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process, +lstat64Func(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { std::string path; @@ -1115,7 +1115,7 @@ lstat64Func(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target fstat() handler. template SyscallReturn -fstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +fstatFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -1143,7 +1143,7 @@ fstatFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target statfs() handler. template SyscallReturn -statfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +statfsFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { #if NO_STATFS @@ -1176,7 +1176,7 @@ statfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target fstatfs() handler. template SyscallReturn -fstatfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +fstatfsFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -1202,7 +1202,7 @@ fstatfsFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target writev() handler. template SyscallReturn -writevFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +writevFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -1241,7 +1241,7 @@ writevFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Real mmap handler. template SyscallReturn -mmapImpl(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc, +mmapImpl(SyscallDesc *desc, int num, Process *p, ThreadContext *tc, bool is_mmap2) { int index = 0; @@ -1414,7 +1414,7 @@ mmapImpl(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc, template SyscallReturn -pwrite64Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +pwrite64Func(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 0; int tgt_fd = p->getSyscallArg(tc, index); @@ -1437,7 +1437,7 @@ pwrite64Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) /// Target mmap() handler. template SyscallReturn -mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +mmapFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { return mmapImpl(desc, num, p, tc, false); } @@ -1445,7 +1445,7 @@ mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) /// Target mmap2() handler. template SyscallReturn -mmap2Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +mmap2Func(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { return mmapImpl(desc, num, p, tc, true); } @@ -1453,8 +1453,8 @@ mmap2Func(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) /// Target getrlimit() handler. template SyscallReturn -getrlimitFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +getrlimitFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { int index = 0; unsigned resource = process->getSyscallArg(tc, index); @@ -1488,7 +1488,7 @@ getrlimitFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target clock_gettime() function. template SyscallReturn -clock_gettimeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +clock_gettimeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 1; //int clk_id = p->getSyscallArg(tc, index); @@ -1507,7 +1507,7 @@ clock_gettimeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) /// Target clock_getres() function. template SyscallReturn -clock_getresFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) +clock_getresFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 1; TypedBufferArg tp(p->getSyscallArg(tc, index)); @@ -1524,8 +1524,8 @@ clock_getresFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) /// Target gettimeofday() handler. template SyscallReturn -gettimeofdayFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +gettimeofdayFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { int index = 0; TypedBufferArg tp(process->getSyscallArg(tc, index)); @@ -1544,7 +1544,7 @@ gettimeofdayFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target utimes() handler. template SyscallReturn -utimesFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +utimesFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { std::string path; @@ -1579,7 +1579,7 @@ utimesFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target getrusage() function. template SyscallReturn -getrusageFunc(SyscallDesc *desc, int callnum, LiveProcess *process, +getrusageFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { int index = 0; @@ -1631,8 +1631,8 @@ getrusageFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target times() function. template SyscallReturn -timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +timesFunc(SyscallDesc *desc, int callnum, Process *process, + ThreadContext *tc) { int index = 0; TypedBufferArg bufp(process->getSyscallArg(tc, index)); @@ -1657,8 +1657,7 @@ timesFunc(SyscallDesc *desc, int callnum, LiveProcess *process, /// Target time() function. template SyscallReturn -timeFunc(SyscallDesc *desc, int callnum, LiveProcess *process, - ThreadContext *tc) +timeFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { typename OS::time_t sec, usec; getElapsedTimeMicro(sec, usec); -- cgit v1.2.3