Guarded unsafe decrements of uxTopReadyPriority and uxCurrentPriority

This commit is contained in:
Tobias Reinhard 2022-12-08 08:45:17 -05:00
parent 136b1d69b2
commit 99d46f9e51

17
tasks.c
View file

@ -1365,7 +1365,15 @@ static void prvYieldForTask( TCB_t * pxTCB,
{ {
if( xDecrementTopPriority != pdFALSE ) if( xDecrementTopPriority != pdFALSE )
{ {
#if VERIFAST
/* Reason for rewrite: Code not memory safe.
*/
if(uxTopReadyPriority > 0) {
uxTopReadyPriority--; uxTopReadyPriority--;
}
#else
uxTopReadyPriority--;
#endif /* VERIFAST */
#if ( ( configRUN_MULTIPLE_PRIORITIES == 0 ) && ( configNUM_CORES > 1 ) ) #if ( ( configRUN_MULTIPLE_PRIORITIES == 0 ) && ( configNUM_CORES > 1 ) )
{ {
xPriorityDropped = pdTRUE; xPriorityDropped = pdTRUE;
@ -1403,9 +1411,16 @@ static void prvYieldForTask( TCB_t * pxTCB,
configASSERT( ( uxCurrentPriority > tskIDLE_PRIORITY ) || ( xTaskScheduled == pdTRUE ) ); configASSERT( ( uxCurrentPriority > tskIDLE_PRIORITY ) || ( xTaskScheduled == pdTRUE ) );
#endif /* VERIFAST */ #endif /* VERIFAST */
//@ assume(uxCurrentPriority > 0);
#if VERIFAST
/* Reason for rewrite: Code not memory safe.
*/
if(uxCurrentPriority > 0) {
uxCurrentPriority--; uxCurrentPriority--;
}
#else
uxCurrentPriority--;
#endif /* VERIFAST */
// @ close xLIST(gReadyList, gSize, gIndex, gEnd, gCells, gVals, gOwners); // @ close xLIST(gReadyList, gSize, gIndex, gEnd, gCells, gVals, gOwners);
// @ assert( xLIST(gReadyList, ?gReadyListSize, _, _, gCells, gVals, gOwners) ); // @ assert( xLIST(gReadyList, ?gReadyListSize, _, _, gCells, gVals, gOwners) );