This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cortex M33 Return to Non Secure Thread from Secure SVC


Is there any limitation on returning back from Secure SVC Handler mode to Non-Secure Thread Mode?

The EXC_RETURN value should be 0xFFFFFFBC (Non-Secure, PSP, Thread Mode) after the exit Secure SVC call.

void SVC_Handler(void)
    __asm volatile(
        "mov r0, lr         \n\t"       // 1st argument, EXC_RETURN
        "mov r1, sp         \n\t"       // 1st argument, MSP Value
        "BL SVCHandler      \n\t"
        "bx r0              \n\t"       // Uses return value as EXC_RETURN

Herein, I am wondering should we use BXNS at the end of the SVC Handler above?

Actually I tried both, but getting an INVPC Usage Fault for both cases.

In the following link; “the Figure 6-4 Forms of transition between Secure and Non-secure worlds” shows that a Secure Handler can return Non-Secure thread

but; there is a note in TrustedFirmware-m like (I know it is not fully related but just in case)

        /* Secure SV executing with NS return.

         * NS cannot directly trigger S SVC so this should not happen. This is

         * an unrecoverable error.