summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-09-15 00:59:39 -0400
committerGabe Black <gblack@eecs.umich.edu>2006-09-15 00:59:39 -0400
commit8abab05c833bcba09ef0093a5fbfb77398c10bf3 (patch)
tree7b4b1a00873bc1674d229100d8e5cf24bb11fdbf /src/sim
parent44c6f953b0a448bd27b8354de90db8934b3ca799 (diff)
parentb11018ca12ddd8557bddbadaf649253aa5fd8c47 (diff)
downloadgem5-8abab05c833bcba09ef0093a5fbfb77398c10bf3.tar.xz
Merge zizzer.eecs.umich.edu:/bk/newmem
into ewok.(none):/home/gblack/m5/newmem --HG-- extra : convert_revision : 91aacb435c223e8c37f6ba0a458b0dee55edcaf2
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/process.cc14
-rw-r--r--src/sim/process.hh10
-rw-r--r--src/sim/syscall_emul.cc26
3 files changed, 36 insertions, 14 deletions
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 081a25976..20f7fec2d 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -460,6 +460,12 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(LiveProcess)
Param<string> output;
VectorParam<string> env;
SimObjectParam<System *> system;
+ Param<uint64_t> uid;
+ Param<uint64_t> euid;
+ Param<uint64_t> gid;
+ Param<uint64_t> egid;
+ Param<uint64_t> pid;
+ Param<uint64_t> ppid;
END_DECLARE_SIM_OBJECT_PARAMS(LiveProcess)
@@ -471,7 +477,13 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(LiveProcess)
INIT_PARAM(input, "filename for stdin (dflt: use sim stdin)"),
INIT_PARAM(output, "filename for stdout/stderr (dflt: use sim stdout)"),
INIT_PARAM(env, "environment settings"),
- INIT_PARAM(system, "system")
+ INIT_PARAM(system, "system"),
+ INIT_PARAM(uid, "user id"),
+ INIT_PARAM(euid, "effective user id"),
+ INIT_PARAM(gid, "group id"),
+ INIT_PARAM(egid, "effective group id"),
+ INIT_PARAM(pid, "process id"),
+ INIT_PARAM(ppid, "parent process id")
END_INIT_SIM_OBJECT_PARAMS(LiveProcess)
diff --git a/src/sim/process.hh b/src/sim/process.hh
index 763deb100..d64cc3cf1 100644
--- a/src/sim/process.hh
+++ b/src/sim/process.hh
@@ -75,6 +75,16 @@ class Process : public SimObject
// number of CPUs (esxec contexts, really) assigned to this process.
unsigned int numCpus() { return threadContexts.size(); }
+ // 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;
+
// record of blocked context
struct WaitRec
{
diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc
index cf90d8f84..fe0260223 100644
--- a/src/sim/syscall_emul.cc
+++ b/src/sim/syscall_emul.cc
@@ -414,8 +414,8 @@ getpidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
// fake_syscall mode, so there's no way for a process to know it's
// not getting a unique value.
- tc->setIntReg(SyscallPseudoReturnReg, 99);
- return 100;
+ tc->setIntReg(SyscallPseudoReturnReg, process->ppid);
+ return process->pid;
}
@@ -427,8 +427,8 @@ getuidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
// simulation to be deterministic.
// EUID goes in r20.
- tc->setIntReg(SyscallPseudoReturnReg, 100); //EUID
- return 100; // UID
+ tc->setIntReg(SyscallPseudoReturnReg, process->euid); //EUID
+ return process->uid; // UID
}
@@ -437,8 +437,8 @@ getgidPseudoFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
// Get current group ID. EGID goes in r20.
- tc->setIntReg(SyscallPseudoReturnReg, 100); //EGID
- return 100;
+ tc->setIntReg(SyscallPseudoReturnReg, process->egid); //EGID
+ return process->gid;
}
@@ -459,43 +459,43 @@ getpidFunc(SyscallDesc *desc, int callnum, Process *process,
// fake_syscall mode, so there's no way for a process to know it's
// not getting a unique value.
- tc->setIntReg(SyscallPseudoReturnReg, 99); //PID
- return 100;
+ tc->setIntReg(SyscallPseudoReturnReg, process->ppid); //PID
+ return process->pid;
}
SyscallReturn
getppidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
- return 99;
+ return process->ppid;
}
SyscallReturn
getuidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
- return 100; // UID
+ return process->uid; // UID
}
SyscallReturn
geteuidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
- return 100; // UID
+ return process->euid; // UID
}
SyscallReturn
getgidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
- return 100;
+ return process->gid;
}
SyscallReturn
getegidFunc(SyscallDesc *desc, int callnum, Process *process,
ThreadContext *tc)
{
- return 100;
+ return process->egid;
}