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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [synth/] [i386linux/] [current/] [src/] [syscall-i386-linux-1.0.S] - Blame information for rev 834

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

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

powered by: WebSVN 2.1.0

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