From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J2FBc-0004Fm-9T for qemu-devel@nongnu.org; Tue, 11 Dec 2007 19:10:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J2FBX-0004Do-Ny for qemu-devel@nongnu.org; Tue, 11 Dec 2007 19:10:51 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J2FBX-0004De-D1 for qemu-devel@nongnu.org; Tue, 11 Dec 2007 19:10:47 -0500 Received: from owa.c2.net ([207.235.78.2] helo=email.c2.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J2FBX-0000OS-1N for qemu-devel@nongnu.org; Tue, 11 Dec 2007 19:10:47 -0500 From: Thayne Harbaugh Content-Type: multipart/mixed; boundary="=-15lre9QZlpwxuLCxcKS/" Date: Tue, 11 Dec 2007 17:02:10 -0700 Message-Id: <1197417730.2947.70.camel@phantasm.home.enterpriseandprosperity.com> Mime-Version: 1.0 Subject: [Qemu-devel] [PATCH] print default cpu_model Reply-To: thayne@c2.net, qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --=-15lre9QZlpwxuLCxcKS/ Content-Type: text/plain Content-Transfer-Encoding: 7bit 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. --=-15lre9QZlpwxuLCxcKS/ Content-Disposition: attachment; filename=05_cpu_model_default.patch Content-Type: text/x-patch; name=05_cpu_model_default.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit 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); --=-15lre9QZlpwxuLCxcKS/--