setjmp.S 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* These are predefined by new versions of GNU cpp. */
  2. #ifndef __USER_LABEL_PREFIX__
  3. #define __USER_LABEL_PREFIX__ _
  4. #endif
  5. #ifndef __REGISTER_PREFIX__
  6. #define __REGISTER_PREFIX__
  7. #endif
  8. /* ANSI concatenation macros. */
  9. #define CONCAT1(a, b) CONCAT2(a, b)
  10. #define CONCAT2(a, b) a ## b
  11. /* Use the right prefix for global labels. */
  12. #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
  13. /* Use the right prefix for registers. */
  14. #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
  15. #define d0 REG (d0)
  16. #define d1 REG (d1)
  17. #define d2 REG (d2)
  18. #define d3 REG (d3)
  19. #define d4 REG (d4)
  20. #define d5 REG (d5)
  21. #define d6 REG (d6)
  22. #define d7 REG (d7)
  23. #define a0 REG (a0)
  24. #define a1 REG (a1)
  25. #define a2 REG (a2)
  26. #define a3 REG (a3)
  27. #define a4 REG (a4)
  28. #define a5 REG (a5)
  29. #define a6 REG (a6)
  30. #define fp REG (fp)
  31. #define sp REG (sp)
  32. .global SYM (setjmp)
  33. .global SYM (longjmp)
  34. SYM (setjmp):
  35. moveal sp@(4),a0
  36. movel sp@(0),a0@(12)
  37. movel sp,a0@(8)
  38. moveml d2-d7/a2-a6,a0@(20)
  39. clrl d0
  40. rts
  41. SYM (longjmp):
  42. moveal sp@(4),a0
  43. movel sp@(8),d0
  44. bne 1f
  45. movel #1,d0
  46. 1:
  47. moveml a0@(20),d2-d7/a2-a6
  48. moveal a0@(8),sp
  49. movel a0@(12),sp@
  50. rts
  51. #ifdef M68881
  52. .global SYM (setjmp_68881)
  53. .global SYM (longjmp_68881)
  54. SYM (setjmp_68881):
  55. moveal sp@(4),a0
  56. movel sp@(0),a0@(12)
  57. movel sp,a0@(8)
  58. moveml d2-d7/a2-a6,a0@(20)
  59. fmovemx fp2-fp7,a0@(64)
  60. clrl d0
  61. rts
  62. SYM (longjmp_68881):
  63. moveal sp@(4),a0
  64. fmovemx a0@(64),fp2-fp7
  65. movel sp@(8),d0
  66. bne 1f
  67. movel #1,d0
  68. 1:
  69. moveml a0@(20),d2-d7/a2-a6
  70. moveal a0@(8),sp
  71. movel a0@(12),sp@
  72. rts
  73. #endif