xtensa asm2: Fixup stack alignment at runtime
The API allows any byte count for stack size, and tests in fact check that a stack with a 499 byte stack works correctly. No choice, have to do this at runtime. Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
parent
02b2fe1c9e
commit
2867bfc1eb
1 changed files with 3 additions and 1 deletions
|
@ -64,7 +64,9 @@ void _new_thread(struct k_thread *thread, k_thread_stack_t *stack, size_t sz,
|
||||||
{
|
{
|
||||||
char *base = K_THREAD_STACK_BUFFER(stack);
|
char *base = K_THREAD_STACK_BUFFER(stack);
|
||||||
char *top = base + sz;
|
char *top = base + sz;
|
||||||
__ASSERT((((size_t)top) & 3) == 0, "Misaligned stack");
|
|
||||||
|
/* Align downward. The API as specified requires a runtime check. */
|
||||||
|
top = (char *)(((unsigned int)top) & ~3);
|
||||||
|
|
||||||
_new_thread_init(thread, base, sz, prio, opts);
|
_new_thread_init(thread, base, sz, prio, opts);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue