__longjmp.S 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * This file is subject to the terms and conditions of the LGPL V2.1
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2018 Kalray Inc.
  7. */
  8. #include <sysdep.h>
  9. #define _SETJMP_H
  10. #define _ASM
  11. #include <bits/setjmp.h>
  12. #include <libc-symbols.h>
  13. /**
  14. * void __longjmp(__jmp_buf __env, int __val)
  15. */
  16. ENTRY(__longjmp)
  17. /* Load $ra and $csinto r40r41 */
  18. lq $r40r41 = JMPBUF_RA_CS_OFFSET[$r0]
  19. ;;
  20. /* Load $r36r37r38r39 with r12(sp) r14 r18 r19 */
  21. lo $r36r37r38r39 = (JMPBUF_REGS_OFFSET)[$r0]
  22. set $ra = $r40
  23. ;;
  24. /* Load $lc, $le and $ls */
  25. lo $r32r33r34r35 = JMPBUF_LC_LE_LS_OFFSET[$r0]
  26. copyd $sp = $r36
  27. copyd $r14 = $r37
  28. set $cs = $r41
  29. ;;
  30. /* Load r20r21r22r23 */
  31. lo $r20r21r22r23 = (JMPBUF_REGS_OFFSET + QUAD_REG_SIZE)[$r0]
  32. copyd $r18 = $r38
  33. copyd $r19 = $r39
  34. set $lc = $r32
  35. ;;
  36. /* Load r24r25r26r27 */
  37. lo $r24r25r26r27 = (JMPBUF_REGS_OFFSET + 2 * QUAD_REG_SIZE)[$r0]
  38. set $le = $r33
  39. ;;
  40. /* Load r28r29r30r31 */
  41. lo $r28r29r30r31 = (JMPBUF_REGS_OFFSET + 3 * QUAD_REG_SIZE)[$r0]
  42. set $ls = $r34
  43. /* Copy retval */
  44. copyd $r0 = $r1
  45. ;;
  46. /* According to man, if retval is equal to 0, then we should return 1 */
  47. cmoved.deqz $r0? $r0 = 1
  48. ret
  49. ;;
  50. END(__longjmp)
  51. libc_hidden_def(__longjmp)