setjmp.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* int setjmp (jmp_buf); */
  2. .globl setjmp
  3. setjmp:
  4. SD ra,0(a0) // X1
  5. SD sp,8(a0) // X14
  6. SD s0,16(a0) // X2
  7. // X0 is zero
  8. // X1 and X2 are done.
  9. sd x3, 48(a0)
  10. sd x4, 56(a0)
  11. sd x5, 64(a0)
  12. sd x6, 72(a0)
  13. sd x7, 80(a0)
  14. sd x8, 88(a0)
  15. sd x9, 96(a0)
  16. sd x10, 104(a0) // store a zero in jmp_buf
  17. sd x11, 112(a0) // Don't touch a1.
  18. sd x12, 120(a0)
  19. sd x13, 128(a0)
  20. // X14 done already
  21. sd x15, 144(a0)
  22. sd x16, 152(a0)
  23. sd x17, 160(a0)
  24. sd x18, 168(a0)
  25. sd x19, 176(a0)
  26. sd x20, 184(a0)
  27. sd x21, 192(a0)
  28. sd x22, 200(a0)
  29. sd x23, 208(a0)
  30. sd x24, 216(a0)
  31. sd x25, 224(a0)
  32. sd x26, 232(a0)
  33. sd x27, 240(a0)
  34. sd x28, 248(a0)
  35. sd x29, 256(a0)
  36. sd x30, 264(a0)
  37. sd x31, 272(a0)
  38. mv a0, x0
  39. RET
  40. /* volatile void longjmp (jmp_buf, int); */
  41. .globl longjmp
  42. longjmp:
  43. LD sp,8(a0) // X14
  44. LD s0,16(a0) // X2
  45. // X0 is zero
  46. // X1 and X2 are done.
  47. LD x3, 48(a0)
  48. // Don't restore X4, that's reserved for Mach *
  49. //LD x4, 56(a0)
  50. LD x5, 64(a0)
  51. LD x6, 72(a0)
  52. LD x7, 80(a0)
  53. LD x8, 88(a0)
  54. LD x9, 96(a0)
  55. //LD x10, 104(a0) this is a0
  56. // LD x11, 112(a0)
  57. LD x12, 120(a0)
  58. LD x13, 128(a0)
  59. // X14 done already
  60. LD x15, 144(a0)
  61. LD x16, 152(a0)
  62. LD x17, 160(a0)
  63. LD x18, 168(a0)
  64. LD x19, 176(a0)
  65. LD x20, 184(a0)
  66. LD x21, 192(a0)
  67. LD x22, 200(a0)
  68. LD x23, 208(a0)
  69. LD x24, 216(a0)
  70. LD x25, 224(a0)
  71. LD x26, 232(a0)
  72. LD x27, 240(a0)
  73. LD x28, 248(a0)
  74. LD x29, 256(a0)
  75. LD x30, 264(a0)
  76. LD x30, 272(a0)
  77. LD a0,0(a0)
  78. MV ra,a0 // X1 (non zero by definition I hope.
  79. mv a0, a1
  80. RET