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.
This commit is contained in:
Steve Reinhardt
2016-03-17 10:29:32 -07:00
parent 7eaa5952f9
commit f6cd7a4bb7
13 changed files with 31 additions and 33 deletions

View File

@@ -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);