Changeset 436a0a5 in mainline for kernel/generic/src/proc
- Timestamp:
- 2018-11-09T22:04:01Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 95d45482
- Parents:
- 88e43bc (diff), abf6c01 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- kernel/generic/src/proc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/scheduler.c
r88e43bc r436a0a5 134 134 void scheduler_fpu_lazy_request(void) 135 135 { 136 restart:137 136 fpu_enable(); 138 137 irq_spinlock_lock(&CPU->lock, false); … … 153 152 fpu_context_restore(THREAD->saved_fpu_context); 154 153 } else { 155 /* Allocate FPU context */156 if (!THREAD->saved_fpu_context) {157 /* Might sleep */158 irq_spinlock_unlock(&THREAD->lock, false);159 irq_spinlock_unlock(&CPU->lock, false);160 THREAD->saved_fpu_context =161 (fpu_context_t *) slab_alloc(fpu_context_cache, 0);162 163 /* We may have switched CPUs during slab_alloc */164 goto restart;165 }166 154 fpu_init(); 167 155 THREAD->fpu_context_exists = true; -
kernel/generic/src/proc/task.c
r88e43bc r436a0a5 199 199 task_t *task_create(as_t *as, const char *name) 200 200 { 201 task_t *task = (task_t *) slab_alloc(task_cache, 0);202 if ( task == NULL) {201 task_t *task = (task_t *) slab_alloc(task_cache, FRAME_ATOMIC); 202 if (!task) 203 203 return NULL; 204 }205 204 206 205 task_create_arch(task); -
kernel/generic/src/proc/thread.c
r88e43bc r436a0a5 165 165 166 166 #ifdef CONFIG_FPU 167 #ifdef CONFIG_FPU_LAZY 168 thread->saved_fpu_context = NULL; 169 #else /* CONFIG_FPU_LAZY */ 170 thread->saved_fpu_context = slab_alloc(fpu_context_cache, kmflags); 167 thread->saved_fpu_context = slab_alloc(fpu_context_cache, 168 FRAME_ATOMIC | kmflags); 171 169 if (!thread->saved_fpu_context) 172 170 return ENOMEM; 173 #endif /* CONFIG_FPU_LAZY */174 171 #endif /* CONFIG_FPU */ 175 172 … … 200 197 if (!stack_phys) { 201 198 #ifdef CONFIG_FPU 202 if (thread->saved_fpu_context)203 slab_free(fpu_context_cache, thread->saved_fpu_context);199 assert(thread->saved_fpu_context); 200 slab_free(fpu_context_cache, thread->saved_fpu_context); 204 201 #endif 205 202 return ENOMEM; … … 226 223 227 224 #ifdef CONFIG_FPU 228 if (thread->saved_fpu_context)229 slab_free(fpu_context_cache, thread->saved_fpu_context);225 assert(thread->saved_fpu_context); 226 slab_free(fpu_context_cache, thread->saved_fpu_context); 230 227 #endif 231 228 … … 342 339 thread_flags_t flags, const char *name) 343 340 { 344 thread_t *thread = (thread_t *) slab_alloc(thread_cache, 0);341 thread_t *thread = (thread_t *) slab_alloc(thread_cache, FRAME_ATOMIC); 345 342 if (!thread) 346 343 return NULL; 344 345 if (thread_create_arch(thread, flags) != EOK) { 346 slab_free(thread_cache, thread); 347 return NULL; 348 } 347 349 348 350 /* Not needed, but good for debugging */ … … 407 409 udebug_thread_initialize(&thread->udebug); 408 410 #endif 409 410 /* Might depend on previous initialization */411 thread_create_arch(thread);412 411 413 412 if ((flags & THREAD_FLAG_NOATTACH) != THREAD_FLAG_NOATTACH) … … 654 653 655 654 return waitq_sleep_timeout(&thread->join_wq, usec, flags, NULL); 655 656 // FIXME: join should deallocate the thread. 657 // Current code calls detach after join, that's contrary to how 658 // join is used in other threading APIs. 656 659 } 657 660
Note:
See TracChangeset
for help on using the changeset viewer.
