syscall.inc 5.4 KB

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