sysdep.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003, 2004
  2. Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. Contributed by Brendan Kehoe (brendan@zen.org).
  5. The GNU C Library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, write to the Free
  15. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307 USA. */
  17. #include <sgidefs.h>
  18. #include <sysdeps/generic/sysdep.h>
  19. #ifdef __ASSEMBLER__
  20. #include <regdef.h>
  21. #define ENTRY(name) \
  22. .globl name; \
  23. .align 2; \
  24. .ent name,0; \
  25. name##:
  26. #undef END
  27. #define END(function) \
  28. .end function; \
  29. .size function,.-function
  30. #define ret j ra ; nop
  31. #undef PSEUDO_END
  32. #define PSEUDO_END(sym) .end sym; .size sym,.-sym
  33. #define PSEUDO_NOERRNO(name, syscall_name, args) \
  34. .align 2; \
  35. ENTRY(name) \
  36. .set noreorder; \
  37. li v0, SYS_ify(syscall_name); \
  38. syscall
  39. #undef PSEUDO_END_NOERRNO
  40. #define PSEUDO_END_NOERRNO(sym) .end sym; .size sym,.-sym
  41. #define ret_NOERRNO ret
  42. #define PSEUDO_ERRVAL(name, syscall_name, args) \
  43. .align 2; \
  44. ENTRY(name) \
  45. .set noreorder; \
  46. li v0, SYS_ify(syscall_name); \
  47. syscall
  48. #undef PSEUDO_END_ERRVAL
  49. #define PSEUDO_END_ERRVAL(sym) .end sym; .size sym,.-sym
  50. #define ret_ERRVAL ret
  51. #define r0 v0
  52. #define r1 v1
  53. /* The mips move insn is d,s. */
  54. #define MOVE(x,y) move y , x
  55. #if _MIPS_SIM == _ABIO32
  56. # define L(label) $L ## label
  57. #else
  58. # define L(label) .L ## label
  59. #endif
  60. /* Note that while it's better structurally, going back to call __syscall_error
  61. can make things confusing if you're debugging---it looks like it's jumping
  62. backwards into the previous fn. */
  63. #ifdef __PIC__
  64. #define PSEUDO(name, syscall_name, args) \
  65. .align 2; \
  66. 99: la t9,__syscall_error; \
  67. jr t9; \
  68. ENTRY(name) \
  69. .set noreorder; \
  70. .cpload t9; \
  71. li v0, SYS_ify(syscall_name); \
  72. syscall; \
  73. .set reorder; \
  74. bne a3, zero, 99b; \
  75. L(syse1):
  76. #else
  77. #define PSEUDO(name, syscall_name, args) \
  78. .set noreorder; \
  79. .align 2; \
  80. 99: j __syscall_error; \
  81. nop; \
  82. ENTRY(name) \
  83. .set noreorder; \
  84. li v0, SYS_ify(syscall_name); \
  85. syscall; \
  86. .set reorder; \
  87. bne a3, zero, 99b; \
  88. L(syse1):
  89. #endif
  90. #endif