Fixed smp_percpu_init() on sparc; added asserts
authorKevin Klues <klueska@ros-dev.(none)>
Fri, 9 Apr 2010 02:17:09 +0000 (19:17 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:41 +0000 (17:35 -0700)
kern/arch/sparc/smp.c
kern/src/process.c

index 33d1764..21c33e8 100644 (file)
@@ -35,6 +35,7 @@ smp_init(void)
 {
        static spinlock_t report_in_lock = SPINLOCK_INITIALIZER;
 
+       smp_percpu_init();
        spin_lock(&report_in_lock);
        num_cpus++;
        spin_unlock(&report_in_lock);
index c9e8e50..f64c10d 100644 (file)
@@ -188,15 +188,16 @@ void proc_init(void)
        int reserved_cores = 1;
        #ifdef __CONFIG_NETWORKING__
        reserved_cores++; // Next core is dedicated to the NIC
+       assert(num_cpus >= reserved_cores);
        #endif
        #ifdef __CONFIG_APPSERVER__
        #ifdef __CONFIG_DEDICATED_MONITOR__
        reserved_cores++; // Next core dedicated to running the kernel monitor
+       assert(num_cpus >= reserved_cores);
        // Need to subtract 1 from the reserved_cores # to get the cores index
        send_kernel_message(reserved_cores-1, (amr_t)monitor, 0,0,0, KMSG_ROUTINE);
        #endif
        #endif
-       assert(num_cpus >= reserved_cores);
        num_idlecores = num_cpus - reserved_cores;
        for (int i = 0; i < num_idlecores; i++)
                idlecoremap[i] = i + reserved_cores;