--- kernel/kern/thread.c 2018/04/24 18:26:07 1.1 +++ kernel/kern/thread.c 2018/04/24 18:32:37 1.1.1.2 @@ -494,7 +494,7 @@ kern_return_t thread_create( */ new_thread->_uthread = (struct uthread *) zalloc(u_thread_zone); -// uarea_zero(new_thread); /* XXX */ + uarea_zero(new_thread->_uthread); // uarea_init(new_thread); /* @@ -1807,7 +1807,21 @@ void reaper_thread_continue(void) void reaper_thread(void) { - current_thread()->vm_privilege = TRUE; + thread_t th = current_thread(); + + /* + * make reaper a high priority thread + * with fix priority scheduling policy + */ + th->priority = BASEPRI_SYSTEM + 3; + th->sched_pri = BASEPRI_SYSTEM + 3; + th->policy = POLICY_FIXEDPRI; + th->vm_privilege = TRUE; + th->sched_data = min_quantum * 4; + + /* Dedicate a stack for the reaper */ + stack_privilege(th); + reaper_thread_continue(); /*NOTREACHED*/ }