--- Gnu-Mach/kern/sched_prim.h 2020/09/02 04:36:56 1.1 +++ Gnu-Mach/kern/sched_prim.h 2020/09/02 04:49:51 1.1.1.4 @@ -52,6 +52,8 @@ typedef void *event_t; /* wait event * typedef void (*continuation_t)(void); /* continuation */ +#define thread_no_continuation ((continuation_t) 0) /* no continuation */ + /* * Exported interface to sched_prim.c. */ @@ -69,7 +71,7 @@ extern void thread_sleep( event_t event, simple_lock_t lock, boolean_t interruptible); -extern void thread_wakeup(); /* for function pointers */ +extern void thread_wakeup(void); /* for function pointers */ extern void thread_wakeup_prim( event_t event, boolean_t one_thread, @@ -103,7 +105,19 @@ extern boolean_t thread_handoff( thread_t old_thread, continuation_t continuation, thread_t new_thread); -extern void recompute_priorities(); +extern void recompute_priorities(void *param); +extern void update_priority( + thread_t thread); +extern void compute_my_priority( + thread_t thread); +extern void thread_bind( + thread_t thread, + processor_t processor); +extern void compute_priority( + thread_t thread, + boolean_t resched); +extern void thread_timeout_setup( + thread_t thread); /* * Routines defined as macros @@ -120,13 +134,10 @@ extern void recompute_priorities(); * Machine-dependent code must define these functions. */ -extern void thread_bootstrap_return(void); -extern void thread_exception_return(void); -#ifdef __GNUC__ -extern void __volatile__ thread_syscall_return(kern_return_t); -#else -extern void thread_syscall_return(kern_return_t); -#endif +extern void thread_bootstrap_return(void) __attribute__((noreturn)); +extern void thread_exception_return(void) __attribute__((noreturn)); +extern void __attribute__((__noreturn__)) thread_syscall_return(kern_return_t); + extern thread_t switch_context( thread_t old_thread, continuation_t continuation, @@ -141,7 +152,7 @@ extern void stack_handoff( * or are defined directly by machine-dependent code. */ -extern void stack_alloc( +extern kern_return_t stack_alloc( thread_t thread, void (*resume)(thread_t)); extern boolean_t stack_alloc_try( @@ -160,4 +171,18 @@ extern void stack_free( #define convert_ipc_timeout_to_ticks(millis) \ (((millis) * hz + 999) / 1000) +void set_pri(thread_t th, int pri, boolean_t resched); +void do_thread_scan(void); +thread_t choose_pset_thread(processor_t myprocessor, processor_set_t pset); + +#if DEBUG +#include /* for run_queue_t */ + +void checkrq(run_queue_t rq, const char *msg); +void thread_check(thread_t th, run_queue_t rq); +#endif /* DEBUG */ + +extern void idle_thread(void) __attribute__((noreturn)); +extern void sched_thread(void); + #endif /* _KERN_SCHED_PRIM_H_ */