2
0

syscall.inc 5.6 KB

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