setjmp.S 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (C) 2017 Hangzhou C-SKY Microsystems co.,ltd.
  3. *
  4. * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB
  5. * in this tarball.
  6. */
  7. #include <sysdep.h>
  8. ENTRY(__sigsetjmp)
  9. stw sp, (a0, 0)
  10. stw lr, (a0, 4)
  11. stw l0, (a0, 8)
  12. stw l1, (a0, 12)
  13. stw l2, (a0, 16)
  14. stw l3, (a0, 20)
  15. stw l4, (a0, 24)
  16. stw l5, (a0, 28)
  17. #ifdef __CSKYABIV2__
  18. stw l6, (a0, 32)
  19. stw l7, (a0, 36)
  20. stw l8, (a0, 40)
  21. stw l9, (a0, 44)
  22. stw r26, (a0, 48)
  23. stw r27, (a0, 52)
  24. stw gb, (a0, 56)
  25. stw r29, (a0, 60)
  26. stw r30, (a0, 64)
  27. stw tls, (a0, 68)
  28. #else
  29. stw gb, (a0, 32)
  30. #endif
  31. subi sp, 8
  32. stw lr, (sp, 0)
  33. stw gb, (sp, 4)
  34. __GET_GB
  35. __JSR(__sigjmp_save)
  36. ldw gb, (sp, 4)
  37. ldw lr, (sp, 0)
  38. addi sp, 8
  39. rts
  40. END(__sigsetjmp)
  41. /*
  42. * Support bsd-setjmp and bsd-_setjmp with tail-call method.
  43. * Use br to keep the lr-reg, we must return to the Caller not setjmp.
  44. * And we will rts by __sigsetjmp.
  45. */
  46. ENTRY(setjmp)
  47. movi a1, 1
  48. br __sigsetjmp
  49. END(setjmp)
  50. ENTRY(_setjmp)
  51. movi a1, 0
  52. br __sigsetjmp
  53. END(_setjmp)