kernel: Un-inline z_new_thread_init.

This commit modifies the z_new_thread_init function, that was
previously declared as ALWAYS_INLINE to be a normal function.

z_new_thread_init function is only called by the z_arch_new_thread
function and, since this is not a performance-critical function, there
is no good justification for inlining it.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
Stephanos Ioannidis 2019-11-01 18:03:51 +09:00 committed by Andrew Boie
commit 37d6241ecf
2 changed files with 47 additions and 43 deletions

View file

@ -46,50 +46,9 @@ extern void z_setup_new_thread(struct k_thread *new_thread,
void *p1, void *p2, void *p3,
int prio, u32_t options, const char *name);
static ALWAYS_INLINE void z_new_thread_init(struct k_thread *thread,
extern void z_new_thread_init(struct k_thread *thread,
char *pStack, size_t stackSize,
int prio, unsigned int options)
{
#if !defined(CONFIG_INIT_STACKS) && !defined(CONFIG_THREAD_STACK_INFO)
ARG_UNUSED(pStack);
ARG_UNUSED(stackSize);
#endif
#ifdef CONFIG_INIT_STACKS
memset(pStack, 0xaa, stackSize);
#endif
#ifdef CONFIG_STACK_SENTINEL
/* Put the stack sentinel at the lowest 4 bytes of the stack area.
* We periodically check that it's still present and kill the thread
* if it isn't.
*/
*((u32_t *)pStack) = STACK_SENTINEL;
#endif /* CONFIG_STACK_SENTINEL */
/* Initialize various struct k_thread members */
z_init_thread_base(&thread->base, prio, _THREAD_PRESTART, options);
/* static threads overwrite it afterwards with real value */
thread->init_data = NULL;
thread->fn_abort = NULL;
#ifdef CONFIG_THREAD_CUSTOM_DATA
/* Initialize custom data field (value is opaque to kernel) */
thread->custom_data = NULL;
#endif
#ifdef CONFIG_THREAD_NAME
thread->name[0] = '\0';
#endif
#if defined(CONFIG_USERSPACE)
thread->mem_domain_info.mem_domain = NULL;
#endif /* CONFIG_USERSPACE */
#if defined(CONFIG_THREAD_STACK_INFO)
thread->stack_info.start = (uintptr_t)pStack;
thread->stack_info.size = (u32_t)stackSize;
#endif /* CONFIG_THREAD_STACK_INFO */
}
int prio, unsigned int options);
#ifdef CONFIG_USERSPACE
/**

View file

@ -428,6 +428,51 @@ static inline size_t adjust_stack_size(size_t stack_size)
#endif /* CONFIG_STACK_POINTER_RANDOM */
void z_new_thread_init(struct k_thread *thread,
char *pStack, size_t stackSize,
int prio, unsigned int options)
{
#if !defined(CONFIG_INIT_STACKS) && !defined(CONFIG_THREAD_STACK_INFO)
ARG_UNUSED(pStack);
ARG_UNUSED(stackSize);
#endif
#ifdef CONFIG_INIT_STACKS
memset(pStack, 0xaa, stackSize);
#endif
#ifdef CONFIG_STACK_SENTINEL
/* Put the stack sentinel at the lowest 4 bytes of the stack area.
* We periodically check that it's still present and kill the thread
* if it isn't.
*/
*((u32_t *)pStack) = STACK_SENTINEL;
#endif /* CONFIG_STACK_SENTINEL */
/* Initialize various struct k_thread members */
z_init_thread_base(&thread->base, prio, _THREAD_PRESTART, options);
/* static threads overwrite it afterwards with real value */
thread->init_data = NULL;
thread->fn_abort = NULL;
#ifdef CONFIG_THREAD_CUSTOM_DATA
/* Initialize custom data field (value is opaque to kernel) */
thread->custom_data = NULL;
#endif
#ifdef CONFIG_THREAD_NAME
thread->name[0] = '\0';
#endif
#if defined(CONFIG_USERSPACE)
thread->mem_domain_info.mem_domain = NULL;
#endif /* CONFIG_USERSPACE */
#if defined(CONFIG_THREAD_STACK_INFO)
thread->stack_info.start = (uintptr_t)pStack;
thread->stack_info.size = (u32_t)stackSize;
#endif /* CONFIG_THREAD_STACK_INFO */
}
/*
* Note:
* The caller must guarantee that the stack_size passed here corresponds