call_with_stack.S 499 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * arch/arm64/lib/call_with_stack.S
  3. *
  4. */
  5. #include <linux/linkage.h>
  6. #include <asm/assembler.h>
  7. /*
  8. * void call_with_stack(void (*fn)(void *), void *arg, void *sp)
  9. *
  10. * Change the stack to that pointed at by sp, then invoke fn(arg) with
  11. * the new stack.
  12. */
  13. ENTRY(call_with_stack)
  14. mov x3, sp
  15. str x3, [x2, #-8]!
  16. str lr, [x2, #-8]!
  17. mov sp, x2
  18. mov x2, x0
  19. mov x0, x1
  20. adr lr, 1f
  21. br x2
  22. 1: ldr lr, [sp]
  23. ldr x3, [sp, #8]
  24. mov sp, x3
  25. br lr
  26. ENDPROC(call_with_stack)