--- Gnu-Mach/kern/eventcount.c 2020/09/02 04:36:56 1.1 +++ Gnu-Mach/kern/eventcount.c 2020/09/02 04:47:27 1.1.1.3 @@ -35,11 +35,12 @@ * */ - -#include +#include +#include #include #include +#include #include "cpu_number.h" #include #include @@ -52,13 +53,6 @@ #include - -#if NCPUS <= 1 -void simpler_thread_setrun( - thread_t th, - boolean_t may_preempt); /* forward */ -#endif - #define MAX_EVCS 10 /* xxx for now */ evc_t all_eventcounters[MAX_EVCS]; @@ -70,7 +64,7 @@ evc_init(evc_t ev) { int i; - bzero((char*)ev, sizeof(*ev)); + memset(ev, 0, sizeof(*ev)); /* keep track of who is who */ for (i = 0; i < MAX_EVCS; i++) @@ -104,7 +98,7 @@ evc_destroy(evc_t ev) * Thread termination. * HORRIBLE. This stuff needs to be fixed. */ -void evc_notify_abort(thread_t thread) +void evc_notify_abort(const thread_t thread) { int i; evc_t ev; @@ -125,20 +119,16 @@ void evc_notify_abort(thread_t thread) splx(s); } -#ifdef CONTINUATIONS /* * Just so that we return success, and give * up the stack while blocked */ -static void +static void __attribute__((noreturn)) evc_continue(void) { thread_syscall_return(KERN_SUCCESS); /* NOTREACHED */ } -#else /* not CONTINUATIONS */ -#define evc_continue 0 -#endif /* not CONTINUATIONS */ /* * User-trappable @@ -193,7 +183,6 @@ kern_return_t evc_wait(natural_t ev_id) kern_return_t evc_wait_clear(natural_t ev_id) { spl_t s; - kern_return_t ret; evc_t ev; if ((ev_id >= MAX_EVCS) || @@ -230,7 +219,7 @@ kern_return_t evc_wait_clear(natural_t e simple_unlock(&ev->lock); splx(s); - ret = KERN_NO_SPACE; /* XX */ + return KERN_NO_SPACE; /* XX */ } /* @@ -239,8 +228,8 @@ kern_return_t evc_wait_clear(natural_t e void evc_signal(evc_t ev) { - register volatile thread_t thread; - register int state; + volatile thread_t thread; + int state; spl_t s; if (ev->sanity != ev) return; @@ -329,8 +318,8 @@ simpler_thread_setrun( thread_t th, boolean_t may_preempt) { - register struct run_queue *rq; - register whichq; + struct run_queue *rq; + int whichq; /* * XXX should replace queue with a boolean in this case. @@ -351,7 +340,7 @@ simpler_thread_setrun( whichq = (th)->sched_pri; simple_lock(&(rq)->lock); /* lock the run queue */ - enqueue_head(&(rq)->runq[whichq], (queue_entry_t) (th)); + enqueue_head(&(rq)->runq[whichq], &((th)->links)); if (whichq < (rq)->low || (rq)->count == 0) (rq)->low = whichq; /* minimize */