Received: from eggs.gnu.org ([140.186.70.92]:50792) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaPy7-0001AU-Lq for qemu-devel@nongnu.org; Tue, 13 Dec 2011 05:52:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RaPy6-0006zU-Gz for qemu-devel@nongnu.org; Tue, 13 Dec 2011 05:52:19 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:54462) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaPy6-0006zM-Cl for qemu-devel@nongnu.org; Tue, 13 Dec 2011 05:52:18 -0500 From: Alex_Rozenman@mentor.com Date: Tue, 13 Dec 2011 12:52:08 +0200 Message-Id: <1323773528-30485-1-git-send-email-Alex_Rozenman@mentor.com> Subject: [Qemu-devel] [PATCH] phys_page_find_alloc: Use correct initial region_offset. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Alex Rozenman From: Alex Rozenman This fixes a common bug with initial region_offset value. Usually, the pages are re-assigned afterwards, so the bug has a very small effect on regular QEMU use flows. Signed-off-by: Alex Rozenman --- exec.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/exec.c b/exec.c index d8b2180..14628d9 100644 --- a/exec.c +++ b/exec.c @@ -418,6 +418,7 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc) pd = *lp; if (pd == NULL) { int i; + int first_index = index & ~(L2_SIZE - 1); if (!alloc) { return NULL; @@ -427,7 +428,7 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc) for (i = 0; i < L2_SIZE; i++) { pd[i].phys_offset = IO_MEM_UNASSIGNED; - pd[i].region_offset = (index + i) << TARGET_PAGE_BITS; + pd[i].region_offset = (first_index + i) << TARGET_PAGE_BITS; } } -- 1.7.8