bl2_run_next_image.S 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2021, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch.h>
  7. #include <asm_macros.S>
  8. #include <common/bl_common.h>
  9. .globl bl2_run_next_image
  10. func bl2_run_next_image
  11. mov r8,r0
  12. /*
  13. * MMU needs to be disabled because both BL2 and BL32 execute
  14. * in PL1, and therefore share the same address space.
  15. * BL32 will initialize the address space according to its
  16. * own requirement.
  17. */
  18. bl disable_mmu_icache_secure
  19. stcopr r0, TLBIALL
  20. dsb sy
  21. isb
  22. mov r0, r8
  23. bl bl2_el3_plat_prepare_exit
  24. /*
  25. * Extract PC and SPSR based on struct `entry_point_info_t`
  26. * and load it in LR and SPSR registers respectively.
  27. */
  28. ldr lr, [r8, #ENTRY_POINT_INFO_PC_OFFSET]
  29. ldr r1, [r8, #(ENTRY_POINT_INFO_PC_OFFSET + 4)]
  30. msr spsr_xc, r1
  31. /* Some BL32 stages expect lr_svc to provide the BL33 entry address */
  32. cps #MODE32_svc
  33. ldr lr, [r8, #ENTRY_POINT_INFO_LR_SVC_OFFSET]
  34. cps #MODE32_mon
  35. add r8, r8, #ENTRY_POINT_INFO_ARGS_OFFSET
  36. ldm r8, {r0, r1, r2, r3}
  37. exception_return
  38. endfunc bl2_run_next_image