\r
secureportNON_SECURE_CALLABLE void SecureContext_LoadContext( SecureContextHandle_t xSecureContextHandle )\r
{\r
- /* xSecureContextHandle value is in r0. */\r
- __asm volatile\r
- (\r
- " .syntax unified \n"\r
- " \n"\r
- " mrs r1, ipsr \n" /* r1 = IPSR. */\r
- " cbz r1, load_ctx_therad_mode \n" /* Do nothing if the processor is running in the Thread Mode. */\r
- " ldmia r0!, {r1, r2} \n" /* r1 = xSecureContextHandle->pucCurrentStackPointer, r2 = xSecureContextHandle->pucStackLimit. */\r
- #if( configENABLE_MPU == 1 )\r
- " ldmia r1!, {r3} \n" /* Read CONTROL register value from task's stack. r3 = CONTROL. */\r
- " msr control, r3 \n" /* CONTROL = r3. */\r
- #endif /* configENABLE_MPU */\r
- " msr psplim, r2 \n" /* PSPLIM = r2. */\r
- " msr psp, r1 \n" /* PSP = r1. */\r
- " \n"\r
- " load_ctx_therad_mode: \n"\r
- " nop \n"\r
- " \n"\r
- :::"r0", "r1", "r2"\r
- );\r
+ /* xSecureContextHandle value is in r0. */\r
+ __asm volatile\r
+ (\r
+ " .syntax unified \n"\r
+ " \n"\r
+ " mrs r1, ipsr \n" /* r1 = IPSR. */\r
+ " cbz r1, load_ctx_therad_mode \n" /* Do nothing if the processor is running in the Thread Mode. */\r
+ " ldmia r0!, {r1, r2} \n" /* r1 = xSecureContextHandle->pucCurrentStackPointer, r2 = xSecureContextHandle->pucStackLimit. */\r
+ #if( configENABLE_MPU == 1 )\r
+ " ldmia r1!, {r3} \n" /* Read CONTROL register value from task's stack. r3 = CONTROL. */\r
+ " msr control, r3 \n" /* CONTROL = r3. */\r
+ #endif /* configENABLE_MPU */\r
+ " msr psplim, r2 \n" /* PSPLIM = r2. */\r
+ " msr psp, r1 \n" /* PSP = r1. */\r
+ " \n"\r
+ " load_ctx_therad_mode: \n"\r
+ " nop \n"\r
+ " \n"\r
+ :::"r0", "r1", "r2"\r
+ );\r
}\r
/*-----------------------------------------------------------*/\r
\r
secureportNON_SECURE_CALLABLE void SecureContext_SaveContext( SecureContextHandle_t xSecureContextHandle )\r
{\r
- /* xSecureContextHandle value is in r0. */\r
- __asm volatile\r
- (\r
- " .syntax unified \n"\r
- " \n"\r
- " mrs r1, ipsr \n" /* r1 = IPSR. */\r
- " cbz r1, save_ctx_therad_mode \n" /* Do nothing if the processor is running in the Thread Mode. */\r
- " mrs r1, psp \n" /* r1 = PSP. */\r
- #if( configENABLE_FPU == 1 )\r
- " vstmdb r1!, {s0} \n" /* Trigger the defferred stacking of FPU registers. */\r
- " vldmia r1!, {s0} \n" /* Nullify the effect of the pervious statement. */\r
- #endif /* configENABLE_FPU */\r
- #if( configENABLE_MPU == 1 )\r
- " mrs r2, control \n" /* r2 = CONTROL. */\r
- " stmdb r1!, {r2} \n" /* Store CONTROL value on the stack. */\r
- #endif /* configENABLE_MPU */\r
- " str r1, [r0] \n" /* Save the top of stack in context. xSecureContextHandle->pucCurrentStackPointer = r1. */\r
- " movs r1, %0 \n" /* r1 = securecontextNO_STACK. */\r
- " msr psplim, r1 \n" /* PSPLIM = securecontextNO_STACK. */\r
- " msr psp, r1 \n" /* PSP = securecontextNO_STACK i.e. No stack for thread mode until next task's context is loaded. */\r
- " \n"\r
- " save_ctx_therad_mode: \n"\r
- " nop \n"\r
- " \n"\r
- :: "i" ( securecontextNO_STACK ) : "r1", "memory"\r
- );\r
+ /* xSecureContextHandle value is in r0. */\r
+ __asm volatile\r
+ (\r
+ " .syntax unified \n"\r
+ " \n"\r
+ " mrs r1, ipsr \n" /* r1 = IPSR. */\r
+ " cbz r1, save_ctx_therad_mode \n" /* Do nothing if the processor is running in the Thread Mode. */\r
+ " mrs r1, psp \n" /* r1 = PSP. */\r
+ #if( configENABLE_FPU == 1 )\r
+ " vstmdb r1!, {s0} \n" /* Trigger the defferred stacking of FPU registers. */\r
+ " vldmia r1!, {s0} \n" /* Nullify the effect of the pervious statement. */\r
+ #endif /* configENABLE_FPU */\r
+ #if( configENABLE_MPU == 1 )\r
+ " mrs r2, control \n" /* r2 = CONTROL. */\r
+ " stmdb r1!, {r2} \n" /* Store CONTROL value on the stack. */\r
+ #endif /* configENABLE_MPU */\r
+ " str r1, [r0] \n" /* Save the top of stack in context. xSecureContextHandle->pucCurrentStackPointer = r1. */\r
+ " movs r1, %0 \n" /* r1 = securecontextNO_STACK. */\r
+ " msr psplim, r1 \n" /* PSPLIM = securecontextNO_STACK. */\r
+ " msr psp, r1 \n" /* PSP = securecontextNO_STACK i.e. No stack for thread mode until next task's context is loaded. */\r
+ " \n"\r
+ " save_ctx_therad_mode: \n"\r
+ " nop \n"\r
+ " \n"\r
+ :: "i" ( securecontextNO_STACK ) : "r1", "memory"\r
+ );\r
}\r
/*-----------------------------------------------------------*/\r