From: Glauber Costa <[EMAIL PROTECTED]>

Put all memory allocation under qemu_alloc_physram().
Protect the mem_area code with #ifdef USE_KVM. Although it
is not really needed, it help us keep track of the fact that
this is a kvm-only feature to the moment.

Signed-off-by: Glauber Costa <[EMAIL PROTECTED]>
---
 qemu/vl.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/qemu/vl.c b/qemu/vl.c
index 25a1ee9..022b3b8 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -9019,8 +9019,10 @@ void *qemu_alloc_physram(unsigned long memory)
     void *area = NULL;
     unsigned long map_len = memory;
 
+#ifdef USE_KVM
     if (mem_path)
        area = alloc_mem_area(memory, &map_len, mem_path);
+#endif
     if (!area)
        area = qemu_vmalloc(memory);
 #ifdef USE_KVM
@@ -9934,18 +9936,12 @@ int main(int argc, char **argv)
                    fprintf(stderr, "Could not create KVM context\n");
                    exit(1);
            }
+    }
 
-        phys_ram_base = qemu_alloc_physram(phys_ram_size);
-           if (!phys_ram_base) {
-                   fprintf(stderr, "Could not allocate physical memory\n");
-                   exit(1);
-           }
-    } else {
-           phys_ram_base = qemu_vmalloc(phys_ram_size);
-           if (!phys_ram_base) {
-                   fprintf(stderr, "Could not allocate physical memory\n");
-                   exit(1);
-           }
+    phys_ram_base = qemu_alloc_physram(phys_ram_size);
+    if (!phys_ram_base) {
+        fprintf(stderr, "Could not allocate physical memory\n");
+        exit(1);
     }
 
     /* init the dynamic translator */
-- 
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to