setjmp.S 730 B

123456789101112131415161718192021222324252627282930313233343536
  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/assembler.h>
  7. #include <linux/linkage.h>
  8. .pushsection .text.setjmp, "ax"
  9. ENTRY(setjmp)
  10. /*
  11. * A subroutine must preserve the contents of the registers
  12. * r4-r8, r10, r11 (v1-v5, v7 and v8) and SP (and r9 in PCS
  13. * variants that designate r9 as v6).
  14. */
  15. mov ip, sp
  16. stm a1, {v1-v8, ip, lr}
  17. mov a1, #0
  18. bx lr
  19. ENDPROC(setjmp)
  20. .popsection
  21. .pushsection .text.longjmp, "ax"
  22. ENTRY(longjmp)
  23. ldm a1, {v1-v8, ip, lr}
  24. mov sp, ip
  25. mov a1, a2
  26. /* If we were passed a return value of zero, return one instead */
  27. cmp a1, #0
  28. bne 1f
  29. mov a1, #1
  30. 1:
  31. bx lr
  32. ENDPROC(longjmp)
  33. .popsection