syscall.inc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. Syscalls for NetBSD/macppc. Merged from an initial version,
  9. Jonas' linux version and some testing checking.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. **********************************************************************}
  14. {*****************************************************************************
  15. --- Main:The System Call Self ---
  16. *****************************************************************************}
  17. function FpSysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
  18. {
  19. This function puts the registers in place, does the call, and then
  20. copies back the registers as they are after the SysCall.
  21. }
  22. asm
  23. mr r0,r3
  24. sc
  25. bnslr
  26. lis r4,Errno@ha
  27. stw r3,Errno@l(r4)
  28. li r3,-1
  29. end;
  30. function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
  31. {
  32. This function puts the registers in place, does the call, and then
  33. copies back the registers as they are after the SysCall.
  34. }
  35. asm
  36. mr r0,r3
  37. mr r3,r4
  38. sc
  39. bnslr
  40. lis r4,Errno@ha
  41. stw r3,Errno@l(r4)
  42. li r3,-1
  43. end;
  44. function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
  45. {
  46. This function puts the registers in place, does the call, and then
  47. copies back the registers as they are after the SysCall.
  48. }
  49. asm
  50. mr r0,r3
  51. mr r3,r4
  52. mr r4,r5
  53. sc
  54. bnslr
  55. lis r4,Errno@ha
  56. stw r3,Errno@l(r4)
  57. li r3,-1
  58. end;
  59. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
  60. {
  61. This function puts the registers in place, does the call, and then
  62. copies back the registers as they are after the SysCall.
  63. }
  64. asm
  65. mr r0,r3
  66. mr r3,r4
  67. mr r4,r5
  68. mr r5,r6
  69. sc
  70. bnslr
  71. lis r4,Errno@ha
  72. stw r3,Errno@l(r4)
  73. li r3,-1
  74. end;
  75. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
  76. {
  77. This function puts the registers in place, does the call, and then
  78. copies back the registers as they are after the SysCall.
  79. }
  80. asm
  81. mr r0,r3
  82. mr r3,r4
  83. mr r4,r5
  84. mr r5,r6
  85. mr r6,r7
  86. sc
  87. bnslr
  88. lis r4,Errno@ha
  89. stw r3,Errno@l(r4)
  90. li r3,-1
  91. end;
  92. function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
  93. {
  94. This function puts the registers in place, does the call, and then
  95. copies back the registers as they are after the SysCall.
  96. }
  97. asm
  98. mr r0,r3
  99. mr r3,r4
  100. mr r4,r5
  101. mr r5,r6
  102. mr r6,r7
  103. mr r7,r8
  104. sc
  105. bnslr
  106. lis r4,Errno@ha
  107. stw r3,Errno@l(r4)
  108. li r3,-1
  109. end;
  110. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
  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. mr r0,r3
  117. mr r3,r4
  118. mr r4,r5
  119. mr r5,r6
  120. mr r6,r7
  121. mr r7,r8
  122. mr r8,r9
  123. sc
  124. bnslr
  125. lis r4,Errno@ha
  126. stw r3,Errno@l(r4)
  127. li r3,-1
  128. li r4,-1
  129. end;
  130. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL7'];
  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. mr r0,r3
  137. mr r3,r4
  138. mr r4,r5
  139. mr r5,r6
  140. mr r6,r7
  141. mr r7,r8
  142. mr r8,r9
  143. mr r9,r10
  144. sc
  145. bnslr
  146. lis r4,Errno@ha
  147. stw r3,Errno@l(r4)
  148. li r3,-1
  149. li r4,-1
  150. end;
  151. {
  152. $Log$
  153. Revision 1.5 2003-06-01 16:35:28 marco
  154. * Several small fixes to harmonize the *BSD rtls and Linux.
  155. Revision 1.4 2003/05/29 13:42:58 marco
  156. * small fix
  157. Revision 1.3 2003/05/29 13:14:07 marco
  158. * 7 parameter syscall added. *BSD has calls with more params due to __syscall etc
  159. Revision 1.5 2003/05/11 16:07:55 jonas
  160. * fixed mmap for non-i386 non-m68k architectures (not sure about
  161. x86-64)
  162. Revision 1.4 2003/04/22 17:07:55 florian
  163. * there where two SYSCALL1 procedures for the powerpc, fixed
  164. Revision 1.3 2003/01/09 13:38:26 florian
  165. * syscall stuff fixed
  166. Revision 1.2 2002/12/22 16:00:28 jonas
  167. + added syscallh.inc, adapted syscall.inc
  168. Revision 1.1 2002/11/09 20:32:14 marco
  169. * powerpc version. Threadsafe errno access not yet done.
  170. Revision 1.1 2002/10/14 19:39:44 peter
  171. * syscall moved into seperate include
  172. }