bsd-setjmp.S 831 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (C) 2016 Andes Technology, Inc.
  3. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  4. */
  5. /* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
  6. We cannot do it in C because it must be a tail-call, so frame-unwinding
  7. in setjmp doesn't clobber the state restored by longjmp. */
  8. #include <sysdep.h>
  9. ENTRY(setjmp)
  10. move $r1, #1
  11. /* Make a tail call to __sigsetjmp. */
  12. #ifdef PIC
  13. /* Initialize $r2 as $gp value. */
  14. sethi $r2, hi20(_GLOBAL_OFFSET_TABLE_-8)
  15. ori $r2, $r2, lo12(_GLOBAL_OFFSET_TABLE_-4)
  16. mfusr $r15, $pc
  17. add $r2, $r15, $r2
  18. ! la $r3, __sigsetjmp@PLT
  19. sethi $r3, hi20(__sigsetjmp@PLT)
  20. ori $r3, $r3, lo12(__sigsetjmp@PLT)
  21. add $r3, $r3, $r2
  22. jr $r3
  23. #else /* NOT PIC */
  24. la $r15, C_SYMBOL_NAME(__sigsetjmp)
  25. jr $r15
  26. #endif
  27. END (setjmp)