__longjmp.S 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. /* longjmp.
  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 (__longjmp)
  20. REG_L ra, a0, 0*SZREG
  21. REG_L sp, a0, 1*SZREG
  22. REG_L x, a0, 2*SZREG
  23. REG_L fp, a0, 3*SZREG
  24. REG_L s0, a0, 4*SZREG
  25. REG_L s1, a0, 5*SZREG
  26. REG_L s2, a0, 6*SZREG
  27. REG_L s3, a0, 7*SZREG
  28. REG_L s4, a0, 8*SZREG
  29. REG_L s5, a0, 9*SZREG
  30. REG_L s6, a0, 10*SZREG
  31. REG_L s7, a0, 11*SZREG
  32. REG_L s8, a0, 12*SZREG
  33. #ifndef __loongarch_soft_float
  34. FREG_L fs0, a0, 13*SZREG + 0*SZFREG
  35. FREG_L fs1, a0, 13*SZREG + 1*SZFREG
  36. FREG_L fs2, a0, 13*SZREG + 2*SZFREG
  37. FREG_L fs3, a0, 13*SZREG + 3*SZFREG
  38. FREG_L fs4, a0, 13*SZREG + 4*SZFREG
  39. FREG_L fs5, a0, 13*SZREG + 5*SZFREG
  40. FREG_L fs6, a0, 13*SZREG + 6*SZFREG
  41. FREG_L fs7, a0, 13*SZREG + 7*SZFREG
  42. #endif
  43. sltui a0, a1, 1
  44. ADD a0, a0, a1 # a0 = (a1 == 0) ? 1 : a1
  45. jirl zero, ra, 0
  46. END (__longjmp)
  47. libc_hidden_def(__longjmp)