This fix a kernel crash building hurd under smp
---
 kern/sched_prim.c | 4 ++--
 kern/thread.c     | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index 605f7001..c1b809be 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -1272,7 +1272,7 @@ void thread_setrun(
             *  But first check the last processor it ran on.
             */
            processor = th->last_processor;
-           if (processor->state == PROCESSOR_IDLE) {
+           if (processor != PROCESSOR_NULL && processor->state == 
PROCESSOR_IDLE) {
                    processor_lock(processor);
                    pset_idle_lock();
                    if ((processor->state == PROCESSOR_IDLE)
@@ -1334,7 +1334,7 @@ void thread_setrun(
             *  Bound, can only run on bound processor.  Have to lock
             *  processor here because it may not be the current one.
             */
-           if (processor->state == PROCESSOR_IDLE) {
+           if (processor != PROCESSOR_NULL && processor->state == 
PROCESSOR_IDLE) {
                processor_lock(processor);
                pset = processor->processor_set;
                pset_idle_lock();
diff --git a/kern/thread.c b/kern/thread.c
index deb9688d..fa6bab72 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1292,7 +1292,8 @@ thread_dowait(
                     *  should cause the thread to take an ast and
                     *  context switch to suspend for us.
                     */
-                   cause_ast_check(thread->last_processor);
+                   if (thread->last_processor != PROCESSOR_NULL)
+                      cause_ast_check(thread->last_processor);
 #endif /* NCPUS > 1 */
 
                    /*
-- 
2.53.0


Reply via email to