summary refs log tree commit diff stats
path: root/exec.c
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-04-08 20:02:06 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2006-04-08 20:02:06 +0000
commite3f4e2a4b0df510e441badb85c9398516c27bd66 (patch)
treeaa9d7c3a858ba675cd9aa83cf53272f9d0267293 /exec.c
parent706cd4b547db5c27585b6125a43663aba3404dfe (diff)
downloadfocaccia-qemu-e3f4e2a4b0df510e441badb85c9398516c27bd66.tar.gz
focaccia-qemu-e3f4e2a4b0df510e441badb85c9398516c27bd66.zip
Initialize physical memory space to IO_MEM_UNASSIGNED.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1801 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/exec.c b/exec.c
index 2a13c592f4..9843ae5e74 100644
--- a/exec.c
+++ b/exec.c
@@ -204,6 +204,7 @@ static inline PageDesc *page_find(unsigned int index)
 static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)
 {
     void **lp, **p;
+    PhysPageDesc *pd;
 
     p = (void **)l1_phys_map;
 #if TARGET_PHYS_ADDR_SPACE_BITS > 32
@@ -223,16 +224,18 @@ static PhysPageDesc *phys_page_find_alloc(target_phys_addr_t index, int alloc)
     }
 #endif
     lp = p + ((index >> L2_BITS) & (L1_SIZE - 1));
-    p = *lp;
-    if (!p) {
+    pd = *lp;
+    if (!pd) {
+        int i;
         /* allocate if not found */
         if (!alloc)
             return NULL;
-        p = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE);
-        memset(p, 0, sizeof(PhysPageDesc) * L2_SIZE);
-        *lp = p;
+        pd = qemu_vmalloc(sizeof(PhysPageDesc) * L2_SIZE);
+        *lp = pd;
+        for (i = 0; i < L2_SIZE; i++)
+          pd[i].phys_offset = IO_MEM_UNASSIGNED;
     }
-    return ((PhysPageDesc *)p) + (index & (L2_SIZE - 1));
+    return ((PhysPageDesc *)pd) + (index & (L2_SIZE - 1));
 }
 
 static inline PhysPageDesc *phys_page_find(target_phys_addr_t index)