setjmp.S 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #include <features.h>
  2. #define _SETJMP_H
  3. #define _ASM
  4. #include <bits/setjmp.h>
  5. .text
  6. /* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
  7. We cannot do it in C because it must be a tail-call, so frame-unwinding
  8. in setjmp doesn't clobber the state restored by longjmp. */
  9. .global _setjmp
  10. .type _setjmp,@function
  11. _setjmp:
  12. setlos #0, gr9
  13. bra .Lsigsetjmp_intern
  14. .size _setjmp,.-_setjmp
  15. /* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
  16. We cannot do it in C because it must be a tail-call, so frame-unwinding
  17. in setjmp doesn't clobber the state restored by longjmp. */
  18. .align 4
  19. .type setjmp,@function
  20. .globl setjmp
  21. setjmp:
  22. setlos #1, gr9
  23. bra .Lsigsetjmp_intern
  24. .size setjmp,.-setjmp
  25. # setjmp/longjmp for Frv. The jmpbuf looks like this:
  26. #
  27. # Register jmpbuf offset
  28. # R16-R31 0x0-0x03c
  29. # R48-R63 0x40-0x7c
  30. # FR16-FR31 0x80-0xbc
  31. # FR48-FR63 0xc0-0xfc
  32. # LR 0x100
  33. # SP 0x104
  34. # FP 0x108
  35. .global __sigsetjmp
  36. .type __sigsetjmp,@function
  37. __sigsetjmp:
  38. .Lsigsetjmp_intern:
  39. stdi gr16, @(gr8,0)
  40. stdi gr18, @(gr8,8)
  41. stdi gr20, @(gr8,16)
  42. stdi gr22, @(gr8,24)
  43. stdi gr24, @(gr8,32)
  44. stdi gr26, @(gr8,40)
  45. stdi gr28, @(gr8,48)
  46. stdi gr30, @(gr8,56)
  47. #if __FRV_GPR__ != 32
  48. stdi gr48, @(gr8,64)
  49. stdi gr50, @(gr8,72)
  50. stdi gr52, @(gr8,80)
  51. stdi gr54, @(gr8,88)
  52. stdi gr56, @(gr8,96)
  53. stdi gr58, @(gr8,104)
  54. stdi gr60, @(gr8,112)
  55. stdi gr62, @(gr8,120)
  56. #endif
  57. #if __FRV_FPR__ != 0
  58. stdfi fr16, @(gr8,128)
  59. stdfi fr18, @(gr8,136)
  60. stdfi fr20, @(gr8,144)
  61. stdfi fr22, @(gr8,152)
  62. stdfi fr24, @(gr8,160)
  63. stdfi fr26, @(gr8,168)
  64. stdfi fr28, @(gr8,176)
  65. stdfi fr30, @(gr8,184)
  66. #if __FRV_FPR__ != 32
  67. stdfi fr48, @(gr8,192)
  68. stdfi fr50, @(gr8,200)
  69. stdfi fr52, @(gr8,208)
  70. stdfi fr54, @(gr8,216)
  71. stdfi fr56, @(gr8,224)
  72. stdfi fr58, @(gr8,232)
  73. stdfi fr60, @(gr8,240)
  74. stdfi fr62, @(gr8,248)
  75. #endif
  76. #endif
  77. movsg lr, gr4
  78. sti gr4, @(gr8,256)
  79. sti sp, @(gr8,260)
  80. sti fp, @(gr8,264)
  81. sethi.p #gotofffuncdeschi(__sigjmp_save), gr4
  82. setlo #gotofffuncdesclo(__sigjmp_save), gr4
  83. ldd @(gr15, gr4), gr14
  84. jmpl @(gr14, gr0)
  85. .size __sigsetjmp,.-__sigsetjmp