* [Qemu-devel] [PATCH] print default cpu_model
@ 2007-12-12 0:02 Thayne Harbaugh
0 siblings, 0 replies; only message in thread
From: Thayne Harbaugh @ 2007-12-12 0:02 UTC (permalink / raw)
To: qemu-devel
[-- 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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-12-12 0:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-12 0:02 [Qemu-devel] [PATCH] print default cpu_model Thayne Harbaugh
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).