--- Gnu-Mach/kern/syscall_subr.c 2020/09/02 04:42:47 1.1.1.2 +++ Gnu-Mach/kern/syscall_subr.c 2020/09/02 04:49:55 1.1.1.5 @@ -27,30 +27,27 @@ * 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 */ - - /* * swtch and swtch_pri both attempt to context switch (logic in * thread_block no-ops the context switch if nothing would happen). @@ -64,27 +61,19 @@ * returned, the thread should make one more check on the * lock and then be a good citizen and really suspend. */ - -extern void thread_depress_priority(); -extern kern_return_t thread_depress_abort(); - -#ifdef CONTINUATIONS -void swtch_continue() +void swtch_continue(void) { - register processor_t myprocessor; + processor_t myprocessor; myprocessor = current_processor(); thread_syscall_return(myprocessor->runq.count > 0 || 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; + processor_t myprocessor; #if NCPUS > 1 myprocessor = current_processor(); @@ -100,11 +89,10 @@ 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; + thread_t thread = current_thread(); + processor_t myprocessor; if (thread->depress_priority >= 0) (void) thread_depress_abort(thread); @@ -113,19 +101,11 @@ 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; +boolean_t swtch_pri(int pri) { - register thread_t thread = current_thread(); - register processor_t myprocessor; - -#ifdef lint - pri++; -#endif /* lint */ + thread_t thread = current_thread(); + processor_t myprocessor; #if NCPUS > 1 myprocessor = current_processor(); @@ -150,12 +130,9 @@ 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(); + thread_t cur_thread = current_thread(); /* * Restore depressed priority @@ -165,9 +142,6 @@ void thread_switch_continue() thread_syscall_return(KERN_SUCCESS); /*NOTREACHED*/ } -#else /* not CONTINUATIONS */ -#define thread_switch_continue 0 -#endif /* not CONTINUATIONS */ /* * thread_switch: @@ -177,13 +151,13 @@ void thread_switch_continue() * Fixed priority threads that call this get what they asked for * even if that violates priority order. */ -kern_return_t thread_switch(thread_name, option, option_time) -mach_port_t thread_name; -int option; -mach_msg_timeout_t option_time; +kern_return_t thread_switch( + mach_port_t thread_name, + int option, + mach_msg_timeout_t option_time) { - register thread_t cur_thread = current_thread(); - register processor_t myprocessor; + thread_t cur_thread = current_thread(); + processor_t myprocessor; ipc_port_t port; /* @@ -224,8 +198,8 @@ mach_msg_timeout_t option_time; * Get corresponding thread. */ if (ip_active(port) && (ip_kotype(port) == IKOT_THREAD)) { - register thread_t thread; - register spl_t s; + thread_t thread; + spl_t s; thread = (thread_t) port->ip_kobject; /* @@ -305,9 +279,9 @@ mach_msg_timeout_t option_time; * of zero will result in no timeout being scheduled. */ void -thread_depress_priority(thread, depress_time) -register thread_t thread; -mach_msg_timeout_t depress_time; +thread_depress_priority( + thread_t thread, + mach_msg_timeout_t depress_time) { unsigned int ticks; spl_t s; @@ -328,8 +302,8 @@ mach_msg_timeout_t depress_time; * sched_pri to their lowest possible values. */ thread->depress_priority = thread->priority; - thread->priority = 31; - thread->sched_pri = 31; + thread->priority = NRQS-1; + thread->sched_pri = NRQS-1; if (ticks != 0) set_timeout(&thread->depress_timer, ticks); @@ -343,8 +317,7 @@ mach_msg_timeout_t depress_time; * Timeout routine for priority depression. */ void -thread_depress_timeout(thread) -register thread_t thread; +thread_depress_timeout(thread_t thread) { spl_t s; @@ -372,8 +345,7 @@ register thread_t thread; * Prematurely abort priority depression if there is one. */ kern_return_t -thread_depress_abort(thread) -register thread_t thread; +thread_depress_abort(thread_t thread) { spl_t s; @@ -397,3 +369,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 */