trusty-fiq-arm64-glue.S 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (C) 2013 Google, Inc.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. */
  14. #include <asm/asm-offsets.h>
  15. #include <asm/ptrace.h>
  16. #include <linux/linkage.h>
  17. #include <linux/trusty/smcall.h>
  18. .macro push reg1,reg2,remregs:vararg
  19. .ifnb \remregs
  20. push \remregs
  21. .endif
  22. stp \reg1, \reg2, [sp, #-16]!
  23. .endm
  24. .macro pop reg1,reg2,remregs:vararg
  25. ldp \reg1, \reg2, [sp], #16
  26. .ifnb \remregs
  27. pop \remregs
  28. .endif
  29. .endm
  30. ENTRY(trusty_fiq_glue_arm64)
  31. sub sp, sp, #S_FRAME_SIZE - S_LR
  32. push x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, \
  33. x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, \
  34. x26, x27, x28, x29
  35. ldr x0, =SMC_FC64_GET_FIQ_REGS
  36. smc #0
  37. stp x0, x1, [sp, #S_PC] /* original pc, cpsr */
  38. tst x1, PSR_MODE_MASK
  39. csel x2, x2, x3, eq /* sp el0, sp el1 */
  40. stp x30, x2, [sp, #S_LR] /* lr, original sp */
  41. mov x0, sp
  42. mov x1, x3
  43. bl trusty_fiq_handler
  44. pop x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, \
  45. x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, \
  46. x26, x27, x28, x29
  47. ldr x30, [sp], #S_FRAME_SIZE - S_LR /* load LR and restore SP */
  48. ldr x0, =SMC_FC_FIQ_EXIT
  49. smc #0
  50. b . /* should not get here */