trusty_helpers.S 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <asm_macros.S>
  7. .macro push ra, rb, sp=sp
  8. stp \ra, \rb, [\sp,#-16]!
  9. .endm
  10. .macro pop ra, rb, sp=sp
  11. ldp \ra, \rb, [\sp], #16
  12. .endm
  13. .global trusty_context_switch_helper
  14. func trusty_context_switch_helper
  15. push x8, xzr
  16. push x19, x20
  17. push x21, x22
  18. push x23, x24
  19. push x25, x26
  20. push x27, x28
  21. push x29, x30
  22. mov x9, sp
  23. ldr x10, [x0]
  24. mov sp, x10
  25. str x9, [x0]
  26. pop x29, x30
  27. pop x27, x28
  28. pop x25, x26
  29. pop x23, x24
  30. pop x21, x22
  31. pop x19, x20
  32. pop x8, xzr
  33. ldr x2, [x1]
  34. ldr x3, [x1, #0x08]
  35. ldr x4, [x1, #0x10]
  36. ldr x5, [x1, #0x18]
  37. ldr x6, [x1, #0x20]
  38. ldr x7, [x1, #0x28]
  39. ldr x10, [x1, #0x30]
  40. ldr x11, [x1, #0x38]
  41. stp x2, x3, [x8]
  42. stp x4, x5, [x8, #16]
  43. stp x6, x7, [x8, #32]
  44. stp x10, x11, [x8, #48]
  45. ret
  46. endfunc trusty_context_switch_helper
  47. .global trusty_init_context_stack
  48. func trusty_init_context_stack
  49. push x8, xzr, x1
  50. push xzr, xzr, x1
  51. push xzr, xzr, x1
  52. push xzr, xzr, x1
  53. push xzr, xzr, x1
  54. push xzr, xzr, x1
  55. adr x9, el3_exit
  56. push xzr, x9, x1
  57. str x1, [x0]
  58. ret
  59. endfunc trusty_init_context_stack