--- Gnu-Mach/kern/syscall_subr.c 2020/09/02 04:36:57 1.1 +++ Gnu-Mach/kern/syscall_subr.c 2020/09/02 04:45:18 1.1.1.3 @@ -27,27 +27,26 @@ * the rights to redistribute these changes. */ -#include -#include - #include #include #include #include #include #include +#include +#include #include #include #include +#include #include #include #include -#include #include /* for splsched */ #if MACH_FIXPRI #include -#endif MACH_FIXPRI +#endif /* MACH_FIXPRI */ @@ -65,11 +64,9 @@ * lock and then be a good citizen and really suspend. */ -extern void thread_depress_priority(); -extern kern_return_t thread_depress_abort(); +void thread_depress_priority(thread_t, mach_msg_timeout_t); -#ifdef CONTINUATIONS -void swtch_continue() +void swtch_continue(void) { register processor_t myprocessor; @@ -78,11 +75,8 @@ void swtch_continue() myprocessor->processor_set->runq.count > 0); /*NOTREACHED*/ } -#else /* not CONTINUATIONS */ -#define swtch_continue 0 -#endif /* not CONTINUATIONS */ -boolean_t swtch() +boolean_t swtch(void) { register processor_t myprocessor; @@ -91,7 +85,7 @@ boolean_t swtch() if (myprocessor->runq.count == 0 && myprocessor->processor_set->runq.count == 0) return(FALSE); -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ counter(c_swtch_block++); thread_block(swtch_continue); @@ -100,8 +94,7 @@ boolean_t swtch() myprocessor->processor_set->runq.count > 0); } -#ifdef CONTINUATIONS -void swtch_pri_continue() +void swtch_pri_continue(void) { register thread_t thread = current_thread(); register processor_t myprocessor; @@ -113,9 +106,6 @@ void swtch_pri_continue() myprocessor->processor_set->runq.count > 0); /*NOTREACHED*/ } -#else /* not CONTINUATIONS */ -#define swtch_pri_continue 0 -#endif /* not CONTINUATIONS */ boolean_t swtch_pri(pri) int pri; @@ -125,14 +115,14 @@ boolean_t swtch_pri(pri) #ifdef lint pri++; -#endif lint +#endif /* lint */ #if NCPUS > 1 myprocessor = current_processor(); if (myprocessor->runq.count == 0 && myprocessor->processor_set->runq.count == 0) return(FALSE); -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ /* * XXX need to think about depression duration. @@ -150,24 +140,18 @@ boolean_t swtch_pri(pri) myprocessor->processor_set->runq.count > 0); } -extern int hz; - -#ifdef CONTINUATIONS -void thread_switch_continue() +void thread_switch_continue(void) { register thread_t cur_thread = current_thread(); /* - * Restore depressed priority + * Restore depressed priority */ if (cur_thread->depress_priority >= 0) (void) thread_depress_abort(cur_thread); thread_syscall_return(KERN_SUCCESS); /*NOTREACHED*/ } -#else /* not CONTINUATIONS */ -#define thread_switch_continue 0 -#endif /* not CONTINUATIONS */ /* * thread_switch: @@ -210,7 +194,7 @@ mach_msg_timeout_t option_time; default: return(KERN_INVALID_ARGUMENT); } - + #ifndef MIGRATING_THREADS /* XXX thread_run defunct */ /* * Check and act on thread hint if appropriate. @@ -250,11 +234,11 @@ mach_msg_timeout_t option_time; myprocessor->quantum = thread->sched_data; myprocessor->first_quantum = TRUE; } -#endif MACH_FIXPRI +#endif /* MACH_FIXPRI */ counter(c_thread_switch_handoff++); thread_run(thread_switch_continue, thread); /* - * Restore depressed priority + * Restore depressed priority */ if (cur_thread->depress_priority >= 0) (void) thread_depress_abort(cur_thread); @@ -280,14 +264,14 @@ mach_msg_timeout_t option_time; myprocessor = current_processor(); if (myprocessor->processor_set->runq.count > 0 || myprocessor->runq.count > 0) -#endif NCPUS > 1 +#endif /* NCPUS > 1 */ { counter(c_thread_switch_block++); thread_block(thread_switch_continue); } /* - * Restore depressed priority + * Restore depressed priority */ if (cur_thread->depress_priority >= 0) (void) thread_depress_abort(cur_thread); @@ -335,7 +319,7 @@ mach_msg_timeout_t depress_time; thread_unlock(thread); (void) splx(s); -} +} /* * thread_depress_timeout: @@ -397,3 +381,18 @@ register thread_t thread; (void) splx(s); return(KERN_SUCCESS); } + +/* + * mach_print + * + * Display a null-terminated character string on the Mach console. + * This system call is meant as a debugging tool useful to circumvent + * messaging altogether. + */ +#ifdef MACH_KDB +void +mach_print(const char *s) +{ + printf("%s", s); +} +#endif /* MACH_KDB */