bsd-_setjmp.S 857 B

1234567891011121314151617181920212223242526272829303132333435
  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, 0)'.
  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, #0
  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)
  28. libc_hidden_def(_setjmp)