summaryrefslogtreecommitdiff
path: root/bl31/bl31_main.c
diff options
context:
space:
mode:
authorZelalem Aweke <zelalem.aweke@arm.com>2022-01-31 16:59:42 -0600
committerJoanna Farley <joanna.farley@arm.com>2022-04-12 17:42:11 +0200
commit8b95e8487006ff77a7d84fba5bd20ba7e68d8330 (patch)
treed7ac71ff571d2631984c20a02daf1715190f5dfa /bl31/bl31_main.c
parentfd5da7a84731e9687f56c263ff3aa8ebed75075a (diff)
downloadarm-trusted-firmware-8b95e8487006ff77a7d84fba5bd20ba7e68d8330.tar.gz
refactor(context mgmt): add cm_prepare_el3_exit_ns function
As part of the RFC: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/13651, this patch adds the 'cm_prepare_el3_exit_ns' function. The function is a wrapper to 'cm_prepare_el3_exit' function for Non-secure state. When EL2 sysregs context exists (CTX_INCLUDE_EL2_REGS is enabled) EL1 and EL2 sysreg values are restored from the context instead of directly updating the registers. Signed-off-by: Zelalem Aweke <zelalem.aweke@arm.com> Change-Id: I9b071030576bb05500d54090e2a03b3f125d1653
Diffstat (limited to 'bl31/bl31_main.c')
-rw-r--r--bl31/bl31_main.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/bl31/bl31_main.c b/bl31/bl31_main.c
index 797093e15..2a3d838e4 100644
--- a/bl31/bl31_main.c
+++ b/bl31/bl31_main.c
@@ -259,7 +259,16 @@ void __init bl31_prepare_next_image_entry(void)
(image_type == SECURE) ? "secure" : "normal");
print_entry_point_info(next_image_info);
cm_init_my_context(next_image_info);
- cm_prepare_el3_exit(image_type);
+
+ /*
+ * If we are entering the Non-secure world, use
+ * 'cm_prepare_el3_exit_ns' to exit.
+ */
+ if (image_type == NON_SECURE) {
+ cm_prepare_el3_exit_ns();
+ } else {
+ cm_prepare_el3_exit(image_type);
+ }
}
/*******************************************************************************