Arch-specific per-vcpu info should be initialised to zero
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sat, 14 Jan 2006 20:26:40 +0000 (21:26 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sat, 14 Jan 2006 20:26:40 +0000 (21:26 +0100)
when allocating a new vcpu structure, not copied from
CPU0's idle VCPU. Especially now that the idle VCPU itself
is dynamically allocated.

This should fix assertions people have been seeing in
getdomain_info_ctxt() relation to IOPL in eflags.

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/domain.c

index 19c29d084c1007140b22425b5ce349945c3e6fc5..db764760b14299e39640875ccb6b43d3a01afd14 100644 (file)
@@ -215,14 +215,10 @@ struct vcpu *alloc_vcpu_struct(struct domain *d, unsigned int vcpu_id)
 
     memset(v, 0, sizeof(*v));
 
-    memcpy(&v->arch, &idle_vcpu[0]->arch, sizeof(v->arch));
     v->arch.flags = TF_kernel_mode;
 
     if ( is_idle_domain(d) )
-    {
         percpu_ctxt[vcpu_id].curr_vcpu = v;
-        v->arch.schedule_tail = continue_idle_domain;
-    }
 
     if ( (v->vcpu_id = vcpu_id) != 0 )
     {
@@ -333,10 +329,11 @@ int arch_do_createdomain(struct vcpu *v)
         memset(d->shared_info, 0, PAGE_SIZE);
         v->vcpu_info = &d->shared_info->vcpu_info[v->vcpu_id];
         SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d);
-
-        v->arch.schedule_tail = continue_nonidle_domain;
     }
 
+    v->arch.schedule_tail = is_idle_domain(d) ?
+        continue_idle_domain : continue_nonidle_domain;
+
     return 0;
 
  fail_nomem: