transition.S 959 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * (C) Copyright 2013
  3. * David Feng <fenghua@phytium.com.cn>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <asm-offsets.h>
  8. #include <config.h>
  9. #include <linux/linkage.h>
  10. #include <asm/macro.h>
  11. ENTRY(armv8_switch_to_el2)
  12. switch_el x5, 1f, 0f, 0f
  13. 0:
  14. cmp x4, #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. * x3 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 x3.
  27. */
  28. br x3
  29. 1: armv8_switch_to_el2_m x3, x4, x5
  30. ENDPROC(armv8_switch_to_el2)
  31. ENTRY(armv8_switch_to_el1)
  32. switch_el x5, 0f, 1f, 0f
  33. 0:
  34. /* x3 is kernel entry point. When running in EL1
  35. * now, jump to the address saved in x3.
  36. */
  37. br x3
  38. 1: armv8_switch_to_el1_m x3, x4, x5
  39. ENDPROC(armv8_switch_to_el1)
  40. WEAK(armv8_el2_to_aarch32)
  41. ret
  42. ENDPROC(armv8_el2_to_aarch32)