diff mbox

[18/27] pc: isolate the code that create CPUs

Message ID 1351101001-14589-19-git-send-email-ehabkost@redhat.com
State New
Headers show

Commit Message

Eduardo Habkost Oct. 24, 2012, 5:49 p.m. UTC
The code will get more complex, so put it outside the for loop, into a
separate function.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/pc.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
diff mbox

Patch

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);
     }
 }