Commit e3f4e2a4b0df510e441badb85c9398516c27bd66

Authored by pbrook
1 parent 706cd4b5

Initialize physical memory space to IO_MEM_UNASSIGNED.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1801 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 9 additions and 6 deletions
@@ -204,6 +204,7 @@ static inline PageDesc *page_find(unsigned int index) @@ -204,6 +204,7 @@ static inline PageDesc *page_find(unsigned int index)
204 static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc) 204 static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)
205 { 205 {
206 void **lp, **p; 206 void **lp, **p;
  207 + PhysPageDesc *pd;
207 208
208 p = (void **)l1_phys_map; 209 p = (void **)l1_phys_map;
209 #if TARGET_PHYS_ADDR_SPACE_BITS > 32 210 #if TARGET_PHYS_ADDR_SPACE_BITS > 32
@@ -223,16 +224,18 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc) @@ -223,16 +224,18 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)
223 } 224 }
224 #endif 225 #endif
225 lp = p + ((index >> L2_BITS) & (L1_SIZE - 1)); 226 lp = p + ((index >> L2_BITS) & (L1_SIZE - 1));
226 - p = *lp;  
227 - if (!p) { 227 + pd = *lp;
  228 + if (!pd) {
  229 + int i;
228 /* allocate if not found */ 230 /* allocate if not found */
229 if (!alloc) 231 if (!alloc)
230 return NULL; 232 return NULL;
231 - p = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE);  
232 - memset(p, 0, sizeof(PhysPageDesc) * L2_SIZE);  
233 - *lp = p; 233 + pd = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE);
  234 + *lp = pd;
  235 + for (i = 0; i < L2_SIZE; i++)
  236 + pd[i].phys_offset = IO_MEM_UNASSIGNED;
234 } 237 }
235 - return ((PhysPageDesc *)p) + (index & (L2_SIZE - 1)); 238 + return ((PhysPageDesc *)pd) + (index & (L2_SIZE - 1));
236 } 239 }
237 240
238 static inline PhysPageDesc *phys_page_find(target_phys_addr_t index) 241 static inline PhysPageDesc *phys_page_find(target_phys_addr_t index)