transition.S 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2013
  4. * David Feng <fenghua@phytium.com.cn>
  5. */
  6. #include <asm-offsets.h>
  7. #include <config.h>
  8. #include <linux/linkage.h>
  9. #include <asm/macro.h>
  10. .pushsection .text.armv8_switch_to_el2, "ax"
  11. ENTRY(armv8_switch_to_el2)
  12. switch_el x6, 1f, 0f, 0f
  13. 0:
  14. cmp x5, #ES_TO_AARCH64
  15. b.eq 2f
  16. /*
  17. * When loading 32-bit kernel, it will jump
  18. * to secure firmware again, and never return.
  19. */
  20. bl armv8_el2_to_aarch32
  21. 2:
  22. /*
  23. * x4 is kernel entry point or switch_to_el1
  24. * if CONFIG_ARMV8_SWITCH_TO_EL1 is defined.
  25. * When running in EL2 now, jump to the
  26. * address saved in x4.
  27. */
  28. br x4
  29. 1: armv8_switch_to_el2_m x4, x5, x6
  30. ENDPROC(armv8_switch_to_el2)
  31. .popsection
  32. .pushsection .text.armv8_switch_to_el1, "ax"
  33. ENTRY(armv8_switch_to_el1)
  34. switch_el x6, 0f, 1f, 0f
  35. 0:
  36. /* x4 is kernel entry point. When running in EL1
  37. * now, jump to the address saved in x4.
  38. */
  39. br x4
  40. 1: armv8_switch_to_el1_m x4, x5, x6
  41. ENDPROC(armv8_switch_to_el1)
  42. .popsection
  43. .pushsection .text.armv8_el2_to_aarch32, "ax"
  44. WEAK(armv8_el2_to_aarch32)
  45. ret
  46. ENDPROC(armv8_el2_to_aarch32)
  47. .popsection