From 69e38bee22624eaaddbb8f812a96ff29f4efee49 Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Mon, 28 Mar 2016 16:47:46 -0500 Subject: Fix rounding error in memory allocation code A rounding error exposed by a new compiler caused us to write over the SPTE entries for the extended memory block. This led to unhandled page faults due to invalid permissions on the affected pages. Change-Id: I53656103252180d37a4291176d45f2cb3f63421d Backport: yes Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/22560 Reviewed-by: Andrew J. Geissler Tested-by: Jenkins Server Tested-by: FSP CI Jenkins Reviewed-by: William G. Hoffa --- src/kernel/basesegment.C | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/kernel') diff --git a/src/kernel/basesegment.C b/src/kernel/basesegment.C index ea5846a46..90d61f1b2 100644 --- a/src/kernel/basesegment.C +++ b/src/kernel/basesegment.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -267,8 +267,9 @@ int BaseSegment::_mmExtend(void) // Now need to take the pages past the SPTE and add them to the heap. //get the number of pages needed to hold the SPTE entries. - uint64_t spte_pages = (ALIGN_PAGE(l_size)/PAGESIZE * - sizeof(ShadowPTE))/PAGESIZE; + uint64_t spte_pages = (ALIGN_PAGE + (ALIGN_PAGE(l_size)/PAGESIZE*sizeof(ShadowPTE))) + /PAGESIZE; printkd("Number of SPTE pages %ld\n", spte_pages); -- cgit v1.2.3