summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/process.cc4
-rw-r--r--src/sim/process.hh6
-rw-r--r--src/sim/syscall_emul.hh4
3 files changed, 8 insertions, 6 deletions
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 6c12b8100..81a7ec89e 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -182,7 +182,7 @@ Process::Process(ProcessParams * params)
fde_stderr->set(sim_fd, params->errout, O_WRONLY | O_CREAT | O_TRUNC,
0664, false);
- mmap_start = mmap_end = 0;
+ mmap_end = 0;
nxm_start = nxm_end = 0;
// other parameters will be initialized when the program is loaded
}
@@ -412,7 +412,6 @@ Process::serialize(CheckpointOut &cp) const
SERIALIZE_SCALAR(stack_size);
SERIALIZE_SCALAR(stack_min);
SERIALIZE_SCALAR(next_thread_stack_base);
- SERIALIZE_SCALAR(mmap_start);
SERIALIZE_SCALAR(mmap_end);
SERIALIZE_SCALAR(nxm_start);
SERIALIZE_SCALAR(nxm_end);
@@ -432,7 +431,6 @@ Process::unserialize(CheckpointIn &cp)
UNSERIALIZE_SCALAR(stack_size);
UNSERIALIZE_SCALAR(stack_min);
UNSERIALIZE_SCALAR(next_thread_stack_base);
- UNSERIALIZE_SCALAR(mmap_start);
UNSERIALIZE_SCALAR(mmap_end);
UNSERIALIZE_SCALAR(nxm_start);
UNSERIALIZE_SCALAR(nxm_end);
diff --git a/src/sim/process.hh b/src/sim/process.hh
index df007c9f2..72f789ec7 100644
--- a/src/sim/process.hh
+++ b/src/sim/process.hh
@@ -107,9 +107,13 @@ class Process : public SimObject
Addr next_thread_stack_base;
// Base of region for mmaps (when user doesn't specify an address).
- Addr mmap_start;
Addr mmap_end;
+ // Does mmap region grow upward or downward from mmap_end? Most
+ // platforms grow downward, but a few (such as Alpha) grow upward
+ // instead, so they can override thie method to return false.
+ virtual bool mmapGrowsDown() const { return true; }
+
// Base of region for nxm data
Addr nxm_start;
Addr nxm_end;
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index a859fbe43..71c0dd090 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1297,8 +1297,8 @@ mmapImpl(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc,
// Extend global mmap region if necessary. Note that we ignore the
// start address unless MAP_FIXED is specified.
if (!(tgt_flags & OS::TGT_MAP_FIXED)) {
- start = (OS::mmapGrowsDown()) ? p->mmap_end - length : p->mmap_end;
- p->mmap_end = (OS::mmapGrowsDown()) ? start : p->mmap_end + length;
+ start = p->mmapGrowsDown() ? p->mmap_end - length : p->mmap_end;
+ p->mmap_end = p->mmapGrowsDown() ? start : p->mmap_end + length;
}
DPRINTF_SYSCALL(Verbose, " mmap range is 0x%x - 0x%x\n",