syscall.inc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. Syscalls for NetBSD/macppc. Merged from an initial version,
  8. Jonas' linux version and some testing checking.
  9. This program 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.
  12. **********************************************************************}
  13. {*****************************************************************************
  14. --- Main:The System Call Self ---
  15. *****************************************************************************}
  16. function FpSysCall(sysnr:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL0'];
  17. {
  18. This function puts the registers in place, does the call, and then
  19. copies back the registers as they are after the SysCall.
  20. }
  21. asm
  22. mr r0,r3
  23. sc
  24. bnslr
  25. lis r4,Errno@ha
  26. stw r3,Errno@l(r4)
  27. li r3,-1
  28. end;
  29. function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
  30. {
  31. This function puts the registers in place, does the call, and then
  32. copies back the registers as they are after the SysCall.
  33. }
  34. asm
  35. mr r0,r3
  36. mr r3,r4
  37. sc
  38. bnslr
  39. lis r4,Errno@ha
  40. stw r3,Errno@l(r4)
  41. li r3,-1
  42. end;
  43. function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
  44. {
  45. This function puts the registers in place, does the call, and then
  46. copies back the registers as they are after the SysCall.
  47. }
  48. asm
  49. mr r0,r3
  50. mr r3,r4
  51. mr r4,r5
  52. sc
  53. bnslr
  54. lis r4,Errno@ha
  55. stw r3,Errno@l(r4)
  56. li r3,-1
  57. end;
  58. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
  59. {
  60. This function puts the registers in place, does the call, and then
  61. copies back the registers as they are after the SysCall.
  62. }
  63. asm
  64. mr r0,r3
  65. mr r3,r4
  66. mr r4,r5
  67. mr r5,r6
  68. sc
  69. bnslr
  70. lis r4,Errno@ha
  71. stw r3,Errno@l(r4)
  72. li r3,-1
  73. end;
  74. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
  75. {
  76. This function puts the registers in place, does the call, and then
  77. copies back the registers as they are after the SysCall.
  78. }
  79. asm
  80. mr r0,r3
  81. mr r3,r4
  82. mr r4,r5
  83. mr r5,r6
  84. mr r6,r7
  85. sc
  86. bnslr
  87. lis r4,Errno@ha
  88. stw r3,Errno@l(r4)
  89. li r3,-1
  90. end;
  91. function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
  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. mr r0,r3
  98. mr r3,r4
  99. mr r4,r5
  100. mr r5,r6
  101. mr r6,r7
  102. mr r7,r8
  103. sc
  104. bnslr
  105. lis r4,Errno@ha
  106. stw r3,Errno@l(r4)
  107. li r3,-1
  108. end;
  109. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
  110. {
  111. This function puts the registers in place, does the call, and then
  112. copies back the registers as they are after the SysCall.
  113. }
  114. asm
  115. mr r0,r3
  116. mr r3,r4
  117. mr r4,r5
  118. mr r5,r6
  119. mr r6,r7
  120. mr r7,r8
  121. mr r8,r9
  122. sc
  123. bnslr
  124. lis r4,Errno@ha
  125. stw r3,Errno@l(r4)
  126. li r3,-1
  127. li r4,-1
  128. end;
  129. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL7'];
  130. {
  131. This function puts the registers in place, does the call, and then
  132. copies back the registers as they are after the SysCall.
  133. }
  134. asm
  135. mr r0,r3
  136. mr r3,r4
  137. mr r4,r5
  138. mr r5,r6
  139. mr r6,r7
  140. mr r7,r8
  141. mr r8,r9
  142. mr r9,r10
  143. sc
  144. bnslr
  145. lis r4,Errno@ha
  146. stw r3,Errno@l(r4)
  147. li r3,-1
  148. li r4,-1
  149. end;