changeset cd7f3a1dbf55 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=cd7f3a1dbf55
description:
        syscall_emul: [patch 4/22] remove redundant M5_pid field from process

diffstat:

 src/arch/alpha/process.cc |   4 ++--
 src/arch/sparc/faults.cc  |   4 ++--
 src/sim/Process.py        |  13 +++++++------
 src/sim/process.cc        |  15 ++++++---------
 src/sim/process.hh        |  38 ++++++++++++++++++--------------------
 src/sim/system.cc         |   3 ---
 src/sim/system.hh         |   8 --------
 7 files changed, 35 insertions(+), 50 deletions(-)

diffs (243 lines):

diff -r 54436a1784dc -r cd7f3a1dbf55 src/arch/alpha/process.cc
--- a/src/arch/alpha/process.cc Wed Nov 09 14:27:40 2016 -0600
+++ b/src/arch/alpha/process.cc Wed Nov 09 14:27:40 2016 -0600
@@ -179,7 +179,7 @@
 AlphaLiveProcess::setupASNReg()
 {
     ThreadContext *tc = system->getThreadContext(contextIds[0]);
-    tc->setMiscRegNoEffect(IPR_DTB_ASN, M5_pid << 57);
+    tc->setMiscRegNoEffect(IPR_DTB_ASN, _pid << 57);
 }
 
 
@@ -187,7 +187,7 @@
 AlphaLiveProcess::loadState(CheckpointIn &cp)
 {
     LiveProcess::loadState(cp);
-    // need to set up ASN after unserialization since M5_pid value may
+    // need to set up ASN after unserialization since _pid value may
     // come from checkpoint
     setupASNReg();
 }
diff -r 54436a1784dc -r cd7f3a1dbf55 src/arch/sparc/faults.cc
--- a/src/arch/sparc/faults.cc  Wed Nov 09 14:27:40 2016 -0600
+++ b/src/arch/sparc/faults.cc  Wed Nov 09 14:27:40 2016 -0600
@@ -630,7 +630,7 @@
     } else {
         Addr alignedVaddr = p->pTable->pageAlign(vaddr);
         tc->getITBPtr()->insert(alignedVaddr, 0 /*partition id*/,
-                p->M5_pid /*context id*/, false, entry.pte);
+                p->_pid /*context id*/, false, entry.pte);
     }
 }
 
@@ -654,7 +654,7 @@
     } else {
         Addr alignedVaddr = p->pTable->pageAlign(vaddr);
         tc->getDTBPtr()->insert(alignedVaddr, 0 /*partition id*/,
-                p->M5_pid /*context id*/, false, entry.pte);
+                p->_pid /*context id*/, false, entry.pte);
     }
 }
 
diff -r 54436a1784dc -r cd7f3a1dbf55 src/sim/Process.py
--- a/src/sim/Process.py        Wed Nov 09 14:27:40 2016 -0600
+++ b/src/sim/Process.py        Wed Nov 09 14:27:40 2016 -0600
@@ -43,6 +43,13 @@
     kvmInSE = Param.Bool('false', 'initialize the process for KvmCPU in SE')
     max_stack_size = Param.MemorySize('64MB', 'maximum size of the stack')
 
+    uid = Param.Int(100, 'user id')
+    euid = Param.Int(100, 'effective user id')
+    gid = Param.Int(100, 'group id')
+    egid = Param.Int(100, 'effective group id')
+    pid = Param.Int(100, 'process id')
+    ppid = Param.Int(99, 'parent process id')
+
     @classmethod
     def export_methods(cls, code):
         code('bool map(Addr vaddr, Addr paddr, int size, bool 
cacheable=true);')
@@ -60,12 +67,6 @@
     cmd = VectorParam.String("command line (executable plus arguments)")
     env = VectorParam.String([], "environment settings")
     cwd = Param.String('', "current working directory")
-    uid = Param.Int(100, 'user id')
-    euid = Param.Int(100, 'effective user id')
-    gid = Param.Int(100, 'group id')
-    egid = Param.Int(100, 'effective group id')
-    pid = Param.Int(100, 'process id')
-    ppid = Param.Int(99, 'parent process id')
     simpoint = Param.UInt64(0, 'simulation point at which to start simulation')
     drivers = VectorParam.EmulatedDriver([], 'Available emulated drivers')
 
diff -r 54436a1784dc -r cd7f3a1dbf55 src/sim/process.cc
--- a/src/sim/process.cc        Wed Nov 09 14:27:40 2016 -0600
+++ b/src/sim/process.cc        Wed Nov 09 14:27:40 2016 -0600
@@ -131,12 +131,11 @@
       brk_point(0), stack_base(0), stack_size(0), stack_min(0),
       max_stack_size(params->max_stack_size),
       next_thread_stack_base(0),
-      M5_pid(system->allocatePID()),
       useArchPT(params->useArchPT),
       kvmInSE(params->kvmInSE),
       pTable(useArchPT ?
-        static_cast<PageTableBase *>(new ArchPageTable(name(), M5_pid, 
system)) :
-        static_cast<PageTableBase *>(new FuncPageTable(name(), M5_pid)) ),
+        static_cast<PageTableBase *>(new ArchPageTable(name(), _pid, system)) :
+        static_cast<PageTableBase *>(new FuncPageTable(name(), _pid))),
       initVirtMem(system->getSystemPort(), this,
                   SETranslatingPortProxy::Always),
       fd_array(make_shared<array<FDEntry, NUM_FDS>>()),
@@ -147,7 +146,10 @@
             {"cout",   STDOUT_FILENO},
             {"stdout", STDOUT_FILENO},
             {"cerr",   STDERR_FILENO},
-            {"stderr", STDERR_FILENO}}
+            {"stderr", STDERR_FILENO}},
+      _uid(params->uid), _euid(params->euid),
+      _gid(params->gid), _egid(params->egid),
+      _pid(params->pid), _ppid(params->ppid)
 {
     int sim_fd;
     std::map<string,int>::iterator it;
@@ -457,7 +459,6 @@
     for (int x = 0; x < fd_array->size(); x++) {
         (*fd_array)[x].serializeSection(cp, csprintf("FDEntry%d", x));
     }
-    SERIALIZE_SCALAR(M5_pid);
 
 }
 
@@ -478,7 +479,6 @@
         fde->unserializeSection(cp, csprintf("FDEntry%d", x));
     }
     fixFileOffsets();
-    UNSERIALIZE_OPT_SCALAR(M5_pid);
     // The above returns a bool so that you could do something if you don't
     // find the param in the checkpoint if you wanted to, like set a default
     // but in this case we'll just stick with the instantiated value if not
@@ -506,9 +506,6 @@
     : Process(params), objFile(_objFile),
       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),
       drivers(params->drivers)
 {
 
diff -r 54436a1784dc -r cd7f3a1dbf55 src/sim/process.hh
--- a/src/sim/process.hh        Wed Nov 09 14:27:40 2016 -0600
+++ b/src/sim/process.hh        Wed Nov 09 14:27:40 2016 -0600
@@ -132,10 +132,6 @@
 
   public:
 
-    //This id is assigned by m5 and is used to keep process' tlb entries
-    //separated.
-    uint64_t M5_pid;
-
     // flag for using architecture specific page table
     bool useArchPT;
     // running KvmCPU in SE mode requires special initialization
@@ -231,6 +227,18 @@
 
     void serialize(CheckpointOut &cp) const override;
     void unserialize(CheckpointIn &cp) override;
+
+  public:
+    // Id of the owner of the process
+    uint64_t _uid;
+    uint64_t _euid;
+    uint64_t _gid;
+    uint64_t _egid;
+
+    // pid of the process and it's parent
+    uint64_t _pid;
+    uint64_t _ppid;
+
 };
 
 //
@@ -248,16 +256,6 @@
 
     LiveProcess(LiveProcessParams *params, ObjectFile *objFile);
 
-    // Id of the owner of the process
-    uint64_t __uid;
-    uint64_t __euid;
-    uint64_t __gid;
-    uint64_t __egid;
-
-    // pid of the process and it's parent
-    uint64_t __pid;
-    uint64_t __ppid;
-
     // Emulated drivers available to this process
     std::vector<EmulatedDriver *> drivers;
 
@@ -293,12 +291,12 @@
         M5_AT_VECTOR_SIZE = 44
     };
 
-    inline uint64_t uid() {return __uid;}
-    inline uint64_t euid() {return __euid;}
-    inline uint64_t gid() {return __gid;}
-    inline uint64_t egid() {return __egid;}
-    inline uint64_t pid() {return __pid;}
-    inline uint64_t ppid() {return __ppid;}
+    inline uint64_t uid() { return _uid; }
+    inline uint64_t euid() { return _euid; }
+    inline uint64_t gid() { return _gid; }
+    inline uint64_t egid() { return _egid; }
+    inline uint64_t pid() { return _pid; }
+    inline uint64_t ppid() { return _ppid; }
 
     // provide program name for debug messages
     virtual const char *progName() const { return executable.c_str(); }
diff -r 54436a1784dc -r cd7f3a1dbf55 src/sim/system.cc
--- a/src/sim/system.cc Wed Nov 09 14:27:40 2016 -0600
+++ b/src/sim/system.cc Wed Nov 09 14:27:40 2016 -0600
@@ -90,7 +90,6 @@
       kernel(nullptr),
       loadAddrMask(p->load_addr_mask),
       loadAddrOffset(p->load_offset),
-      nextPID(0),
       physmem(name() + ".physmem", p->memories, p->mmap_using_noreserve),
       memoryMode(p->mem_mode),
       _cacheLineSize(p->cache_line_size),
@@ -371,7 +370,6 @@
     if (FullSystem)
         kernelSymtab->serialize("kernel_symtab", cp);
     SERIALIZE_SCALAR(pagePtr);
-    SERIALIZE_SCALAR(nextPID);
     serializeSymtab(cp);
 
     // also serialize the memories in the system
@@ -385,7 +383,6 @@
     if (FullSystem)
         kernelSymtab->unserialize("kernel_symtab", cp);
     UNSERIALIZE_SCALAR(pagePtr);
-    UNSERIALIZE_SCALAR(nextPID);
     unserializeSymtab(cp);
 
     // also unserialize the memories in the system
diff -r 54436a1784dc -r cd7f3a1dbf55 src/sim/system.hh
--- a/src/sim/system.hh Wed Nov 09 14:27:40 2016 -0600
+++ b/src/sim/system.hh Wed Nov 09 14:27:40 2016 -0600
@@ -248,15 +248,7 @@
      */
     Addr loadAddrOffset;
 
-  protected:
-    uint64_t nextPID;
-
   public:
-    uint64_t allocatePID()
-    {
-        return nextPID++;
-    }
-
     /** Get a pointer to access the physical memory of the system */
     PhysicalMemory& getPhysMem() { return physmem; }
 
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to