mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Fix free secure context for Cortex-M23 ports
Update the branching condition to correctly free secure context when there is one. Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
parent
faa92f7df2
commit
8341ffdc61
|
@ -448,7 +448,7 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
|
||||||
" ldr r2, [r0] \n"/* The first item in the TCB is the top of the stack. */
|
" ldr r2, [r0] \n"/* The first item in the TCB is the top of the stack. */
|
||||||
" ldr r1, [r2] \n"/* The first item on the stack is the task's xSecureContext. */
|
" ldr r1, [r2] \n"/* The first item on the stack is the task's xSecureContext. */
|
||||||
" cmp r1, #0 \n"/* Raise svc if task's xSecureContext is not NULL. */
|
" cmp r1, #0 \n"/* Raise svc if task's xSecureContext is not NULL. */
|
||||||
" beq free_secure_context \n"
|
" bne free_secure_context \n"/* Branch if r1 != 0. */
|
||||||
" bx lr \n"/* There is no secure context (xSecureContext is NULL). */
|
" bx lr \n"/* There is no secure context (xSecureContext is NULL). */
|
||||||
" free_secure_context: \n"
|
" free_secure_context: \n"
|
||||||
" svc %0 \n"/* Secure context is freed in the supervisor call. */
|
" svc %0 \n"/* Secure context is freed in the supervisor call. */
|
||||||
|
|
|
@ -380,7 +380,7 @@ vPortFreeSecureContext:
|
||||||
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
|
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
|
||||||
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
|
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
|
||||||
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
|
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
|
||||||
beq free_secure_context
|
bne free_secure_context /* Branch if r1 != 0. */
|
||||||
bx lr /* There is no secure context (xSecureContext is NULL). */
|
bx lr /* There is no secure context (xSecureContext is NULL). */
|
||||||
free_secure_context:
|
free_secure_context:
|
||||||
svc 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */
|
svc 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */
|
||||||
|
|
|
@ -448,7 +448,7 @@ void vPortFreeSecureContext( uint32_t * pulTCB ) /* __attribute__ (( naked )) PR
|
||||||
" ldr r2, [r0] \n"/* The first item in the TCB is the top of the stack. */
|
" ldr r2, [r0] \n"/* The first item in the TCB is the top of the stack. */
|
||||||
" ldr r1, [r2] \n"/* The first item on the stack is the task's xSecureContext. */
|
" ldr r1, [r2] \n"/* The first item on the stack is the task's xSecureContext. */
|
||||||
" cmp r1, #0 \n"/* Raise svc if task's xSecureContext is not NULL. */
|
" cmp r1, #0 \n"/* Raise svc if task's xSecureContext is not NULL. */
|
||||||
" beq free_secure_context \n"
|
" bne free_secure_context \n"/* Branch if r1 != 0. */
|
||||||
" bx lr \n"/* There is no secure context (xSecureContext is NULL). */
|
" bx lr \n"/* There is no secure context (xSecureContext is NULL). */
|
||||||
" free_secure_context: \n"
|
" free_secure_context: \n"
|
||||||
" svc %0 \n"/* Secure context is freed in the supervisor call. */
|
" svc %0 \n"/* Secure context is freed in the supervisor call. */
|
||||||
|
|
|
@ -380,7 +380,7 @@ vPortFreeSecureContext:
|
||||||
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
|
ldr r2, [r0] /* The first item in the TCB is the top of the stack. */
|
||||||
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
|
ldr r1, [r2] /* The first item on the stack is the task's xSecureContext. */
|
||||||
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
|
cmp r1, #0 /* Raise svc if task's xSecureContext is not NULL. */
|
||||||
beq free_secure_context
|
bne free_secure_context /* Branch if r1 != 0. */
|
||||||
bx lr /* There is no secure context (xSecureContext is NULL). */
|
bx lr /* There is no secure context (xSecureContext is NULL). */
|
||||||
free_secure_context:
|
free_secure_context:
|
||||||
svc 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */
|
svc 1 /* Secure context is freed in the supervisor call. portSVC_FREE_SECURE_CONTEXT = 1. */
|
||||||
|
|
9
tasks.c
9
tasks.c
|
@ -1216,7 +1216,6 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
||||||
{
|
{
|
||||||
--uxCurrentNumberOfTasks;
|
--uxCurrentNumberOfTasks;
|
||||||
traceTASK_DELETE( pxTCB );
|
traceTASK_DELETE( pxTCB );
|
||||||
prvDeleteTCB( pxTCB );
|
|
||||||
|
|
||||||
/* Reset the next expected unblock time in case it referred to
|
/* Reset the next expected unblock time in case it referred to
|
||||||
* the task that has just been deleted. */
|
* the task that has just been deleted. */
|
||||||
|
@ -1225,6 +1224,14 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
||||||
}
|
}
|
||||||
taskEXIT_CRITICAL();
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
|
/* If the task is not deleting itself, call prvDeleteTCB from outside of
|
||||||
|
* critical section. If a task deletes itself, prvDeleteTCB is called
|
||||||
|
* from prvCheckTasksWaitingTermination which is called from Idle task. */
|
||||||
|
if( pxTCB != pxCurrentTCB )
|
||||||
|
{
|
||||||
|
prvDeleteTCB( pxTCB );
|
||||||
|
}
|
||||||
|
|
||||||
/* Force a reschedule if it is the currently running task that has just
|
/* Force a reschedule if it is the currently running task that has just
|
||||||
* been deleted. */
|
* been deleted. */
|
||||||
if( xSchedulerRunning != pdFALSE )
|
if( xSchedulerRunning != pdFALSE )
|
||||||
|
|
Loading…
Reference in a new issue