setjmp.S 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (C) 2026 Waldemar Brodkorb <wbx@uclibc-ng.org>
  3. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  4. */
  5. /* setjmp for LoongArch.
  6. Copyright (C) 2022-2026 Free Software Foundation, Inc.
  7. The GNU C Library is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2.1 of the License, or (at your option) any later version.
  11. The GNU C Library is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. Lesser General Public License for more details.
  15. You should have received a copy of the GNU Lesser General Public
  16. License along with the GNU C Library. If not, see
  17. <https://www.gnu.org/licenses/>. */
  18. #include <sys/asm.h>
  19. ENTRY (_setjmp)
  20. li.w a1,0
  21. b HIDDEN_JUMPTARGET (__sigsetjmp)
  22. END (_setjmp)
  23. ENTRY (setjmp)
  24. li.w a1,1
  25. END (setjmp)
  26. ENTRY (__sigsetjmp)
  27. REG_S ra, a0, 0*SZREG
  28. REG_S sp, a0, 1*SZREG
  29. REG_S x, a0, 2*SZREG
  30. REG_S fp, a0, 3*SZREG
  31. REG_S s0, a0, 4*SZREG
  32. REG_S s1, a0, 5*SZREG
  33. REG_S s2, a0, 6*SZREG
  34. REG_S s3, a0, 7*SZREG
  35. REG_S s4, a0, 8*SZREG
  36. REG_S s5, a0, 9*SZREG
  37. REG_S s6, a0, 10*SZREG
  38. REG_S s7, a0, 11*SZREG
  39. REG_S s8, a0, 12*SZREG
  40. #ifndef __loongarch_soft_float
  41. FREG_S fs0, a0, 13*SZREG + 0*SZFREG
  42. FREG_S fs1, a0, 13*SZREG + 1*SZFREG
  43. FREG_S fs2, a0, 13*SZREG + 2*SZFREG
  44. FREG_S fs3, a0, 13*SZREG + 3*SZFREG
  45. FREG_S fs4, a0, 13*SZREG + 4*SZFREG
  46. FREG_S fs5, a0, 13*SZREG + 5*SZFREG
  47. FREG_S fs6, a0, 13*SZREG + 6*SZFREG
  48. FREG_S fs7, a0, 13*SZREG + 7*SZFREG
  49. #endif
  50. b __sigjmp_save
  51. END (__sigsetjmp)
  52. hidden_def (__sigsetjmp)
  53. weak_alias (_setjmp, __GI__setjmp)