diff options
Diffstat (limited to 'meta/packages/linux-libc-headers/linux-libc-headers-2.6.18+2.6.19-rc1/arm-unistd-syscall.patch')
-rw-r--r-- | meta/packages/linux-libc-headers/linux-libc-headers-2.6.18+2.6.19-rc1/arm-unistd-syscall.patch | 190 |
1 files changed, 190 insertions, 0 deletions
diff --git a/meta/packages/linux-libc-headers/linux-libc-headers-2.6.18+2.6.19-rc1/arm-unistd-syscall.patch b/meta/packages/linux-libc-headers/linux-libc-headers-2.6.18+2.6.19-rc1/arm-unistd-syscall.patch new file mode 100644 index 0000000000..f1fed650bb --- /dev/null +++ b/meta/packages/linux-libc-headers/linux-libc-headers-2.6.18+2.6.19-rc1/arm-unistd-syscall.patch | |||
@@ -0,0 +1,190 @@ | |||
1 | # Add asm syscall definitions, needed for fstab/llseek.c in util-linux | ||
2 | |||
3 | Index: linux-2.6.19-rc1/usr/include/asm-arm/unistd.h | ||
4 | =================================================================== | ||
5 | --- linux-2.6.19-rc1.orig/usr/include/asm-arm/unistd.h 2006-10-05 10:29:50.000000000 +0200 | ||
6 | +++ linux-2.6.19-rc1/usr/include/asm-arm/unistd.h 2006-10-05 10:31:43.000000000 +0200 | ||
7 | @@ -376,4 +376,183 @@ | ||
8 | #undef __NR_ipc | ||
9 | #endif | ||
10 | |||
11 | +#include <linux/err.h> | ||
12 | + | ||
13 | +#define __sys2(x) #x | ||
14 | +#define __sys1(x) __sys2(x) | ||
15 | + | ||
16 | +#ifndef __syscall | ||
17 | +#if defined(__thumb__) || defined(__ARM_EABI__) | ||
18 | +#define __SYS_REG(name) register long __sysreg __asm__("r7") = __NR_##name; | ||
19 | +#define __SYS_REG_LIST(regs...) "r" (__sysreg) , ##regs | ||
20 | +#define __syscall(name) "swi\t0" | ||
21 | +#else | ||
22 | +#define __SYS_REG(name) | ||
23 | +#define __SYS_REG_LIST(regs...) regs | ||
24 | +#define __syscall(name) "swi\t" __sys1(__NR_##name) "" | ||
25 | +#endif | ||
26 | +#endif | ||
27 | + | ||
28 | +#define __syscall_return(type, res) \ | ||
29 | +do { \ | ||
30 | + if ((unsigned long)(res) >= (unsigned long)(-MAX_ERRNO)) { \ | ||
31 | + errno = -(res); \ | ||
32 | + res = -1; \ | ||
33 | + } \ | ||
34 | + return (type) (res); \ | ||
35 | +} while (0) | ||
36 | + | ||
37 | +#define _syscall0(type,name) \ | ||
38 | +type name(void) { \ | ||
39 | + __SYS_REG(name) \ | ||
40 | + register long __res_r0 __asm__("r0"); \ | ||
41 | + long __res; \ | ||
42 | + __asm__ __volatile__ ( \ | ||
43 | + __syscall(name) \ | ||
44 | + : "=r" (__res_r0) \ | ||
45 | + : __SYS_REG_LIST() \ | ||
46 | + : "memory" ); \ | ||
47 | + __res = __res_r0; \ | ||
48 | + __syscall_return(type,__res); \ | ||
49 | +} | ||
50 | + | ||
51 | +#define _syscall1(type,name,type1,arg1) \ | ||
52 | +type name(type1 arg1) { \ | ||
53 | + __SYS_REG(name) \ | ||
54 | + register long __r0 __asm__("r0") = (long)arg1; \ | ||
55 | + register long __res_r0 __asm__("r0"); \ | ||
56 | + long __res; \ | ||
57 | + __asm__ __volatile__ ( \ | ||
58 | + __syscall(name) \ | ||
59 | + : "=r" (__res_r0) \ | ||
60 | + : __SYS_REG_LIST( "0" (__r0) ) \ | ||
61 | + : "memory" ); \ | ||
62 | + __res = __res_r0; \ | ||
63 | + __syscall_return(type,__res); \ | ||
64 | +} | ||
65 | + | ||
66 | +#define _syscall2(type,name,type1,arg1,type2,arg2) \ | ||
67 | +type name(type1 arg1,type2 arg2) { \ | ||
68 | + __SYS_REG(name) \ | ||
69 | + register long __r0 __asm__("r0") = (long)arg1; \ | ||
70 | + register long __r1 __asm__("r1") = (long)arg2; \ | ||
71 | + register long __res_r0 __asm__("r0"); \ | ||
72 | + long __res; \ | ||
73 | + __asm__ __volatile__ ( \ | ||
74 | + __syscall(name) \ | ||
75 | + : "=r" (__res_r0) \ | ||
76 | + : __SYS_REG_LIST( "0" (__r0), "r" (__r1) ) \ | ||
77 | + : "memory" ); \ | ||
78 | + __res = __res_r0; \ | ||
79 | + __syscall_return(type,__res); \ | ||
80 | +} | ||
81 | + | ||
82 | + | ||
83 | +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ | ||
84 | +type name(type1 arg1,type2 arg2,type3 arg3) { \ | ||
85 | + __SYS_REG(name) \ | ||
86 | + register long __r0 __asm__("r0") = (long)arg1; \ | ||
87 | + register long __r1 __asm__("r1") = (long)arg2; \ | ||
88 | + register long __r2 __asm__("r2") = (long)arg3; \ | ||
89 | + register long __res_r0 __asm__("r0"); \ | ||
90 | + long __res; \ | ||
91 | + __asm__ __volatile__ ( \ | ||
92 | + __syscall(name) \ | ||
93 | + : "=r" (__res_r0) \ | ||
94 | + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2) ) \ | ||
95 | + : "memory" ); \ | ||
96 | + __res = __res_r0; \ | ||
97 | + __syscall_return(type,__res); \ | ||
98 | +} | ||
99 | + | ||
100 | + | ||
101 | +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4)\ | ||
102 | +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ | ||
103 | + __SYS_REG(name) \ | ||
104 | + register long __r0 __asm__("r0") = (long)arg1; \ | ||
105 | + register long __r1 __asm__("r1") = (long)arg2; \ | ||
106 | + register long __r2 __asm__("r2") = (long)arg3; \ | ||
107 | + register long __r3 __asm__("r3") = (long)arg4; \ | ||
108 | + register long __res_r0 __asm__("r0"); \ | ||
109 | + long __res; \ | ||
110 | + __asm__ __volatile__ ( \ | ||
111 | + __syscall(name) \ | ||
112 | + : "=r" (__res_r0) \ | ||
113 | + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), "r" (__r3) ) \ | ||
114 | + : "memory" ); \ | ||
115 | + __res = __res_r0; \ | ||
116 | + __syscall_return(type,__res); \ | ||
117 | +} | ||
118 | + | ||
119 | + | ||
120 | +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ | ||
121 | +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ | ||
122 | + __SYS_REG(name) \ | ||
123 | + register long __r0 __asm__("r0") = (long)arg1; \ | ||
124 | + register long __r1 __asm__("r1") = (long)arg2; \ | ||
125 | + register long __r2 __asm__("r2") = (long)arg3; \ | ||
126 | + register long __r3 __asm__("r3") = (long)arg4; \ | ||
127 | + register long __r4 __asm__("r4") = (long)arg5; \ | ||
128 | + register long __res_r0 __asm__("r0"); \ | ||
129 | + long __res; \ | ||
130 | + __asm__ __volatile__ ( \ | ||
131 | + __syscall(name) \ | ||
132 | + : "=r" (__res_r0) \ | ||
133 | + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \ | ||
134 | + "r" (__r3), "r" (__r4) ) \ | ||
135 | + : "memory" ); \ | ||
136 | + __res = __res_r0; \ | ||
137 | + __syscall_return(type,__res); \ | ||
138 | +} | ||
139 | + | ||
140 | +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ | ||
141 | +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) { \ | ||
142 | + __SYS_REG(name) \ | ||
143 | + register long __r0 __asm__("r0") = (long)arg1; \ | ||
144 | + register long __r1 __asm__("r1") = (long)arg2; \ | ||
145 | + register long __r2 __asm__("r2") = (long)arg3; \ | ||
146 | + register long __r3 __asm__("r3") = (long)arg4; \ | ||
147 | + register long __r4 __asm__("r4") = (long)arg5; \ | ||
148 | + register long __r5 __asm__("r5") = (long)arg6; \ | ||
149 | + register long __res_r0 __asm__("r0"); \ | ||
150 | + long __res; \ | ||
151 | + __asm__ __volatile__ ( \ | ||
152 | + __syscall(name) \ | ||
153 | + : "=r" (__res_r0) \ | ||
154 | + : __SYS_REG_LIST( "0" (__r0), "r" (__r1), "r" (__r2), \ | ||
155 | + "r" (__r3), "r" (__r4), "r" (__r5) ) \ | ||
156 | + : "memory" ); \ | ||
157 | + __res = __res_r0; \ | ||
158 | + __syscall_return(type,__res); \ | ||
159 | +} | ||
160 | + | ||
161 | +#define __ARCH_WANT_IPC_PARSE_VERSION | ||
162 | +#define __ARCH_WANT_STAT64 | ||
163 | +#define __ARCH_WANT_SYS_GETHOSTNAME | ||
164 | +#define __ARCH_WANT_SYS_PAUSE | ||
165 | +#define __ARCH_WANT_SYS_GETPGRP | ||
166 | +#define __ARCH_WANT_SYS_LLSEEK | ||
167 | +#define __ARCH_WANT_SYS_NICE | ||
168 | +#define __ARCH_WANT_SYS_SIGPENDING | ||
169 | +#define __ARCH_WANT_SYS_SIGPROCMASK | ||
170 | +#define __ARCH_WANT_SYS_RT_SIGACTION | ||
171 | + | ||
172 | +#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) | ||
173 | +#define __ARCH_WANT_SYS_TIME | ||
174 | +#define __ARCH_WANT_SYS_OLDUMOUNT | ||
175 | +#define __ARCH_WANT_SYS_ALARM | ||
176 | +#define __ARCH_WANT_SYS_UTIME | ||
177 | +#define __ARCH_WANT_SYS_OLD_GETRLIMIT | ||
178 | +#define __ARCH_WANT_OLD_READDIR | ||
179 | +#define __ARCH_WANT_SYS_SOCKETCALL | ||
180 | +#endif | ||
181 | + | ||
182 | +/* | ||
183 | + * "Conditional" syscalls | ||
184 | + * | ||
185 | + * What we want is __attribute__((weak,alias("sys_ni_syscall"))), | ||
186 | + * but it doesn't work on all toolchains, so we just do it by hand | ||
187 | + */ | ||
188 | +#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall") | ||
189 | + | ||
190 | #endif /* __ASM_ARM_UNISTD_H */ | ||