From 51d95f2e41553890121a611852594ca4a74eb53e Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Wed, 1 Apr 2015 14:01:14 +0200 Subject: XXX pmm from x15, userspace crashes soon --- kern/thread.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'kern/thread.c') diff --git a/kern/thread.c b/kern/thread.c index 9c82af5..a6644ca 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -123,6 +123,15 @@ decl_simple_lock_data(, stack_lock_data)/* splsched only */ */ static struct kmem_cache stack_cache; +vm_offset_t +thread_bootstrap_stack_alloc(void) +{ + vm_offset_t stack; + stack = kmem_cache_alloc(&stack_cache); + assert ((stack & (KERNEL_STACK_SIZE-1)) == 0); + return stack; +} + /* * stack_alloc_try: * @@ -220,7 +229,7 @@ void stack_privilege( thread->stack_privilege = current_stack(); } -void thread_init(void) +void thread_bootstrap(void) { kmem_cache_init(&thread_cache, "thread", sizeof(struct thread), 0, NULL, 0); @@ -233,7 +242,10 @@ void thread_init(void) kmem_cache_init(&stack_cache, "stack", KERNEL_STACK_SIZE, KERNEL_STACK_SIZE, NULL, 0); +} +void thread_init(void) +{ /* * Fill in a template thread for fast initialization. * [Fields that must be (or are typically) reset at -- cgit v1.2.3