aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorAlex Rozenman <Alex_Rozenman@mentor.com>2011-12-13 12:52:08 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-15 10:22:40 -0600
commit5ab97b7f81dccccee03a3f1d03a4d09a27f0eeff (patch)
treecdc1c601179a16e7aa901d8291a363ebc2cfba31 /exec.c
parent885660bd48efbe3742892e06de7a8898703e0bdc (diff)
downloadqemu-5ab97b7f81dccccee03a3f1d03a4d09a27f0eeff.zip
qemu-5ab97b7f81dccccee03a3f1d03a4d09a27f0eeff.tar.gz
qemu-5ab97b7f81dccccee03a3f1d03a4d09a27f0eeff.tar.bz2
phys_page_find_alloc: Use correct initial region_offset.
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 <Alex_Rozenman@mentor.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/exec.c b/exec.c
index eef5e2f..06889bd 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;
}
}