Xtensa port: Moved coporcessor context area inside struct _k_thread
The CP context area was before on the bottom of the stack just after the thread descriptor. Now it is moved inside the thread descriptor to support some kind of memory protection. Change-Id: Id3ebeaecfd9c2475899713fdc8da583a1f9121f9 Signed-off-by: Mazen NEIFER <mazen@nestwave.com>
This commit is contained in:
parent
bf382a59e0
commit
cc8ffbdb44
2 changed files with 5 additions and 8 deletions
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue