syscall.inc 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2003 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 syslinux 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; nostackframe; [public,alias:'FPC_SYSCALL0'];
  19. {
  20. Perform syscall and set errno variable if needed.
  21. }
  22. asm
  23. swi #0x900071
  24. cmn r0,#126
  25. movls pc,lr
  26. stmfd sp!,{lr}
  27. rsb r0,r0,#0
  28. bl seterrno
  29. mvn r0,#0
  30. ldmfd sp!,{pc}
  31. end;
  32. procedure FPC_SYSCALL; external name 'FPC_SYSCALL0';
  33. function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler; nostackframe; [public,alias:'FPC_SYSCALL1'];
  34. {
  35. Jump to FPC_SYSCALL0 because code for FPC_SYSCALL0-FPC_SYSCALL3 is the same.
  36. }
  37. asm
  38. b FPC_SYSCALL
  39. end;
  40. function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler; nostackframe; [public,alias:'FPC_SYSCALL2'];
  41. {
  42. Jump to FPC_SYSCALL0 because code for FPC_SYSCALL0-FPC_SYSCALL3 is the same.
  43. }
  44. asm
  45. b FPC_SYSCALL
  46. end;
  47. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler; nostackframe; [public,alias:'FPC_SYSCALL3'];
  48. {
  49. Jump to FPC_SYSCALL0 because code for FPC_SYSCALL0-FPC_SYSCALL3 is the same.
  50. }
  51. asm
  52. b FPC_SYSCALL
  53. end;
  54. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler; [public,alias:'FPC_SYSCALL4'];
  55. {
  56. This function loads some parameters from stack and calls FPC_SYSCALL0.
  57. }
  58. asm
  59. stmfd sp!,{r4}
  60. ldr r4,param4
  61. bl FPC_SYSCALL
  62. ldmfd sp!,{r4}
  63. end;
  64. function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
  65. {
  66. This function loads some parameters from stack and calls FPC_SYSCALL0.
  67. }
  68. asm
  69. stmfd sp!,{r4,r5}
  70. ldr r4,param4
  71. ldr r5,param5
  72. bl FPC_SYSCALL
  73. ldmfd sp!,{r4,r5}
  74. end;
  75. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
  76. {
  77. This function loads some parameters from stack and calls FPC_SYSCALL0.
  78. }
  79. asm
  80. stmfd sp!,{r4,r5,r6}
  81. ldr r4,param4
  82. ldr r5,param5
  83. ldr r6,param6
  84. bl FPC_SYSCALL
  85. ldmfd sp!,{r4,r5,r6}
  86. end;