xtensa/asm2: Add a _new_thread implementation for asm2/switch

Implement _new_thread in terms of the asm2 switch mechanism.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2017-12-09 09:32:21 -08:00 committed by Anas Nashif
commit b2c74e017e

View file

@ -48,3 +48,17 @@ void *xtensa_init_stack(int *stack_top,
bsa[-9] = bsa;
return &bsa[-9];
}
void _new_thread(struct k_thread *thread, k_thread_stack_t *stack, size_t sz,
k_thread_entry_t entry, void *p1, void *p2, void *p3,
int prio, unsigned int opts)
{
char *base = K_THREAD_STACK_BUFFER(stack);
char *top = base + sz;
__ASSERT((((size_t)top) & 3) == 0, "Misaligned stack");
_new_thread_init(thread, base, sz, prio, opts);
thread->switch_handle = xtensa_init_stack(top, entry, p1, p2, p3);
}