summaryrefslogtreecommitdiff
path: root/src/sim/system.cc
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2012-02-02 23:54:25 -0800
committerGabe Black <gblack@eecs.umich.edu>2012-02-02 23:54:25 -0800
commitacebd9bf917df996d6e94f16d8ca7b45f4c200de (patch)
tree300af8bd9071d0d243b050770feef87b7cc127a9 /src/sim/system.cc
parent096a5507571bc2202c3d1569ed4258113d10ad56 (diff)
downloadgem5-acebd9bf917df996d6e94f16d8ca7b45f4c200de.tar.xz
System: Fix the check which detects running out of physical memory.
The code that checks whether pages allocated by allocPhysPages only checks that the first page fits into physical memory, not that all of them do. This change makes the code check the last page which should work properly. This function used to only allocate one page at a time, so the first page and last page used to be the same thing.
Diffstat (limited to 'src/sim/system.cc')
-rw-r--r--src/sim/system.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sim/system.cc b/src/sim/system.cc
index 83610a102..47791beaa 100644
--- a/src/sim/system.cc
+++ b/src/sim/system.cc
@@ -296,7 +296,7 @@ System::allocPhysPages(int npages)
{
Addr return_addr = pagePtr << LogVMPageSize;
pagePtr += npages;
- if (return_addr >= physmem->size())
+ if (return_addr + npages - 1 >= physmem->size())
fatal("Out of memory, please increase size of physical memory.");
return return_addr;
}