From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5A9-0004Zp-SZ for qemu-devel@nongnu.org; Wed, 24 Oct 2012 13:54:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TR5A4-000551-1o for qemu-devel@nongnu.org; Wed, 24 Oct 2012 13:54:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TR5A3-00054i-PN for qemu-devel@nongnu.org; Wed, 24 Oct 2012 13:54:35 -0400 From: Eduardo Habkost Date: Wed, 24 Oct 2012 15:49:52 -0200 Message-Id: <1351101001-14589-19-git-send-email-ehabkost@redhat.com> In-Reply-To: <1351101001-14589-1-git-send-email-ehabkost@redhat.com> References: <1351101001-14589-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 18/27] pc: isolate the code that create CPUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Paolo Bonzini The code will get more complex, so put it outside the for loop, into a separate function. Signed-off-by: Eduardo Habkost --- hw/pc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 0e01003..85eab04 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -859,6 +859,14 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level) } } +static void pc_cpu_init(PCInitArgs *args, int cpu_index) +{ + if (!cpu_x86_init(args->qemu_args->cpu_model)) { + fprintf(stderr, "Unable to find x86 CPU definition\n"); + exit(1); + } +} + void pc_cpus_init(PCInitArgs *args) { int i; @@ -869,10 +877,7 @@ void pc_cpus_init(PCInitArgs *args) } for (i = 0; i < smp_cpus; i++) { - if (!cpu_x86_init(args->qemu_args->cpu_model)) { - fprintf(stderr, "Unable to find x86 CPU definition\n"); - exit(1); - } + pc_cpu_init(args, i); } } -- 1.7.11.7