summaryrefslogtreecommitdiff
path: root/src/sim/process.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2011-05-23 14:29:23 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2011-05-23 14:29:23 -0700
commit8d29bda74211f4ff1804aeeb05b2795b549036f7 (patch)
treeddf4ed45b6f56efab93e27812f1fca0eb3cbfece /src/sim/process.cc
parent19bb896bfeffc0b49197f5b2d8395a6ee4c5e94d (diff)
downloadgem5-8d29bda74211f4ff1804aeeb05b2795b549036f7.tar.xz
syscall emul: fix Power Linux mmap constant, plus other cleanup
We were getting a spurious warning in the regressions that turned out to be due to having the wrong value for TGT_MAP_ANONYMOUS for Power Linux, but in the process of tracking it down I ended up doing some cleanup of the mmap handling in general.
Diffstat (limited to 'src/sim/process.cc')
-rw-r--r--src/sim/process.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 9a9527664..28142d731 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -313,7 +313,7 @@ Process::free_fd(int tgt_fd)
int
Process::sim_fd(int tgt_fd)
{
- if (tgt_fd > MAX_FD)
+ if (tgt_fd < 0 || tgt_fd > MAX_FD)
return -1;
return fd_map[tgt_fd].fd;
@@ -322,8 +322,8 @@ Process::sim_fd(int tgt_fd)
Process::FdMap *
Process::sim_fd_obj(int tgt_fd)
{
- if (tgt_fd > MAX_FD)
- panic("sim_fd_obj called in fd out of range.");
+ if (tgt_fd < 0 || tgt_fd > MAX_FD)
+ return NULL;
return &fd_map[tgt_fd];
}