[U-Boot] [PATCH v5 3/8] ARM: add assembly routine to switch to non-secure state

Peter Maydell
2013-09-19T22:35:27Z

On 20 September 2013 06:55, Mj Embd <mj.embd@gmail.com> wrote:
> Hello Andre,
> I need a bit clarification here, if you read the next line after the line
> you have quoted. It clearly says that you can use a MCR to change from
> Secure to NS in Monitor Mode

No, it's not saying that, because Monitor mode is always Secure:
this is exactly why an MCR to change SCR.NS is OK only in
Monitor mode -- it doesn't change from Secure to Non-Secure.
Only when you do an exception-return to leave Monitor mode
will you drop into the NonSecure world.

> "Use an MCR instruction that writes SCR.NS to change from Secure to
> Non-secure state. This means ARM recommends that software does not alter
> SCR.NS in any mode except Monitor mode. ARM deprecates changing SCR.NS in
> any other mode."

The text says "don't change from Secure to NonSecure by flipping
SCR.NS". It then lays out the corollary: the only time you then can
change SCR.NS is when it won't switch from Secure to NonSecure,
which is when you're in Monitor mode.

-- PMM