summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2016-03-17 10:29:32 -0700
committerSteve Reinhardt <steve.reinhardt@amd.com>2016-03-17 10:29:32 -0700
commitf6cd7a4bb7ee66b58f88fbdc6bdc4faa6a559952 (patch)
tree7d579b1d984c0b3d7497780ff8ff1b96ab1f7aae /src/arch
parent7eaa5952f994c07a801fbef81f8097a5e9a5828f (diff)
downloadgem5-f6cd7a4bb7ee66b58f88fbdc6bdc4faa6a559952.tar.xz
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.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/alpha/process.cc2
-rw-r--r--src/arch/alpha/process.hh4
-rw-r--r--src/arch/arm/process.cc4
-rw-r--r--src/arch/mips/process.cc2
-rw-r--r--src/arch/power/process.cc2
-rw-r--r--src/arch/sparc/process.hh7
-rw-r--r--src/arch/x86/linux/linux.hh2
-rw-r--r--src/arch/x86/process.cc4
8 files changed, 14 insertions, 13 deletions
diff --git a/src/arch/alpha/process.cc b/src/arch/alpha/process.cc
index eb1a2ee6d..54ef338f3 100644
--- a/src/arch/alpha/process.cc
+++ b/src/arch/alpha/process.cc
@@ -57,7 +57,7 @@ AlphaLiveProcess::AlphaLiveProcess(LiveProcessParams *params,
// Set up region for mmaps. Tru64 seems to start just above 0 and
// grow up from there.
- mmap_start = mmap_end = 0x10000;
+ mmap_end = 0x10000;
// Set pointer for next thread stack. Reserve 8M for main stack.
next_thread_stack_base = stack_base - (8 * 1024 * 1024);
diff --git a/src/arch/alpha/process.hh b/src/arch/alpha/process.hh
index fcaa6539c..c41ece837 100644
--- a/src/arch/alpha/process.hh
+++ b/src/arch/alpha/process.hh
@@ -54,6 +54,10 @@ class AlphaLiveProcess : public LiveProcess
void setSyscallArg(ThreadContext *tc, int i, AlphaISA::IntReg val) override;
void setSyscallReturn(ThreadContext *tc,
SyscallReturn return_value) override;
+
+ // override default implementation in LiveProcess as the mmap
+ // region for Alpha platforms grows upward
+ virtual bool mmapGrowsDown() const override { return false; }
};
/* No architectural page table defined for this ISA */
diff --git a/src/arch/arm/process.cc b/src/arch/arm/process.cc
index ba56f0cdc..0c6f48fb5 100644
--- a/src/arch/arm/process.cc
+++ b/src/arch/arm/process.cc
@@ -77,7 +77,7 @@ ArmLiveProcess32::ArmLiveProcess32(LiveProcessParams *params,
brk_point = roundUp(brk_point, PageBytes);
// Set up region for mmaps. For now, start at bottom of kuseg space.
- mmap_start = mmap_end = 0x40000000L;
+ mmap_end = 0x40000000L;
}
ArmLiveProcess64::ArmLiveProcess64(LiveProcessParams *params,
@@ -94,7 +94,7 @@ ArmLiveProcess64::ArmLiveProcess64(LiveProcessParams *params,
brk_point = roundUp(brk_point, PageBytes);
// Set up region for mmaps. For now, start at bottom of kuseg space.
- mmap_start = mmap_end = 0x4000000000L;
+ mmap_end = 0x4000000000L;
}
void
diff --git a/src/arch/mips/process.cc b/src/arch/mips/process.cc
index 404c84da6..8754191fa 100644
--- a/src/arch/mips/process.cc
+++ b/src/arch/mips/process.cc
@@ -61,7 +61,7 @@ MipsLiveProcess::MipsLiveProcess(LiveProcessParams * params,
brk_point = roundUp(brk_point, PageBytes);
// Set up region for mmaps. Start it 1GB above the top of the heap.
- mmap_start = mmap_end = brk_point + 0x40000000L;
+ mmap_end = brk_point + 0x40000000L;
}
void
diff --git a/src/arch/power/process.cc b/src/arch/power/process.cc
index 3dc2c0d17..a770d8137 100644
--- a/src/arch/power/process.cc
+++ b/src/arch/power/process.cc
@@ -59,7 +59,7 @@ PowerLiveProcess::PowerLiveProcess(LiveProcessParams *params,
brk_point = roundUp(brk_point, PageBytes);
// Set up region for mmaps. For now, start at bottom of kuseg space.
- mmap_start = mmap_end = 0x70000000L;
+ mmap_end = 0x70000000L;
}
void
diff --git a/src/arch/sparc/process.hh b/src/arch/sparc/process.hh
index 2eda40aac..e9d81367b 100644
--- a/src/arch/sparc/process.hh
+++ b/src/arch/sparc/process.hh
@@ -82,7 +82,7 @@ class Sparc32LiveProcess : public SparcLiveProcess
stack_base = (Addr)0xf0000000ULL;
// Set up region for mmaps.
- mmap_start = mmap_end = 0x70000000;
+ mmap_end = 0x70000000;
}
void initState();
@@ -111,9 +111,8 @@ class Sparc64LiveProcess : public SparcLiveProcess
// downward, less the hole for the kernel address space.
stack_base = (Addr)0x80000000000ULL;
- // Set up region for mmaps. Tru64 seems to start just above 0 and
- // grow up from there.
- mmap_start = mmap_end = 0xfffff80000000000ULL;
+ // Set up region for mmaps.
+ mmap_end = 0xfffff80000000000ULL;
}
void initState();
diff --git a/src/arch/x86/linux/linux.hh b/src/arch/x86/linux/linux.hh
index ce395f17d..47eac12b8 100644
--- a/src/arch/x86/linux/linux.hh
+++ b/src/arch/x86/linux/linux.hh
@@ -290,8 +290,6 @@ class X86Linux32 : public Linux
uint32_t freehigh; /* Available high memory size */
uint32_t mem_unit; /* Memory unit size in bytes */
} tgt_sysinfo;
-
- static bool mmapGrowsDown() { return true; }
};
#endif
diff --git a/src/arch/x86/process.cc b/src/arch/x86/process.cc
index 13cbf6edd..f0b8370c0 100644
--- a/src/arch/x86/process.cc
+++ b/src/arch/x86/process.cc
@@ -114,7 +114,7 @@ X86_64LiveProcess::X86_64LiveProcess(LiveProcessParams *params,
// Set up region for mmaps. This was determined empirically and may not
// always be correct.
- mmap_start = mmap_end = (Addr)0x2aaaaaaab000ULL;
+ mmap_end = (Addr)0x2aaaaaaab000ULL;
}
void
@@ -151,7 +151,7 @@ I386LiveProcess::I386LiveProcess(LiveProcessParams *params,
// Set up region for mmaps. This was determined empirically and may not
// always be correct.
- mmap_start = mmap_end = (Addr)0xf7ffe000ULL;
+ mmap_end = (Addr)0xf7ffe000ULL;
}
SyscallDesc*