Commit 6b704da3 authored by Ruari Phipps's avatar Ruari Phipps
Browse files

SPM: Change condition on saving/restoring EL2 registers



Make this more scalable by explicitly checking internal and hardware
states at run_time
Signed-off-by: default avatarRuari Phipps <ruari.phipps@arm.com>
Change-Id: I1c6ed1c1badb3538a93bff3ac5b5189b59cccfa1
parent 572dea85
......@@ -585,7 +585,7 @@ void cm_el2_sysregs_context_save(uint32_t security_state)
* S-EL2 context if S-EL2 is enabled.
*/
if ((security_state == NON_SECURE) ||
((scr_el3 & SCR_EEL2_BIT) != 0U)) {
((security_state == SECURE) && ((scr_el3 & SCR_EEL2_BIT) != 0U))) {
cpu_context_t *ctx;
ctx = cm_get_context(security_state);
......@@ -607,7 +607,7 @@ void cm_el2_sysregs_context_restore(uint32_t security_state)
* S-EL2 context if S-EL2 is enabled.
*/
if ((security_state == NON_SECURE) ||
((scr_el3 & SCR_EEL2_BIT) != 0U)) {
((security_state == SECURE) && ((scr_el3 & SCR_EEL2_BIT) != 0U))) {
cpu_context_t *ctx;
ctx = cm_get_context(security_state);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment