SE mode: Make the direction anonymous mmaps move through memory configurable.
This commit is contained in:
parent
f09f84da6e
commit
86f3bec76d
2 changed files with 11 additions and 2 deletions
|
@ -122,6 +122,10 @@ class OperatingSystem {
|
|||
|
||||
static int openSpecialFile(std::string path, LiveProcess *process, ThreadContext *tc);
|
||||
|
||||
static const bool mmapGrowsUp = true;
|
||||
|
||||
static bool mmapGrowsDown() { return false; }
|
||||
|
||||
}; // class OperatingSystem
|
||||
|
||||
|
||||
|
|
|
@ -978,9 +978,14 @@ mmapFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc)
|
|||
}
|
||||
|
||||
// pick next address from our "mmap region"
|
||||
start = p->mmap_end;
|
||||
if (OS::mmapGrowsDown()) {
|
||||
start = p->mmap_end - length;
|
||||
p->mmap_end = start;
|
||||
} else {
|
||||
start = p->mmap_end;
|
||||
p->mmap_end += length;
|
||||
}
|
||||
p->pTable->allocate(start, length);
|
||||
p->mmap_end += length;
|
||||
|
||||
if (!(flags & OS::TGT_MAP_ANONYMOUS)) {
|
||||
warn("allowing mmap of file @ fd %d. "
|
||||
|
|
Loading…
Reference in a new issue