syscall.inc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2006 Sven Barth
  4. member of the Free Pascal development team.
  5. m68k syscall headers for Linux
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  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.
  11. **********************************************************************}
  12. function FpSysCall(sysnr:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL0'];
  13. begin
  14. asm
  15. move.l sysnr, d0
  16. trap #0
  17. move.l d0, @Result
  18. end ['d0'];
  19. if (ptruint(result) > ptruint(-4096)) then
  20. begin
  21. seterrno(-result);
  22. result:=TSysResult(-1);
  23. end;
  24. end;
  25. function FpSysCall(sysnr,param1:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL1'];
  26. begin
  27. asm
  28. move.l sysnr, d0
  29. move.l param1, d1
  30. trap #0
  31. move.l d0, @Result
  32. end ['d0', 'd1'];
  33. if (ptruint(result) > ptruint(-4096)) then
  34. begin
  35. seterrno(-result);
  36. result:=TSysResult(-1);
  37. end;
  38. end;
  39. function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL2'];
  40. begin
  41. asm
  42. move.l sysnr, d0
  43. move.l param1, d1
  44. move.l param2, d2
  45. trap #0
  46. move.l d0, @Result
  47. end ['d0', 'd1', 'd2'];
  48. if (ptruint(result) > ptruint(-4096)) then
  49. begin
  50. seterrno(-result);
  51. result:=TSysResult(-1);
  52. end;
  53. end;
  54. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL3'];
  55. begin
  56. asm
  57. move.l sysnr, d0
  58. move.l param1, d1
  59. move.l param2, d2
  60. move.l param3, d3
  61. trap #0
  62. move.l d0, @Result
  63. end ['d0', 'd1', 'd2', 'd3'];
  64. if (ptruint(result) > ptruint(-4096)) then
  65. begin
  66. seterrno(-result);
  67. result:=TSysResult(-1);
  68. end;
  69. end;
  70. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL4'];
  71. begin
  72. asm
  73. move.l sysnr, d0
  74. move.l param1, d1
  75. move.l param2, d2
  76. move.l param3, d3
  77. move.l param4, d4
  78. trap #0
  79. move.l d0, @Result
  80. end ['d0', 'd1', 'd2', 'd3', 'd4'];
  81. if (ptruint(result) > ptruint(-4096)) then
  82. begin
  83. seterrno(-result);
  84. result:=TSysResult(-1);
  85. end;
  86. end;
  87. function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL5'];
  88. begin
  89. asm
  90. move.l sysnr, d0
  91. move.l param1, d1
  92. move.l param2, d2
  93. move.l param3, d3
  94. move.l param4, d4
  95. move.l param5, d5
  96. trap #0
  97. move.l d0, @Result
  98. end ['d0', 'd1', 'd2', 'd3', 'd4', 'd5'];
  99. if (ptruint(result) > ptruint(-4096)) then
  100. begin
  101. seterrno(-result);
  102. result:=TSysResult(-1);
  103. end;
  104. end;
  105. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL6'];
  106. begin
  107. asm
  108. move.l sysnr, d0
  109. move.l param1, d1
  110. move.l param2, d2
  111. move.l param3, d3
  112. move.l param4, d4
  113. move.l param5, d5
  114. move.l param6, a0
  115. trap #0
  116. move.l d0, @Result
  117. end ['d0', 'd1', 'd2', 'd3', 'd4', 'd5', 'a0'];
  118. if (ptruint(result) > ptruint(-4096)) then
  119. begin
  120. seterrno(-result);
  121. result:=TSysResult(-1);
  122. end;
  123. end;