From 8935358ddf9bf5b80c8b8ac7014b650a519a3ebf Mon Sep 17 00:00:00 2001 From: Alex Rozenman Date: Thu, 27 Jan 2011 12:47:57 +0200 Subject: [PATCH] phys_page_find_alloc: use correct initial region_offset --- exec.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/exec.c b/exec.c index db9ff55..00667d7 100644 --- a/exec.c +++ b/exec.c @@ -416,6 +416,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; @@ -425,7 +426,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.0.4