syscall.inc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 1999-2000 by Michael Van Canneyt,
  4. member of the Free Pascal development team.
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {No debugging for syslinux include !}
  12. {$IFDEF SYS_LINUX}
  13. {$UNDEF SYSCALL_DEBUG}
  14. {$ENDIF SYS_LINUX}
  15. {$define FPC_SYSTEM_HAS_FPFORK}
  16. {
  17. behaviour of result of fork on sparc/linux is different than on other
  18. linux flavours
  19. }
  20. function Fpfork : pid_t; [public, alias : 'FPC_SYSC_FORK'];assembler;
  21. asm
  22. mov 2,%g1
  23. ta 0x10
  24. bcc .LSyscOK
  25. nop
  26. call SetErrno
  27. nop
  28. ba .LReturn
  29. mov -1,%i0
  30. .LSyscOK:
  31. // o1 contains 1 in the parent
  32. // and 0 in the child
  33. sub %o1, 1, %o1
  34. and %o0, %o1, %i0
  35. .LReturn:
  36. end;
  37. {*****************************************************************************
  38. --- Main:The System Call Self ---
  39. *****************************************************************************}
  40. function FpSysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
  41. {
  42. This function puts the registers in place, does the call, and then
  43. copies back the registers as they are after the SysCall.
  44. }
  45. asm
  46. mov %i0,%g1
  47. ta 0x10
  48. bcc .LSyscOK
  49. nop
  50. call SetErrno
  51. nop
  52. mov -1,%o0
  53. .LSyscOK:
  54. mov %o0,%i0
  55. end;
  56. function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
  57. {
  58. This function puts the registers in place, does the call, and then
  59. copies back the registers as they are after the SysCall.
  60. }
  61. asm
  62. mov %i0,%g1
  63. mov %i1,%o0
  64. ta 0x10
  65. bcc .LSyscOK
  66. nop
  67. call SetErrno
  68. nop
  69. mov -1,%o0
  70. .LSyscOK:
  71. mov %o0,%i0
  72. end;
  73. function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
  74. {
  75. This function puts the registers in place, does the call, and then
  76. copies back the registers as they are after the SysCall.
  77. }
  78. asm
  79. mov %i0,%g1
  80. mov %i1,%o0
  81. mov %i2,%o1
  82. ta 0x10
  83. bcc .LSyscOK
  84. nop
  85. call SetErrno
  86. nop
  87. mov -1,%o0
  88. .LSyscOK:
  89. mov %o0,%i0
  90. end;
  91. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
  92. {
  93. This function puts the registers in place, does the call, and then
  94. copies back the registers as they are after the SysCall.
  95. }
  96. asm
  97. mov %i0,%g1
  98. mov %i1,%o0
  99. mov %i2,%o1
  100. mov %i3,%o2
  101. ta 0x10
  102. bcc .LSyscOK
  103. nop
  104. call SetErrno
  105. nop
  106. mov -1,%o0
  107. .LSyscOK:
  108. mov %o0,%i0
  109. end;
  110. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
  111. {
  112. This function puts the registers in place, does the call, and then
  113. copies back the registers as they are after the SysCall.
  114. }
  115. asm
  116. mov %i0,%g1
  117. mov %i1,%o0
  118. mov %i2,%o1
  119. mov %i3,%o2
  120. mov %i4,%o3
  121. ta 0x10
  122. bcc .LSyscOK
  123. nop
  124. call SetErrno
  125. nop
  126. mov -1,%o0
  127. .LSyscOK:
  128. mov %o0,%i0
  129. end;
  130. function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
  131. {
  132. This function puts the registers in place, does the call, and then
  133. copies back the registers as they are after the SysCall.
  134. }
  135. asm
  136. mov %i0,%g1
  137. mov %i1,%o0
  138. mov %i2,%o1
  139. mov %i3,%o2
  140. mov %i4,%o3
  141. mov %i5,%o4
  142. ta 0x10
  143. bcc .LSyscOK
  144. nop
  145. call SetErrno
  146. nop
  147. mov -1,%o0
  148. .LSyscOK:
  149. mov %o0,%i0
  150. end;
  151. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
  152. {
  153. This function puts the registers in place, does the call, and then
  154. copies back the registers as they are after the SysCall.
  155. }
  156. asm
  157. mov %i0,%g1
  158. mov %i1,%o0
  159. mov %i2,%o1
  160. mov %i3,%o2
  161. mov %i4,%o3
  162. ld [%i6+92],%o5
  163. mov %i5,%o4
  164. ta 0x10
  165. bcc .LSyscOK
  166. nop
  167. call SetErrno
  168. nop
  169. mov -1,%o0
  170. .LSyscOK:
  171. mov %o0,%i0
  172. end;