__longjmp.S 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #define _SETJMP_H
  2. #define _ASM
  3. #include <bits/setjmp.h>
  4. # setjmp/longjmp for Frv. The jmpbuf looks like this:
  5. #
  6. # Register jmpbuf offset
  7. # R16-R31 0x0-0x03c
  8. # R48-R63 0x40-0x7c
  9. # FR16-FR31 0x80-0xbc
  10. # FR48-FR63 0xc0-0xfc
  11. # LR 0x100
  12. # SP 0x104
  13. # FP 0x108
  14. #
  15. # R8 contains the pointer to jmpbuf
  16. .text
  17. .global __longjmp
  18. .type __longjmp,@function
  19. __longjmp:
  20. lddi @(gr8,0), gr16
  21. lddi @(gr8,8), gr18
  22. lddi @(gr8,16), gr20
  23. lddi @(gr8,24), gr22
  24. lddi @(gr8,32), gr24
  25. lddi @(gr8,40), gr26
  26. lddi @(gr8,48), gr28
  27. lddi @(gr8,56), gr30
  28. #if __FRV_GPR__ != 32
  29. lddi @(gr8,64), gr48
  30. lddi @(gr8,72), gr50
  31. lddi @(gr8,80), gr52
  32. lddi @(gr8,88), gr54
  33. lddi @(gr8,96), gr56
  34. lddi @(gr8,104), gr58
  35. lddi @(gr8,112), gr60
  36. lddi @(gr8,120), gr62
  37. #endif
  38. #if __FRV_FPR__ != 0
  39. lddfi @(gr8,128), fr16
  40. lddfi @(gr8,136), fr18
  41. lddfi @(gr8,144), fr20
  42. lddfi @(gr8,152), fr22
  43. lddfi @(gr8,160), fr24
  44. lddfi @(gr8,168), fr26
  45. lddfi @(gr8,176), fr28
  46. lddfi @(gr8,184), fr30
  47. #if __FRV_FPR__ != 32
  48. lddfi @(gr8,192), fr48
  49. lddfi @(gr8,200), fr50
  50. lddfi @(gr8,208), fr52
  51. lddfi @(gr8,216), fr54
  52. lddfi @(gr8,224), fr56
  53. lddfi @(gr8,232), fr58
  54. lddfi @(gr8,240), fr60
  55. lddfi @(gr8,248), fr62
  56. #endif
  57. #endif
  58. ldi @(gr8,256), gr4
  59. movgs gr4,lr
  60. ldi @(gr8,260), sp
  61. ldi @(gr8,264), fp
  62. # Value to return is in r9. If zero, return 1
  63. cmp gr9, gr0, icc0
  64. setlos #1, gr8
  65. ckne icc0, cc4
  66. cmov gr9, gr8, cc4, 1
  67. ret
  68. .Lend2:
  69. .size __longjmp,.Lend2-__longjmp