From d993e0260bf7a200df348a2fb0c5a6efa885987d Mon Sep 17 00:00:00 2001
From: bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Date: Thu, 10 Feb 2005 22:00:06 +0000
Subject: [PATCH] -no-kqemu option

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1280 c046a42c-6fe2-441c-8c8c-71466251a162
---
 vl.c | 19 +++++++++++++------
 vl.h |  1 +
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/vl.c b/vl.c
index 21c77758d6..89efe67ca4 100644
--- a/vl.c
+++ b/vl.c
@@ -2760,6 +2760,9 @@ void help(void)
            "-hdachs c,h,s[,t]  force hard disk 0 physical geometry and the optional BIOS\n"
            "                translation (t=none or lba) (usually qemu can guess them)\n"
            "-L path         set the directory for the BIOS and VGA BIOS\n"
+#ifdef USE_KQEMU
+           "-no-kqemu       disable KQEMU kernel module usage\n"
+#endif
 #ifdef USE_CODE_COPY
            "-no-code-copy   disable code copy acceleration\n"
 #endif
@@ -2848,6 +2851,7 @@ enum {
     QEMU_OPTION_loadvm,
     QEMU_OPTION_full_screen,
     QEMU_OPTION_pidfile,
+    QEMU_OPTION_no_kqemu,
 };
 
 typedef struct QEMUOption {
@@ -2898,6 +2902,9 @@ const QEMUOption qemu_options[] = {
     { "hdachs", HAS_ARG, QEMU_OPTION_hdachs },
     { "L", HAS_ARG, QEMU_OPTION_L },
     { "no-code-copy", 0, QEMU_OPTION_no_code_copy },
+#ifdef USE_KQEMU
+    { "no-kqemu", 0, QEMU_OPTION_no_kqemu },
+#endif
 #ifdef TARGET_PPC
     { "prep", 0, QEMU_OPTION_prep },
     { "g", 1, QEMU_OPTION_g },
@@ -3358,6 +3365,11 @@ int main(int argc, char **argv)
             case QEMU_OPTION_pidfile:
                 create_pidfile(optarg);
                 break;
+#ifdef USE_KQEMU
+            case QEMU_OPTION_no_kqemu:
+                kqemu_allowed = 0;
+                break;
+#endif
             }
         }
     }
@@ -3433,12 +3445,7 @@ int main(int argc, char **argv)
     phys_ram_size = ram_size + vga_ram_size + bios_size;
 
 #ifdef CONFIG_SOFTMMU
-#ifdef _BSD
-    /* mallocs are always aligned on BSD. valloc is better for correctness */
-    phys_ram_base = valloc(phys_ram_size);
-#else
-    phys_ram_base = memalign(TARGET_PAGE_SIZE, phys_ram_size);
-#endif
+    phys_ram_base = qemu_vmalloc(phys_ram_size);
     if (!phys_ram_base) {
         fprintf(stderr, "Could not allocate physical memory\n");
         exit(1);
diff --git a/vl.h b/vl.h
index 39ea6550b0..3fd7ce9ad1 100644
--- a/vl.h
+++ b/vl.h
@@ -124,6 +124,7 @@ extern int graphic_width;
 extern int graphic_height;
 extern int graphic_depth;
 extern const char *keyboard_layout;
+extern int kqemu_allowed;
 
 /* XXX: make it dynamic */
 #if defined (TARGET_PPC)
-- 
2.30.2