summaryrefslogtreecommitdiff
path: root/bl1/aarch64
diff options
context:
space:
mode:
authorJohn Tsichritzis <john.tsichritzis@arm.com>2019-07-01 14:27:33 +0100
committerJohn Tsichritzis <john.tsichritzis@arm.com>2019-07-24 12:49:54 +0100
commitd200f2306463b28fc2650939ac9bcc0d701fa2d5 (patch)
treee97a9a3c3f6a9139b96675835750a231311638a2 /bl1/aarch64
parentc250cc3b1be497c4262e781df4e55c9ecf18bbd1 (diff)
Refactor SPSR initialisation code
Change-Id: Ic3b30de13e314efca30fc71370227d3e76f1148b Signed-off-by: John Tsichritzis <john.tsichritzis@arm.com>
Diffstat (limited to 'bl1/aarch64')
-rw-r--r--bl1/aarch64/bl1_context_mgmt.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/bl1/aarch64/bl1_context_mgmt.c b/bl1/aarch64/bl1_context_mgmt.c
index 03263190..8be8830a 100644
--- a/bl1/aarch64/bl1_context_mgmt.c
+++ b/bl1/aarch64/bl1_context_mgmt.c
@@ -42,7 +42,7 @@ void cm_set_context(void *context, uint32_t security_state)
******************************************************************************/
void bl1_prepare_next_image(unsigned int image_id)
{
- unsigned int security_state;
+ unsigned int security_state, mode = MODE_EL1;
image_desc_t *image_desc;
entry_point_info_t *next_bl_ep;
@@ -73,20 +73,13 @@ void bl1_prepare_next_image(unsigned int image_id)
cm_set_context(&bl1_cpu_context[security_state], security_state);
/* Prepare the SPSR for the next BL image. */
- if (security_state == SECURE) {
- next_bl_ep->spsr = SPSR_64(MODE_EL1, MODE_SP_ELX,
- DISABLE_ALL_EXCEPTIONS);
- } else {
- /* Use EL2 if supported; else use EL1. */
- if (el_implemented(2) != EL_IMPL_NONE) {
- next_bl_ep->spsr = SPSR_64(MODE_EL2, MODE_SP_ELX,
- DISABLE_ALL_EXCEPTIONS);
- } else {
- next_bl_ep->spsr = SPSR_64(MODE_EL1, MODE_SP_ELX,
- DISABLE_ALL_EXCEPTIONS);
- }
+ if ((security_state != SECURE) && (el_implemented(2) != EL_IMPL_NONE)) {
+ mode = MODE_EL2;
}
+ next_bl_ep->spsr = SPSR_64(mode, MODE_SP_ELX,
+ DISABLE_ALL_EXCEPTIONS);
+
/* Allow platform to make change */
bl1_plat_set_ep_info(image_id, next_bl_ep);