thread: add kthreads

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-08-12 22:03:52 -04:00
commit 54803ed29b
Signed by: michaelsshaw
GPG key ID: 5A5E0FB20708A9E7
6 changed files with 79 additions and 36 deletions

View file

@ -74,16 +74,8 @@ struct thread *thread_create(void)
thread->stack_size = USTACK_DEFAULT_SIZE;
thread->ustack_top = 0x7FFFFFFFF000;
thread->tid = alloc_tid();
thread->state = THREAD_STATE_DNS;
void *kstack = kalloc(P_STACK_SIZE, ALLOC_KERN);
if (!kstack) {
slab_free(thread_slab, thread);
return NULL;
}
thread->kstack_top = (uaddr_t)kstack + P_STACK_SIZE;
thread->tid = alloc_tid();
thread->group = thread->tid;
void *ustack = thread_alloc(thread, thread->stack_size);