Prevented hart_max_harts() from returning 0
authorAndrew Waterman <waterman@r53.millennium.berkeley.edu>
Tue, 27 Oct 2009 06:28:13 +0000 (23:28 -0700)
committerAndrew Waterman <waterman@r53.millennium.berkeley.edu>
Tue, 27 Oct 2009 06:28:13 +0000 (23:28 -0700)
The current algorithm is hart_max_harts() == num_cpus-1,
because core 0 is reserved.  However, single-core processes
still need something to run on, so on uniprocessor systems
we return 1 rather than 1-1.

kern/src/env.c

index b9ee4d5..514815a 100644 (file)
@@ -239,7 +239,7 @@ proc_init_procinfo(struct proc* p)
        p->env_procinfo->id = (p->env_id & 0x3FF);
 
        // TODO: maybe do something smarter here
-       p->env_procinfo->max_harts = num_cpus-1;
+       p->env_procinfo->max_harts = num_cpus > 1 ? num_cpus-1 : 1;
 }
 
 // Sets up argc/argv in procinfo.  Returns number of