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>
This commit is contained in:
parent
4b18a079d9
commit
f281b74c56
1 changed files with 8 additions and 8 deletions
|
@ -403,6 +403,14 @@ void z_setup_new_thread(struct k_thread *new_thread,
|
||||||
void *p1, void *p2, void *p3,
|
void *p1, void *p2, void *p3,
|
||||||
int prio, u32_t options, const char *name)
|
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);
|
stack_size = adjust_stack_size(stack_size);
|
||||||
|
|
||||||
#ifdef CONFIG_THREAD_USERSPACE_LOCAL_DATA
|
#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';
|
new_thread->name[CONFIG_THREAD_MAX_NAME_LEN - 1] = '\0';
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef CONFIG_SCHED_CPU_MASK
|
||||||
new_thread->base.cpu_mask = -1;
|
new_thread->base.cpu_mask = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue