qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thayne Harbaugh <thayne@c2.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] print default cpu_model
Date: Tue, 11 Dec 2007 17:02:10 -0700	[thread overview]
Message-ID: <1197417730.2947.70.camel@phantasm.home.enterpriseandprosperity.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 152 bytes --]

The linux-user qemu help usage doesn't output the default cpu_model in
the usage.  This patch is a minimal code change to output the default
cpu_model.

[-- Attachment #2: 05_cpu_model_default.patch --]
[-- Type: text/x-patch, Size: 2822 bytes --]

Index: qemu/linux-user/main.c
===================================================================
--- qemu.orig/linux-user/main.c	2007-12-11 16:14:01.000000000 -0700
+++ qemu/linux-user/main.c	2007-12-11 16:54:32.000000000 -0700
@@ -1890,6 +1890,43 @@
 }
 #endif /* TARGET_ALPHA */
 
+static const char *get_cpu_model_default()
+{
+    const char *cpu_model = "any";
+
+#if defined(TARGET_I386)
+#ifdef TARGET_X86_64
+    cpu_model = "qemu64";
+#else
+    cpu_model = "qemu32";
+#endif
+#elif defined(TARGET_ARM)
+    cpu_model = "arm926";
+#elif defined(TARGET_M68K)
+    cpu_model = "any";
+#elif defined(TARGET_SPARC)
+#ifdef TARGET_SPARC64
+    cpu_model = "TI UltraSparc II";
+#else
+    cpu_model = "Fujitsu MB86904";
+#endif
+#elif defined(TARGET_MIPS)
+#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
+    cpu_model = "20Kc";
+#else
+    cpu_model = "24Kf";
+#endif
+#elif defined(TARGET_PPC)
+#ifdef TARGET_PPC64
+    cpu_model = "970";
+#else
+    cpu_model = "750";
+#endif
+#endif
+
+    return cpu_model;
+}
+
 void usage(void)
 {
     printf("qemu-" TARGET_ARCH " version " QEMU_VERSION ", Copyright (c) 2003-2007 Fabrice Bellard\n"
@@ -1900,7 +1937,7 @@
            "-g port           wait gdb connection to port\n"
            "-L path           set the elf interpreter prefix (default=%s)\n"
            "-s size           set the stack size in bytes (default=%ld)\n"
-           "-cpu model        select CPU (-cpu ? for list)\n"
+           "-cpu model        select CPU (default=\"%s\"; -cpu ? for list)\n"
            "-drop-ld-preload  drop LD_PRELOAD for target process\n"
            "\n"
            "debug options:\n"
@@ -1910,6 +1947,7 @@
            TARGET_ARCH,
            interp_prefix,
            x86_stack_size,
+           get_cpu_model_default(),
            DEBUG_LOGFILE);
     _exit(1);
 }
@@ -2023,38 +2061,9 @@
     init_paths(interp_prefix);
 
     if (cpu_model == NULL) {
-#if defined(TARGET_I386)
-#ifdef TARGET_X86_64
-        cpu_model = "qemu64";
-#else
-        cpu_model = "qemu32";
-#endif
-#elif defined(TARGET_ARM)
-        cpu_model = "arm926";
-#elif defined(TARGET_M68K)
-        cpu_model = "any";
-#elif defined(TARGET_SPARC)
-#ifdef TARGET_SPARC64
-        cpu_model = "TI UltraSparc II";
-#else
-        cpu_model = "Fujitsu MB86904";
-#endif
-#elif defined(TARGET_MIPS)
-#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
-        cpu_model = "20Kc";
-#else
-        cpu_model = "24Kf";
-#endif
-#elif defined(TARGET_PPC)
-#ifdef TARGET_PPC64
-        cpu_model = "970";
-#else
-        cpu_model = "750";
-#endif
-#else
-        cpu_model = "any";
-#endif
+        cpu_model = get_cpu_model_default();
     }
+
     /* NOTE: we need to init the CPU at this stage to get
        qemu_host_page_size */
     env = cpu_init(cpu_model);

                 reply	other threads:[~2007-12-12  0:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1197417730.2947.70.camel@phantasm.home.enterpriseandprosperity.com \
    --to=thayne@c2.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).