syscall.inc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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 (result < 0) then seterrno(-result);
  26. end;
  27. function FpSysCall(sysnr,param1:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL1'];
  28. begin
  29. asm
  30. move.l sysnr, d0
  31. move.l param1, d1
  32. trap #0
  33. move.l d0, @Result
  34. end ['d0', 'd1'];
  35. if (result < 0) then seterrno(-result);
  36. end;
  37. function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL2'];
  38. begin
  39. asm
  40. move.l sysnr, d0
  41. move.l param1, d1
  42. move.l param2, d2
  43. trap #0
  44. move.l d0, @Result
  45. end ['d0', 'd1', 'd2'];
  46. if (result < 0) then seterrno(-result);
  47. end;
  48. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL3'];
  49. begin
  50. asm
  51. move.l sysnr, d0
  52. move.l param1, d1
  53. move.l param2, d2
  54. move.l param3, d3
  55. trap #0
  56. move.l d0, @Result
  57. end ['d0', 'd1', 'd2', 'd3'];
  58. if (result < 0) then seterrno(-result);
  59. end;
  60. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL4'];
  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. move.l param4, d4
  68. trap #0
  69. move.l d0, @Result
  70. end ['d0', 'd1', 'd2', 'd3', 'd4'];
  71. if (result < 0) then seterrno(-result);
  72. end;
  73. function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL5'];
  74. begin
  75. asm
  76. move.l sysnr, d0
  77. move.l param1, d1
  78. move.l param2, d2
  79. move.l param3, d3
  80. move.l param4, d4
  81. move.l param5, d5
  82. trap #0
  83. move.l d0, @Result
  84. end ['d0', 'd1', 'd2', 'd3', 'd4', 'd5'];
  85. if (result < 0) then seterrno(-result);
  86. end;
  87. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; [public,alias:'FPC_SYSCALL6'];
  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. move.l param6, a0
  97. trap #0
  98. move.l d0, @Result
  99. end ['d0', 'd1', 'd2', 'd3', 'd4', 'd5', 'a0'];
  100. if (result < 0) then seterrno(-result);
  101. end;