Skip to content
Permalink
Browse files

userspace: set stack object earlier

Populate thread->stack_obj earlier in the thread initialization
process such that it is set when z_new_thread() is called.

There was nothing specific about its position, or the rest of
the code in that CONFIG_USERSPACE block, so just move it all up..

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
  • Loading branch information...
andrewboie authored and carlescufi committed Jul 30, 2019
1 parent 4b18a07 commit f281b74c56bb6e6e02580ede60d13b75246365f5
Showing with 8 additions and 8 deletions.
  1. +8 −8 kernel/thread.c
@@ -403,6 +403,14 @@ void z_setup_new_thread(struct k_thread *new_thread,
void *p1, void *p2, void *p3,
int prio, u32_t options, const char *name)
{
#ifdef CONFIG_USERSPACE
z_object_init(new_thread);
z_object_init(stack);
new_thread->stack_obj = stack;

/* Any given thread has access to itself */
k_object_access_grant(new_thread, new_thread);
#endif
stack_size = adjust_stack_size(stack_size);

#ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA
@@ -447,14 +455,6 @@ void z_setup_new_thread(struct k_thread *new_thread,
new_thread->name[CONFIG_THREAD_MAX_NAME_LEN - 1] = '\0';
}
#endif
#ifdef CONFIG_USERSPACE
z_object_init(new_thread);
z_object_init(stack);
new_thread->stack_obj = stack;

/* Any given thread has access to itself */
k_object_access_grant(new_thread, new_thread);
#endif
#ifdef CONFIG_SCHED_CPU_MASK
new_thread->base.cpu_mask = -1;
#endif

0 comments on commit f281b74

Please sign in to comment.
You can’t perform that action at this time.