syscall.inc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2020 by Florian Klaempfl,
  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 system include !}
  12. {$IFDEF SYS_LINUX}
  13. {$UNDEF SYSCALL_DEBUG}
  14. {$ENDIF SYS_LINUX}
  15. {*****************************************************************************
  16. --- Main:The System Call Self ---
  17. *****************************************************************************}
  18. function FpSysCall(sysnr:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL0'];
  19. {
  20. Perform syscall and set errno variable if needed.
  21. }
  22. asm
  23. syscall
  24. movi a4,-4095
  25. bgeu a2,a4,.Lnoexit
  26. retw
  27. .Lnoexit:
  28. neg a2,a2
  29. call4 seterrno
  30. end;
  31. function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL1'];
  32. {
  33. Perform syscall and set errno variable if needed.
  34. }
  35. asm
  36. mov a6,param1
  37. syscall
  38. movi a4,-4095
  39. bgeu a2,a4,.Lnoexit
  40. retw
  41. .Lnoexit:
  42. neg a2,a2
  43. call4 seterrno
  44. end;
  45. function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL2'];
  46. {
  47. Perform syscall and set errno variable if needed.
  48. }
  49. asm
  50. mov a6,param1
  51. mov a3,param2
  52. syscall
  53. movi a4,-4095
  54. bgeu a2,a4,.Lnoexit
  55. retw
  56. .Lnoexit:
  57. neg a2,a2
  58. call4 seterrno
  59. end;
  60. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL3'];
  61. {
  62. Perform syscall and set errno variable if needed.
  63. }
  64. asm
  65. mov a6,param1
  66. mov a3,param2
  67. mov a4,param3
  68. syscall
  69. movi a4,-4095
  70. bgeu a2,a4,.Lnoexit
  71. retw
  72. .Lnoexit:
  73. neg a2,a2
  74. call4 seterrno
  75. end;
  76. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL4'];
  77. {
  78. Perform syscall and set errno variable if needed.
  79. }
  80. asm
  81. mov a9,param1
  82. mov a3,param2
  83. mov a4,param3
  84. mov a5,param4
  85. mov a6,a9
  86. syscall
  87. movi a4,-4095
  88. bgeu a2,a4,.Lnoexit
  89. retw
  90. .Lnoexit:
  91. neg a2,a2
  92. call4 seterrno
  93. end;
  94. function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL5'];
  95. {
  96. Perform syscall and set errno variable if needed.
  97. }
  98. asm
  99. mov a9,param1
  100. mov a3,param2
  101. mov a4,param3
  102. mov a5,param4
  103. mov a8,param5
  104. mov a6,a9
  105. syscall
  106. movi a4,-4095
  107. bgeu a2,a4,.Lnoexit
  108. retw
  109. .Lnoexit:
  110. neg a2,a2
  111. call4 seterrno
  112. end;
  113. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL6'];
  114. {
  115. Perform syscall and set errno variable if needed.
  116. }
  117. asm
  118. mov a9,param1
  119. mov a3,param2
  120. mov a4,param3
  121. mov a5,param4
  122. mov a8,param5
  123. mov a6,a9
  124. l32i a9,param6
  125. syscall
  126. movi a4,-4095
  127. bgeu a2,a4,.Lnoexit
  128. retw
  129. .Lnoexit:
  130. neg a2,a2
  131. call4 seterrno
  132. end;