summaryrefslogtreecommitdiff
path: root/src/sim/process.cc
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-05-09 15:37:46 -0400
committerAli Saidi <saidi@eecs.umich.edu>2007-05-09 15:37:46 -0400
commit37b45e3c8cb2aef57e1d5dd8efd46705b8d46c16 (patch)
tree6a4d803e04308139788ee55db97bb37b743ab492 /src/sim/process.cc
parenta38c79ec22918b02c529c930827e64e440984d29 (diff)
downloadgem5-37b45e3c8cb2aef57e1d5dd8efd46705b8d46c16.tar.xz
fix the translating ports so it can add a page on a fault
--HG-- extra : convert_revision : 56f6f2cbf4e92b7f2dd8c9453831fab86d83ef80
Diffstat (limited to 'src/sim/process.cc')
-rw-r--r--src/sim/process.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/sim/process.cc b/src/sim/process.cc
index 68239fa52..8b273d591 100644
--- a/src/sim/process.cc
+++ b/src/sim/process.cc
@@ -47,6 +47,7 @@
#include "mem/translating_port.hh"
#include "sim/builder.hh"
#include "sim/process.hh"
+#include "sim/process_impl.hh"
#include "sim/stats.hh"
#include "sim/syscall_emul.hh"
#include "sim/system.hh"
@@ -182,7 +183,8 @@ Process::startup()
Port *mem_port;
mem_port = system->physmem->getPort("functional");
- initVirtMem = new TranslatingPort("process init port", pTable, true);
+ initVirtMem = new TranslatingPort("process init port", this,
+ TranslatingPort::Always);
mem_port->setPeer(initVirtMem);
initVirtMem->setPeer(mem_port);
}
@@ -250,6 +252,29 @@ Process::sim_fd(int tgt_fd)
return fd_map[tgt_fd];
}
+bool
+Process::checkAndAllocNextPage(Addr vaddr)
+{
+ // if this is an initial write we might not have
+ if (vaddr >= stack_min && vaddr < stack_base) {
+ pTable->allocate(roundDown(vaddr, VMPageSize), VMPageSize);
+ return true;
+ }
+
+ // We've accessed the next page of the stack, so extend the stack
+ // to cover it.
+ if(vaddr < stack_min && vaddr >= stack_min - TheISA::PageBytes)
+ {
+ stack_min -= TheISA::PageBytes;
+ if(stack_base - stack_min > 8*1024*1024)
+ fatal("Over max stack size for one thread\n");
+ pTable->allocate(stack_min, TheISA::PageBytes);
+ warn("Increasing stack size by one page.");
+ return true;
+ }
+ return false;
+}
+
void
Process::serialize(std::ostream &os)
{