setjmp.S 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* setjmp for Nios II.
  2. Copyright (C) 1991-2016 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library. If not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #include <sysdep.h>
  16. #include <jmpbuf-offsets.h>
  17. .text
  18. ENTRY(setjmp)
  19. movi r5, 1
  20. br __sigsetjmp
  21. END(setjmp)
  22. libc_hidden_def(setjmp)
  23. ENTRY(_setjmp)
  24. mov r5, zero
  25. br __sigsetjmp
  26. END(_setjmp)
  27. libc_hidden_def(_setjmp)
  28. /* Save the current program position in ENV and return 0. */
  29. ENTRY(__sigsetjmp)
  30. stw r16, (JB_R16*4)(r4)
  31. stw r17, (JB_R17*4)(r4)
  32. stw r18, (JB_R18*4)(r4)
  33. stw r19, (JB_R19*4)(r4)
  34. stw r20, (JB_R20*4)(r4)
  35. stw r21, (JB_R21*4)(r4)
  36. stw r22, (JB_R22*4)(r4)
  37. stw fp, (JB_FP*4)(r4)
  38. stw ra, (JB_RA*4)(r4)
  39. stw sp, (JB_SP*4)(r4)
  40. /* Save the signal mask if requested. */
  41. nextpc r2
  42. 1: movhi r3, %hiadj(__sigjmp_save - 1b)
  43. addi r3, r3, %lo(__sigjmp_save - 1b)
  44. add r2, r2, r3
  45. jmp r2
  46. END(__sigsetjmp)
  47. libc_hidden_def(__sigsetjmp)