syscall.inc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Michael Van Canneyt,
  5. member of the Free Pascal development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {No debugging for syslinux include !}
  13. {$IFDEF SYS_LINUX}
  14. {$UNDEF SYSCALL_DEBUG}
  15. {$ENDIF SYS_LINUX}
  16. {*****************************************************************************
  17. --- Main:The System Call Self ---
  18. *****************************************************************************}
  19. function FpSysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
  20. {
  21. This function puts the registers in place, does the call, and then
  22. copies back the registers as they are after the SysCall.
  23. }
  24. asm
  25. mr r0,r3
  26. sc
  27. blr
  28. neg r3, r3
  29. lis r4,(Errno+4)@ha
  30. stw r3,(Errno+4)@l(r4)
  31. li r3,-1
  32. end;
  33. function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
  34. {
  35. This function puts the registers in place, does the call, and then
  36. copies back the registers as they are after the SysCall.
  37. }
  38. asm
  39. mr r0,r3
  40. mr r3,r4
  41. sc
  42. blr
  43. neg r3, r3
  44. lis r4,(Errno+4)@ha
  45. stw r3,(Errno+4)@l(r4)
  46. li r3,-1
  47. end;
  48. function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
  49. {
  50. This function puts the registers in place, does the call, and then
  51. copies back the registers as they are after the SysCall.
  52. }
  53. asm
  54. mr r0,r3
  55. mr r3,r4
  56. mr r4,r5
  57. sc
  58. blr
  59. neg r3, r3
  60. lis r4,(Errno+4)@ha
  61. stw r3,(Errno+4)@l(r4)
  62. li r3,-1
  63. end;
  64. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
  65. {
  66. This function puts the registers in place, does the call, and then
  67. copies back the registers as they are after the SysCall.
  68. }
  69. asm
  70. mr r0,r3
  71. mr r3,r4
  72. mr r4,r5
  73. mr r5,r6
  74. sc
  75. blr
  76. neg r3, r3
  77. lis r4,(Errno+4)@ha
  78. stw r3,(Errno+4)@l(r4)
  79. li r3,-1
  80. end;
  81. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
  82. {
  83. This function puts the registers in place, does the call, and then
  84. copies back the registers as they are after the SysCall.
  85. }
  86. asm
  87. mr r0,r3
  88. mr r3,r4
  89. mr r4,r5
  90. mr r5,r6
  91. mr r6,r7
  92. sc
  93. blr
  94. neg r3, r3
  95. lis r4,(Errno+4)@ha
  96. stw r3,(Errno+4)@l(r4)
  97. li r3,-1
  98. end;
  99. function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
  100. {
  101. This function puts the registers in place, does the call, and then
  102. copies back the registers as they are after the SysCall.
  103. }
  104. asm
  105. mr r0,r3
  106. mr r3,r4
  107. mr r4,r5
  108. mr r5,r6
  109. mr r6,r7
  110. mr r7,r8
  111. sc
  112. blr
  113. neg r3, r3
  114. lis r4,(Errno+4)@ha
  115. stw r3,(Errno+4)@l(r4)
  116. li r3,-1
  117. end;
  118. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
  119. {
  120. This function puts the registers in place, does the call, and then
  121. copies back the registers as they are after the SysCall.
  122. }
  123. asm
  124. mr r0,r3
  125. mr r3,r4
  126. mr r4,r5
  127. mr r5,r6
  128. mr r6,r7
  129. mr r7,r8
  130. mr r8,r9
  131. sc
  132. blr
  133. neg r3, r3
  134. lis r4,(Errno+4)@ha
  135. stw r3,(Errno+4)@l(r4)
  136. li r3,-1
  137. end;
  138. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL7'];
  139. {
  140. This function puts the registers in place, does the call, and then
  141. copies back the registers as they are after the SysCall.
  142. }
  143. asm
  144. mr r0,r3
  145. mr r3,r4
  146. mr r4,r5
  147. mr r5,r6
  148. mr r6,r7
  149. mr r7,r8
  150. mr r8,r9
  151. mr r9,r10
  152. sc
  153. blr
  154. neg r3, r3
  155. lis r4,(Errno+4)@ha
  156. stw r3,(Errno+4)@l(r4)
  157. li r3,-1
  158. end;
  159. {
  160. $Log$
  161. Revision 1.2 2003-05-25 13:51:58 jonas
  162. * several fixes, addition of Mach trap numbers (thye are simply syscalls
  163. with a negative number)
  164. Revision 1.6 2003/05/23 21:58:30 jonas
  165. * fixed storing to errno for single threaded programs
  166. Revision 1.5 2003/05/11 16:07:55 jonas
  167. * fixed mmap for non-i386 non-m68k architectures (not sure about
  168. x86-64)
  169. Revision 1.4 2003/04/22 17:07:55 florian
  170. * there where two SYSCALL1 procedures for the powerpc, fixed
  171. Revision 1.3 2003/01/09 13:38:26 florian
  172. * syscall stuff fixed
  173. Revision 1.2 2002/12/22 16:00:28 jonas
  174. + added syscallh.inc, adapted syscall.inc
  175. Revision 1.1 2002/11/09 20:32:14 marco
  176. * powerpc version. Threadsafe errno access not yet done.
  177. Revision 1.1 2002/10/14 19:39:44 peter
  178. * syscall moved into seperate include
  179. }