Commit 67c4d23c4f31d603ba179fcede6eb53d32fdf1ea

Authored by pbrook
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
... ... @@ -368,8 +368,10 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)
368 368 return NULL;
369 369 pd = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE);
370 370 *lp = pd;
371   - for (i = 0; i < L2_SIZE; i++)
  371 + for (i = 0; i < L2_SIZE; i++) {
372 372 pd[i].phys_offset = IO_MEM_UNASSIGNED;
  373 + pd[i].region_offset = (index + i) << TARGET_PAGE_BITS;
  374 + }
373 375 }
374 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 2282 if (kvm_enabled())
2281 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 2288 region_offset &= TARGET_PAGE_MASK;
2284 2289 size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
2285 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 2332 if (need_subpage || phys_offset & IO_MEM_SUBWIDTH) {
2328 2333 subpage = subpage_init((addr & TARGET_PAGE_MASK),
2329 2334 &p->phys_offset, IO_MEM_UNASSIGNED,
2330   - 0);
  2335 + addr & TARGET_PAGE_MASK);
2331 2336 subpage_register(subpage, start_addr2, end_addr2,
2332 2337 phys_offset, region_offset);
2333 2338 p->region_offset = 0;
... ...