syscall.inc 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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;[public,alias:'FPC_SYSCALL0'];
  19. {
  20. This function puts the registers in place, does the call, and then
  21. copies back the registers as they are after the SysCall.
  22. }
  23. asm
  24. swi #0x900071
  25. cmn r0,#126
  26. bls .LDone
  27. rsb r4,r0,#0
  28. ldr r2,.Lthread_var
  29. ldr r2,[r2]
  30. ldr r0,.LErrno
  31. cmp r2,#0
  32. bne .LThread
  33. str r4,[r0,#4]
  34. mvn r0,#0
  35. b .LDone
  36. .LThread:
  37. mov pc,r2
  38. str r4,[r0]
  39. mvn r0,#0
  40. b .LDone
  41. .LErrno:
  42. .word Errno
  43. .Lthread_var:
  44. .word fpc_threadvar_relocate_proc
  45. .LDone:
  46. end ['r4'];
  47. function FpSysCall(sysnr,param1:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL1'];
  48. {
  49. This function puts the registers in place, does the call, and then
  50. copies back the registers as they are after the SysCall.
  51. }
  52. asm
  53. swi #0x900071
  54. cmn r0,#126
  55. bls .LDone
  56. rsb r4,r0,#0
  57. ldr r2,.Lthread_var
  58. ldr r2,[r2]
  59. ldr r0,.LErrno
  60. cmp r2,#0
  61. bne .LThread
  62. str r4,[r0,#4]
  63. mvn r0,#0
  64. b .LDone
  65. .LThread:
  66. mov pc,r2
  67. str r4,[r0]
  68. mvn r0,#0
  69. b .LDone
  70. .LErrno:
  71. .word Errno
  72. .Lthread_var:
  73. .word fpc_threadvar_relocate_proc
  74. .LDone:
  75. end ['r4'];
  76. function FpSysCall(sysnr,param1,param2:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL2'];
  77. {
  78. This function puts the registers in place, does the call, and then
  79. copies back the registers as they are after the SysCall.
  80. }
  81. asm
  82. swi #0x900071
  83. cmn r0,#126
  84. bls .LDone
  85. rsb r4,r0,#0
  86. ldr r2,.Lthread_var
  87. ldr r2,[r2]
  88. ldr r0,.LErrno
  89. cmp r2,#0
  90. bne .LThread
  91. str r4,[r0,#4]
  92. mvn r0,#0
  93. b .LDone
  94. .LThread:
  95. mov pc,r2
  96. str r4,[r0]
  97. mvn r0,#0
  98. b .LDone
  99. .LErrno:
  100. .word Errno
  101. .Lthread_var:
  102. .word fpc_threadvar_relocate_proc
  103. .LDone:
  104. end ['r4'];
  105. function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL3'];
  106. {
  107. This function puts the registers in place, does the call, and then
  108. copies back the registers as they are after the SysCall.
  109. }
  110. asm
  111. swi #0x900071
  112. cmn r0,#126
  113. bls .LDone
  114. rsb r4,r0,#0
  115. ldr r2,.Lthread_var
  116. ldr r2,[r2]
  117. ldr r0,.LErrno
  118. cmp r2,#0
  119. bne .LThread
  120. str r4,[r0,#4]
  121. mvn r0,#0
  122. b .LDone
  123. .LThread:
  124. mov pc,r2
  125. str r4,[r0]
  126. mvn r0,#0
  127. b .LDone
  128. .LErrno:
  129. .word Errno
  130. .Lthread_var:
  131. .word fpc_threadvar_relocate_proc
  132. .LDone:
  133. end ['r4'];
  134. function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL4'];
  135. {
  136. This function puts the registers in place, does the call, and then
  137. copies back the registers as they are after the SysCall.
  138. }
  139. asm
  140. ldr r4,param4
  141. swi #0x900071
  142. cmn r0,#126
  143. bls .LDone
  144. rsb r4,r0,#0
  145. ldr r2,.Lthread_var
  146. ldr r2,[r2]
  147. ldr r0,.LErrno
  148. cmp r2,#0
  149. bne .LThread
  150. str r4,[r0,#4]
  151. mvn r0,#0
  152. b .LDone
  153. .LThread:
  154. mov pc,r2
  155. str r4,[r0]
  156. mvn r0,#0
  157. b .LDone
  158. .LErrno:
  159. .word Errno
  160. .Lthread_var:
  161. .word fpc_threadvar_relocate_proc
  162. .LDone:
  163. end ['r4'];
  164. function FpSysCall(sysnr,param1,param2,param3,param4,param5:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL5'];
  165. {
  166. This function puts the registers in place, does the call, and then
  167. copies back the registers as they are after the SysCall.
  168. }
  169. asm
  170. ldr r5,param5
  171. ldr r4,param4
  172. swi #0x900071
  173. cmn r0,#126
  174. bls .LDone
  175. rsb r4,r0,#0
  176. ldr r2,.Lthread_var
  177. ldr r2,[r2]
  178. ldr r0,.LErrno
  179. cmp r2,#0
  180. bne .LThread
  181. str r4,[r0,#4]
  182. mvn r0,#0
  183. b .LDone
  184. .LThread:
  185. mov pc,r2
  186. str r4,[r0]
  187. mvn r0,#0
  188. b .LDone
  189. .LErrno:
  190. .word Errno
  191. .Lthread_var:
  192. .word fpc_threadvar_relocate_proc
  193. .LDone:
  194. end ['r4','r5'];
  195. function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6:TSysParam):TSysResult; assembler;[public,alias:'FPC_SYSCALL6'];
  196. {
  197. This function puts the registers in place, does the call, and then
  198. copies back the registers as they are after the SysCall.
  199. }
  200. asm
  201. ldr r6,param6
  202. ldr r5,param5
  203. ldr r4,param4
  204. swi #0x900071
  205. cmn r0,#126
  206. bls .LDone
  207. rsb r4,r0,#0
  208. ldr r2,.Lthread_var
  209. ldr r2,[r2]
  210. ldr r0,.LErrno
  211. cmp r2,#0
  212. bne .LThread
  213. str r4,[r0,#4]
  214. mvn r0,#0
  215. b .LDone
  216. .LThread:
  217. mov pc,r2
  218. str r4,[r0]
  219. mvn r0,#0
  220. b .LDone
  221. .LErrno:
  222. .word Errno
  223. .Lthread_var:
  224. .word fpc_threadvar_relocate_proc
  225. .LDone:
  226. end ['r4','r5','r6'];