Arm® TrustZone Technology for the Armv8-M Architecture mentioned:
In a simplified view, the program address determines the security state of the processor, which can be either Secure or Non-secure.• If the processor is running program code in Non-secure memory, the processor is in Non-secure state.• If the processor is running program code in Secure memory, the processor is in Secure state.• If the processor is in Secure state, it must fetch instructions from Secure memory.
Is there a system register indicating the security state of the core?
AFAIK, in non-secure state you cannot check the state w/o excpetion.
Chapter B3.7 in DDI0553B_f leads to this:
For privileged software to determine if it is in Secure state - Just use the Non-secure alias of CPUID:
Secure software can access the Non-secure version of this register via CPUID_NS located at 0xE002ED00.The location 0xE002ED00 is RES0 to software executing in Non-secure state and the debugger.
It's validated on FVP. Thanks, Joseph.