Commit 3fe81dcf authored by Etienne Carriere's avatar Etienne Carriere
Browse files

aarch32: use lr as bl32 boot argument on aarch32 only systems



Add 'lr_svc' as a boot parameter in AArch32 bl1. This is used by Optee
and Trusty to get the non-secure entry point on AArch32 platforms.

This change is not ported in AArch64 mode where the BL31, not BL32,
is in charge of booting the non secure image (BL33).
Signed-off-by: default avatarEtienne Carriere <etienne.carriere@linaro.org>
parent 956defc7
...@@ -73,6 +73,11 @@ debug_loop: ...@@ -73,6 +73,11 @@ debug_loop:
ldr r1, [r8, #(ENTRY_POINT_INFO_PC_OFFSET + 4)] ldr r1, [r8, #(ENTRY_POINT_INFO_PC_OFFSET + 4)]
msr spsr, r1 msr spsr, r1
/* Some BL32 stages expect lr_svc to provide the BL33 entry address */
cps #MODE32_svc
ldr lr, [r8, #ENTRY_POINT_INFO_LR_SVC_OFFSET]
cps #MODE32_mon
add r8, r8, #ENTRY_POINT_INFO_ARGS_OFFSET add r8, r8, #ENTRY_POINT_INFO_ARGS_OFFSET
ldm r8, {r0, r1, r2, r3} ldm r8, {r0, r1, r2, r3}
eret eret
......
...@@ -20,7 +20,8 @@ ...@@ -20,7 +20,8 @@
******************************************************************************/ ******************************************************************************/
#define ENTRY_POINT_INFO_PC_OFFSET U(0x08) #define ENTRY_POINT_INFO_PC_OFFSET U(0x08)
#ifdef AARCH32 #ifdef AARCH32
#define ENTRY_POINT_INFO_ARGS_OFFSET U(0x10) #define ENTRY_POINT_INFO_LR_SVC_OFFSET U(0x10)
#define ENTRY_POINT_INFO_ARGS_OFFSET U(0x14)
#else #else
#define ENTRY_POINT_INFO_ARGS_OFFSET U(0x18) #define ENTRY_POINT_INFO_ARGS_OFFSET U(0x18)
#endif #endif
...@@ -93,6 +94,7 @@ typedef struct entry_point_info { ...@@ -93,6 +94,7 @@ typedef struct entry_point_info {
uintptr_t pc; uintptr_t pc;
uint32_t spsr; uint32_t spsr;
#ifdef AARCH32 #ifdef AARCH32
uintptr_t lr_svc;
aapcs32_params_t args; aapcs32_params_t args;
#else #else
aapcs64_params_t args; aapcs64_params_t args;
...@@ -108,6 +110,12 @@ CASSERT(ENTRY_POINT_INFO_PC_OFFSET == ...@@ -108,6 +110,12 @@ CASSERT(ENTRY_POINT_INFO_PC_OFFSET ==
__builtin_offsetof(entry_point_info_t, pc), \ __builtin_offsetof(entry_point_info_t, pc), \
assert_BL31_pc_offset_mismatch); assert_BL31_pc_offset_mismatch);
#ifdef AARCH32
CASSERT(ENTRY_POINT_INFO_LR_SVC_OFFSET ==
__builtin_offsetof(entry_point_info_t, lr_svc),
assert_entrypoint_lr_offset_error);
#endif
CASSERT(ENTRY_POINT_INFO_ARGS_OFFSET == \ CASSERT(ENTRY_POINT_INFO_ARGS_OFFSET == \
__builtin_offsetof(entry_point_info_t, args), \ __builtin_offsetof(entry_point_info_t, args), \
assert_BL31_args_offset_mismatch); assert_BL31_args_offset_mismatch);
......
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