Lines Matching full:stack
27 k_thread_stack_t *stack; member
38 k_thread_stack_t *stack; in z_thread_stack_alloc_pool() local
41 LOG_DBG("stack size %zu is > pool stack size %d", size, in z_thread_stack_alloc_pool()
48 LOG_DBG("unable to allocate stack from pool"); in z_thread_stack_alloc_pool()
54 stack = (k_thread_stack_t *)&dynamic_stack[offset]; in z_thread_stack_alloc_pool()
56 return stack; in z_thread_stack_alloc_pool()
65 /* Dynamic user stack needs a kobject, so if this option is not in z_thread_stack_alloc_dyn()
77 k_thread_stack_t *stack = NULL; in z_impl_k_thread_stack_alloc() local
80 stack = z_thread_stack_alloc_dyn(size, flags); in z_impl_k_thread_stack_alloc()
81 if (stack == NULL && CONFIG_DYNAMIC_THREAD_POOL_SIZE > 0) { in z_impl_k_thread_stack_alloc()
82 stack = z_thread_stack_alloc_pool(size); in z_impl_k_thread_stack_alloc()
86 stack = z_thread_stack_alloc_pool(size); in z_impl_k_thread_stack_alloc()
89 if ((stack == NULL) && IS_ENABLED(CONFIG_DYNAMIC_THREAD_ALLOC)) { in z_impl_k_thread_stack_alloc()
90 stack = z_thread_stack_alloc_dyn(size, flags); in z_impl_k_thread_stack_alloc()
94 return stack; in z_impl_k_thread_stack_alloc()
109 if (data->stack == (k_thread_stack_t *)thread->stack_info.start) { in dyn_cb()
110 __ASSERT(data->tid == NULL, "stack %p is associated with more than one thread!", in dyn_cb()
116 int z_impl_k_thread_stack_free(k_thread_stack_t *stack) in z_impl_k_thread_stack_free() argument
118 struct dyn_cb_data data = {.stack = stack}; in z_impl_k_thread_stack_free()
120 /* Get a possible tid associated with stack */ in z_impl_k_thread_stack_free()
132 if (IS_ARRAY_ELEMENT(dynamic_stack, stack)) { in z_impl_k_thread_stack_free()
133 if (sys_bitarray_free(&dynamic_ba, 1, ARRAY_INDEX(dynamic_stack, stack))) { in z_impl_k_thread_stack_free()
134 LOG_ERR("stack %p is not allocated!", stack); in z_impl_k_thread_stack_free()
144 if (k_object_find(stack)) { in z_impl_k_thread_stack_free()
145 k_object_free(stack); in z_impl_k_thread_stack_free()
147 k_free(stack); in z_impl_k_thread_stack_free()
150 k_free(stack); in z_impl_k_thread_stack_free()
153 LOG_DBG("Invalid stack %p", stack); in z_impl_k_thread_stack_free()
161 static inline int z_vrfy_k_thread_stack_free(k_thread_stack_t *stack) in z_vrfy_k_thread_stack_free() argument
163 /* The thread stack object must not be in initialized state. in z_vrfy_k_thread_stack_free()
165 * Thread stack objects are initialized when the thread is created in z_vrfy_k_thread_stack_free()
167 * free a stack that is in use, we have to check that the caller in z_vrfy_k_thread_stack_free()
170 K_OOPS(K_SYSCALL_OBJ_NEVER_INIT(stack, K_OBJ_THREAD_STACK_ELEMENT)); in z_vrfy_k_thread_stack_free()
172 return z_impl_k_thread_stack_free(stack); in z_vrfy_k_thread_stack_free()