From f6cd7a4bb7ee66b58f88fbdc6bdc4faa6a559952 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Thu, 17 Mar 2016 10:29:32 -0700 Subject: syscall_emul: move mmapGrowsDown() to LiveProcess The mmapGrowsDown() method was a static method on the OperatingSystem class (and derived classes), which worked OK for the templated syscall emulation methods, but made it hard to access elsewhere. This patch moves the method to be a virtual function on the LiveProcess method, where it can be overridden for specific platforms (for now, Alpha). This patch also changes the value of mmapGrowsDown() from being false by default and true only on X86Linux32 to being true by default and false only on Alpha, which seems closer to reality (though in reality most people use ASLR and this doesn't really matter anymore). In the process, also got rid of the unused mmap_start field on LiveProcess and OperatingSystem mmapGrowsUp variable. --- src/sim/syscall_emul.hh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sim/syscall_emul.hh') 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", -- cgit v1.2.3