From patchwork Sat Mar 27 22:11:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 48760 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 039D2B7CF8 for ; Sun, 28 Mar 2010 09:42:43 +1100 (EST) Received: from localhost ([127.0.0.1]:42792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NveNH-0003GM-Q6 for incoming@patchwork.ozlabs.org; Sat, 27 Mar 2010 18:20:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NveDi-00011c-NJ for qemu-devel@nongnu.org; Sat, 27 Mar 2010 18:11:06 -0400 Received: from [140.186.70.92] (port=46078 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NveDh-000117-BF for qemu-devel@nongnu.org; Sat, 27 Mar 2010 18:11:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NveDf-0007Yd-Tu for qemu-devel@nongnu.org; Sat, 27 Mar 2010 18:11:05 -0400 Received: from mail-pv0-f173.google.com ([74.125.83.173]:60597) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NveDf-0007Ux-P2 for qemu-devel@nongnu.org; Sat, 27 Mar 2010 18:11:03 -0400 Received: by mail-pv0-f173.google.com with SMTP id 33so4983104pvf.4 for ; Sat, 27 Mar 2010 15:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:received:message-id :subject:from:to:content-type; bh=4yrf8mzClq2uyKqn++4rXIOUtR90SqOQ2X555nwOdMQ=; b=wQPib9VjlDCqBqWL7FCNvmGwgUkQLXAeg8IoFH2z69AacWiF+EV2iWIhRlF74zwCtZ P1L8cIiwymWbFFq4uPYj3E8Kn89SbuaOBXYL665uC5UTjoaH/G4T/lCSL6ESIF33MeU9 cA3XNj1NIkBM9gequK61+9ULAPKiNOEtKELCk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=T8OteKOkwNYGAHYdSWhkb89y3CUdWJEUYSivR1Jnp3ng2Dv7XyWXj/5EvIHgB84+Fg BQJqjXgyEm+AdxUY+DVEmIfg6Wg718I+/HYRYOA/f4Ng8qP89pk0ekc8APQmg+SaeFRO MT0Cqwziq++8SK5jasjGif+E4Le6FPRfXCcW4= MIME-Version: 1.0 Received: by 10.141.51.13 with HTTP; Sat, 27 Mar 2010 15:11:01 -0700 (PDT) Date: Sun, 28 Mar 2010 00:11:01 +0200 Received: by 10.141.5.13 with SMTP id h13mr983035rvi.24.1269727861334; Sat, 27 Mar 2010 15:11:01 -0700 (PDT) Message-ID: From: Blue Swirl To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 5/7] Refactor a few architecture dependent pieces in vl.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org These will be moved later. Signed-off-by: Blue Swirl --- vl.c | 72 +++++++++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 47 insertions(+), 25 deletions(-) diff --git a/vl.c b/vl.c index d9fc0cc..a1bb6e1 100644 --- a/vl.c +++ b/vl.c @@ -2945,6 +2945,22 @@ static void set_numa_modes(void) } } +static void set_cpu_log(const char *optarg) +{ + int mask; + const CPULogItem *item; + + mask = cpu_str_to_log_mask(optarg); + if (!mask) { + printf("Log items (comma separated):\n"); + for (item = cpu_log_items; item->mask != 0; item++) { + printf("%-10s %s\n", item->name, item->help); + } + exit(1); + } + cpu_set_log(mask); +} + static int vm_can_run(void) { if (powerdown_requested) @@ -3308,6 +3324,33 @@ int qemu_uuid_parse(const char *str, uint8_t *uuid) return 0; } +#ifdef TARGET_I386 +static void do_acpitable_option(const char *optarg) +{ + if (acpi_table_add(optarg) < 0) { + fprintf(stderr, "Wrong acpi table provided\n"); + exit(1); + } +} +#endif + +#ifdef TARGET_I386 +static void do_smbios_option(const char *optarg) +{ + if (smbios_entry_add(optarg) < 0) { + fprintf(stderr, "Wrong smbios provided\n"); + exit(1); + } +} +#endif + +static void cpudef_init(void) +{ +#if defined(cpudef_setup) + cpudef_setup(); /* parse cpu definitions in target config file */ +#endif +} + #ifndef _WIN32 static void termsig_handler(int signal) @@ -3856,9 +3899,7 @@ int main(int argc, char **argv, char **envp) fclose(fp); } } -#if defined(cpudef_setup) - cpudef_setup(); /* parse cpu definitions in target config file */ -#endif + cpudef_init(); /* second pass of option parsing */ optind = 1; @@ -4164,20 +4205,7 @@ int main(int argc, char **argv, char **envp) break; #endif case QEMU_OPTION_d: - { - int mask; - const CPULogItem *item; - - mask = cpu_str_to_log_mask(optarg); - if (!mask) { - printf("Log items (comma separated):\n"); - for(item = cpu_log_items; item->mask != 0; item++) { - printf("%-10s %s\n", item->name, item->help); - } - exit(1); - } - cpu_set_log(mask); - } + set_cpu_log(optarg); break; case QEMU_OPTION_s: gdbstub_dev = "tcp::" DEFAULT_GDBSTUB_PORT; @@ -4345,16 +4373,10 @@ int main(int argc, char **argv, char **envp) rtc_td_hack = 1; break; case QEMU_OPTION_acpitable: - if(acpi_table_add(optarg) < 0) { - fprintf(stderr, "Wrong acpi table provided\n"); - exit(1); - } + do_acpitable_option(optarg); break; case QEMU_OPTION_smbios: - if(smbios_entry_add(optarg) < 0) { - fprintf(stderr, "Wrong smbios provided\n"); - exit(1); - } + do_smbios_option(optarg); break; #endif #ifdef CONFIG_KVM