summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adler <Michael.Adler@intel.com>2014-10-20 16:45:08 -0500
committerMichael Adler <Michael.Adler@intel.com>2014-10-20 16:45:08 -0500
commit7254d5742a7b9df0f24fcf5b35e231a0fa0d777a (patch)
treefafada762c84993598b1f415465cdba1b1cff60c
parenta3fe4c06620439aa317f257d3bcdde34508d3d43 (diff)
downloadgem5-7254d5742a7b9df0f24fcf5b35e231a0fa0d777a.tar.xz
sim: mmap: correct behavior for fixed address
Change mmap fixed address request to return an error if the mapping is impossible due to conflict instead of what I believe used to be silent corruption. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
-rw-r--r--src/sim/syscall_emul.hh6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh
index a106a1939..034a7043b 100644
--- a/src/sim/syscall_emul.hh
+++ b/src/sim/syscall_emul.hh
@@ -1256,10 +1256,8 @@ mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
// whether we clobber them or not depends on whether the caller
// specified MAP_FIXED
if (flags & OS::TGT_MAP_FIXED) {
- // MAP_FIXED specified: clobber existing mappings
- warn("mmap: MAP_FIXED at 0x%x overwrites existing mappings\n",
- start);
- clobber = true;
+ // MAP_FIXED specified: map attempt fails
+ return -EINVAL;
} else {
// MAP_FIXED not specified: ignore suggested start address
warn("mmap: ignoring suggested map address 0x%x\n", start);