From 54466a31c3c295f11d5936d34a1b2ac0d3e0045f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 16 Oct 2007 18:04:01 -0700 Subject: Make the process objects use the Params structs in their constructors, and use a limit to check if access are on the stack. --HG-- extra : convert_revision : af40a7acf424c4c4f62d0d76db1001a714ae0474 --- src/arch/sparc/linux/process.cc | 36 ++++++------------------------------ src/arch/sparc/linux/process.hh | 22 ++-------------------- src/arch/sparc/process.cc | 11 +++-------- src/arch/sparc/process.hh | 37 +++++-------------------------------- src/arch/sparc/solaris/process.cc | 21 +++------------------ src/arch/sparc/solaris/process.hh | 11 +---------- 6 files changed, 20 insertions(+), 118 deletions(-) (limited to 'src/arch/sparc') diff --git a/src/arch/sparc/linux/process.cc b/src/arch/sparc/linux/process.cc index 9e3f74075..f4ec28c00 100644 --- a/src/arch/sparc/linux/process.cc +++ b/src/arch/sparc/linux/process.cc @@ -72,21 +72,9 @@ SparcLinuxProcess::SparcLinuxProcess() : assert(Num_Syscall_Descs <= 299); } -Sparc32LinuxProcess::Sparc32LinuxProcess(const std::string &name, - ObjectFile *objFile, - System * system, - int stdin_fd, - int stdout_fd, - int stderr_fd, - std::vector &argv, - std::vector &envp, - const std::string &cwd, - uint64_t _uid, uint64_t _euid, - uint64_t _gid, uint64_t _egid, - uint64_t _pid, uint64_t _ppid) - : Sparc32LiveProcess(name, objFile, system, - stdin_fd, stdout_fd, stderr_fd, argv, envp, cwd, - _uid, _euid, _gid, _egid, _pid, _ppid) +Sparc32LinuxProcess::Sparc32LinuxProcess(LiveProcessParams * params, + ObjectFile *objFile) + : Sparc32LiveProcess(params, objFile) {} void Sparc32LinuxProcess::handleTrap(int trapNum, ThreadContext *tc) @@ -101,21 +89,9 @@ void Sparc32LinuxProcess::handleTrap(int trapNum, ThreadContext *tc) } } -Sparc64LinuxProcess::Sparc64LinuxProcess(const std::string &name, - ObjectFile *objFile, - System * system, - int stdin_fd, - int stdout_fd, - int stderr_fd, - std::vector &argv, - std::vector &envp, - const std::string &cwd, - uint64_t _uid, uint64_t _euid, - uint64_t _gid, uint64_t _egid, - uint64_t _pid, uint64_t _ppid) - : Sparc64LiveProcess(name, objFile, system, - stdin_fd, stdout_fd, stderr_fd, argv, envp, cwd, - _uid, _euid, _gid, _egid, _pid, _ppid) +Sparc64LinuxProcess::Sparc64LinuxProcess(LiveProcessParams * params, + ObjectFile *objFile) + : Sparc64LiveProcess(params, objFile) {} void Sparc64LinuxProcess::handleTrap(int trapNum, ThreadContext *tc) diff --git a/src/arch/sparc/linux/process.hh b/src/arch/sparc/linux/process.hh index 6c7f30a43..06eee9235 100644 --- a/src/arch/sparc/linux/process.hh +++ b/src/arch/sparc/linux/process.hh @@ -65,16 +65,7 @@ class Sparc32LinuxProcess : public SparcLinuxProcess, public Sparc32LiveProcess { public: /// Constructor. - Sparc32LinuxProcess(const std::string &name, - ObjectFile *objFile, - System * system, - int stdin_fd, int stdout_fd, int stderr_fd, - std::vector &argv, - std::vector &envp, - const std::string &cwd, - uint64_t _uid, uint64_t _euid, - uint64_t _gid, uint64_t _egid, - uint64_t _pid, uint64_t _ppid); + Sparc32LinuxProcess(LiveProcessParams * params, ObjectFile *objFile); SyscallDesc* getDesc(int callnum) { @@ -89,16 +80,7 @@ class Sparc64LinuxProcess : public SparcLinuxProcess, public Sparc64LiveProcess { public: /// Constructor. - Sparc64LinuxProcess(const std::string &name, - ObjectFile *objFile, - System * system, - int stdin_fd, int stdout_fd, int stderr_fd, - std::vector &argv, - std::vector &envp, - const std::string &cwd, - uint64_t _uid, uint64_t _euid, - uint64_t _gid, uint64_t _egid, - uint64_t _pid, uint64_t _ppid); + Sparc64LinuxProcess(LiveProcessParams * params, ObjectFile *objFile); SyscallDesc* getDesc(int callnum) { diff --git a/src/arch/sparc/process.cc b/src/arch/sparc/process.cc index 91564e754..e0d204a2d 100644 --- a/src/arch/sparc/process.cc +++ b/src/arch/sparc/process.cc @@ -47,14 +47,9 @@ using namespace std; using namespace SparcISA; -SparcLiveProcess::SparcLiveProcess(const std::string &nm, ObjectFile *objFile, - System *_system, int stdin_fd, int stdout_fd, int stderr_fd, - std::vector &argv, std::vector &envp, - const std::string &cwd, - uint64_t _uid, uint64_t _euid, uint64_t _gid, uint64_t _egid, - uint64_t _pid, uint64_t _ppid) - : LiveProcess(nm, objFile, _system, stdin_fd, stdout_fd, stderr_fd, - argv, envp, cwd, _uid, _euid, _gid, _egid, _pid, _ppid) +SparcLiveProcess::SparcLiveProcess(LiveProcessParams * params, + ObjectFile *objFile) + : LiveProcess(params, objFile) { // XXX all the below need to be updated for SPARC - Ali diff --git a/src/arch/sparc/process.hh b/src/arch/sparc/process.hh index f4e823a9a..dd8eae316 100644 --- a/src/arch/sparc/process.hh +++ b/src/arch/sparc/process.hh @@ -46,14 +46,7 @@ class SparcLiveProcess : public LiveProcess //The locations of the fill and spill handlers Addr fillStart, spillStart; - SparcLiveProcess(const std::string &nm, ObjectFile *objFile, - System *_system, int stdin_fd, int stdout_fd, int stderr_fd, - std::vector &argv, - std::vector &envp, - const std::string &cwd, - uint64_t _uid, uint64_t _euid, - uint64_t _gid, uint64_t _egid, - uint64_t _pid, uint64_t _ppid); + SparcLiveProcess(LiveProcessParams * params, ObjectFile *objFile); public: @@ -90,18 +83,8 @@ class Sparc32LiveProcess : public SparcLiveProcess std::vector auxv; - Sparc32LiveProcess(const std::string &nm, ObjectFile *objFile, - System *_system, int stdin_fd, int stdout_fd, int stderr_fd, - std::vector &argv, - std::vector &envp, - const std::string &cwd, - uint64_t _uid, uint64_t _euid, - uint64_t _gid, uint64_t _egid, - uint64_t _pid, uint64_t _ppid) : - SparcLiveProcess(nm, objFile, _system, - stdin_fd, stdout_fd, stderr_fd, - argv, envp, cwd, - _uid, _euid, _gid, _egid, _pid, _ppid) + Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) : + SparcLiveProcess(params, objFile) { // Set up stack. On SPARC Linux, stack goes from the top of memory // downward, less the hole for the kernel address space. @@ -143,18 +126,8 @@ class Sparc64LiveProcess : public SparcLiveProcess std::vector auxv; - Sparc64LiveProcess(const std::string &nm, ObjectFile *objFile, - System *_system, int stdin_fd, int stdout_fd, int stderr_fd, - std::vector &argv, - std::vector &envp, - const std::string &cwd, - uint64_t _uid, uint64_t _euid, - uint64_t _gid, uint64_t _egid, - uint64_t _pid, uint64_t _ppid) : - SparcLiveProcess(nm, objFile, _system, - stdin_fd, stdout_fd, stderr_fd, - argv, envp, cwd, - _uid, _euid, _gid, _egid, _pid, _ppid) + Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) : + SparcLiveProcess(params, objFile) { // Set up stack. On SPARC Linux, stack goes from the top of memory // downward, less the hole for the kernel address space. diff --git a/src/arch/sparc/solaris/process.cc b/src/arch/sparc/solaris/process.cc index b7a49ab8d..40d172690 100644 --- a/src/arch/sparc/solaris/process.cc +++ b/src/arch/sparc/solaris/process.cc @@ -321,24 +321,9 @@ SyscallDesc SparcSolarisProcess::syscallDescs[] = { /* 255 */ SyscallDesc("umount2", unimplementedFunc) }; -SparcSolarisProcess::SparcSolarisProcess(const std::string &name, - ObjectFile *objFile, - System * system, - int stdin_fd, - int stdout_fd, - int stderr_fd, - std::vector &argv, - std::vector &envp, - const std::string &cwd, - uint64_t _uid, - uint64_t _euid, - uint64_t _gid, - uint64_t _egid, - uint64_t _pid, - uint64_t _ppid) - : Sparc64LiveProcess(name, objFile, system, - stdin_fd, stdout_fd, stderr_fd, argv, envp, cwd, - _uid, _euid, _gid, _egid, _pid, _ppid), +SparcSolarisProcess::SparcSolarisProcess(LiveProcessParams * params, + ObjectFile *objFile) + : Sparc64LiveProcess(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 174eaecd7..2cf56f6ba 100644 --- a/src/arch/sparc/solaris/process.hh +++ b/src/arch/sparc/solaris/process.hh @@ -42,16 +42,7 @@ class SparcSolarisProcess : public Sparc64LiveProcess { public: /// Constructor. - SparcSolarisProcess(const std::string &name, - ObjectFile *objFile, - System * system, - int stdin_fd, int stdout_fd, int stderr_fd, - std::vector &argv, - std::vector &envp, - const std::string &cwd, - uint64_t _uid, uint64_t _euid, - uint64_t _gid, uint64_t _egid, - uint64_t _pid, uint64_t _ppid); + SparcSolarisProcess(LiveProcessParams * params, ObjectFile *objFile); virtual SyscallDesc* getDesc(int callnum); -- cgit v1.2.3