thread: add kthreads
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
da53fa3871
commit
54803ed29b
6 changed files with 79 additions and 36 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue