setjmp_aarch64.S 874 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) 2017 Theobroma Systems Design und Consulting GmbH
  4. */
  5. #include <config.h>
  6. #include <asm/macro.h>
  7. #include <linux/linkage.h>
  8. .pushsection .text.setjmp, "ax"
  9. ENTRY(setjmp)
  10. /* Preserve all callee-saved registers and the SP */
  11. stp x19, x20, [x0,#0]
  12. stp x21, x22, [x0,#16]
  13. stp x23, x24, [x0,#32]
  14. stp x25, x26, [x0,#48]
  15. stp x27, x28, [x0,#64]
  16. stp x29, x30, [x0,#80]
  17. mov x2, sp
  18. str x2, [x0, #96]
  19. mov x0, #0
  20. ret
  21. ENDPROC(setjmp)
  22. .popsection
  23. .pushsection .text.longjmp, "ax"
  24. ENTRY(longjmp)
  25. ldp x19, x20, [x0,#0]
  26. ldp x21, x22, [x0,#16]
  27. ldp x23, x24, [x0,#32]
  28. ldp x25, x26, [x0,#48]
  29. ldp x27, x28, [x0,#64]
  30. ldp x29, x30, [x0,#80]
  31. ldr x2, [x0,#96]
  32. mov sp, x2
  33. /* Move the return value in place, but return 1 if passed 0. */
  34. adds x0, xzr, x1
  35. csinc x0, x0, xzr, ne
  36. ret
  37. ENDPROC(longjmp)
  38. .popsection