File tree Expand file tree Collapse file tree 8 files changed +40
-36
lines changed Expand file tree Collapse file tree 8 files changed +40
-36
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,11 @@ BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) );
185
185
*/
186
186
void vResetPrivilege ( void ) __attribute__( ( naked ) );
187
187
188
+ /**
189
+ * @brief Make a task unprivileged.
190
+ */
191
+ void vPortSwitchToUserMode ( void );
192
+
188
193
/**
189
194
* @brief Enter critical section.
190
195
*/
@@ -1211,16 +1216,13 @@ void vResetPrivilege( void ) /* __attribute__ (( naked )) */
1211
1216
1212
1217
void vPortSwitchToUserMode ( void )
1213
1218
{
1214
- /* Load the current task's MPU settings from its TCB */
1219
+ /* Load the current task's MPU settings from its TCB. */
1215
1220
xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings ( NULL );
1216
1221
1217
- /* Determine if the task that is running is marked as privileged or not */
1218
- if ( ( xTaskMpuSettings -> ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1219
- {
1220
- xTaskMpuSettings -> ulTaskFlags &= ( ~( portTASK_IS_PRIVILEGED_FLAG ) );
1221
- }
1222
+ /* Mark the task as unprivileged. */
1223
+ xTaskMpuSettings -> ulTaskFlags &= ( ~( portTASK_IS_PRIVILEGED_FLAG ) );
1222
1224
1223
- /* Set the privilege bit of the processor low */
1225
+ /* Lower the processor's privilege level. */
1224
1226
vResetPrivilege ();
1225
1227
}
1226
1228
/*-----------------------------------------------------------*/
Original file line number Diff line number Diff line change @@ -288,8 +288,7 @@ extern void vPortSwitchToUserMode( void );
288
288
#define portRESET_PRIVILEGE () vResetPrivilege()
289
289
290
290
/**
291
- * @brief Mark the ulTaskFlags in the task's TCB as unprivileged. Then use
292
- * vResetPrivilege() to lower the processor's privilege bit.
291
+ * @brief Make a task unprivileged.
293
292
*/
294
293
#define portSWITCH_TO_USER_MODE () vPortSwitchToUserMode()
295
294
/*-----------------------------------------------------------*/
Original file line number Diff line number Diff line change @@ -206,6 +206,11 @@ BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) );
206
206
*/
207
207
void vResetPrivilege ( void ) __attribute__( ( naked ) );
208
208
209
+ /**
210
+ * @brief Make a task unprivileged.
211
+ */
212
+ void vPortSwitchToUserMode ( void );
213
+
209
214
/**
210
215
* @brief Enter critical section.
211
216
*/
@@ -1392,16 +1397,13 @@ void vResetPrivilege( void ) /* __attribute__ (( naked )) */
1392
1397
1393
1398
void vPortSwitchToUserMode ( void )
1394
1399
{
1395
- /* Load the current task's MPU settings from its TCB */
1400
+ /* Load the current task's MPU settings from its TCB. */
1396
1401
xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings ( NULL );
1397
1402
1398
- /* Determine if the task that is running is marked as privileged or not */
1399
- if ( ( xTaskMpuSettings -> ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1400
- {
1401
- xTaskMpuSettings -> ulTaskFlags &= ( ~( portTASK_IS_PRIVILEGED_FLAG ) );
1402
- }
1403
+ /* Mark the task as unprivileged. */
1404
+ xTaskMpuSettings -> ulTaskFlags &= ( ~( portTASK_IS_PRIVILEGED_FLAG ) );
1403
1405
1404
- /* Set the privilege bit of the processor low */
1406
+ /* Lower the processor's privilege level. */
1405
1407
vResetPrivilege ();
1406
1408
}
1407
1409
/*-----------------------------------------------------------*/
Original file line number Diff line number Diff line change @@ -382,8 +382,7 @@ extern void vPortSwitchToUserMode( void );
382
382
#define portRESET_PRIVILEGE () vResetPrivilege()
383
383
384
384
/**
385
- * @brief Mark the ulTaskFlags in the task's TCB as unprivileged. Then use
386
- * vResetPrivilege() to lower the processor's privilege bit.
385
+ * @brief Make a task unprivileged.
387
386
*/
388
387
#define portSWITCH_TO_USER_MODE () vPortSwitchToUserMode()
389
388
/*-----------------------------------------------------------*/
Original file line number Diff line number Diff line change @@ -283,6 +283,11 @@ extern void vPortRestoreContextOfFirstTask( void ) PRIVILEGED_FUNCTION;
283
283
*/
284
284
BaseType_t xPortIsTaskPrivileged ( void ) PRIVILEGED_FUNCTION ;
285
285
286
+ /**
287
+ * @brief Make a task unprivileged.
288
+ */
289
+ void vPortSwitchToUserMode ( void );
290
+
286
291
/*-----------------------------------------------------------*/
287
292
288
293
/* Each task maintains its own interrupt status in the critical nesting
@@ -743,16 +748,13 @@ BaseType_t xPortIsTaskPrivileged( void ) /* PRIVILEGED_FUNCTION */
743
748
744
749
void vPortSwitchToUserMode ( void )
745
750
{
746
- /* Load the current task's MPU settings from its TCB */
751
+ /* Load the current task's MPU settings from its TCB. */
747
752
xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings ( NULL );
748
753
749
- /* Determine if the task that is running is marked as privileged or not */
750
- if ( ( xTaskMpuSettings -> ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
751
- {
752
- xTaskMpuSettings -> ulTaskFlags &= ( ~( portTASK_IS_PRIVILEGED_FLAG ) );
753
- }
754
+ /* Mark the task as unprivileged. */
755
+ xTaskMpuSettings -> ulTaskFlags &= ( ~( portTASK_IS_PRIVILEGED_FLAG ) );
754
756
755
- /* Set the privilege bit of the processor low */
757
+ /* Lower the processor's privilege level. */
756
758
vResetPrivilege ();
757
759
}
758
760
/*-----------------------------------------------------------*/
Original file line number Diff line number Diff line change @@ -410,8 +410,7 @@ extern void vPortSwitchToUserMode( void );
410
410
#define portRESET_PRIVILEGE () vResetPrivilege()
411
411
412
412
/**
413
- * @brief Mark the ulTaskFlags in the task's TCB as unprivileged. Then use
414
- * vResetPrivilege() to lower the processor's privilege bit.
413
+ * @brief Make a task unprivileged.
415
414
*/
416
415
#define portSWITCH_TO_USER_MODE () vPortSwitchToUserMode()
417
416
/*-----------------------------------------------------------*/
Original file line number Diff line number Diff line change @@ -219,6 +219,11 @@ BaseType_t xIsPrivileged( void );
219
219
*/
220
220
void vResetPrivilege ( void );
221
221
222
+ /**
223
+ * @brief Make a task unprivileged.
224
+ */
225
+ void vPortSwitchToUserMode ( void );
226
+
222
227
/**
223
228
* @brief Enter critical section.
224
229
*/
@@ -1360,16 +1365,13 @@ __asm void vResetPrivilege( void )
1360
1365
1361
1366
void vPortSwitchToUserMode ( void )
1362
1367
{
1363
- /* Load the current task's MPU settings from its TCB */
1368
+ /* Load the current task's MPU settings from its TCB. */
1364
1369
xMPU_SETTINGS * xTaskMpuSettings = xTaskGetMPUSettings ( NULL );
1365
1370
1366
- /* Determine if the task that is running is marked as privileged or not */
1367
- if ( ( xTaskMpuSettings -> ulTaskFlags & portTASK_IS_PRIVILEGED_FLAG ) == portTASK_IS_PRIVILEGED_FLAG )
1368
- {
1369
- xTaskMpuSettings -> ulTaskFlags &= ( ~( portTASK_IS_PRIVILEGED_FLAG ) );
1370
- }
1371
+ /* Mark the task as unprivileged. */
1372
+ xTaskMpuSettings -> ulTaskFlags &= ( ~( portTASK_IS_PRIVILEGED_FLAG ) );
1371
1373
1372
- /* Set the privilege bit of the processor low */
1374
+ /* Lower the processor's privilege level. */
1373
1375
vResetPrivilege ();
1374
1376
}
1375
1377
/*-----------------------------------------------------------*/
Original file line number Diff line number Diff line change @@ -375,8 +375,7 @@ extern void vPortSwitchToUserMode( void );
375
375
#define portRESET_PRIVILEGE () vResetPrivilege()
376
376
377
377
/**
378
- * @brief Mark the ulTaskFlags in the task's TCB as unprivileged. Then use
379
- * vResetPrivilege() to lower the processor's privilege bit.
378
+ * @brief Make a task unprivileged.
380
379
*/
381
380
#define portSWITCH_TO_USER_MODE () vPortSwitchToUserMode()
382
381
/*-----------------------------------------------------------*/
You can’t perform that action at this time.
0 commit comments