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); }