X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm.c;h=589f57673353261e22b0914f1f9d10170af1016f;hb=1f0cbd22f1263a6083f0d5fc69f69f98db6006df;hp=855b11cf6bbd8cb7eae999cd4a8eb106b4593ffd;hpb=539b0d4741f477f0d94205fea9ae9c15b88367a1;p=palacios.git diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index 855b11c..589f576 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -39,6 +39,8 @@ v3_cpu_arch_t v3_cpu_types[V3_CONFIG_MAX_CPUS]; +v3_cpu_arch_t v3_mach_type = V3_INVALID_CPU; + struct v3_os_hooks * os_hooks = NULL; int v3_dbg_enable = 0; @@ -105,6 +107,9 @@ void Init_V3(struct v3_os_hooks * hooks, int num_cpus) { // Set global variables. os_hooks = hooks; + // Determine the global machine type + v3_mach_type = V3_INVALID_CPU; + for (i = 0; i < V3_CONFIG_MAX_CPUS; i++) { v3_cpu_types[i] = V3_INVALID_CPU; } @@ -131,11 +136,15 @@ void Init_V3(struct v3_os_hooks * hooks, int num_cpus) { if ((hooks) && (hooks->call_on_cpu)) { - for (i = 0; i < num_cpus; i++) { V3_Print("Initializing VMM extensions on cpu %d\n", i); hooks->call_on_cpu(i, &init_cpu, (void *)(addr_t)i); + + if (v3_mach_type == V3_INVALID_CPU) { + v3_mach_type = v3_cpu_types[i]; + } + } } @@ -210,7 +219,7 @@ static int start_core(void * p) PrintDebug("virtual core %u (on logical core %u): in start_core (RIP=%p)\n", core->vcpu_id, core->pcpu_id, (void *)(addr_t)core->rip); - switch (v3_cpu_types[0]) { + switch (v3_mach_type) { #ifdef V3_CONFIG_SVM case V3_SVM_CPU: case V3_SVM_REV3_CPU: @@ -628,7 +637,7 @@ void v3_interrupt_cpu(struct v3_vm_info * vm, int logical_cpu, int vector) { int v3_vm_enter(struct guest_info * info) { - switch (v3_cpu_types[0]) { + switch (v3_mach_type) { #ifdef V3_CONFIG_SVM case V3_SVM_CPU: case V3_SVM_REV3_CPU: