OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [synth/] [i386linux/] [v2_0/] [src/] [syscall-i386-linux-1.0.S] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//=============================================================================
2
//
3
//      syscall-i386-linux-1.0.S
4
//
5
//      Linux system call interface functions for i386.
6
//
7
//=============================================================================
8
//####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
// for more details.
21
//
22
// You should have received a copy of the GNU General Public License along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//=============================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):   proven
44
// Contributors:proven,bartv
45
// Date:        1998-10-06
46
// Description: Machine dependent syscalls for i386/i486/i586
47
//
48
//####DESCRIPTIONEND####
49
//
50
//=============================================================================
51
 
52
// The numbers come from 
53
#define SYS_setup               0 // Used only by init, to get system going.
54
#define SYS_exit                1
55
#define SYS_fork                2
56
#define SYS_read                3
57
#define SYS_write               4
58
#define SYS_open                5
59
#define SYS_close               6
60
#define SYS_waitpid             7
61
#define SYS_creat               8
62
#define SYS_link                9
63
#define SYS_unlink              10
64
#define SYS_execve              11
65
#define SYS_chdir               12
66
#define SYS_time                13
67
#define SYS_prev_mknod          14
68
#define SYS_chmod               15
69
#define SYS_lchown              16
70
#define SYS_break               17
71
#define SYS_oldstat             18
72
#define SYS_lseek               19
73
#define SYS_getpid              20
74
#define SYS_mount               21
75
#define SYS_umount              22
76
#define SYS_setuid              23
77
#define SYS_getuid              24
78
#define SYS_stime               25
79
#define SYS_ptrace              26
80
#define SYS_alarm               27
81
#define SYS_oldfstat            28
82
#define SYS_pause               29
83
#define SYS_utime               30
84
#define SYS_stty                31
85
#define SYS_gtty                32
86
#define SYS_access              33
87
#define SYS_nice                34
88
#define SYS_ftime               35
89
#define SYS_sync                36
90
#define SYS_kill                37
91
#define SYS_rename              38
92
#define SYS_mkdir               39
93
#define SYS_rmdir               40
94
#define SYS_dup                 41
95
#define SYS_pipe                42
96
#define SYS_times               43
97
#define SYS_prof                44
98
#define SYS_brk                 45
99
#define SYS_setgid              46
100
#define SYS_getgid              47
101
#define SYS_signal              48
102
#define SYS_geteuid             49
103
#define SYS_getegid             50
104
#define SYS_acct                51
105
#define SYS_phys                52
106
#define SYS_lock                53
107
#define SYS_ioctl               54
108
#define SYS_fcntl               55
109
#define SYS_mpx                 56
110
#define SYS_setpgid             57
111
#define SYS_ulimit              58
112
#define SYS_oldolduname         59
113
#define SYS_umask               60
114
#define SYS_chroot              61
115
#define SYS_prev_ustat          62
116
#define SYS_dup2                63
117
#define SYS_getppid             64
118
#define SYS_getpgrp             65
119
#define SYS_setsid              66
120
#define SYS_sigaction           67
121
#define SYS_siggetmask          68
122
#define SYS_sigsetmask          69
123
#define SYS_setreuid            70
124
#define SYS_setregid            71
125
#define SYS_sigsuspend          72
126
#define SYS_sigpending          73
127
#define SYS_sethostname         74
128
#define SYS_setrlimit           75
129
#define SYS_getrlimit           76
130
#define SYS_getrusage           77
131
#define SYS_gettimeofday        78
132
#define SYS_settimeofday        79
133
#define SYS_getgroups           80
134
#define SYS_setgroups           81
135
#define SYS_select              82
136
#define SYS_symlink             83
137
#define SYS_oldlstat            84
138
#define SYS_readlink            85
139
#define SYS_uselib              86
140
#define SYS_swapon              87
141
#define SYS_reboot              88
142
#define SYS_readdir             89
143
#define SYS_mmap                90
144
#define SYS_munmap              91
145
#define SYS_truncate            92
146
#define SYS_ftruncate           93
147
#define SYS_fchmod              94
148
#define SYS_fchown              95
149
#define SYS_getpriority         96
150
#define SYS_setpriority         97
151
#define SYS_profil              98
152
#define SYS_statfs              99
153
#define SYS_fstatfs             100
154
#define SYS_ioperm              101
155
#define SYS_socketcall          102
156
#define SYS_klog                103
157
#define SYS_setitimer           104
158
#define SYS_getitimer           105
159
#define SYS_prev_stat           106
160
#define SYS_prev_lstat          107
161
#define SYS_prev_fstat          108
162
#define SYS_olduname            109
163
#define SYS_iopl                110
164
#define SYS_vhangup             111
165
#define SYS_idle                112
166
#define SYS_vm86old             113
167
#define SYS_wait4               114
168
#define SYS_swapoff             115
169
#define SYS_sysinfo             116
170
#define SYS_ipc                 117
171
#define SYS_fsync               118
172
#define SYS_sigreturn           119
173
#define SYS_clone               120
174
#define SYS_setdomainname       121
175
#define SYS_uname               122
176
#define SYS_modify_ldt          123
177
#define SYS_adjtimex            124
178
#define SYS_mprotect            125
179
#define SYS_sigprocmask         126
180
#define SYS_create_module       127
181
#define SYS_init_module         128
182
#define SYS_delete_module       129
183
#define SYS_get_kernel_syms     130
184
#define SYS_quotactl            131
185
#define SYS_getpgid             132
186
#define SYS_fchdir              133
187
#define SYS_bdflush             134
188
#define SYS_sysfs               135
189
#define SYS_personality         136
190
#define SYS_afs_syscall         137 // Syscall for Andrew File System
191
#define SYS_setfsuid            138
192
#define SYS_setfsgid            139
193
#define SYS__llseek             140
194
#define SYS_getdents            141
195
#define SYS__newselect          142
196
#define SYS_flock               143
197
#define SYS_syscall_flock       143
198
#define SYS_msync               144
199
#define SYS_readv               145
200
#define SYS_syscall_readv       145
201
#define SYS_writev              146
202
#define SYS_syscall_writev      146
203
#define SYS_getsid              147
204
#define SYS_fdatasync           148
205
#define SYS__sysctl             149
206
#define SYS_mlock               150
207
#define SYS_munlock             151
208
#define SYS_mlockall            152
209
#define SYS_munlockall          153
210
#define SYS_sched_setparam      154
211
#define SYS_sched_getparam      155
212
#define SYS_sched_setscheduler  156
213
#define SYS_sched_getscheduler  157
214
#define SYS_sched_yield         158
215
#define SYS_sched_get_priority_max      159
216
#define SYS_sched_get_priority_min      160
217
#define SYS_sched_rr_get_interval       161
218
#define SYS_nanosleep           162
219
#define SYS_mremap              163
220
#define SYS_setresuid           164
221
#define SYS_getresuid           165
222
#define SYS_vm86                166
223
#define SYS_query_module        167
224
#define SYS_poll                168
225
#define SYS_nfsservctl          169
226
#define SYS_setresgid           170
227
#define SYS_getresgid           171
228
#define SYS_prctl               172
229
#define SYS_rt_sigreturn        173
230
#define SYS_rt_sigaction        174
231
#define SYS_rt_sigprocmask      175
232
#define SYS_rt_sigpending       176
233
#define SYS_rt_sigtimedwait     177
234
#define SYS_rt_sigqueueinfo     178
235
#define SYS_rt_sigsuspend       179
236
#define SYS_pread               180
237
#define SYS_pwrite              181
238
#define SYS_chown               182
239
#define SYS_getcwd              183
240
#define SYS_capget              184
241
#define SYS_capset              185
242
#define SYS_sigaltstack         186
243
#define SYS_sendfile            187
244
#define SYS_getpmsg             188
245
#define SYS_putpmsg             189
246
#define SYS_vfork               190
247
#define SYS_ugetrlimit          191
248
#define SYS_mmap2               192
249
#define SYS_truncate64          193
250
#define SYS_ftruncate64         194
251
#define SYS_stat64              195
252
#define SYS_lstat64             196
253
#define SYS_fstat64             197
254
#define SYS_lchown32            198
255
#define SYS_getuid32            199
256
#define SYS_getgid32            200
257
#define SYS_geteuid32           201
258
#define SYS_getegid32           202
259
#define SYS_setreuid32          203
260
#define SYS_setregid32          204
261
#define SYS_getgroups32         205
262
#define SYS_setgroups32         206
263
#define SYS_fchown32            207
264
#define SYS_setresuid32         208
265
#define SYS_getresuid32         209
266
#define SYS_setresgid32         210
267
#define SYS_getresgid32         211
268
#define SYS_chown32             212
269
#define SYS_setuid32            213
270
#define SYS_setgid32            214
271
#define SYS_setfsuid32          215
272
#define SYS_setfsgid32          216
273
#define SYS_pivot_root          217
274
#define SYS_mincore             218
275
#define SYS_madvise             219
276
#define SYS_madvise1            219
277
#define SYS_getdents64          220
278
#define SYS_fcntl64             221
279
 
280
 
281
#define NAME(X) cyg_hal_sys_##X
282
#define END(X)  1: ; .type NAME(X),@function ; .size NAME(X),1b - NAME(X)
283
 
284
#define SYSCALL0(x)                             \
285
        .globl NAME(x) ;                        \
286
                                                \
287
NAME(x):                                        \
288
                                                \
289
        push %ebx;                              \
290
        lea     SYS_##x, %eax;                  \
291
        int $0x80;                              \
292
        pop %ebx;                               \
293
        ret;                                    \
294
                                                \
295
        END(x)
296
 
297
#define SYSCALL1(x)                             \
298
        .globl NAME(x) ;                        \
299
                                                \
300
NAME(x):                                        \
301
                                                \
302
        push %ebx;                              \
303
        mov 8(%esp), %ebx;                      \
304
        lea     SYS_##x, %eax;                  \
305
        int $0x80;                              \
306
        pop %ebx;                               \
307
        ret;                                    \
308
                                                \
309
    END(x)
310
 
311
#define SYSCALL2(x)                             \
312
        .globl NAME(x) ;                        \
313
                                                \
314
NAME(x):                                        \
315
                                                \
316
        push %ebx;                              \
317
        mov 8(%esp), %ebx;                      \
318
        mov 12(%esp), %ecx;                     \
319
        lea     SYS_##x, %eax;                  \
320
        int $0x80;                              \
321
        pop %ebx;                               \
322
        ret;                                    \
323
                                                \
324
    END(x)
325
 
326
#define STATCALL2(x)                            \
327
   .globl NAME(x) ;                             \
328
                                                \
329
NAME(x):                                        \
330
                                                \
331
        push %ebx;                              \
332
        mov 8(%esp), %ebx;                      \
333
        mov 12(%esp), %ecx;                     \
334
        lea SYS_prev_##x, %eax;                 \
335
        int $0x80;                              \
336
        pop %ebx;                               \
337
        ret;                                    \
338
        END(x)
339
 
340
#define SYSCALL3(x)                             \
341
        .globl NAME(x) ;                        \
342
                                                \
343
NAME(x):                                        \
344
                                                \
345
        push %ebx;                              \
346
        mov 8(%esp), %ebx;                      \
347
        mov 12(%esp), %ecx;                     \
348
        mov 16(%esp), %edx;                     \
349
        lea     SYS_##x, %eax;                  \
350
        int $0x80;                              \
351
        pop %ebx;                               \
352
        ret;                                    \
353
        END(x)
354
 
355
 
356
#define SYSCALL4(x)                             \
357
        .globl NAME(x) ;                        \
358
                                                \
359
NAME(x):                                        \
360
                                                \
361
        push %ebx;                              \
362
        push %esi;                              \
363
        mov 12(%esp), %ebx;                     \
364
        mov 16(%esp), %ecx;                     \
365
        mov 20(%esp), %edx;                     \
366
        mov 24(%esp), %esi;                     \
367
        lea     SYS_##x, %eax;                  \
368
        int $0x80;                              \
369
        pop %esi;                               \
370
        pop %ebx;                               \
371
        ret;                                    \
372
        END(x)
373
 
374
#define SYSCALL5(x)                             \
375
        .globl NAME(x) ;                        \
376
                                                \
377
NAME(x):                                        \
378
                                                \
379
        push %ebx;                              \
380
        push %esi;                              \
381
        push %edi;                              \
382
        mov 16(%esp), %ebx;                     \
383
        mov 20(%esp), %ecx;                     \
384
        mov 24(%esp), %edx;                     \
385
        mov 28(%esp), %esi;                     \
386
        mov 32(%esp), %edi;                     \
387
        lea     SYS_##x, %eax;                  \
388
        int $0x80;                              \
389
        pop %edi;                               \
390
        pop %esi;                               \
391
        pop %ebx;                               \
392
        ret;                                    \
393
        END(x)
394
 
395
 
396
//==========================================================================
397
// Initial asm stuff for all functions.
398
        .text
399
        .align  2
400
 
401
SYSCALL1(exit)
402
SYSCALL0(fork)
403
SYSCALL3(read)
404
SYSCALL3(write)
405
SYSCALL3(open)
406
SYSCALL1(close)
407
SYSCALL3(waitpid)
408
SYSCALL2(creat)
409
SYSCALL2(link)
410
SYSCALL1(unlink)
411
SYSCALL3(execve)
412
SYSCALL1(chdir)
413
SYSCALL1(time)
414
SYSCALL2(chmod)
415
SYSCALL3(lseek)
416
SYSCALL0(getpid)
417
SYSCALL0(getuid)
418
SYSCALL1(nice)
419
SYSCALL2(kill)
420
SYSCALL1(dup)
421
SYSCALL1(pipe)
422
SYSCALL1(brk)
423
SYSCALL3(ioctl)
424
SYSCALL3(fcntl)
425
SYSCALL1(chroot)
426
SYSCALL2(dup2)
427
SYSCALL3(sigaction)
428
SYSCALL2(gettimeofday)
429
SYSCALL1(mmap)
430
SYSCALL2(socketcall)
431
SYSCALL3(setitimer)
432
SYSCALL3(sigprocmask)
433
SYSCALL5(_newselect)
434
SYSCALL3(readv)
435
SYSCALL3(writev)
436
SYSCALL1(fdatasync)
437
SYSCALL2(getcwd)
438
SYSCALL2(access)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.