Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen/x86 The code assumes that ci_index is also the ...



details:   https://anonhg.NetBSD.org/src/rev/cf21bfc6c44f
branches:  trunk
changeset: 777616:cf21bfc6c44f
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sat Feb 25 18:57:50 2012 +0000

description:
The code assumes that ci_index is also the Xen's cpunum, and that
cpunum is less than XEN_LEGACY_MAX_VCPUS. KASSERT both.

diffstat:

 sys/arch/xen/x86/cpu.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r 6e727c8d0dbd -r cf21bfc6c44f sys/arch/xen/x86/cpu.c
--- a/sys/arch/xen/x86/cpu.c    Sat Feb 25 18:11:05 2012 +0000
+++ b/sys/arch/xen/x86/cpu.c    Sat Feb 25 18:57:50 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.88 2012/02/24 11:43:06 bouyer Exp $  */
+/*     $NetBSD: cpu.c,v 1.89 2012/02/25 18:57:50 bouyer Exp $  */
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.88 2012/02/24 11:43:06 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.89 2012/02/25 18:57:50 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -409,6 +409,7 @@
        ci->ci_cpuid = cpunum;
 
        KASSERT(HYPERVISOR_shared_info != NULL);
+       KASSERT(cpunum < XEN_LEGACY_MAX_VCPUS);
        ci->ci_vcpu = &HYPERVISOR_shared_info->vcpu_info[cpunum];
 
        KASSERT(ci->ci_func == 0);
@@ -434,6 +435,7 @@
                KASSERT(ci->ci_data.cpu_idlelwp != NULL);
        }
 
+       KASSERT(ci->ci_cpuid == ci->ci_index);
        ci->ci_cpumask = (1 << cpu_index(ci));
        pmap_reference(pmap_kernel());
        ci->ci_pmap = pmap_kernel();



Home | Main Index | Thread Index | Old Index