Make the process objects use the Params structs in their constructors, and use a...
authorGabe Black <gblack@eecs.umich.edu>
Wed, 17 Oct 2007 01:04:01 +0000 (18:04 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Wed, 17 Oct 2007 01:04:01 +0000 (18:04 -0700)
--HG--
extra : convert_revision : af40a7acf424c4c4f62d0d76db1001a714ae0474

23 files changed:
src/arch/alpha/linux/process.cc
src/arch/alpha/linux/process.hh
src/arch/alpha/process.cc
src/arch/alpha/process.hh
src/arch/alpha/tru64/process.cc
src/arch/alpha/tru64/process.hh
src/arch/mips/linux/process.cc
src/arch/mips/linux/process.hh
src/arch/mips/process.cc
src/arch/mips/process.hh
src/arch/sparc/linux/process.cc
src/arch/sparc/linux/process.hh
src/arch/sparc/process.cc
src/arch/sparc/process.hh
src/arch/sparc/solaris/process.cc
src/arch/sparc/solaris/process.hh
src/arch/x86/linux/process.cc
src/arch/x86/linux/process.hh
src/arch/x86/process.cc
src/arch/x86/process.hh
src/sim/Process.py
src/sim/process.cc
src/sim/process.hh

index b638aa927c9fcb9ceb66e88ba3f396c929b7cb34..ec47992bdcb9c381e3c76656b36892d287de1431 100644 (file)
@@ -568,23 +568,9 @@ SyscallDesc AlphaLinuxProcess::syscallDescs[] = {
     /* 441 */ SyscallDesc("keyctl", unimplementedFunc)
 };
 
-AlphaLinuxProcess::AlphaLinuxProcess(const std::string &name,
-                                     ObjectFile *objFile,
-                                     System *system,
-                                     int stdin_fd,
-                                     int stdout_fd,
-                                     int stderr_fd,
-                                     std::vector<std::string> &argv,
-                                     std::vector<std::string> &envp,
-                                     const std::string &cwd,
-                                     uint64_t _uid,
-                                     uint64_t _euid,
-                                     uint64_t _gid,
-                                     uint64_t _egid,
-                                     uint64_t _pid,
-                                     uint64_t _ppid)
-    : AlphaLiveProcess(name, objFile, system, stdin_fd, stdout_fd,
-           stderr_fd, argv, envp, cwd, _uid, _euid, _gid, _egid, _pid, _ppid),
+AlphaLinuxProcess::AlphaLinuxProcess(LiveProcessParams * params,
+                                     ObjectFile *objFile)
+    : AlphaLiveProcess(params, objFile),
      Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
 {
     //init_regs->intRegFile[0] = 0;
index cb22f521bcc01cbefc6cc59d606a6426e97788e6..8d7c24e37a14d7274265f028ab805d9ded25cffd 100644 (file)
@@ -40,16 +40,7 @@ class AlphaLinuxProcess : public AlphaLiveProcess
 {
   public:
     /// Constructor.
-    AlphaLinuxProcess(const std::string &name,
-                      ObjectFile *objFile,
-                      System *system,
-                      int stdin_fd, int stdout_fd, int stderr_fd,
-                      std::vector<std::string> &argv,
-                      std::vector<std::string> &envp,
-                      const std::string &cwd,
-                      uint64_t _uid, uint64_t _euid,
-                      uint64_t _gid, uint64_t _egid,
-                      uint64_t _pid, uint64_t _ppid);
+    AlphaLinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
 
     virtual SyscallDesc* getDesc(int callnum);
 
index a9848ebb5748dc372caf273e1246b71e092a03b6..ef53021c513be413495c7d9c62e59065b910c767 100644 (file)
 using namespace AlphaISA;
 using namespace std;
 
-AlphaLiveProcess::AlphaLiveProcess(const std::string &nm, ObjectFile *objFile,
-        System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
-        std::vector<std::string> &argv, std::vector<std::string> &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)
+AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams * params,
+        ObjectFile *objFile)
+    : LiveProcess(params, objFile)
 {
     brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize();
     brk_point = roundUp(brk_point, VMPageSize);
index 8eede502aebb9175981a0da1c4f4b219dcd28b3b..c66b97d234c57f7df4c2b7b7f636ac538cabd537 100644 (file)
@@ -43,14 +43,7 @@ class System;
 class AlphaLiveProcess : public LiveProcess
 {
   protected:
-    AlphaLiveProcess(const std::string &nm, ObjectFile *objFile,
-                System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
-                std::vector<std::string> &argv,
-                std::vector<std::string> &envp,
-                const std::string &cwd,
-                uint64_t _uid, uint64_t _euid,
-                uint64_t _gid, uint64_t _egid,
-                uint64_t _pid, uint64_t _ppid);
+    AlphaLiveProcess(LiveProcessParams * params, ObjectFile *objFile);
 
     void startup();
 };
index a1f02b16c02f844f733e9a4651228fa8d7aca99d..6823d820add268d50effe390c8e73188e8ce9c89 100644 (file)
@@ -573,20 +573,9 @@ AlphaTru64Process::getDesc(int callnum)
 }
 
 
-AlphaTru64Process::AlphaTru64Process(const std::string &name,
-                                     ObjectFile *objFile,
-                                     System *system,
-                                     int stdin_fd,
-                                     int stdout_fd,
-                                     int stderr_fd,
-                                     std::vector<std::string> &argv,
-                                     std::vector<std::string> &envp,
-                                     const std::string &cwd,
-                                     uint64_t _uid, uint64_t _euid,
-                                     uint64_t _gid, uint64_t _egid,
-                                     uint64_t _pid, uint64_t _ppid)
-    : AlphaLiveProcess(name, objFile, system, stdin_fd, stdout_fd,
-            stderr_fd, argv, envp, cwd, _uid, _euid, _gid, _egid, _pid, _ppid),
+AlphaTru64Process::AlphaTru64Process(LiveProcessParams * params,
+                                     ObjectFile *objFile)
+    : AlphaLiveProcess(params, objFile),
       Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)),
       Num_Mach_Syscall_Descs(sizeof(machSyscallDescs) / sizeof(SyscallDesc))
 {
index f5643c0b996d5ed992f5765a663aa295e0ac2a03..16bc499c63807743335e0f39f8a0a6bc2682ed02 100644 (file)
@@ -39,16 +39,8 @@ class AlphaTru64Process : public AlphaLiveProcess
 {
   public:
     /// Constructor.
-    AlphaTru64Process(const std::string &name,
-                      ObjectFile *objFile,
-                      System *system,
-                      int stdin_fd, int stdout_fd, int stderr_fd,
-                      std::vector<std::string> &argv,
-                      std::vector<std::string> &envp,
-                      const std::string &cwd,
-                      uint64_t _uid, uint64_t _euid,
-                      uint64_t _gid, uint64_t _egid,
-                      uint64_t _pid, uint64_t _ppid);
+    AlphaTru64Process(LiveProcessParams * params,
+                      ObjectFile *objFile);
 
     /// Array of syscall descriptors, indexed by call number.
     static SyscallDesc syscallDescs[];
index 283088cb2d49a9d1d3bc7b974d4dfb0ebc68b64e..425ef9ac37b422ac2be56f7046d5e1a3e33aea36 100644 (file)
@@ -405,23 +405,9 @@ SyscallDesc MipsLinuxProcess::syscallDescs[] = {
 };
 
 
-MipsLinuxProcess::MipsLinuxProcess(const std::string &name,
-                                     ObjectFile *objFile,
-                                     System *system,
-                                     int stdin_fd,
-                                     int stdout_fd,
-                                     int stderr_fd,
-                                     std::vector<std::string> &argv,
-                                     std::vector<std::string> &envp,
-                                     const std::string &cwd,
-                                     uint64_t _uid,
-                                     uint64_t _euid,
-                                     uint64_t _gid,
-                                     uint64_t _egid,
-                                     uint64_t _pid,
-                                     uint64_t _ppid)
-    : MipsLiveProcess(name, objFile, system, stdin_fd, stdout_fd, stderr_fd,
-                      argv, envp, cwd, _uid, _euid, _gid, _egid, _pid, _ppid),
+MipsLinuxProcess::MipsLinuxProcess(LiveProcessParams * params,
+                                     ObjectFile *objFile)
+    : MipsLiveProcess(params, objFile),
      Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
 {  }
 
index d18c9618827de9605543168c07a5ac644745c3e2..a1e738d6147fd33ec4c0e83ecacf27aab97172a6 100644 (file)
@@ -38,16 +38,7 @@ class MipsLinuxProcess : public MipsLiveProcess
 {
   public:
     /// Constructor.
-    MipsLinuxProcess(const std::string &name,
-                      ObjectFile *objFile,
-                      System *system,
-                      int stdin_fd, int stdout_fd, int stderr_fd,
-                      std::vector<std::string> &argv,
-                      std::vector<std::string> &envp,
-                      const std::string &cwd,
-                      uint64_t _uid, uint64_t _euid,
-                      uint64_t _gid, uint64_t _egid,
-                      uint64_t _pid, uint64_t _ppid);
+    MipsLinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
 
     void startup();
 
index d1e6e27bf32fbe8d2c04d3790260f90da90a415a..3ce6b19fa0fa390016014da6021af8a3ba77b783 100644 (file)
 using namespace std;
 using namespace MipsISA;
 
-MipsLiveProcess::MipsLiveProcess(const std::string &nm, ObjectFile *objFile,
-        System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
-        std::vector<std::string> &argv, std::vector<std::string> &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)
+MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params,
+        ObjectFile *objFile)
+    : LiveProcess(params, objFile)
 {
     // Set up stack. On MIPS, stack starts at the top of kuseg
     // user address space. MIPS stack grows down from here
index b6249f76dc5f7df4778d6c84fe990dbde34fed32..350a5bed9ef0066724f906f86da7c33811c08f69 100644 (file)
@@ -44,14 +44,7 @@ class System;
 class MipsLiveProcess : public LiveProcess
 {
   protected:
-    MipsLiveProcess(const std::string &nm, ObjectFile *objFile,
-                System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
-                std::vector<std::string> &argv,
-                std::vector<std::string> &envp,
-                    const std::string &cwd,
-                uint64_t _uid, uint64_t _euid,
-                uint64_t _gid, uint64_t _egid,
-                uint64_t _pid, uint64_t _ppid);
+    MipsLiveProcess(LiveProcessParams * params, ObjectFile *objFile);
 
     virtual void startup();
 
index 9e3f7407581a5aa52cb48b4c8c07bf68724feed6..f4ec28c0081ca8efeaa6eb5ba2723c409ed3b28f 100644 (file)
@@ -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<std::string> &argv,
-                                         std::vector<std::string> &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<std::string> &argv,
-                                         std::vector<std::string> &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)
index 6c7f30a43826b955fae1e04eee3b81c3e59c317f..06eee9235303562b9bc1ae0357a0e81703de885e 100644 (file)
@@ -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<std::string> &argv,
-                      std::vector<std::string> &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<std::string> &argv,
-                      std::vector<std::string> &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)
     {
index 91564e754d107fa87aa6dd5d0719a95e40639631..e0d204a2d4b9179a34dcbbab052bc5d1f041972e 100644 (file)
@@ -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<std::string> &argv, std::vector<std::string> &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
index f4e823a9a799fbf5f8b85d0770750adef107bdc1..dd8eae316a984ace25fc8c5df322dad1f1e149a2 100644 (file)
@@ -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<std::string> &argv,
-                std::vector<std::string> &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<M5_32_auxv_t> auxv;
 
-    Sparc32LiveProcess(const std::string &nm, ObjectFile *objFile,
-                System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
-                std::vector<std::string> &argv,
-                std::vector<std::string> &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<M5_64_auxv_t> auxv;
 
-    Sparc64LiveProcess(const std::string &nm, ObjectFile *objFile,
-                System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
-                std::vector<std::string> &argv,
-                std::vector<std::string> &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.
index b7a49ab8d4355e025e72b818da3d3a179da6db54..40d172690f36bea853ca9c344dc19fdee7b96136 100644 (file)
@@ -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<std::string> &argv,
-                                     std::vector<std::string> &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
index 174eaecd7ff857f6d12a7113e651b9dd7314711a..2cf56f6ba9ee26bd8994ace4fcf8861ca9bcecad 100644 (file)
@@ -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<std::string> &argv,
-                      std::vector<std::string> &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);
 
index 9ef591a1c10a1388eb79321fe993b2af16b3d30e..8beaf150b8f073e3a7b525b0533894ca274ebf38 100644 (file)
@@ -77,21 +77,9 @@ X86LinuxProcess::getDesc(int callnum)
     return &syscallDescs[callnum];
 }
 
-X86LinuxProcess::X86LinuxProcess(const std::string &name,
-                                       ObjectFile *objFile,
-                                       System * system,
-                                       int stdin_fd,
-                                       int stdout_fd,
-                                       int stderr_fd,
-                                       std::vector<std::string> &argv,
-                                       std::vector<std::string> &envp,
-                                       const std::string &cwd,
-                                       uint64_t _uid, uint64_t _euid,
-                                       uint64_t _gid, uint64_t _egid,
-                                       uint64_t _pid, uint64_t _ppid)
-    : X86LiveProcess(name, objFile, system,
-            stdin_fd, stdout_fd, stderr_fd, argv, envp, cwd,
-            _uid, _euid, _gid, _egid, _pid, _ppid),
+X86LinuxProcess::X86LinuxProcess(LiveProcessParams * params,
+        ObjectFile *objFile)
+    : X86LiveProcess(params, objFile),
     Num_Syscall_Descs(273)
 {}
 
index 7e7236f0d07e23dc20b51082197d761f1e1b91d2..e224374d4ca0d083a76fe542a8b9d427abd4ff1b 100644 (file)
@@ -70,16 +70,7 @@ class X86LinuxProcess : public X86LiveProcess
 {
   public:
     /// Constructor.
-    X86LinuxProcess(const std::string &name,
-                      ObjectFile *objFile,
-                      System * system,
-                      int stdin_fd, int stdout_fd, int stderr_fd,
-                      std::vector<std::string> &argv,
-                      std::vector<std::string> &envp,
-                      const std::string &cwd,
-                      uint64_t _uid, uint64_t _euid,
-                      uint64_t _gid, uint64_t _egid,
-                      uint64_t _pid, uint64_t _ppid);
+    X86LinuxProcess(LiveProcessParams * params, ObjectFile *objFile);
 
      /// Array of syscall descriptors, indexed by call number.
     static SyscallDesc syscallDescs[];
index 0193344e8c312b15e3aafa06baa898fadad6ebef..db32437d58f58c2ac23cecf07bd69620031c7632 100644 (file)
@@ -109,14 +109,9 @@ M5_64_auxv_t::M5_64_auxv_t(int64_t type, int64_t val)
     a_val = TheISA::htog(val);
 }
 
-X86LiveProcess::X86LiveProcess(const std::string &nm, ObjectFile *objFile,
-        System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
-        std::vector<std::string> &argv, std::vector<std::string> &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)
+X86LiveProcess::X86LiveProcess(LiveProcessParams * params,
+        ObjectFile *objFile)
+    : LiveProcess(params, objFile)
 {
     brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize();
     brk_point = roundUp(brk_point, VMPageSize);
index a2fa258c86aeb0ab446a3e967196757c24b19760..5def9e13da33a0adee95144518c85c1c4f329e53 100644 (file)
@@ -84,15 +84,7 @@ namespace X86ISA
       protected:
         std::vector<M5_64_auxv_t> auxv;
 
-        X86LiveProcess(const std::string &nm, ObjectFile *objFile,
-                    System *_system,
-                    int stdin_fd, int stdout_fd, int stderr_fd,
-                    std::vector<std::string> &argv,
-                    std::vector<std::string> &envp,
-                    const std::string &cwd,
-                    uint64_t _uid, uint64_t _euid,
-                    uint64_t _gid, uint64_t _egid,
-                    uint64_t _pid, uint64_t _ppid);
+        X86LiveProcess(LiveProcessParams * params, ObjectFile *objFile);
 
         void startup();
 
index 34ff6c3948d8a3c0e02981bd4b9d05ec85f1d722..07ed2c6920e21644e5c63ad6b0c53e6764246a95 100644 (file)
@@ -33,8 +33,10 @@ from m5.proxy import *
 class Process(SimObject):
     type = 'Process'
     abstract = True
+    input = Param.String('cin', "filename for stdin")
     output = Param.String('cout', 'filename for stdout/stderr')
     system = Param.System(Parent.any, "system process will run on")
+    max_stack_size = Param.MemorySize('64MB', 'maximum size of the stack')
 
 class LiveProcess(Process):
     type = 'LiveProcess'
@@ -42,7 +44,6 @@ class LiveProcess(Process):
     cmd = VectorParam.String("command line (executable plus arguments)")
     env = VectorParam.String([], "environment settings")
     cwd = Param.String('', "current working directory")
-    input = Param.String('cin', "filename for stdin")
     uid = Param.Int(100, 'user id')
     euid = Param.Int(100, 'effective user id')
     gid = Param.Int(100, 'group id')
index 6ec7c86098ef425ec9d537d12e3e5385397dc82e..c5be4087dcfb2f1a44864eb9b76ad537b6016d06 100644 (file)
@@ -45,6 +45,7 @@
 #include "mem/page_table.hh"
 #include "mem/physical.hh"
 #include "mem/translating_port.hh"
+#include "params/Process.hh"
 #include "params/LiveProcess.hh"
 #include "sim/process.hh"
 #include "sim/process_impl.hh"
@@ -83,13 +84,34 @@ using namespace TheISA;
 // current number of allocated processes
 int num_processes = 0;
 
-Process::Process(const string &nm,
-                 System *_system,
-                 int stdin_fd,         // initial I/O descriptors
-                 int stdout_fd,
-                 int stderr_fd)
-    : SimObject(makeParams(nm)), system(_system)
+Process::Process(ProcessParams * params)
+    : SimObject(params), system(params->system),
+    max_stack_size(params->max_stack_size)
 {
+    string in = params->input;
+    string out = params->output;
+
+    // initialize file descriptors to default: same as simulator
+    int stdin_fd, stdout_fd, stderr_fd;
+
+    if (in == "stdin" || in == "cin")
+        stdin_fd = STDIN_FILENO;
+    else if (in == "None")
+        stdin_fd = -1;
+    else
+        stdin_fd = Process::openInputFile(in);
+
+    if (out == "stdout" || out == "cout")
+        stdout_fd = STDOUT_FILENO;
+    else if (out == "stderr" || out == "cerr")
+        stdout_fd = STDERR_FILENO;
+    else if (out == "None")
+        stdout_fd = -1;
+    else
+        stdout_fd = Process::openOutputFile(out);
+
+    stderr_fd = (stdout_fd != STDOUT_FILENO) ? stdout_fd : STDERR_FILENO;
+
     M5_pid = system->allocatePID();
     // initialize first 3 fds (stdin, stdout, stderr)
     fd_map[STDIN_FILENO] = stdin_fd;
@@ -264,13 +286,16 @@ Process::checkAndAllocNextPage(Addr vaddr)
 
     // We've accessed the next page of the stack, so extend the stack
     // to cover it.
-    if(vaddr < stack_min && vaddr >= stack_min - TheISA::PageBytes)
-    {
-        stack_min -= TheISA::PageBytes;
-        if(stack_base - stack_min > 8*1024*1024)
-            fatal("Over max stack size for one thread\n");
-        pTable->allocate(stack_min, TheISA::PageBytes);
-        warn("Increasing stack size by one page.");
+    if (vaddr < stack_min && vaddr >= stack_base - max_stack_size) {
+        while (vaddr < stack_min) {
+            stack_min -= TheISA::PageBytes;
+            if(stack_base - stack_min > max_stack_size)
+                fatal("Maximum stack size exceeded\n");
+            if(stack_base - stack_min > 8*1024*1024)
+                fatal("Over max stack size for one thread\n");
+            pTable->allocate(stack_min, TheISA::PageBytes);
+            warn("Increasing stack size by one page.");
+        };
         return true;
     }
     return false;
@@ -320,25 +345,18 @@ Process::unserialize(Checkpoint *cp, const std::string &section)
 ////////////////////////////////////////////////////////////////////////
 
 
-LiveProcess::LiveProcess(const string &nm, ObjectFile *_objFile,
-                         System *_system,
-                         int stdin_fd, int stdout_fd, int stderr_fd,
-                         vector<string> &_argv, vector<string> &_envp,
-                         const string &_cwd,
-                         uint64_t _uid, uint64_t _euid,
-                         uint64_t _gid, uint64_t _egid,
-                         uint64_t _pid, uint64_t _ppid)
-    : Process(nm, _system, stdin_fd, stdout_fd, stderr_fd),
-      objFile(_objFile), argv(_argv), envp(_envp), cwd(_cwd)
+LiveProcess::LiveProcess(LiveProcessParams * params, ObjectFile *_objFile)
+    : Process(params), objFile(_objFile),
+      argv(params->cmd), envp(params->env), cwd(params->cwd)
 {
-    __uid = _uid;
-    __euid = _euid;
-    __gid = _gid;
-    __egid = _egid;
-    __pid = _pid;
-    __ppid = _ppid;
+    __uid = params->uid;
+    __euid = params->euid;
+    __gid = params->gid;
+    __egid = params->egid;
+    __pid = params->pid;
+    __ppid = params->ppid;
 
-    prog_fname = argv[0];
+    prog_fname = params->cmd[0];
 
     // load up symbols, if any... these may be used for debugging or
     // profiling.
@@ -435,17 +453,12 @@ LiveProcess::syscall(int64_t callnum, ThreadContext *tc)
 }
 
 LiveProcess *
-LiveProcess::create(const std::string &nm, System *system, int stdin_fd,
-                    int stdout_fd, int stderr_fd, std::string executable,
-                    std::vector<std::string> &argv,
-                    std::vector<std::string> &envp,
-                    const std::string &cwd,
-                    uint64_t _uid, uint64_t _euid,
-                    uint64_t _gid, uint64_t _egid,
-                    uint64_t _pid, uint64_t _ppid)
+LiveProcess::create(LiveProcessParams * params)
 {
     LiveProcess *process = NULL;
 
+    string executable =
+        params->executable == "" ? params->cmd[0] : params->executable;
     ObjectFile *objFile = createObjectFile(executable);
     if (objFile == NULL) {
         fatal("Can't load object file %s", executable);
@@ -466,17 +479,11 @@ LiveProcess::create(const std::string &nm, System *system, int stdin_fd,
         fatal("Object file architecture does not match compiled ISA (Alpha).");
     switch (objFile->getOpSys()) {
       case ObjectFile::Tru64:
-        process = new AlphaTru64Process(nm, objFile, system,
-                                        stdin_fd, stdout_fd, stderr_fd,
-                                        argv, envp, cwd,
-                                        _uid, _euid, _gid, _egid, _pid, _ppid);
+        process = new AlphaTru64Process(params, objFile);
         break;
 
       case ObjectFile::Linux:
-        process = new AlphaLinuxProcess(nm, objFile, system,
-                                        stdin_fd, stdout_fd, stderr_fd,
-                                        argv, envp, cwd,
-                                        _uid, _euid, _gid, _egid, _pid, _ppid);
+        process = new AlphaLinuxProcess(params, objFile);
         break;
 
       default:
@@ -488,26 +495,15 @@ LiveProcess::create(const std::string &nm, System *system, int stdin_fd,
     switch (objFile->getOpSys()) {
       case ObjectFile::Linux:
         if (objFile->getArch() == ObjectFile::SPARC64) {
-            process = new Sparc64LinuxProcess(nm, objFile, system,
-                                              stdin_fd, stdout_fd, stderr_fd,
-                                              argv, envp, cwd,
-                                              _uid, _euid, _gid,
-                                              _egid, _pid, _ppid);
+            process = new Sparc64LinuxProcess(params, objFile);
         } else {
-            process = new Sparc32LinuxProcess(nm, objFile, system,
-                                              stdin_fd, stdout_fd, stderr_fd,
-                                              argv, envp, cwd,
-                                              _uid, _euid, _gid,
-                                              _egid, _pid, _ppid);
+            process = new Sparc32LinuxProcess(params, objFile);
         }
         break;
 
 
       case ObjectFile::Solaris:
-        process = new SparcSolarisProcess(nm, objFile, system,
-                                        stdin_fd, stdout_fd, stderr_fd,
-                                        argv, envp, cwd,
-                                        _uid, _euid, _gid, _egid, _pid, _ppid);
+        process = new SparcSolarisProcess(params, objFile);
         break;
       default:
         fatal("Unknown/unsupported operating system.");
@@ -517,11 +513,7 @@ LiveProcess::create(const std::string &nm, System *system, int stdin_fd,
         fatal("Object file architecture does not match compiled ISA (x86).");
     switch (objFile->getOpSys()) {
       case ObjectFile::Linux:
-        process = new X86LinuxProcess(nm, objFile, system,
-                                          stdin_fd, stdout_fd, stderr_fd,
-                                          argv, envp, cwd,
-                                          _uid, _euid, _gid,
-                                          _egid, _pid, _ppid);
+        process = new X86LinuxProcess(params, objFile);
         break;
       default:
         fatal("Unknown/unsupported operating system.");
@@ -531,10 +523,7 @@ LiveProcess::create(const std::string &nm, System *system, int stdin_fd,
         fatal("Object file architecture does not match compiled ISA (MIPS).");
     switch (objFile->getOpSys()) {
       case ObjectFile::Linux:
-        process = new MipsLinuxProcess(nm, objFile, system,
-                                        stdin_fd, stdout_fd, stderr_fd,
-                                        argv, envp, cwd,
-                                        _uid, _euid, _gid, _egid, _pid, _ppid);
+        process = new MipsLinuxProcess(params, objFile);
         break;
 
       default:
@@ -553,29 +542,5 @@ LiveProcess::create(const std::string &nm, System *system, int stdin_fd,
 LiveProcess *
 LiveProcessParams::create()
 {
-    string in = input;
-    string out = output;
-
-    // initialize file descriptors to default: same as simulator
-    int stdin_fd, stdout_fd, stderr_fd;
-
-    if (in == "stdin" || in == "cin")
-        stdin_fd = STDIN_FILENO;
-    else
-        stdin_fd = Process::openInputFile(input);
-
-    if (out == "stdout" || out == "cout")
-        stdout_fd = STDOUT_FILENO;
-    else if (out == "stderr" || out == "cerr")
-        stdout_fd = STDERR_FILENO;
-    else
-        stdout_fd = Process::openOutputFile(out);
-
-    stderr_fd = (stdout_fd != STDOUT_FILENO) ? stdout_fd : STDERR_FILENO;
-
-    return LiveProcess::create(name, system,
-                               stdin_fd, stdout_fd, stderr_fd,
-                               (string)executable == "" ? cmd[0] : executable,
-                               cmd, env, cwd,
-                               uid, euid, gid, egid, pid, ppid);
+    return LiveProcess::create(this);
 }
index 83c00a6769a682b611e36a21f21312490752ae99..d43208c272ed7a6c586ed7406c1ad58feeb3bc75 100644 (file)
 #include "sim/host.hh"
 #include "sim/sim_object.hh"
 
-class ThreadContext;
-class SyscallDesc;
+class GDBListener;
 class PageTable;
-class TranslatingPort;
+class ProcessParams;
+class LiveProcessParams;
+class SyscallDesc;
 class System;
-class GDBListener;
+class ThreadContext;
+class TranslatingPort;
 namespace TheISA
 {
     class RemoteGDB;
@@ -103,6 +105,9 @@ class Process : public SimObject
     unsigned stack_size;       // initial stack size
     Addr stack_min;            // lowest address accessed on the stack
 
+    // The maximum size allowed for the stack.
+    Addr max_stack_size;
+
     // addr to use for next stack region (for multithreaded apps)
     Addr next_thread_stack_base;
 
@@ -121,11 +126,7 @@ class Process : public SimObject
 
   protected:
     // constructor
-    Process(const std::string &nm,
-            System *_system,
-            int stdin_fd,      // initial I/O descriptors
-            int stdout_fd,
-            int stderr_fd);
+    Process(ProcessParams * params);
 
     // post initialization startup
     virtual void startup();
@@ -195,14 +196,7 @@ class LiveProcess : public Process
     std::vector<std::string> envp;
     std::string cwd;
 
-    LiveProcess(const std::string &nm, ObjectFile *objFile,
-                System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
-                std::vector<std::string> &argv,
-                std::vector<std::string> &envp,
-                const std::string &cwd,
-                uint64_t _uid, uint64_t _euid,
-                uint64_t _gid, uint64_t _egid,
-                uint64_t _pid, uint64_t _ppid);
+    LiveProcess(LiveProcessParams * params, ObjectFile *objFile);
 
     virtual void argsInit(int intSize, int pageSize);
 
@@ -272,16 +266,7 @@ class LiveProcess : public Process
     // 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(const std::string &nm,
-                               System *_system,
-                               int stdin_fd, int stdout_fd, int stderr_fd,
-                               std::string executable,
-                               std::vector<std::string> &argv,
-                               std::vector<std::string> &envp,
-                               const std::string &cwd,
-                               uint64_t _uid, uint64_t _euid,
-                               uint64_t _gid, uint64_t _egid,
-                               uint64_t _pid, uint64_t _ppid);
+    static LiveProcess *create(LiveProcessParams * params);
 };