kernel: Add stack_info to k_thread

This patck adds the stack information into the k_thread data structure.
The information will be set by when creating a new thread (_new_thread)
and will be used by the scheduling process.

Change-Id: Ibe79fe92a9ef8bce27bf8616d8e0c878508c267d
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
This commit is contained in:
Vincenzo Frascino 2017-03-27 15:52:42 +01:00 committed by Kumar Gala
commit dfed8c4874
2 changed files with 28 additions and 0 deletions

View file

@ -65,6 +65,16 @@ struct __thread_entry {
};
#endif
#if defined(CONFIG_THREAD_STACK_INFO)
/* Contains the stack information of a thread */
struct _thread_stack_info {
/* Stack Start */
u32_t start;
/* Stack Size */
u32_t size;
};
#endif /* CONFIG_THREAD_STACK_INFO */
/* can be used for creating 'dummy' threads, e.g. for pending on objects */
struct _thread_base {
@ -148,6 +158,11 @@ struct k_thread {
int errno_var;
#endif
#if defined(CONFIG_THREAD_STACK_INFO)
/* Stack Info */
struct _thread_stack_info stack_info;
#endif /* CONFIG_THREAD_STACK_INFO */
/* arch-specifics: must always be at the end */
struct _thread_arch arch;
};
@ -265,6 +280,11 @@ static ALWAYS_INLINE struct k_thread *_new_thread_init(char *pStack,
thread->custom_data = NULL;
#endif
#if defined(CONFIG_THREAD_STACK_INFO)
thread->stack_info.start = (u32_t)pStack;
thread->stack_info.size = (u32_t)stackSize;
#endif /* CONFIG_THREAD_STACK_INFO */
return thread;
}