SYS.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. SYS.h
  3. */
  4. #ifndef SYS_H
  5. #define SYS_H
  6. #define SYS_call_0(x) \
  7. LABEL_(x); \
  8. BODY(x)
  9. #define _SYS_call_0(x) \
  10. LABEL__(x); \
  11. BODY(x)
  12. #define SYS_call_1(x) \
  13. LABEL_(x); \
  14. ENTRY1; \
  15. BODY(x)
  16. #define _SYS_call_1(x) \
  17. LABEL__(x); \
  18. ENTRY1; \
  19. BODY(x)
  20. #define SYS_call_2(x) \
  21. LABEL_(x); \
  22. ENTRY2; \
  23. BODY(x)
  24. #define _SYS_call_2(x) \
  25. LABEL__(x); \
  26. ENTRY2; \
  27. BODY(x)
  28. #define SYS_call_3(x) \
  29. LABEL_(x); \
  30. ENTRY3; \
  31. BODY(x)
  32. #define _SYS_call_3(x) \
  33. LABEL__(x); \
  34. ENTRY3; \
  35. BODY(x)
  36. #define SYS_call_4(x) \
  37. LABEL_(x); \
  38. ENTRY4; \
  39. BODY(x)
  40. #define _SYS_call_4(x) \
  41. LABEL__(x); \
  42. ENTRY4; \
  43. BODY(x)
  44. #define SYS_call_5(x) \
  45. LABEL_(x); \
  46. ENTRY5; \
  47. BODY(x)
  48. #define _SYS_call_5(x) \
  49. LABEL__(x); \
  50. ENTRY5; \
  51. BODY(x)
  52. #define SYS_call_6(x) \
  53. LABEL_(x); \
  54. ENTRY6; \
  55. BODY(x)
  56. #define _SYS_call_6(x) \
  57. LABEL__(x); \
  58. ENTRY6; \
  59. BODY(x)
  60. #define BODY(x) \
  61. b x; \
  62. nop
  63. #if __STDC__
  64. #define LABEL_(x) \
  65. .global $ ## x; \
  66. $ ## x:
  67. #define LABEL__(x) \
  68. .global $_ ## x; \
  69. $_ ## x:
  70. #else
  71. #define LABEL_(x) \
  72. .global $/**/x; \
  73. $/**/x:
  74. #define LABEL__(x) \
  75. .global $_/**/x; \
  76. $_/**/x:
  77. #endif
  78. #define ENTRY1 \
  79. ld [%l0], %o0 \
  80. #define ENTRY2 \
  81. ENTRY1; \
  82. ld [%l0+4], %o1 \
  83. #define ENTRY3 \
  84. ENTRY2; \
  85. ld [%l0+8], %o2 \
  86. #define ENTRY4 \
  87. ENTRY3; \
  88. ld [%l0+12], %o3 \
  89. #define ENTRY5 \
  90. ENTRY4; \
  91. ld [%l0+16], %o4 \
  92. #define ENTRY6 \
  93. ENTRY5; \
  94. ld [%l0+20], %o5 \
  95. #endif /* SYS_H */