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

Context protection when calling a secure function(NSC) in a non-secure interrupt function

I want to know where the context was saved when a secure function was called in a non-secure interrupt function.

As shown in the figure, when a secure NSC function is called in a non-secure SVC interrupt service function,

the PUSH {R4-R6, LR} operation is executed. At this time, CONTROL_S==0x03, that is, the Thread/PSP state.

But the PSP_S=0X00000000, I want to know where the {R4-R6, LR}  registers are pushed into?  

By the way: the result of the program is normal.

Thank you!

Parents
  • Hi Yang,

    As per your description above, I understand that the program has successfully transitioned from non-secure state to secure state. This effectively means that there is an SG instruction at secure entry point and the branch instruction used for NSC_function1() is correctly marked as Non-Secure-Callable attribute. Hence I would assume that the instruction PUSH {r4-r6,LR} should have got executed before calling NSC_function1() branch (i.e.) in Non-Secure state. If it is executed in Non-Secure state, then CONTROL_NS/Non-Secure stack pointers come into picture.

    Hope this helps.

    Thanks,

    Uma

Reply
  • Hi Yang,

    As per your description above, I understand that the program has successfully transitioned from non-secure state to secure state. This effectively means that there is an SG instruction at secure entry point and the branch instruction used for NSC_function1() is correctly marked as Non-Secure-Callable attribute. Hence I would assume that the instruction PUSH {r4-r6,LR} should have got executed before calling NSC_function1() branch (i.e.) in Non-Secure state. If it is executed in Non-Secure state, then CONTROL_NS/Non-Secure stack pointers come into picture.

    Hope this helps.

    Thanks,

    Uma

Children