setjmp.S 730 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * (C) 2017 Theobroma Systems Design und Consulting GmbH
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <config.h>
  7. #include <asm/assembler.h>
  8. #include <linux/linkage.h>
  9. .pushsection .text.setjmp, "ax"
  10. ENTRY(setjmp)
  11. /*
  12. * A subroutine must preserve the contents of the registers
  13. * r4-r8, r10, r11 (v1-v5, v7 and v8) and SP (and r9 in PCS
  14. * variants that designate r9 as v6).
  15. */
  16. mov ip, sp
  17. stm a1, {v1-v8, ip, lr}
  18. mov a1, #0
  19. bx lr
  20. ENDPROC(setjmp)
  21. .popsection
  22. .pushsection .text.longjmp, "ax"
  23. ENTRY(longjmp)
  24. ldm a1, {v1-v8, ip, lr}
  25. mov sp, ip
  26. mov a1, a2
  27. /* If we were passed a return value of zero, return one instead */
  28. cmp a1, #0
  29. bne 1f
  30. mov a1, #1
  31. 1:
  32. bx lr
  33. ENDPROC(longjmp)
  34. .popsection