From 02b2fe1c9e72285df9ae2c03d63d3acb9a0e7cc4 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Sun, 17 Dec 2017 12:12:13 -0800 Subject: [PATCH] xtensa: THREAD_MONITOR hooks for asm2 You'd this feature would be portable, but it's arch-specific. Initialize the CONFIG_THREAD_MONITOR stuff, placing the __thread_entry struct (which AFAICT is dead: nothing in the tree actually reads it) at the top of the stack. Signed-off-by: Andy Ross --- arch/xtensa/core/xtensa-asm2.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/xtensa/core/xtensa-asm2.c b/arch/xtensa/core/xtensa-asm2.c index f9b8200d733..92e77ed7222 100644 --- a/arch/xtensa/core/xtensa-asm2.c +++ b/arch/xtensa/core/xtensa-asm2.c @@ -68,6 +68,15 @@ void _new_thread(struct k_thread *thread, k_thread_stack_t *stack, size_t sz, _new_thread_init(thread, base, sz, prio, opts); +#ifdef CONFIG_THREAD_MONITOR + top -= sizeof(struct __thread_entry); + thread->entry = (void *)top; + thread->entry->pEntry = entry; + + thread_monitor_init(thread); +#endif + + thread->switch_handle = xtensa_init_stack((void *)top, entry, p1, p2, p3); }