arch: arm: Remove redundant check and fix rounding
This patch removes the redundant stack alignment check being done. The stack definition macros enforce the alignment requirements via the __align() directives. In addition, fix the rounding down of the psp to be correct. The actual initial stack pointer is the end of the stack minus the size of the __esf structure. Rounding down after the subtraction will get us to the correct offset. Signed-off-by: Andy Gross <andy.gross@linaro.org>
This commit is contained in:
parent
817245c564
commit
85481d997b
1 changed files with 2 additions and 6 deletions
|
@ -58,18 +58,14 @@ void _new_thread(struct k_thread *thread, k_thread_stack_t stack,
|
||||||
|
|
||||||
_ASSERT_VALID_PRIO(priority, pEntry);
|
_ASSERT_VALID_PRIO(priority, pEntry);
|
||||||
|
|
||||||
__ASSERT(!((u32_t)pStackMem & (STACK_ALIGN - 1)),
|
|
||||||
"stack is not aligned properly\n"
|
|
||||||
"%d-byte alignment required\n", STACK_ALIGN);
|
|
||||||
|
|
||||||
char *stackEnd = pStackMem + stackSize;
|
char *stackEnd = pStackMem + stackSize;
|
||||||
struct __esf *pInitCtx;
|
struct __esf *pInitCtx;
|
||||||
_new_thread_init(thread, pStackMem, stackSize, priority, options);
|
_new_thread_init(thread, pStackMem, stackSize, priority, options);
|
||||||
|
|
||||||
/* carve the thread entry struct from the "base" of the stack */
|
/* carve the thread entry struct from the "base" of the stack */
|
||||||
|
|
||||||
pInitCtx = (struct __esf *)(STACK_ROUND_DOWN(stackEnd) -
|
pInitCtx = (struct __esf *)(STACK_ROUND_DOWN(stackEnd -
|
||||||
sizeof(struct __esf));
|
sizeof(struct __esf)));
|
||||||
|
|
||||||
pInitCtx->pc = ((u32_t)_thread_entry) & 0xfffffffe;
|
pInitCtx->pc = ((u32_t)_thread_entry) & 0xfffffffe;
|
||||||
pInitCtx->a1 = (u32_t)pEntry;
|
pInitCtx->a1 = (u32_t)pEntry;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue