Commit 67c4d23c4f31d603ba179fcede6eb53d32fdf1ea
1 parent
cc53adbc
Fix unassigned region offsets.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6639 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
7 additions
and
2 deletions
exec.c
@@ -368,8 +368,10 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc) | @@ -368,8 +368,10 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc) | ||
368 | return NULL; | 368 | return NULL; |
369 | pd = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE); | 369 | pd = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE); |
370 | *lp = pd; | 370 | *lp = pd; |
371 | - for (i = 0; i < L2_SIZE; i++) | 371 | + for (i = 0; i < L2_SIZE; i++) { |
372 | pd[i].phys_offset = IO_MEM_UNASSIGNED; | 372 | pd[i].phys_offset = IO_MEM_UNASSIGNED; |
373 | + pd[i].region_offset = (index + i) << TARGET_PAGE_BITS; | ||
374 | + } | ||
373 | } | 375 | } |
374 | return ((PhysPageDesc *)pd) + (index & (L2_SIZE - 1)); | 376 | return ((PhysPageDesc *)pd) + (index & (L2_SIZE - 1)); |
375 | } | 377 | } |
@@ -2280,6 +2282,9 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, | @@ -2280,6 +2282,9 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, | ||
2280 | if (kvm_enabled()) | 2282 | if (kvm_enabled()) |
2281 | kvm_set_phys_mem(start_addr, size, phys_offset); | 2283 | kvm_set_phys_mem(start_addr, size, phys_offset); |
2282 | 2284 | ||
2285 | + if (phys_offset == IO_MEM_UNASSIGNED) { | ||
2286 | + region_offset = start_addr; | ||
2287 | + } | ||
2283 | region_offset &= TARGET_PAGE_MASK; | 2288 | region_offset &= TARGET_PAGE_MASK; |
2284 | size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK; | 2289 | size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK; |
2285 | end_addr = start_addr + (target_phys_addr_t)size; | 2290 | end_addr = start_addr + (target_phys_addr_t)size; |
@@ -2327,7 +2332,7 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, | @@ -2327,7 +2332,7 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, | ||
2327 | if (need_subpage || phys_offset & IO_MEM_SUBWIDTH) { | 2332 | if (need_subpage || phys_offset & IO_MEM_SUBWIDTH) { |
2328 | subpage = subpage_init((addr & TARGET_PAGE_MASK), | 2333 | subpage = subpage_init((addr & TARGET_PAGE_MASK), |
2329 | &p->phys_offset, IO_MEM_UNASSIGNED, | 2334 | &p->phys_offset, IO_MEM_UNASSIGNED, |
2330 | - 0); | 2335 | + addr & TARGET_PAGE_MASK); |
2331 | subpage_register(subpage, start_addr2, end_addr2, | 2336 | subpage_register(subpage, start_addr2, end_addr2, |
2332 | phys_offset, region_offset); | 2337 | phys_offset, region_offset); |
2333 | p->region_offset = 0; | 2338 | p->region_offset = 0; |