syscall.inc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. {
  2. Copyright (c) 2002 by the Free Pascal development team
  3. Syscall implementation for linux m68k
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  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. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  15. MA 02111-1301, USA.
  16. ****************************************************************************
  17. }
  18. function FpSysCall(sysnr:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL0'];
  19. begin
  20. asm
  21. move.l sysnr, d0
  22. trap #0
  23. move.l d0, @Result
  24. end ['d0'];
  25. if (ptruint(result) > ptruint(-4096)) then
  26. begin
  27. seterrno(-result);
  28. result:=TSysResult(-1);
  29. end;
  30. end;
  31. function FpSysCall(sysnr,param1:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL1'];
  32. begin
  33. asm
  34. move.l sysnr, d0
  35. move.l param1, d1
  36. trap #0
  37. move.l d0, @Result
  38. end ['d0', 'd1'];
  39. if (ptruint(result) > ptruint(-4096)) then
  40. begin
  41. seterrno(-result);
  42. result:=TSysResult(-1);
  43. end;
  44. end;
  45. function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL2'];
  46. begin
  47. asm
  48. move.l sysnr, d0
  49. move.l param1, d1
  50. move.l param2, d2
  51. trap #0
  52. move.l d0, @Result
  53. end ['d0', 'd1', 'd2'];
  54. if (ptruint(result) > ptruint(-4096)) then
  55. begin
  56. seterrno(-result);
  57. result:=TSysResult(-1);
  58. end;
  59. end;
  60. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL3'];
  61. begin
  62. asm
  63. move.l sysnr, d0
  64. move.l param1, d1
  65. move.l param2, d2
  66. move.l param3, d3
  67. trap #0
  68. move.l d0, @Result
  69. end ['d0', 'd1', 'd2', 'd3'];
  70. if (ptruint(result) > ptruint(-4096)) then
  71. begin
  72. seterrno(-result);
  73. result:=TSysResult(-1);
  74. end;
  75. end;
  76. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL4'];
  77. begin
  78. asm
  79. move.l sysnr, d0
  80. move.l param1, d1
  81. move.l param2, d2
  82. move.l param3, d3
  83. move.l param4, d4
  84. trap #0
  85. move.l d0, @Result
  86. end ['d0', 'd1', 'd2', 'd3', 'd4'];
  87. if (ptruint(result) > ptruint(-4096)) then
  88. begin
  89. seterrno(-result);
  90. result:=TSysResult(-1);
  91. end;
  92. end;
  93. function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL5'];
  94. begin
  95. asm
  96. move.l sysnr, d0
  97. move.l param1, d1
  98. move.l param2, d2
  99. move.l param3, d3
  100. move.l param4, d4
  101. move.l param5, d5
  102. trap #0
  103. move.l d0, @Result
  104. end ['d0', 'd1', 'd2', 'd3', 'd4', 'd5'];
  105. if (ptruint(result) > ptruint(-4096)) then
  106. begin
  107. seterrno(-result);
  108. result:=TSysResult(-1);
  109. end;
  110. end;
  111. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL6'];
  112. begin
  113. asm
  114. move.l sysnr, d0
  115. move.l param1, d1
  116. move.l param2, d2
  117. move.l param3, d3
  118. move.l param4, d4
  119. move.l param5, d5
  120. move.l param6, a0
  121. trap #0
  122. move.l d0, @Result
  123. end ['d0', 'd1', 'd2', 'd3', 'd4', 'd5', 'a0'];
  124. if (ptruint(result) > ptruint(-4096)) then
  125. begin
  126. seterrno(-result);
  127. result:=TSysResult(-1);
  128. end;
  129. end;