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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [sys/] [linux/] [sys/] [syscall.h] - Blame information for rev 1773

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

Line No. Rev Author Line
1 1010 ivang
/* libc/sys/linux/syscall.h - Linux system calls, common definitions */
2
 
3
/* Written 2000 by Werner Almesberger */
4
 
5
 
6
#ifndef SYSCALL_H
7
 
8
#include <sys/errno.h>
9
#include <asm/unistd.h>
10
 
11
 
12
/*
13
 * Note: several system calls are for SysV or BSD compatibility, or are
14
 * specific Linuxisms. Most of those system calls are not implemented in
15
 * this library.
16
 */
17
 
18
 
19
#if defined(__PIC__) && defined(__i386__)
20
 
21
/*
22
 * PIC uses %ebx, so we need to save it during system calls
23
 */
24
 
25
#undef _syscall1
26
#define _syscall1(type,name,type1,arg1) \
27
type name(type1 arg1) \
28
{ \
29
long __res; \
30
__asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
31
        : "=a" (__res) \
32
        : "0" (__NR_##name),"r" ((long)(arg1))); \
33
__syscall_return(type,__res); \
34
}
35
 
36
#undef _syscall2
37
#define _syscall2(type,name,type1,arg1,type2,arg2) \
38
type name(type1 arg1,type2 arg2) \
39
{ \
40
long __res; \
41
__asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
42
        : "=a" (__res) \
43
        : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2))); \
44
__syscall_return(type,__res); \
45
}
46
 
47
#undef _syscall3
48
#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
49
type name(type1 arg1,type2 arg2,type3 arg3) \
50
{ \
51
long __res; \
52
__asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
53
        : "=a" (__res) \
54
        : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \
55
                "d" ((long)(arg3))); \
56
__syscall_return(type,__res); \
57
}
58
 
59
#undef _syscall4
60
#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
61
type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
62
{ \
63
long __res; \
64
__asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
65
        : "=a" (__res) \
66
        : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \
67
          "d" ((long)(arg3)),"S" ((long)(arg4))); \
68
__syscall_return(type,__res); \
69
}
70
 
71
#undef _syscall5
72
#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
73
          type5,arg5) \
74
type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
75
{ \
76
long __res; \
77
__asm__ volatile ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \
78
        : "=a" (__res) \
79
        : "0" (__NR_##name),"m" ((long)(arg1)),"c" ((long)(arg2)), \
80
          "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
81
__syscall_return(type,__res); \
82
}
83
 
84
#undef _syscall6
85
 
86
#endif /* __PIC__ && __i386__ */
87
 
88
#endif /* SYSCALL_H */

powered by: WebSVN 2.1.0

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