~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/linux/i386/syscall.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    This file is part of the Free Pascal run time library.
 
3
    Copyright (c) 1999-2000 by Michael Van Canneyt,
 
4
    member of the Free Pascal development team.
 
5
 
 
6
    The syscalls for the new RTL, moved to platform dependant dir.
 
7
    Old linux calling convention is still kept.
 
8
 
 
9
    See the file COPYING.FPC, included in this distribution,
 
10
    for details about the copyright.
 
11
 
 
12
    This program is distributed in the hope that it will be useful,
 
13
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
15
 
 
16
 **********************************************************************}
 
17
 
 
18
{$ASMMODE ATT}
 
19
 
 
20
Procedure fpc_geteipasebx;[external name 'fpc_geteipasebx'];
 
21
 
 
22
function FpSysCall(sysnr:TSysParam):TSysResult; assembler; oldfpccall;[public,alias:'FPC_SYSCALL0'];
 
23
 
 
24
asm
 
25
{ load the registers... }
 
26
  movl  sysnr,%eax
 
27
  int   $0x80
 
28
  cmpl  $-4095,%eax
 
29
  jb   .LSyscOK
 
30
  negl  %eax
 
31
{$ifdef FPC_PIC}
 
32
  call  fpc_geteipasebx
 
33
  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
 
34
  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
 
35
  movl  (%ecx),%ecx
 
36
  movl  Errno@GOT(%ebx),%edi
 
37
{$else FPC_PIC}
 
38
  leal  Errno,%edi
 
39
  movl  fpc_threadvar_relocate_proc,%ecx
 
40
{$endif FPC_PIC}
 
41
  testl %ecx,%ecx
 
42
  jne   .LThread
 
43
  movl  %eax,4(%edi)
 
44
  jmp   .LNoThread
 
45
.LThread:
 
46
  movl  %eax,%ebx
 
47
  movl  (%edi),%eax
 
48
  call  *%ecx
 
49
  movl  %ebx,(%eax)
 
50
.LNoThread:
 
51
  movl  $-1,%eax
 
52
.LSyscOK:
 
53
end;
 
54
 
 
55
function FpSysCall(sysnr,param1 : TSysParam):TSysResult; assembler; oldfpccall;[public,alias:'FPC_SYSCALL1'];
 
56
 
 
57
asm
 
58
{ load the registers... }
 
59
  movl sysnr,%eax
 
60
  movl param1,%ebx
 
61
  int $0x80
 
62
  cmpl  $-4095,%eax
 
63
  jb   .LSyscOK
 
64
  negl  %eax
 
65
{$ifdef FPC_PIC}
 
66
  call  fpc_geteipasebx
 
67
  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
 
68
  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
 
69
  movl  (%ecx),%ecx
 
70
  movl  Errno@GOT(%ebx),%edi
 
71
{$else FPC_PIC}
 
72
  leal  Errno,%edi
 
73
  movl  fpc_threadvar_relocate_proc,%ecx
 
74
{$endif FPC_PIC}
 
75
  testl %ecx,%ecx
 
76
  jne   .LThread
 
77
  movl  %eax,4(%edi)
 
78
  jmp   .LNoThread
 
79
.LThread:
 
80
  movl  %eax,%ebx
 
81
  movl  (%edi),%eax
 
82
  call  *%ecx
 
83
  movl  %ebx,(%eax)
 
84
.LNoThread:
 
85
  movl  $-1,%eax
 
86
.LSyscOK:
 
87
end;
 
88
 
 
89
function FpSysCall(sysnr,param1,param2 : TSysParam):TSysResult; assembler; oldfpccall; [public,alias:'FPC_SYSCALL2'];
 
90
 
 
91
asm
 
92
{ load the registers... }
 
93
  movl sysnr,%eax
 
94
  movl param1,%ebx
 
95
  movl param2,%ecx
 
96
  int $0x80
 
97
  cmpl  $-4095,%eax
 
98
  jb   .LSyscOK
 
99
  negl  %eax
 
100
{$ifdef FPC_PIC}
 
101
  call  fpc_geteipasebx
 
102
  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
 
103
  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
 
104
  movl  (%ecx),%ecx
 
105
  movl  Errno@GOT(%ebx),%edi
 
106
{$else FPC_PIC}
 
107
  leal  Errno,%edi
 
108
  movl  fpc_threadvar_relocate_proc,%ecx
 
109
{$endif FPC_PIC}
 
110
  testl %ecx,%ecx
 
111
  jne   .LThread
 
112
  movl  %eax,4(%edi)
 
113
  jmp   .LNoThread
 
114
.LThread:
 
115
  movl  %eax,%ebx
 
116
  movl (%edi),%eax
 
117
  call  *%ecx
 
118
  movl  %ebx,(%eax)
 
119
.LNoThread:
 
120
  movl  $-1,%eax
 
121
.LSyscOK:
 
122
end;
 
123
 
 
124
function FpSysCall(sysnr,param1,param2,param3:TSysParam):TSysResult; assembler; oldfpccall; [public,alias:'FPC_SYSCALL3'];
 
125
 
 
126
asm
 
127
{ load the registers... }
 
128
  movl sysnr,%eax
 
129
  movl param1,%ebx
 
130
  movl param2,%ecx
 
131
  movl param3,%edx
 
132
  int $0x80
 
133
  cmpl  $-4095,%eax
 
134
  jb   .LSyscOK
 
135
  negl  %eax
 
136
{$ifdef FPC_PIC}
 
137
  call  fpc_geteipasebx
 
138
  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
 
139
  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
 
140
  movl  (%ecx),%ecx
 
141
  movl  Errno@GOT(%ebx),%edi
 
142
{$else FPC_PIC}
 
143
  leal  Errno,%edi
 
144
  movl  fpc_threadvar_relocate_proc,%ecx
 
145
{$endif FPC_PIC}
 
146
  testl %ecx,%ecx
 
147
  jne   .LThread
 
148
  movl  %eax,4(%edi)
 
149
  jmp   .LNoThread
 
150
.LThread:
 
151
  movl  %eax,%ebx
 
152
  movl  (%edi),%eax
 
153
  call  *%ecx
 
154
  movl  %ebx,(%eax)
 
155
.LNoThread:
 
156
  movl  $-1,%eax
 
157
.LSyscOK:
 
158
end;
 
159
 
 
160
function FpSysCall(sysnr,param1,param2,param3,param4:TSysParam):TSysResult; assembler; oldfpccall; [public,alias:'FPC_SYSCALL4'];
 
161
 
 
162
asm
 
163
{ load the registers... }
 
164
  movl sysnr,%eax
 
165
  movl param1,%ebx
 
166
  movl param2,%ecx
 
167
  movl param3,%edx
 
168
  movl param4,%esi
 
169
  int $0x80
 
170
  cmpl  $-4095,%eax
 
171
  jb   .LSyscOK
 
172
  negl  %eax
 
173
{$ifdef FPC_PIC}
 
174
  call  fpc_geteipasebx
 
175
  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
 
176
  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
 
177
  movl  (%ecx),%ecx
 
178
  movl  Errno@GOT(%ebx),%edi
 
179
{$else FPC_PIC}
 
180
  leal  Errno,%edi
 
181
  movl  fpc_threadvar_relocate_proc,%ecx
 
182
{$endif FPC_PIC}
 
183
  testl %ecx,%ecx
 
184
  jne   .LThread
 
185
  movl  %eax,4(%edi)
 
186
  jmp   .LNoThread
 
187
.LThread:
 
188
  movl  %eax,%ebx
 
189
  movl  (%edi),%eax
 
190
  call  *%ecx
 
191
  movl  %ebx,(%eax)
 
192
.LNoThread:
 
193
  movl  $-1,%eax
 
194
.LSyscOK:
 
195
end;
 
196
 
 
197
function FpSysCall(sysnr,param1,param2,param3,param4,param5 : TSysParam):TSysResult; assembler; oldfpccall;[public,alias:'FPC_SYSCALL5'];
 
198
 
 
199
asm
 
200
{ load the registers... }
 
201
  movl sysnr,%eax
 
202
  movl param1,%ebx
 
203
  movl param2,%ecx
 
204
  movl param3,%edx
 
205
  movl param4,%esi
 
206
  movl param5,%edi
 
207
  int $0x80
 
208
  cmpl  $-4095,%eax
 
209
  jb   .LSyscOK
 
210
  negl  %eax
 
211
{$ifdef FPC_PIC}
 
212
  call  fpc_geteipasebx
 
213
  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
 
214
  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
 
215
  movl  (%ecx),%ecx
 
216
  movl  Errno@GOT(%ebx),%edi
 
217
{$else FPC_PIC}
 
218
  leal  Errno,%edi
 
219
  movl  fpc_threadvar_relocate_proc,%ecx
 
220
{$endif FPC_PIC}
 
221
  testl %ecx,%ecx
 
222
  jne   .LThread
 
223
  movl  %eax,4(%edi)
 
224
  jmp   .LNoThread
 
225
.LThread:
 
226
  movl  %eax,%ebx
 
227
  movl  (%edi),%eax
 
228
  call  *%ecx
 
229
  movl  %ebx,(%eax)
 
230
.LNoThread:
 
231
  movl  $-1,%eax
 
232
.LSyscOK:
 
233
end;
 
234
 
 
235
{.$ifdef notsupported}
 
236
{ Only 5 params are pushed, so it'll not work as expected (PFV) }
 
237
function FpSysCall(sysnr,param1,param2,param3,param4,param5,param6 : TSysParam):TSysResult; assembler; oldfpccall;[public,alias:'FPC_SYSCALL6'];
 
238
 
 
239
asm
 
240
{ load the registers... }
 
241
  push %ebp
 
242
  movl sysnr,%eax
 
243
  movl param1,%ebx
 
244
  movl param2,%ecx
 
245
  movl param3,%edx
 
246
  movl param4,%esi
 
247
  movl param5,%edi
 
248
  movl param6,%ebp
 
249
  int $0x80
 
250
  pop  %ebp
 
251
  cmpl  $-4095,%eax
 
252
  jb   .LSyscOK
 
253
  negl  %eax
 
254
{$ifdef FPC_PIC}
 
255
  call  fpc_geteipasebx
 
256
  addl  $_GLOBAL_OFFSET_TABLE_,%ebx
 
257
  movl  fpc_threadvar_relocate_proc@GOT(%ebx),%ecx
 
258
  movl  (%ecx),%ecx
 
259
  movl  Errno@GOT(%ebx),%edi
 
260
{$else FPC_PIC}
 
261
  leal  Errno,%edi
 
262
  movl  fpc_threadvar_relocate_proc,%ecx
 
263
{$endif FPC_PIC}
 
264
  testl %ecx,%ecx
 
265
  jne   .LThread
 
266
  movl  %eax,4(%edi)
 
267
  jmp   .LNoThread
 
268
.LThread:
 
269
  movl  %eax,%ebx
 
270
  movl  (%edi),%eax
 
271
  call  *%ecx
 
272
  movl  %ebx,(%eax)
 
273
.LNoThread:
 
274
  movl  $-1,%eax
 
275
.LSyscOK:
 
276
end;
 
277
{.$endif notsupported}
 
278
 
 
279
{No debugging for syslinux include !}
 
280
{$IFDEF SYS_LINUX}
 
281
  {$UNDEF SYSCALL_DEBUG}
 
282
{$ENDIF SYS_LINUX}