summaryrefslogtreecommitdiff
path: root/src/sim/process.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2012-01-07 02:10:34 -0800
committerGabe Black <gblack@eecs.umich.edu>2012-01-07 02:10:34 -0800
commit36a822f08e88483b41af214ace4fd3dccf3aa8cb (patch)
treed7c4c08590459d967a1d7638b02c586911826953 /src/sim/process.cc
parent85424bef192c02a47c0d46c2d99ac0a5d6e55a99 (diff)
parentf171a29118e1d80c04c72d2fb5f024fed4fb62af (diff)
downloadgem5-36a822f08e88483b41af214ace4fd3dccf3aa8cb.tar.xz
Merge with main repository.
Diffstat (limited to 'src/sim/process.cc')
-rw-r--r--src/sim/process.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sim/process.cc b/src/sim/process.cc
index ba43a6b77..468f42955 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -159,7 +159,7 @@ Process::Process(ProcessParams * params)
mmap_start = mmap_end = 0;
nxm_start = nxm_end = 0;
- pTable = new PageTable(this);
+ pTable = new PageTable(name(), M5_pid);
// other parameters will be initialized when the program is loaded
}
@@ -318,13 +318,21 @@ Process::sim_fd_obj(int tgt_fd)
return &fd_map[tgt_fd];
}
+void
+Process::allocateMem(Addr vaddr, int64_t size, bool clobber)
+{
+ int npages = divCeil(size, (int64_t)VMPageSize);
+ Addr paddr = system->allocPhysPages(npages);
+ pTable->map(vaddr, paddr, size, clobber);
+}
+
bool
Process::fixupStackFault(Addr vaddr)
{
// Check if this is already on the stack and there's just no page there
// yet.
if (vaddr >= stack_min && vaddr < stack_base) {
- pTable->allocate(roundDown(vaddr, VMPageSize), VMPageSize);
+ allocateMem(roundDown(vaddr, VMPageSize), VMPageSize);
return true;
}
@@ -337,7 +345,7 @@ Process::fixupStackFault(Addr vaddr)
fatal("Maximum stack size exceeded\n");
if (stack_base - stack_min > 8 * 1024 * 1024)
fatal("Over max stack size for one thread\n");
- pTable->allocate(stack_min, TheISA::PageBytes);
+ allocateMem(stack_min, TheISA::PageBytes);
inform("Increasing stack size by one page.");
};
return true;