syscall.inc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. The syscalls for the new RTL, moved to platform dependant dir.
  6. Old linux calling convention is still kept.
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  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. {$ASMMODE ATT}
  14. Procedure fpc_geteipasebx;[external name 'fpc_geteipasebx'];
  15. function FpSysCall(sysnr:TSysParam):TSysResult; assembler; register; [public,alias:'FPC_SYSCALL0'];
  16. { Var sysnr located in register eax }
  17. asm
  18. // movl sysnr,%eax
  19. int $0x80
  20. cmpl $-4095,%eax
  21. jb .LSyscOK
  22. negl %eax
  23. call seterrno
  24. movl $-1,%eax
  25. .LSyscOK:
  26. end;
  27. function FpSysCall(sysnr,param1 : TSysParam):TSysResult; assembler; register; [public,alias:'FPC_SYSCALL1'];
  28. { Var sysnr located in register eax
  29. Var param1 located in register edx }
  30. asm
  31. movl %ebx,%ecx
  32. // movl sysnr,%eax
  33. movl %edx,%ebx
  34. int $0x80
  35. movl %ecx,%ebx
  36. cmpl $-4095,%eax
  37. jb .LSyscOK
  38. negl %eax
  39. call seterrno
  40. movl $-1,%eax
  41. .LSyscOK:
  42. end;
  43. function FpSysCall(sysnr,param1,param2 : TSysParam):TSysResult; assembler; register; [public,alias:'FPC_SYSCALL2'];
  44. { Var sysnr located in register eax
  45. Var param1 located in register edx
  46. Var param2 located in register ecx }
  47. asm
  48. push %ebx
  49. // movl sysnr,%eax
  50. movl %edx,%ebx
  51. // movl param2,%ecx
  52. int $0x80
  53. pop %ebx
  54. cmpl $-4095,%eax
  55. jb .LSyscOK
  56. negl %eax
  57. call seterrno
  58. movl $-1,%eax
  59. .LSyscOK:
  60. end;
  61. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler; register; [public,alias:'FPC_SYSCALL3'];
  62. { Var sysnr located in register eax
  63. Var param1 located in register edx
  64. Var param2 located in register ecx
  65. Var param3 located at ebp+20 }
  66. asm
  67. push %ebx
  68. // movl sysnr,%eax
  69. movl %edx,%ebx
  70. // movl param2,%ecx
  71. movl param3,%edx
  72. int $0x80
  73. pop %ebx
  74. cmpl $-4095,%eax
  75. jb .LSyscOK
  76. negl %eax
  77. call seterrno
  78. movl $-1,%eax
  79. .LSyscOK:
  80. end;
  81. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler; register; [public,alias:'FPC_SYSCALL4'];
  82. { Var sysnr located in register eax
  83. Var param1 located in register edx
  84. Var param2 located in register ecx
  85. Var param3 located at ebp+20
  86. Var param4 located at ebp+16 }
  87. asm
  88. push %ebx
  89. push %esi
  90. // movl sysnr,%eax
  91. movl %edx,%ebx
  92. // movl param2,%ecx
  93. movl param3,%edx
  94. movl param4,%esi
  95. int $0x80
  96. pop %esi
  97. pop %ebx
  98. cmpl $-4095,%eax
  99. jb .LSyscOK
  100. negl %eax
  101. call seterrno
  102. movl $-1,%eax
  103. .LSyscOK:
  104. end;
  105. function FpSysCall(sysnr,param1,param2,param3,param4,param5 : TSysParam):TSysResult; assembler; register; [public,alias:'FPC_SYSCALL5'];
  106. { Var sysnr located in register eax
  107. Var param1 located in register edx
  108. Var param2 located in register ecx
  109. Var param3 located at ebp+20
  110. Var param4 located at ebp+16
  111. Var param5 located at ebp+12 }
  112. asm
  113. push %ebx
  114. push %esi
  115. push %edi
  116. // movl sysnr,%eax
  117. movl %edx,%ebx
  118. // movl param2,%ecx
  119. movl param3,%edx
  120. movl param4,%esi
  121. movl param5,%edi
  122. int $0x80
  123. pop %edi
  124. pop %esi
  125. pop %ebx
  126. cmpl $-4095,%eax
  127. jb .LSyscOK
  128. negl %eax
  129. call seterrno
  130. movl $-1,%eax
  131. .LSyscOK:
  132. end;
  133. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6: TSysParam):TSysResult; assembler; register; [public,alias:'FPC_SYSCALL6'];
  134. { Var sysnr located in register eax
  135. Var param1 located in register edx
  136. Var param2 located in register ecx
  137. Var param3 located at ebp+20
  138. Var param4 located at ebp+16
  139. Var param5 located at ebp+12
  140. Var param6 located at ebp+8 }
  141. asm
  142. push %ebx
  143. push %esi
  144. push %edi
  145. push %ebp
  146. // movl sysnr,%eax
  147. movl %edx,%ebx
  148. // movl param2,%ecx
  149. movl param3,%edx
  150. movl param4,%esi
  151. movl param5,%edi
  152. movl param6,%ebp
  153. int $0x80
  154. pop %ebp
  155. pop %edi
  156. pop %esi
  157. pop %ebx
  158. cmpl $-4095,%eax
  159. jb .LSyscOK
  160. negl %eax
  161. call seterrno
  162. movl $-1,%eax
  163. .LSyscOK:
  164. end;
  165. {No debugging for syslinux include !}
  166. {$IFDEF SYS_LINUX}
  167. {$UNDEF SYSCALL_DEBUG}
  168. {$ENDIF SYS_LINUX}