From: Gabe Black Date: Fri, 3 Feb 2012 07:54:25 +0000 (-0800) Subject: System: Fix the check which detects running out of physical memory. X-Git-Tag: stable_2012_06_28~261 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=acebd9bf917df996d6e94f16d8ca7b45f4c200de;p=gem5.git 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. --- 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; }