diff --git a/arch/xtensa/core/thread.c b/arch/xtensa/core/thread.c index eac97bc9f41..f48a9d8c10d 100644 --- a/arch/xtensa/core/thread.c +++ b/arch/xtensa/core/thread.c @@ -82,8 +82,7 @@ void _new_thread(char *pStack, size_t stackSize, int prio, unsigned int options) { /* Align stack end to maximum alignment requirement. */ - char *stackEnd = (char *)ROUND_DOWN(pStack + stackSize, - (XCHAL_TOTAL_SA_ALIGN < 16 ? 16 : XCHAL_TOTAL_SA_ALIGN)); + char *stackEnd = (char *)ROUND_DOWN(pStack + stackSize, 16); /* k_thread is located at top of stack while frames are located at end * of it */ @@ -101,7 +100,6 @@ void _new_thread(char *pStack, size_t stackSize, #endif #if XCHAL_CP_NUM > 0 /* Coprocessor's stack is allocated just after the k_thread */ - thread->arch.preempCoprocReg.cpStack = pStack + sizeof(struct k_thread); cpSA = (uint32_t *)(thread->arch.preempCoprocReg.cpStack + XT_CP_ASA); /* Coprocessor's save area alignment is at leat 16 bytes */ *cpSA = ROUND_UP(cpSA + 1, diff --git a/arch/xtensa/include/kernel_arch_data.h b/arch/xtensa/include/kernel_arch_data.h index 87d9539e7e8..4c2eb884ac9 100644 --- a/arch/xtensa/include/kernel_arch_data.h +++ b/arch/xtensa/include/kernel_arch_data.h @@ -103,19 +103,18 @@ typedef struct s_coopCoprocReg { } tCoopCoprocReg; /* - * The following structure defines the set of 'volatile' x87 FPU/MMX/SSE - * registers. These registers need not be preserved by a called C function. + * The following structure defines the set of 'volatile' coprocessor + * registers. These registers need not be preserved by a called C function. * Given that they are not preserved across function calls, they must be * save/restored (along with s_coopCoprocReg) when a preemptive context switch * occurs. */ typedef struct s_preempCoprocReg { /* - * This structure intentionally left blank, as for now coprocessor's - * stack is positioned at top of the stack. + * This structure reserves coprocessor control and save area memory. */ #if XCHAL_CP_NUM > 0 - char *cpStack; + char __aligned(4) cpStack[XT_CP_SIZE]; #endif } tPreempCoprocReg;