WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] vlapic_init alloc memory for struct vlapic, so it should

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] vlapic_init alloc memory for struct vlapic, so it should do a memset on
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 05 Nov 2005 15:52:07 +0000
Delivery-date: Sat, 05 Nov 2005 16:11:45 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID b180310a0d2ce3b76ca435269c7c99da62f8beec
# Parent  2e880b1fbe84645841e3b024940150d0b5a9c09a
vlapic_init alloc memory for struct vlapic, so it should do a memset on
it, not vlapic_reset.

Signed-off-by: Xin Li <xin.b.li@xxxxxxxxx>

diff -r 2e880b1fbe84 -r b180310a0d2c xen/arch/x86/vmx_vlapic.c
--- a/xen/arch/x86/vmx_vlapic.c Sat Nov  5 09:55:38 2005
+++ b/xen/arch/x86/vmx_vlapic.c Sat Nov  5 10:23:02 2005
@@ -659,7 +659,7 @@
         vlapic->spurious_vec = val & 0x1ff;
         if (!(vlapic->spurious_vec & 0x100)) {
             int i = 0;
-            for (i=0; i < VLAPIC_LVT_NUM; i++) 
+            for (i = 0; i < VLAPIC_LVT_NUM; i++)
                 vlapic->lvt[i] |= 0x10000;
             vlapic->status |= VLAPIC_SOFTWARE_DISABLE_MASK;
         }
@@ -723,10 +723,12 @@
         vlapic->timer_current = val;
         vlapic->timer_current_update = NOW();
 
-        VMX_DBG_LOG(DBG_LEVEL_VLAPIC,
-          "timer_init %x timer_current %x timer_current_update %08x%08x",
-          vlapic->timer_initial, vlapic->timer_current, 
(uint32_t)(vlapic->timer_current_update>>32), 
(uint32_t)vlapic->timer_current_update);
-        vlapic_begin_timer(vlapic);
+        VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "timer_init %x timer_current %x"
+                    "timer_current_update %08x%08x",
+                    vlapic->timer_initial, vlapic->timer_current,
+                    (uint32_t)(vlapic->timer_current_update >> 32),
+                    (uint32_t)vlapic->timer_current_update);
+                    vlapic_begin_timer(vlapic);
         break;
 
     case APIC_TDCR:
@@ -920,19 +922,22 @@
 
 static int vlapic_reset(struct vlapic *vlapic)
 {
-    struct vcpu *v = vlapic->vcpu;
-    int apic_id = v->vcpu_id, i;
-
-    if (!v || !vlapic)
-        return 0;
-
-    memset(vlapic, 0,sizeof(struct vlapic));
-
-    v->arch.arch_vmx.vlapic = vlapic;
+    struct vcpu *v;
+    int apic_id, i;
+
+    ASSERT( vlapic != NULL );
+
+    v = vlapic->vcpu;
+
+    ASSERT( v != NULL );
+
+    apic_id = v->vcpu_id;
 
     vlapic->domain = v->domain;
 
     vlapic->id = apic_id;
+
+    vlapic->vcpu_id = v->vcpu_id;
 
     vlapic->version = VLAPIC_VERSION;
 
@@ -940,6 +945,7 @@
 
     if (apic_id == 0)
         vlapic->apic_base_msr |= MSR_IA32_APICBASE_BSP;
+
     vlapic->base_address = vlapic_get_base_address(vlapic);
 
     for (i = 0; i < VLAPIC_LVT_NUM; i++)
@@ -949,9 +955,8 @@
 
     vlapic->spurious_vec = 0xff;
 
-
     init_ac_timer(&vlapic->vlapic_timer,
-      vlapic_timer_fn, vlapic, v->processor);
+                  vlapic_timer_fn, vlapic, v->processor);
 
 #ifdef VLAPIC_NO_BIOS
     /*
@@ -966,10 +971,10 @@
 #endif
 
     VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "vlapic_reset: "
-      "vcpu=%p id=%d vlapic_apic_base_msr=%08x%08x "
-      "vlapic_base_address=%0lx",
-      v, vlapic->id, (uint32_t)(vlapic->apic_base_msr >> 32),
-      (uint32_t)vlapic->apic_base_msr, vlapic->base_address);
+                "vcpu=%p id=%d vlapic_apic_base_msr=%08x%08x "
+                "vlapic_base_address=%0lx",
+                v, vlapic->id, (uint32_t)(vlapic->apic_base_msr >> 32),
+                (uint32_t)vlapic->apic_base_msr, vlapic->base_address);
 
     return 1;
 }
@@ -978,15 +983,20 @@
 {
     struct vlapic *vlapic = NULL;
 
+    ASSERT( v != NULL );
+
     VMX_DBG_LOG(DBG_LEVEL_VLAPIC, "vlapic_init %d", v->vcpu_id);
 
     vlapic = xmalloc_bytes(sizeof(struct vlapic));
-
     if (!vlapic) {
         printk("malloc vlapic error for vcpu %x\n", v->vcpu_id);
         return -ENOMEM;
     }
 
+    memset(vlapic, 0, sizeof(struct vlapic));
+
+    VLAPIC(v) = vlapic;
+
     vlapic->vcpu = v;
 
     vlapic_reset(vlapic);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] vlapic_init alloc memory for struct vlapic, so it should do a memset on, Xen patchbot -unstable <=