~ubuntu-branches/ubuntu/natty/eglibc/natty-security

« back to all changes in this revision

Viewing changes to sysdeps/unix/sysv/linux/sparc/sysdep.h

  • Committer: Bazaar Package Importer
  • Author(s): Aurelien Jarno
  • Date: 2009-05-05 09:54:14 UTC
  • Revision ID: james.westby@ubuntu.com-20090505095414-c45qsg9ixjheohru
ImportĀ upstreamĀ versionĀ 2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2000, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
 
2
   This file is part of the GNU C Library.
 
3
   Contributed by Jakub Jelinek <jakub@redhat.com>, 2000.
 
4
 
 
5
   The GNU C Library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Lesser General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2.1 of the License, or (at your option) any later version.
 
9
 
 
10
   The GNU C Library is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Lesser General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Lesser General Public
 
16
   License along with the GNU C Library; if not, write to the Free
 
17
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
18
   02111-1307 USA.  */
 
19
 
 
20
#ifndef _LINUX_SPARC_SYSDEP_H
 
21
#define _LINUX_SPARC_SYSDEP_H 1
 
22
 
 
23
#undef INLINE_SYSCALL
 
24
#define INLINE_SYSCALL(name, nr, args...) \
 
25
  inline_syscall##nr(__SYSCALL_STRING, __NR_##name, args)
 
26
 
 
27
#undef INTERNAL_SYSCALL_DECL
 
28
#define INTERNAL_SYSCALL_DECL(err) do { } while (0)
 
29
 
 
30
#undef INTERNAL_SYSCALL
 
31
#define INTERNAL_SYSCALL(name, err, nr, args...) \
 
32
  inline_syscall##nr(__INTERNAL_SYSCALL_STRING, __NR_##name, args)
 
33
 
 
34
#undef INTERNAL_SYSCALL_NCS
 
35
#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
 
36
  inline_syscall##nr(__INTERNAL_SYSCALL_STRING, name, args)
 
37
 
 
38
#undef INTERNAL_SYSCALL_ERROR_P
 
39
#define INTERNAL_SYSCALL_ERROR_P(val, err) \
 
40
  ((unsigned long) (val) >= -515L)
 
41
 
 
42
#undef INTERNAL_SYSCALL_ERRNO
 
43
#define INTERNAL_SYSCALL_ERRNO(val, err)        (-(val))
 
44
 
 
45
#define inline_syscall0(string,name,dummy...)                           \
 
46
({                                                                      \
 
47
        register long __o0 __asm__ ("o0");                              \
 
48
        register long __g1 __asm__ ("g1") = name;                       \
 
49
        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :           \
 
50
                          "0" (__g1) :                                  \
 
51
                          __SYSCALL_CLOBBERS);                          \
 
52
        __o0;                                                           \
 
53
})
 
54
 
 
55
#define inline_syscall1(string,name,arg1)                               \
 
56
({                                                                      \
 
57
        register long __o0 __asm__ ("o0") = (long)(arg1);               \
 
58
        register long __g1 __asm__ ("g1") = name;                       \
 
59
        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :           \
 
60
                          "0" (__g1), "1" (__o0) :                      \
 
61
                          __SYSCALL_CLOBBERS);                          \
 
62
        __o0;                                                           \
 
63
})
 
64
 
 
65
#define inline_syscall2(string,name,arg1,arg2)                          \
 
66
({                                                                      \
 
67
        register long __o0 __asm__ ("o0") = (long)(arg1);               \
 
68
        register long __o1 __asm__ ("o1") = (long)(arg2);               \
 
69
        register long __g1 __asm__ ("g1") = name;                       \
 
70
        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :           \
 
71
                          "0" (__g1), "1" (__o0), "r" (__o1) :          \
 
72
                          __SYSCALL_CLOBBERS);                          \
 
73
        __o0;                                                           \
 
74
})
 
75
 
 
76
#define inline_syscall3(string,name,arg1,arg2,arg3)                     \
 
77
({                                                                      \
 
78
        register long __o0 __asm__ ("o0") = (long)(arg1);               \
 
79
        register long __o1 __asm__ ("o1") = (long)(arg2);               \
 
80
        register long __o2 __asm__ ("o2") = (long)(arg3);               \
 
81
        register long __g1 __asm__ ("g1") = name;                       \
 
82
        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :           \
 
83
                          "0" (__g1), "1" (__o0), "r" (__o1),           \
 
84
                          "r" (__o2) :                                  \
 
85
                          __SYSCALL_CLOBBERS);                          \
 
86
        __o0;                                                           \
 
87
})
 
88
 
 
89
#define inline_syscall4(string,name,arg1,arg2,arg3,arg4)                \
 
90
({                                                                      \
 
91
        register long __o0 __asm__ ("o0") = (long)(arg1);               \
 
92
        register long __o1 __asm__ ("o1") = (long)(arg2);               \
 
93
        register long __o2 __asm__ ("o2") = (long)(arg3);               \
 
94
        register long __o3 __asm__ ("o3") = (long)(arg4);               \
 
95
        register long __g1 __asm__ ("g1") = name;                       \
 
96
        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :           \
 
97
                          "0" (__g1), "1" (__o0), "r" (__o1),           \
 
98
                          "r" (__o2), "r" (__o3) :                      \
 
99
                          __SYSCALL_CLOBBERS);                          \
 
100
        __o0;                                                           \
 
101
})
 
102
 
 
103
#define inline_syscall5(string,name,arg1,arg2,arg3,arg4,arg5)           \
 
104
({                                                                      \
 
105
        register long __o0 __asm__ ("o0") = (long)(arg1);               \
 
106
        register long __o1 __asm__ ("o1") = (long)(arg2);               \
 
107
        register long __o2 __asm__ ("o2") = (long)(arg3);               \
 
108
        register long __o3 __asm__ ("o3") = (long)(arg4);               \
 
109
        register long __o4 __asm__ ("o4") = (long)(arg5);               \
 
110
        register long __g1 __asm__ ("g1") = name;                       \
 
111
        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :           \
 
112
                          "0" (__g1), "1" (__o0), "r" (__o1),           \
 
113
                          "r" (__o2), "r" (__o3), "r" (__o4) :          \
 
114
                          __SYSCALL_CLOBBERS);                          \
 
115
        __o0;                                                           \
 
116
})
 
117
 
 
118
#define inline_syscall6(string,name,arg1,arg2,arg3,arg4,arg5,arg6)      \
 
119
({                                                                      \
 
120
        register long __o0 __asm__ ("o0") = (long)(arg1);               \
 
121
        register long __o1 __asm__ ("o1") = (long)(arg2);               \
 
122
        register long __o2 __asm__ ("o2") = (long)(arg3);               \
 
123
        register long __o3 __asm__ ("o3") = (long)(arg4);               \
 
124
        register long __o4 __asm__ ("o4") = (long)(arg5);               \
 
125
        register long __o5 __asm__ ("o5") = (long)(arg6);               \
 
126
        register long __g1 __asm__ ("g1") = name;                       \
 
127
        __asm __volatile (string : "=r" (__g1), "=r" (__o0) :           \
 
128
                          "0" (__g1), "1" (__o0), "r" (__o1),           \
 
129
                          "r" (__o2), "r" (__o3), "r" (__o4),           \
 
130
                          "r" (__o5) :                                  \
 
131
                          __SYSCALL_CLOBBERS);                          \
 
132
        __o0;                                                           \
 
133
})
 
134
 
 
135
#define INLINE_CLONE_SYSCALL(arg1,arg2,arg3,arg4,arg5)                  \
 
136
({                                                                      \
 
137
        register long __o0 __asm__ ("o0") = (long)(arg1);               \
 
138
        register long __o1 __asm__ ("o1") = (long)(arg2);               \
 
139
        register long __o2 __asm__ ("o2") = (long)(arg3);               \
 
140
        register long __o3 __asm__ ("o3") = (long)(arg4);               \
 
141
        register long __o4 __asm__ ("o4") = (long)(arg5);               \
 
142
        register long __g1 __asm__ ("g1") = __NR_clone;                 \
 
143
        __asm __volatile (__CLONE_SYSCALL_STRING :                      \
 
144
                          "=r" (__g1), "=r" (__o0), "=r" (__o1) :       \
 
145
                          "0" (__g1), "1" (__o0), "2" (__o1),           \
 
146
                          "r" (__o2), "r" (__o3), "r" (__o4) :          \
 
147
                          __SYSCALL_CLOBBERS);                          \
 
148
        __o0;                                                           \
 
149
})
 
150
 
 
151
 
 
152
#ifdef __ASSEMBLER__
 
153
# define JUMPTARGET(sym) sym
 
154
#endif
 
155
 
 
156
#endif /* _LINUX_SPARC_SYSDEP_H */