7e83869ca2efffea5973f92ee848ae1512431c91
[openwrt/openwrt.git] / toolchain / musl / patches / 000-update-to-git-2016-01-30.patch
1 --- a/.gitignore
2 +++ b/.gitignore
3 @@ -5,9 +5,6 @@
4 *.so.1
5 arch/*/bits/alltypes.h
6 config.mak
7 -include/bits
8 -tools/musl-gcc
9 -tools/musl-clang
10 -tools/ld.musl-clang
11 lib/musl-gcc.specs
12 src/internal/version.h
13 +/obj/
14 --- a/Makefile
15 +++ b/Makefile
16 @@ -8,6 +8,7 @@
17 # Do not make changes here.
18 #
19
20 +srcdir = .
21 exec_prefix = /usr/local
22 bindir = $(exec_prefix)/bin
23
24 @@ -16,31 +17,42 @@ includedir = $(prefix)/include
25 libdir = $(prefix)/lib
26 syslibdir = /lib
27
28 -SRCS = $(sort $(wildcard src/*/*.c arch/$(ARCH)/src/*.c))
29 -OBJS = $(SRCS:.c=.o)
30 +BASE_SRCS = $(sort $(wildcard $(srcdir)/src/*/*.c))
31 +BASE_OBJS = $(patsubst $(srcdir)/%,%.o,$(basename $(BASE_SRCS)))
32 +ARCH_SRCS = $(wildcard $(srcdir)/src/*/$(ARCH)/*.[csS])
33 +ARCH_OBJS = $(patsubst $(srcdir)/%,%.o,$(basename $(ARCH_SRCS)))
34 +REPLACED_OBJS = $(sort $(subst /$(ARCH)/,/,$(ARCH_OBJS)))
35 +LDSO_SRCS = $(sort $(wildcard $(srcdir)/ldso/*.c))
36 +LDSO_OBJS = $(patsubst $(srcdir)/%,obj/%.lo,$(basename $(LDSO_SRCS)))
37 +OBJS = $(addprefix obj/, $(filter-out $(REPLACED_OBJS), $(sort $(BASE_OBJS) $(ARCH_OBJS))))
38 +AOBJS = $(OBJS)
39 LOBJS = $(OBJS:.o=.lo)
40 -GENH = include/bits/alltypes.h
41 -GENH_INT = src/internal/version.h
42 -IMPH = src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/libc.h
43 +GENH = obj/include/bits/alltypes.h
44 +GENH_INT = obj/src/internal/version.h
45 +IMPH = $(addprefix $(srcdir)/, src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/libc.h)
46
47 -LDFLAGS =
48 +LDFLAGS =
49 +LDFLAGS_AUTO =
50 LIBCC = -lgcc
51 CPPFLAGS =
52 -CFLAGS = -Os -pipe
53 +CFLAGS =
54 +CFLAGS_AUTO = -Os -pipe
55 CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc
56
57 CFLAGS_ALL = $(CFLAGS_C99FSE)
58 -CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I./arch/$(ARCH) -I./src/internal -I./include
59 -CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS)
60 -CFLAGS_ALL_STATIC = $(CFLAGS_ALL)
61 -CFLAGS_ALL_SHARED = $(CFLAGS_ALL) -fPIC -DSHARED
62 +CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I$(srcdir)/arch/$(ARCH) -I$(srcdir)/arch/generic -Iobj/src/internal -I$(srcdir)/src/internal -Iobj/include -I$(srcdir)/include
63 +CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS_AUTO) $(CFLAGS)
64 +
65 +LDFLAGS_ALL = $(LDFLAGS_AUTO) $(LDFLAGS)
66
67 AR = $(CROSS_COMPILE)ar
68 RANLIB = $(CROSS_COMPILE)ranlib
69 -INSTALL = ./tools/install.sh
70 +INSTALL = $(srcdir)/tools/install.sh
71
72 -ARCH_INCLUDES = $(wildcard arch/$(ARCH)/bits/*.h)
73 -ALL_INCLUDES = $(sort $(wildcard include/*.h include/*/*.h) $(GENH) $(ARCH_INCLUDES:arch/$(ARCH)/%=include/%))
74 +ARCH_INCLUDES = $(wildcard $(srcdir)/arch/$(ARCH)/bits/*.h)
75 +GENERIC_INCLUDES = $(wildcard $(srcdir)/arch/generic/bits/*.h)
76 +INCLUDES = $(wildcard $(srcdir)/include/*.h $(srcdir)/include/*/*.h)
77 +ALL_INCLUDES = $(sort $(INCLUDES:$(srcdir)/%=%) $(GENH:obj/%=%) $(ARCH_INCLUDES:$(srcdir)/arch/$(ARCH)/%=include/%) $(GENERIC_INCLUDES:$(srcdir)/arch/generic/%=include/%))
78
79 EMPTY_LIB_NAMES = m rt pthread crypt util xnet resolv dl
80 EMPTY_LIBS = $(EMPTY_LIB_NAMES:%=lib/lib%.a)
81 @@ -49,7 +61,7 @@ STATIC_LIBS = lib/libc.a
82 SHARED_LIBS = lib/libc.so
83 TOOL_LIBS = lib/musl-gcc.specs
84 ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(EMPTY_LIBS) $(TOOL_LIBS)
85 -ALL_TOOLS = tools/musl-gcc
86 +ALL_TOOLS = obj/musl-gcc
87
88 WRAPCC_GCC = gcc
89 WRAPCC_CLANG = clang
90 @@ -58,122 +70,128 @@ LDSO_PATHNAME = $(syslibdir)/ld-musl-$(A
91
92 -include config.mak
93
94 +ifeq ($(ARCH),)
95 +$(error Please set ARCH in config.mak before running make.)
96 +endif
97 +
98 all: $(ALL_LIBS) $(ALL_TOOLS)
99
100 +OBJ_DIRS = $(sort $(patsubst %/,%,$(dir $(ALL_LIBS) $(ALL_TOOLS) $(OBJS) $(LDSO_OBJS) $(GENH) $(GENH_INT))) $(addprefix obj/, crt crt/$(ARCH) include))
101 +
102 +$(ALL_LIBS) $(ALL_TOOLS) $(CRT_LIBS:lib/%=obj/crt/%) $(OBJS) $(LOBJS) $(GENH) $(GENH_INT): | $(OBJ_DIRS)
103 +
104 +$(OBJ_DIRS):
105 + mkdir -p $@
106 +
107 install: install-libs install-headers install-tools
108
109 clean:
110 - rm -f crt/*.o
111 - rm -f $(OBJS)
112 - rm -f $(LOBJS)
113 - rm -f $(ALL_LIBS) lib/*.[ao] lib/*.so
114 - rm -f $(ALL_TOOLS)
115 - rm -f $(GENH) $(GENH_INT)
116 - rm -f include/bits
117 + rm -rf obj lib
118
119 distclean: clean
120 rm -f config.mak
121
122 -include/bits:
123 - @test "$(ARCH)" || { echo "Please set ARCH in config.mak before running make." ; exit 1 ; }
124 - ln -sf ../arch/$(ARCH)/bits $@
125 +obj/include/bits/alltypes.h: $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in $(srcdir)/tools/mkalltypes.sed
126 + sed -f $(srcdir)/tools/mkalltypes.sed $(srcdir)/arch/$(ARCH)/bits/alltypes.h.in $(srcdir)/include/alltypes.h.in > $@
127
128 -include/bits/alltypes.h.in: include/bits
129 +obj/src/internal/version.h: $(wildcard $(srcdir)/VERSION $(srcdir)/.git)
130 + printf '#define VERSION "%s"\n' "$$(cd $(srcdir); sh tools/version.sh)" > $@
131
132 -include/bits/alltypes.h: include/bits/alltypes.h.in include/alltypes.h.in tools/mkalltypes.sed
133 - sed -f tools/mkalltypes.sed include/bits/alltypes.h.in include/alltypes.h.in > $@
134 +obj/src/internal/version.o obj/src/internal/version.lo: obj/src/internal/version.h
135
136 -src/internal/version.h: $(wildcard VERSION .git)
137 - printf '#define VERSION "%s"\n' "$$(sh tools/version.sh)" > $@
138 +obj/crt/rcrt1.o obj/ldso/dlstart.lo obj/ldso/dynlink.lo: $(srcdir)/src/internal/dynlink.h $(srcdir)/arch/$(ARCH)/reloc.h
139
140 -src/internal/version.lo: src/internal/version.h
141 +obj/crt/crt1.o obj/crt/scrt1.o obj/crt/rcrt1.o obj/ldso/dlstart.lo: $(srcdir)/arch/$(ARCH)/crt_arch.h
142
143 -crt/rcrt1.o src/ldso/dlstart.lo src/ldso/dynlink.lo: src/internal/dynlink.h arch/$(ARCH)/reloc.h
144 +obj/crt/rcrt1.o: $(srcdir)/ldso/dlstart.c
145
146 -crt/crt1.o crt/Scrt1.o crt/rcrt1.o src/ldso/dlstart.lo: $(wildcard arch/$(ARCH)/crt_arch.h)
147 +obj/crt/Scrt1.o obj/crt/rcrt1.o: CFLAGS_ALL += -fPIC
148
149 -crt/rcrt1.o: src/ldso/dlstart.c
150 +obj/crt/$(ARCH)/crti.o: $(srcdir)/crt/$(ARCH)/crti.s
151
152 -crt/Scrt1.o crt/rcrt1.o: CFLAGS += -fPIC
153 +obj/crt/$(ARCH)/crtn.o: $(srcdir)/crt/$(ARCH)/crtn.s
154
155 -OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=src/%))
156 -$(OPTIMIZE_SRCS:%.c=%.o) $(OPTIMIZE_SRCS:%.c=%.lo): CFLAGS += -O3
157 +OPTIMIZE_SRCS = $(wildcard $(OPTIMIZE_GLOBS:%=$(srcdir)/src/%))
158 +$(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.o) $(OPTIMIZE_SRCS:$(srcdir)/%.c=obj/%.lo): CFLAGS += -O3
159
160 MEMOPS_SRCS = src/string/memcpy.c src/string/memmove.c src/string/memcmp.c src/string/memset.c
161 -$(MEMOPS_SRCS:%.c=%.o) $(MEMOPS_SRCS:%.c=%.lo): CFLAGS += $(CFLAGS_MEMOPS)
162 +$(MEMOPS_SRCS:%.c=obj/%.o) $(MEMOPS_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_MEMOPS)
163
164 NOSSP_SRCS = $(wildcard crt/*.c) \
165 src/env/__libc_start_main.c src/env/__init_tls.c \
166 - src/thread/__set_thread_area.c src/env/__stack_chk_fail.c \
167 - src/string/memset.c src/string/memcpy.c \
168 - src/ldso/dlstart.c src/ldso/dynlink.c
169 -$(NOSSP_SRCS:%.c=%.o) $(NOSSP_SRCS:%.c=%.lo): CFLAGS += $(CFLAGS_NOSSP)
170 + src/env/__stack_chk_fail.c \
171 + src/thread/__set_thread_area.c src/thread/$(ARCH)/__set_thread_area.c \
172 + src/string/memset.c src/string/$(ARCH)/memset.c \
173 + src/string/memcpy.c src/string/$(ARCH)/memcpy.c \
174 + ldso/dlstart.c ldso/dynlink.c
175 +$(NOSSP_SRCS:%.c=obj/%.o) $(NOSSP_SRCS:%.c=obj/%.lo): CFLAGS_ALL += $(CFLAGS_NOSSP)
176
177 -$(CRT_LIBS:lib/%=crt/%): CFLAGS += -DCRT
178 +$(CRT_LIBS:lib/%=obj/crt/%): CFLAGS_ALL += -DCRT
179
180 -# This incantation ensures that changes to any subarch asm files will
181 -# force the corresponding object file to be rebuilt, even if the implicit
182 -# rule below goes indirectly through a .sub file.
183 -define mkasmdep
184 -$(dir $(patsubst %/,%,$(dir $(1))))$(notdir $(1:.s=.o)): $(1)
185 -endef
186 -$(foreach s,$(wildcard src/*/$(ARCH)*/*.s),$(eval $(call mkasmdep,$(s))))
187 +$(LOBJS) $(LDSO_OBJS): CFLAGS_ALL += -fPIC
188 +
189 +CC_CMD = $(CC) $(CFLAGS_ALL) -c -o $@ $<
190
191 # Choose invocation of assembler to be used
192 -# $(1) is input file, $(2) is output file, $(3) is assembler flags
193 ifeq ($(ADD_CFI),yes)
194 - AS_CMD = LC_ALL=C awk -f tools/add-cfi.common.awk -f tools/add-cfi.$(ARCH).awk $< | $(CC) -x assembler -c -o $@ -
195 + AS_CMD = LC_ALL=C awk -f $(srcdir)/tools/add-cfi.common.awk -f $(srcdir)/tools/add-cfi.$(ARCH).awk $< | $(CC) $(CFLAGS_ALL) -x assembler -c -o $@ -
196 else
197 - AS_CMD = $(CC) -c -o $@ $<
198 + AS_CMD = $(CC_CMD)
199 endif
200
201 -%.o: $(ARCH)$(ASMSUBARCH)/%.sub
202 - $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $(dir $<)$(shell cat $<)
203 +obj/%.o: $(srcdir)/%.s
204 + $(AS_CMD)
205
206 -%.o: $(ARCH)/%.s
207 - $(AS_CMD) $(CFLAGS_ALL_STATIC)
208 +obj/%.o: $(srcdir)/%.S
209 + $(CC_CMD)
210
211 -%.o: %.c $(GENH) $(IMPH)
212 - $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
213 +obj/%.o: $(srcdir)/%.c $(GENH) $(IMPH)
214 + $(CC_CMD)
215
216 -%.lo: $(ARCH)$(ASMSUBARCH)/%.sub
217 - $(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $(dir $<)$(shell cat $<)
218 +obj/%.lo: $(srcdir)/%.s
219 + $(AS_CMD)
220
221 -%.lo: $(ARCH)/%.s
222 - $(AS_CMD) $(CFLAGS_ALL_SHARED)
223 +obj/%.lo: $(srcdir)/%.S
224 + $(CC_CMD)
225
226 -%.lo: %.c $(GENH) $(IMPH)
227 - $(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $<
228 +obj/%.lo: $(srcdir)/%.c $(GENH) $(IMPH)
229 + $(CC_CMD)
230
231 -lib/libc.so: $(LOBJS)
232 - $(CC) $(CFLAGS_ALL_SHARED) $(LDFLAGS) -nostdlib -shared \
233 +lib/libc.so: $(LOBJS) $(LDSO_OBJS)
234 + $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -nostdlib -shared \
235 -Wl,-e,_dlstart -Wl,-Bsymbolic-functions \
236 - -o $@ $(LOBJS) $(LIBCC)
237 + -o $@ $(LOBJS) $(LDSO_OBJS) $(LIBCC)
238
239 -lib/libc.a: $(OBJS)
240 +lib/libc.a: $(AOBJS)
241 rm -f $@
242 - $(AR) rc $@ $(OBJS)
243 + $(AR) rc $@ $(AOBJS)
244 $(RANLIB) $@
245
246 $(EMPTY_LIBS):
247 rm -f $@
248 $(AR) rc $@
249
250 -lib/%.o: crt/%.o
251 +lib/%.o: obj/crt/%.o
252 cp $< $@
253
254 -lib/musl-gcc.specs: tools/musl-gcc.specs.sh config.mak
255 +lib/crti.o: obj/crt/$(ARCH)/crti.o
256 + cp $< $@
257 +
258 +lib/crtn.o: obj/crt/$(ARCH)/crtn.o
259 + cp $< $@
260 +
261 +lib/musl-gcc.specs: $(srcdir)/tools/musl-gcc.specs.sh config.mak
262 sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" > $@
263
264 -tools/musl-gcc: config.mak
265 +obj/musl-gcc: config.mak
266 printf '#!/bin/sh\nexec "$${REALGCC:-$(WRAPCC_GCC)}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@
267 chmod +x $@
268
269 -tools/%-clang: tools/%-clang.in config.mak
270 +obj/%-clang: $(srcdir)/tools/%-clang.in config.mak
271 sed -e 's!@CC@!$(WRAPCC_CLANG)!g' -e 's!@PREFIX@!$(prefix)!g' -e 's!@INCDIR@!$(includedir)!g' -e 's!@LIBDIR@!$(libdir)!g' -e 's!@LDSO@!$(LDSO_PATHNAME)!g' $< > $@
272 chmod +x $@
273
274 -$(DESTDIR)$(bindir)/%: tools/%
275 +$(DESTDIR)$(bindir)/%: obj/%
276 $(INSTALL) -D $< $@
277
278 $(DESTDIR)$(libdir)/%.so: lib/%.so
279 @@ -182,10 +200,16 @@ $(DESTDIR)$(libdir)/%.so: lib/%.so
280 $(DESTDIR)$(libdir)/%: lib/%
281 $(INSTALL) -D -m 644 $< $@
282
283 -$(DESTDIR)$(includedir)/bits/%: arch/$(ARCH)/bits/%
284 +$(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/$(ARCH)/bits/%
285 $(INSTALL) -D -m 644 $< $@
286
287 -$(DESTDIR)$(includedir)/%: include/%
288 +$(DESTDIR)$(includedir)/bits/%: $(srcdir)/arch/generic/bits/%
289 + $(INSTALL) -D -m 644 $< $@
290 +
291 +$(DESTDIR)$(includedir)/bits/%: obj/include/bits/%
292 + $(INSTALL) -D -m 644 $< $@
293 +
294 +$(DESTDIR)$(includedir)/%: $(srcdir)/include/%
295 $(INSTALL) -D -m 644 $< $@
296
297 $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(libdir)/libc.so
298 @@ -195,12 +219,12 @@ install-libs: $(ALL_LIBS:lib/%=$(DESTDIR
299
300 install-headers: $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%)
301
302 -install-tools: $(ALL_TOOLS:tools/%=$(DESTDIR)$(bindir)/%)
303 +install-tools: $(ALL_TOOLS:obj/%=$(DESTDIR)$(bindir)/%)
304
305 musl-git-%.tar.gz: .git
306 - git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ $(patsubst musl-git-%.tar.gz,%,$@)
307 + git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ $(patsubst musl-git-%.tar.gz,%,$@)
308
309 musl-%.tar.gz: .git
310 - git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ v$(patsubst musl-%.tar.gz,%,$@)
311 + git --git-dir=$(srcdir)/.git archive --format=tar.gz --prefix=$(patsubst %.tar.gz,%,$@)/ -o $@ v$(patsubst musl-%.tar.gz,%,$@)
312
313 .PHONY: all clean install install-libs install-headers install-tools
314 --- a/arch/aarch64/atomic.h
315 +++ /dev/null
316 @@ -1,206 +0,0 @@
317 -#ifndef _INTERNAL_ATOMIC_H
318 -#define _INTERNAL_ATOMIC_H
319 -
320 -#include <stdint.h>
321 -
322 -static inline int a_ctz_64(uint64_t x)
323 -{
324 - __asm__(
325 - " rbit %0, %1\n"
326 - " clz %0, %0\n"
327 - : "=r"(x) : "r"(x));
328 - return x;
329 -}
330 -
331 -static inline int a_ctz_l(unsigned long x)
332 -{
333 - return a_ctz_64(x);
334 -}
335 -
336 -static inline void a_barrier()
337 -{
338 - __asm__ __volatile__("dmb ish");
339 -}
340 -
341 -static inline void *a_cas_p(volatile void *p, void *t, void *s)
342 -{
343 - void *old;
344 - __asm__ __volatile__(
345 - " dmb ish\n"
346 - "1: ldxr %0,%3\n"
347 - " cmp %0,%1\n"
348 - " b.ne 1f\n"
349 - " stxr %w0,%2,%3\n"
350 - " cbnz %w0,1b\n"
351 - " mov %0,%1\n"
352 - "1: dmb ish\n"
353 - : "=&r"(old)
354 - : "r"(t), "r"(s), "Q"(*(long*)p)
355 - : "memory", "cc");
356 - return old;
357 -}
358 -
359 -static inline int a_cas(volatile int *p, int t, int s)
360 -{
361 - int old;
362 - __asm__ __volatile__(
363 - " dmb ish\n"
364 - "1: ldxr %w0,%3\n"
365 - " cmp %w0,%w1\n"
366 - " b.ne 1f\n"
367 - " stxr %w0,%w2,%3\n"
368 - " cbnz %w0,1b\n"
369 - " mov %w0,%w1\n"
370 - "1: dmb ish\n"
371 - : "=&r"(old)
372 - : "r"(t), "r"(s), "Q"(*p)
373 - : "memory", "cc");
374 - return old;
375 -}
376 -
377 -static inline int a_swap(volatile int *x, int v)
378 -{
379 - int old, tmp;
380 - __asm__ __volatile__(
381 - " dmb ish\n"
382 - "1: ldxr %w0,%3\n"
383 - " stxr %w1,%w2,%3\n"
384 - " cbnz %w1,1b\n"
385 - " dmb ish\n"
386 - : "=&r"(old), "=&r"(tmp)
387 - : "r"(v), "Q"(*x)
388 - : "memory", "cc" );
389 - return old;
390 -}
391 -
392 -static inline int a_fetch_add(volatile int *x, int v)
393 -{
394 - int old, tmp;
395 - __asm__ __volatile__(
396 - " dmb ish\n"
397 - "1: ldxr %w0,%3\n"
398 - " add %w0,%w0,%w2\n"
399 - " stxr %w1,%w0,%3\n"
400 - " cbnz %w1,1b\n"
401 - " dmb ish\n"
402 - : "=&r"(old), "=&r"(tmp)
403 - : "r"(v), "Q"(*x)
404 - : "memory", "cc" );
405 - return old-v;
406 -}
407 -
408 -static inline void a_inc(volatile int *x)
409 -{
410 - int tmp, tmp2;
411 - __asm__ __volatile__(
412 - " dmb ish\n"
413 - "1: ldxr %w0,%2\n"
414 - " add %w0,%w0,#1\n"
415 - " stxr %w1,%w0,%2\n"
416 - " cbnz %w1,1b\n"
417 - " dmb ish\n"
418 - : "=&r"(tmp), "=&r"(tmp2)
419 - : "Q"(*x)
420 - : "memory", "cc" );
421 -}
422 -
423 -static inline void a_dec(volatile int *x)
424 -{
425 - int tmp, tmp2;
426 - __asm__ __volatile__(
427 - " dmb ish\n"
428 - "1: ldxr %w0,%2\n"
429 - " sub %w0,%w0,#1\n"
430 - " stxr %w1,%w0,%2\n"
431 - " cbnz %w1,1b\n"
432 - " dmb ish\n"
433 - : "=&r"(tmp), "=&r"(tmp2)
434 - : "Q"(*x)
435 - : "memory", "cc" );
436 -}
437 -
438 -static inline void a_and_64(volatile uint64_t *p, uint64_t v)
439 -{
440 - int tmp, tmp2;
441 - __asm__ __volatile__(
442 - " dmb ish\n"
443 - "1: ldxr %0,%3\n"
444 - " and %0,%0,%2\n"
445 - " stxr %w1,%0,%3\n"
446 - " cbnz %w1,1b\n"
447 - " dmb ish\n"
448 - : "=&r"(tmp), "=&r"(tmp2)
449 - : "r"(v), "Q"(*p)
450 - : "memory", "cc" );
451 -}
452 -
453 -static inline void a_and(volatile int *p, int v)
454 -{
455 - int tmp, tmp2;
456 - __asm__ __volatile__(
457 - " dmb ish\n"
458 - "1: ldxr %w0,%3\n"
459 - " and %w0,%w0,%w2\n"
460 - " stxr %w1,%w0,%3\n"
461 - " cbnz %w1,1b\n"
462 - " dmb ish\n"
463 - : "=&r"(tmp), "=&r"(tmp2)
464 - : "r"(v), "Q"(*p)
465 - : "memory", "cc" );
466 -}
467 -
468 -static inline void a_or_64(volatile uint64_t *p, uint64_t v)
469 -{
470 - int tmp, tmp2;
471 - __asm__ __volatile__(
472 - " dmb ish\n"
473 - "1: ldxr %0,%3\n"
474 - " orr %0,%0,%2\n"
475 - " stxr %w1,%0,%3\n"
476 - " cbnz %w1,1b\n"
477 - " dmb ish\n"
478 - : "=&r"(tmp), "=&r"(tmp2)
479 - : "r"(v), "Q"(*p)
480 - : "memory", "cc" );
481 -}
482 -
483 -static inline void a_or_l(volatile void *p, long v)
484 -{
485 - return a_or_64(p, v);
486 -}
487 -
488 -static inline void a_or(volatile int *p, int v)
489 -{
490 - int tmp, tmp2;
491 - __asm__ __volatile__(
492 - " dmb ish\n"
493 - "1: ldxr %w0,%3\n"
494 - " orr %w0,%w0,%w2\n"
495 - " stxr %w1,%w0,%3\n"
496 - " cbnz %w1,1b\n"
497 - " dmb ish\n"
498 - : "=&r"(tmp), "=&r"(tmp2)
499 - : "r"(v), "Q"(*p)
500 - : "memory", "cc" );
501 -}
502 -
503 -static inline void a_store(volatile int *p, int x)
504 -{
505 - __asm__ __volatile__(
506 - " dmb ish\n"
507 - " str %w1,%0\n"
508 - " dmb ish\n"
509 - : "=m"(*p)
510 - : "r"(x)
511 - : "memory", "cc" );
512 -}
513 -
514 -#define a_spin a_barrier
515 -
516 -static inline void a_crash()
517 -{
518 - *(volatile char *)0=0;
519 -}
520 -
521 -
522 -#endif
523 --- /dev/null
524 +++ b/arch/aarch64/atomic_arch.h
525 @@ -0,0 +1,73 @@
526 +#define a_ll a_ll
527 +static inline int a_ll(volatile int *p)
528 +{
529 + int v;
530 + __asm__ __volatile__ ("ldaxr %w0,%1" : "=r"(v) : "Q"(*p));
531 + return v;
532 +}
533 +
534 +#define a_sc a_sc
535 +static inline int a_sc(volatile int *p, int v)
536 +{
537 + int r;
538 + __asm__ __volatile__ ("stlxr %w0,%w1,%2" : "=&r"(r) : "r"(v), "Q"(*p) : "memory");
539 + return !r;
540 +}
541 +
542 +#define a_barrier a_barrier
543 +static inline void a_barrier()
544 +{
545 + __asm__ __volatile__ ("dmb ish" : : : "memory");
546 +}
547 +
548 +#define a_cas a_cas
549 +static inline int a_cas(volatile int *p, int t, int s)
550 +{
551 + int old;
552 + do {
553 + old = a_ll(p);
554 + if (old != t) {
555 + a_barrier();
556 + break;
557 + }
558 + } while (!a_sc(p, s));
559 + return old;
560 +}
561 +
562 +static inline void *a_ll_p(volatile void *p)
563 +{
564 + void *v;
565 + __asm__ __volatile__ ("ldaxr %0, %1" : "=r"(v) : "Q"(*(void *volatile *)p));
566 + return v;
567 +}
568 +
569 +static inline int a_sc_p(volatile int *p, void *v)
570 +{
571 + int r;
572 + __asm__ __volatile__ ("stlxr %w0,%1,%2" : "=&r"(r) : "r"(v), "Q"(*(void *volatile *)p) : "memory");
573 + return !r;
574 +}
575 +
576 +#define a_cas_p a_cas_p
577 +static inline void *a_cas_p(volatile void *p, void *t, void *s)
578 +{
579 + void *old;
580 + do {
581 + old = a_ll_p(p);
582 + if (old != t) {
583 + a_barrier();
584 + break;
585 + }
586 + } while (!a_sc_p(p, s));
587 + return old;
588 +}
589 +
590 +#define a_ctz_64 a_ctz_64
591 +static inline int a_ctz_64(uint64_t x)
592 +{
593 + __asm__(
594 + " rbit %0, %1\n"
595 + " clz %0, %0\n"
596 + : "=r"(x) : "r"(x));
597 + return x;
598 +}
599 --- a/arch/aarch64/bits/errno.h
600 +++ /dev/null
601 @@ -1,134 +0,0 @@
602 -#define EPERM 1
603 -#define ENOENT 2
604 -#define ESRCH 3
605 -#define EINTR 4
606 -#define EIO 5
607 -#define ENXIO 6
608 -#define E2BIG 7
609 -#define ENOEXEC 8
610 -#define EBADF 9
611 -#define ECHILD 10
612 -#define EAGAIN 11
613 -#define ENOMEM 12
614 -#define EACCES 13
615 -#define EFAULT 14
616 -#define ENOTBLK 15
617 -#define EBUSY 16
618 -#define EEXIST 17
619 -#define EXDEV 18
620 -#define ENODEV 19
621 -#define ENOTDIR 20
622 -#define EISDIR 21
623 -#define EINVAL 22
624 -#define ENFILE 23
625 -#define EMFILE 24
626 -#define ENOTTY 25
627 -#define ETXTBSY 26
628 -#define EFBIG 27
629 -#define ENOSPC 28
630 -#define ESPIPE 29
631 -#define EROFS 30
632 -#define EMLINK 31
633 -#define EPIPE 32
634 -#define EDOM 33
635 -#define ERANGE 34
636 -#define EDEADLK 35
637 -#define ENAMETOOLONG 36
638 -#define ENOLCK 37
639 -#define ENOSYS 38
640 -#define ENOTEMPTY 39
641 -#define ELOOP 40
642 -#define EWOULDBLOCK EAGAIN
643 -#define ENOMSG 42
644 -#define EIDRM 43
645 -#define ECHRNG 44
646 -#define EL2NSYNC 45
647 -#define EL3HLT 46
648 -#define EL3RST 47
649 -#define ELNRNG 48
650 -#define EUNATCH 49
651 -#define ENOCSI 50
652 -#define EL2HLT 51
653 -#define EBADE 52
654 -#define EBADR 53
655 -#define EXFULL 54
656 -#define ENOANO 55
657 -#define EBADRQC 56
658 -#define EBADSLT 57
659 -#define EDEADLOCK EDEADLK
660 -#define EBFONT 59
661 -#define ENOSTR 60
662 -#define ENODATA 61
663 -#define ETIME 62
664 -#define ENOSR 63
665 -#define ENONET 64
666 -#define ENOPKG 65
667 -#define EREMOTE 66
668 -#define ENOLINK 67
669 -#define EADV 68
670 -#define ESRMNT 69
671 -#define ECOMM 70
672 -#define EPROTO 71
673 -#define EMULTIHOP 72
674 -#define EDOTDOT 73
675 -#define EBADMSG 74
676 -#define EOVERFLOW 75
677 -#define ENOTUNIQ 76
678 -#define EBADFD 77
679 -#define EREMCHG 78
680 -#define ELIBACC 79
681 -#define ELIBBAD 80
682 -#define ELIBSCN 81
683 -#define ELIBMAX 82
684 -#define ELIBEXEC 83
685 -#define EILSEQ 84
686 -#define ERESTART 85
687 -#define ESTRPIPE 86
688 -#define EUSERS 87
689 -#define ENOTSOCK 88
690 -#define EDESTADDRREQ 89
691 -#define EMSGSIZE 90
692 -#define EPROTOTYPE 91
693 -#define ENOPROTOOPT 92
694 -#define EPROTONOSUPPORT 93
695 -#define ESOCKTNOSUPPORT 94
696 -#define EOPNOTSUPP 95
697 -#define ENOTSUP EOPNOTSUPP
698 -#define EPFNOSUPPORT 96
699 -#define EAFNOSUPPORT 97
700 -#define EADDRINUSE 98
701 -#define EADDRNOTAVAIL 99
702 -#define ENETDOWN 100
703 -#define ENETUNREACH 101
704 -#define ENETRESET 102
705 -#define ECONNABORTED 103
706 -#define ECONNRESET 104
707 -#define ENOBUFS 105
708 -#define EISCONN 106
709 -#define ENOTCONN 107
710 -#define ESHUTDOWN 108
711 -#define ETOOMANYREFS 109
712 -#define ETIMEDOUT 110
713 -#define ECONNREFUSED 111
714 -#define EHOSTDOWN 112
715 -#define EHOSTUNREACH 113
716 -#define EALREADY 114
717 -#define EINPROGRESS 115
718 -#define ESTALE 116
719 -#define EUCLEAN 117
720 -#define ENOTNAM 118
721 -#define ENAVAIL 119
722 -#define EISNAM 120
723 -#define EREMOTEIO 121
724 -#define EDQUOT 122
725 -#define ENOMEDIUM 123
726 -#define EMEDIUMTYPE 124
727 -#define ECANCELED 125
728 -#define ENOKEY 126
729 -#define EKEYEXPIRED 127
730 -#define EKEYREVOKED 128
731 -#define EKEYREJECTED 129
732 -#define EOWNERDEAD 130
733 -#define ENOTRECOVERABLE 131
734 -#define ERFKILL 132
735 -#define EHWPOISON 133
736 --- a/arch/aarch64/bits/mman.h
737 +++ b/arch/aarch64/bits/mman.h
738 @@ -36,6 +36,7 @@
739
740 #define MCL_CURRENT 1
741 #define MCL_FUTURE 2
742 +#define MCL_ONFAULT 4
743
744 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
745 #define MADV_NORMAL 0
746 --- a/arch/aarch64/bits/statfs.h
747 +++ /dev/null
748 @@ -1,7 +0,0 @@
749 -struct statfs {
750 - unsigned long f_type, f_bsize;
751 - fsblkcnt_t f_blocks, f_bfree, f_bavail;
752 - fsfilcnt_t f_files, f_ffree;
753 - fsid_t f_fsid;
754 - unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
755 -};
756 --- a/arch/aarch64/bits/stdarg.h
757 +++ /dev/null
758 @@ -1,4 +0,0 @@
759 -#define va_start(v,l) __builtin_va_start(v,l)
760 -#define va_end(v) __builtin_va_end(v)
761 -#define va_arg(v,l) __builtin_va_arg(v,l)
762 -#define va_copy(d,s) __builtin_va_copy(d,s)
763 --- a/arch/aarch64/bits/syscall.h
764 +++ b/arch/aarch64/bits/syscall.h
765 @@ -265,6 +265,9 @@
766 #define __NR_memfd_create 279
767 #define __NR_bpf 280
768 #define __NR_execveat 281
769 +#define __NR_userfaultfd 282
770 +#define __NR_membarrier 283
771 +#define __NR_mlock2 284
772
773 #define SYS_io_setup __NR_io_setup
774 #define SYS_io_destroy __NR_io_destroy
775 @@ -533,3 +536,6 @@
776 #define SYS_memfd_create __NR_memfd_create
777 #define SYS_bpf __NR_bpf
778 #define SYS_execveat __NR_execveat
779 +#define SYS_userfaultfd __NR_userfaultfd
780 +#define SYS_membarrier __NR_membarrier
781 +#define SYS_mlock2 __NR_mlock2
782 --- a/arch/aarch64/bits/termios.h
783 +++ /dev/null
784 @@ -1,160 +0,0 @@
785 -struct termios
786 -{
787 - tcflag_t c_iflag;
788 - tcflag_t c_oflag;
789 - tcflag_t c_cflag;
790 - tcflag_t c_lflag;
791 - cc_t c_line;
792 - cc_t c_cc[NCCS];
793 - speed_t __c_ispeed;
794 - speed_t __c_ospeed;
795 -};
796 -
797 -#define VINTR 0
798 -#define VQUIT 1
799 -#define VERASE 2
800 -#define VKILL 3
801 -#define VEOF 4
802 -#define VTIME 5
803 -#define VMIN 6
804 -#define VSWTC 7
805 -#define VSTART 8
806 -#define VSTOP 9
807 -#define VSUSP 10
808 -#define VEOL 11
809 -#define VREPRINT 12
810 -#define VDISCARD 13
811 -#define VWERASE 14
812 -#define VLNEXT 15
813 -#define VEOL2 16
814 -
815 -#define IGNBRK 0000001
816 -#define BRKINT 0000002
817 -#define IGNPAR 0000004
818 -#define PARMRK 0000010
819 -#define INPCK 0000020
820 -#define ISTRIP 0000040
821 -#define INLCR 0000100
822 -#define IGNCR 0000200
823 -#define ICRNL 0000400
824 -#define IUCLC 0001000
825 -#define IXON 0002000
826 -#define IXANY 0004000
827 -#define IXOFF 0010000
828 -#define IMAXBEL 0020000
829 -#define IUTF8 0040000
830 -
831 -#define OPOST 0000001
832 -#define OLCUC 0000002
833 -#define ONLCR 0000004
834 -#define OCRNL 0000010
835 -#define ONOCR 0000020
836 -#define ONLRET 0000040
837 -#define OFILL 0000100
838 -#define OFDEL 0000200
839 -#define NLDLY 0000400
840 -#define NL0 0000000
841 -#define NL1 0000400
842 -#define CRDLY 0003000
843 -#define CR0 0000000
844 -#define CR1 0001000
845 -#define CR2 0002000
846 -#define CR3 0003000
847 -#define TABDLY 0014000
848 -#define TAB0 0000000
849 -#define TAB1 0004000
850 -#define TAB2 0010000
851 -#define TAB3 0014000
852 -#define BSDLY 0020000
853 -#define BS0 0000000
854 -#define BS1 0020000
855 -#define FFDLY 0100000
856 -#define FF0 0000000
857 -#define FF1 0100000
858 -
859 -#define VTDLY 0040000
860 -#define VT0 0000000
861 -#define VT1 0040000
862 -
863 -#define B0 0000000
864 -#define B50 0000001
865 -#define B75 0000002
866 -#define B110 0000003
867 -#define B134 0000004
868 -#define B150 0000005
869 -#define B200 0000006
870 -#define B300 0000007
871 -#define B600 0000010
872 -#define B1200 0000011
873 -#define B1800 0000012
874 -#define B2400 0000013
875 -#define B4800 0000014
876 -#define B9600 0000015
877 -#define B19200 0000016
878 -#define B38400 0000017
879 -
880 -#define B57600 0010001
881 -#define B115200 0010002
882 -#define B230400 0010003
883 -#define B460800 0010004
884 -#define B500000 0010005
885 -#define B576000 0010006
886 -#define B921600 0010007
887 -#define B1000000 0010010
888 -#define B1152000 0010011
889 -#define B1500000 0010012
890 -#define B2000000 0010013
891 -#define B2500000 0010014
892 -#define B3000000 0010015
893 -#define B3500000 0010016
894 -#define B4000000 0010017
895 -
896 -#define CBAUD 0010017
897 -
898 -#define CSIZE 0000060
899 -#define CS5 0000000
900 -#define CS6 0000020
901 -#define CS7 0000040
902 -#define CS8 0000060
903 -#define CSTOPB 0000100
904 -#define CREAD 0000200
905 -#define PARENB 0000400
906 -#define PARODD 0001000
907 -#define HUPCL 0002000
908 -#define CLOCAL 0004000
909 -
910 -#define ISIG 0000001
911 -#define ICANON 0000002
912 -#define ECHO 0000010
913 -#define ECHOE 0000020
914 -#define ECHOK 0000040
915 -#define ECHONL 0000100
916 -#define NOFLSH 0000200
917 -#define TOSTOP 0000400
918 -#define IEXTEN 0100000
919 -
920 -#define ECHOCTL 0001000
921 -#define ECHOPRT 0002000
922 -#define ECHOKE 0004000
923 -#define FLUSHO 0010000
924 -#define PENDIN 0040000
925 -
926 -#define TCOOFF 0
927 -#define TCOON 1
928 -#define TCIOFF 2
929 -#define TCION 3
930 -
931 -#define TCIFLUSH 0
932 -#define TCOFLUSH 1
933 -#define TCIOFLUSH 2
934 -
935 -#define TCSANOW 0
936 -#define TCSADRAIN 1
937 -#define TCSAFLUSH 2
938 -
939 -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
940 -#define CBAUDEX 0010000
941 -#define CRTSCTS 020000000000
942 -#define EXTPROC 0200000
943 -#define XTABS 0014000
944 -#endif
945 --- a/arch/aarch64/pthread_arch.h
946 +++ b/arch/aarch64/pthread_arch.h
947 @@ -8,4 +8,4 @@ static inline struct pthread *__pthread_
948 #define TLS_ABOVE_TP
949 #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 16)
950
951 -#define CANCEL_REG_IP 33
952 +#define MC_PC pc
953 --- a/arch/arm/atomic.h
954 +++ /dev/null
955 @@ -1,261 +0,0 @@
956 -#ifndef _INTERNAL_ATOMIC_H
957 -#define _INTERNAL_ATOMIC_H
958 -
959 -#include <stdint.h>
960 -
961 -static inline int a_ctz_l(unsigned long x)
962 -{
963 - static const char debruijn32[32] = {
964 - 0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13,
965 - 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9, 6, 16, 5, 15, 14
966 - };
967 - return debruijn32[(x&-x)*0x076be629 >> 27];
968 -}
969 -
970 -static inline int a_ctz_64(uint64_t x)
971 -{
972 - uint32_t y = x;
973 - if (!y) {
974 - y = x>>32;
975 - return 32 + a_ctz_l(y);
976 - }
977 - return a_ctz_l(y);
978 -}
979 -
980 -#if __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
981 -
982 -static inline void a_barrier()
983 -{
984 - __asm__ __volatile__("dmb ish");
985 -}
986 -
987 -static inline int a_cas(volatile int *p, int t, int s)
988 -{
989 - int old;
990 - __asm__ __volatile__(
991 - " dmb ish\n"
992 - "1: ldrex %0,%3\n"
993 - " cmp %0,%1\n"
994 - " bne 1f\n"
995 - " strex %0,%2,%3\n"
996 - " cmp %0, #0\n"
997 - " bne 1b\n"
998 - " mov %0, %1\n"
999 - "1: dmb ish\n"
1000 - : "=&r"(old)
1001 - : "r"(t), "r"(s), "Q"(*p)
1002 - : "memory", "cc" );
1003 - return old;
1004 -}
1005 -
1006 -static inline int a_swap(volatile int *x, int v)
1007 -{
1008 - int old, tmp;
1009 - __asm__ __volatile__(
1010 - " dmb ish\n"
1011 - "1: ldrex %0,%3\n"
1012 - " strex %1,%2,%3\n"
1013 - " cmp %1, #0\n"
1014 - " bne 1b\n"
1015 - " dmb ish\n"
1016 - : "=&r"(old), "=&r"(tmp)
1017 - : "r"(v), "Q"(*x)
1018 - : "memory", "cc" );
1019 - return old;
1020 -}
1021 -
1022 -static inline int a_fetch_add(volatile int *x, int v)
1023 -{
1024 - int old, tmp;
1025 - __asm__ __volatile__(
1026 - " dmb ish\n"
1027 - "1: ldrex %0,%3\n"
1028 - " add %0,%0,%2\n"
1029 - " strex %1,%0,%3\n"
1030 - " cmp %1, #0\n"
1031 - " bne 1b\n"
1032 - " dmb ish\n"
1033 - : "=&r"(old), "=&r"(tmp)
1034 - : "r"(v), "Q"(*x)
1035 - : "memory", "cc" );
1036 - return old-v;
1037 -}
1038 -
1039 -static inline void a_inc(volatile int *x)
1040 -{
1041 - int tmp, tmp2;
1042 - __asm__ __volatile__(
1043 - " dmb ish\n"
1044 - "1: ldrex %0,%2\n"
1045 - " add %0,%0,#1\n"
1046 - " strex %1,%0,%2\n"
1047 - " cmp %1, #0\n"
1048 - " bne 1b\n"
1049 - " dmb ish\n"
1050 - : "=&r"(tmp), "=&r"(tmp2)
1051 - : "Q"(*x)
1052 - : "memory", "cc" );
1053 -}
1054 -
1055 -static inline void a_dec(volatile int *x)
1056 -{
1057 - int tmp, tmp2;
1058 - __asm__ __volatile__(
1059 - " dmb ish\n"
1060 - "1: ldrex %0,%2\n"
1061 - " sub %0,%0,#1\n"
1062 - " strex %1,%0,%2\n"
1063 - " cmp %1, #0\n"
1064 - " bne 1b\n"
1065 - " dmb ish\n"
1066 - : "=&r"(tmp), "=&r"(tmp2)
1067 - : "Q"(*x)
1068 - : "memory", "cc" );
1069 -}
1070 -
1071 -static inline void a_and(volatile int *x, int v)
1072 -{
1073 - int tmp, tmp2;
1074 - __asm__ __volatile__(
1075 - " dmb ish\n"
1076 - "1: ldrex %0,%3\n"
1077 - " and %0,%0,%2\n"
1078 - " strex %1,%0,%3\n"
1079 - " cmp %1, #0\n"
1080 - " bne 1b\n"
1081 - " dmb ish\n"
1082 - : "=&r"(tmp), "=&r"(tmp2)
1083 - : "r"(v), "Q"(*x)
1084 - : "memory", "cc" );
1085 -}
1086 -
1087 -static inline void a_or(volatile int *x, int v)
1088 -{
1089 - int tmp, tmp2;
1090 - __asm__ __volatile__(
1091 - " dmb ish\n"
1092 - "1: ldrex %0,%3\n"
1093 - " orr %0,%0,%2\n"
1094 - " strex %1,%0,%3\n"
1095 - " cmp %1, #0\n"
1096 - " bne 1b\n"
1097 - " dmb ish\n"
1098 - : "=&r"(tmp), "=&r"(tmp2)
1099 - : "r"(v), "Q"(*x)
1100 - : "memory", "cc" );
1101 -}
1102 -
1103 -static inline void a_store(volatile int *p, int x)
1104 -{
1105 - __asm__ __volatile__(
1106 - " dmb ish\n"
1107 - " str %1,%0\n"
1108 - " dmb ish\n"
1109 - : "=m"(*p)
1110 - : "r"(x)
1111 - : "memory", "cc" );
1112 -}
1113 -
1114 -#else
1115 -
1116 -int __a_cas(int, int, volatile int *) __attribute__((__visibility__("hidden")));
1117 -#define __k_cas __a_cas
1118 -
1119 -static inline void a_barrier()
1120 -{
1121 - __asm__ __volatile__("bl __a_barrier"
1122 - : : : "memory", "cc", "ip", "lr" );
1123 -}
1124 -
1125 -static inline int a_cas(volatile int *p, int t, int s)
1126 -{
1127 - int old;
1128 - for (;;) {
1129 - if (!__k_cas(t, s, p))
1130 - return t;
1131 - if ((old=*p) != t)
1132 - return old;
1133 - }
1134 -}
1135 -
1136 -static inline int a_swap(volatile int *x, int v)
1137 -{
1138 - int old;
1139 - do old = *x;
1140 - while (__k_cas(old, v, x));
1141 - return old;
1142 -}
1143 -
1144 -static inline int a_fetch_add(volatile int *x, int v)
1145 -{
1146 - int old;
1147 - do old = *x;
1148 - while (__k_cas(old, old+v, x));
1149 - return old;
1150 -}
1151 -
1152 -static inline void a_inc(volatile int *x)
1153 -{
1154 - a_fetch_add(x, 1);
1155 -}
1156 -
1157 -static inline void a_dec(volatile int *x)
1158 -{
1159 - a_fetch_add(x, -1);
1160 -}
1161 -
1162 -static inline void a_store(volatile int *p, int x)
1163 -{
1164 - a_barrier();
1165 - *p = x;
1166 - a_barrier();
1167 -}
1168 -
1169 -static inline void a_and(volatile int *p, int v)
1170 -{
1171 - int old;
1172 - do old = *p;
1173 - while (__k_cas(old, old&v, p));
1174 -}
1175 -
1176 -static inline void a_or(volatile int *p, int v)
1177 -{
1178 - int old;
1179 - do old = *p;
1180 - while (__k_cas(old, old|v, p));
1181 -}
1182 -
1183 -#endif
1184 -
1185 -static inline void *a_cas_p(volatile void *p, void *t, void *s)
1186 -{
1187 - return (void *)a_cas(p, (int)t, (int)s);
1188 -}
1189 -
1190 -#define a_spin a_barrier
1191 -
1192 -static inline void a_crash()
1193 -{
1194 - *(volatile char *)0=0;
1195 -}
1196 -
1197 -static inline void a_or_l(volatile void *p, long v)
1198 -{
1199 - a_or(p, v);
1200 -}
1201 -
1202 -static inline void a_and_64(volatile uint64_t *p, uint64_t v)
1203 -{
1204 - union { uint64_t v; uint32_t r[2]; } u = { v };
1205 - a_and((int *)p, u.r[0]);
1206 - a_and((int *)p+1, u.r[1]);
1207 -}
1208 -
1209 -static inline void a_or_64(volatile uint64_t *p, uint64_t v)
1210 -{
1211 - union { uint64_t v; uint32_t r[2]; } u = { v };
1212 - a_or((int *)p, u.r[0]);
1213 - a_or((int *)p+1, u.r[1]);
1214 -}
1215 -
1216 -#endif
1217 --- /dev/null
1218 +++ b/arch/arm/atomic_arch.h
1219 @@ -0,0 +1,76 @@
1220 +__attribute__((__visibility__("hidden")))
1221 +extern const void *__arm_atomics[3]; /* gettp, cas, barrier */
1222 +
1223 +#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6ZK__) && !__thumb__) \
1224 + || __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
1225 +
1226 +#define a_ll a_ll
1227 +static inline int a_ll(volatile int *p)
1228 +{
1229 + int v;
1230 + __asm__ __volatile__ ("ldrex %0, %1" : "=r"(v) : "Q"(*p));
1231 + return v;
1232 +}
1233 +
1234 +#define a_sc a_sc
1235 +static inline int a_sc(volatile int *p, int v)
1236 +{
1237 + int r;
1238 + __asm__ __volatile__ ("strex %0,%1,%2" : "=&r"(r) : "r"(v), "Q"(*p) : "memory");
1239 + return !r;
1240 +}
1241 +
1242 +#if __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
1243 +
1244 +#define a_barrier a_barrier
1245 +static inline void a_barrier()
1246 +{
1247 + __asm__ __volatile__ ("dmb ish" : : : "memory");
1248 +}
1249 +
1250 +#endif
1251 +
1252 +#define a_pre_llsc a_barrier
1253 +#define a_post_llsc a_barrier
1254 +
1255 +#else
1256 +
1257 +#define a_cas a_cas
1258 +static inline int a_cas(volatile int *p, int t, int s)
1259 +{
1260 + for (;;) {
1261 + register int r0 __asm__("r0") = t;
1262 + register int r1 __asm__("r1") = s;
1263 + register volatile int *r2 __asm__("r2") = p;
1264 + int old;
1265 + __asm__ __volatile__ (
1266 + "bl __a_cas"
1267 + : "+r"(r0) : "r"(r1), "r"(r2)
1268 + : "memory", "r3", "lr", "ip", "cc" );
1269 + if (!r0) return t;
1270 + if ((old=*p)!=t) return old;
1271 + }
1272 +}
1273 +
1274 +#endif
1275 +
1276 +#ifndef a_barrier
1277 +#define a_barrier a_barrier
1278 +static inline void a_barrier()
1279 +{
1280 + __asm__ __volatile__("bl __a_barrier"
1281 + : : : "memory", "cc", "ip", "lr" );
1282 +}
1283 +#endif
1284 +
1285 +#define a_crash a_crash
1286 +static inline void a_crash()
1287 +{
1288 + __asm__ __volatile__(
1289 +#ifndef __thumb__
1290 + ".word 0xe7f000f0"
1291 +#else
1292 + ".short 0xdeff"
1293 +#endif
1294 + : : : "memory");
1295 +}
1296 --- a/arch/arm/bits/errno.h
1297 +++ /dev/null
1298 @@ -1,134 +0,0 @@
1299 -#define EPERM 1
1300 -#define ENOENT 2
1301 -#define ESRCH 3
1302 -#define EINTR 4
1303 -#define EIO 5
1304 -#define ENXIO 6
1305 -#define E2BIG 7
1306 -#define ENOEXEC 8
1307 -#define EBADF 9
1308 -#define ECHILD 10
1309 -#define EAGAIN 11
1310 -#define ENOMEM 12
1311 -#define EACCES 13
1312 -#define EFAULT 14
1313 -#define ENOTBLK 15
1314 -#define EBUSY 16
1315 -#define EEXIST 17
1316 -#define EXDEV 18
1317 -#define ENODEV 19
1318 -#define ENOTDIR 20
1319 -#define EISDIR 21
1320 -#define EINVAL 22
1321 -#define ENFILE 23
1322 -#define EMFILE 24
1323 -#define ENOTTY 25
1324 -#define ETXTBSY 26
1325 -#define EFBIG 27
1326 -#define ENOSPC 28
1327 -#define ESPIPE 29
1328 -#define EROFS 30
1329 -#define EMLINK 31
1330 -#define EPIPE 32
1331 -#define EDOM 33
1332 -#define ERANGE 34
1333 -#define EDEADLK 35
1334 -#define ENAMETOOLONG 36
1335 -#define ENOLCK 37
1336 -#define ENOSYS 38
1337 -#define ENOTEMPTY 39
1338 -#define ELOOP 40
1339 -#define EWOULDBLOCK EAGAIN
1340 -#define ENOMSG 42
1341 -#define EIDRM 43
1342 -#define ECHRNG 44
1343 -#define EL2NSYNC 45
1344 -#define EL3HLT 46
1345 -#define EL3RST 47
1346 -#define ELNRNG 48
1347 -#define EUNATCH 49
1348 -#define ENOCSI 50
1349 -#define EL2HLT 51
1350 -#define EBADE 52
1351 -#define EBADR 53
1352 -#define EXFULL 54
1353 -#define ENOANO 55
1354 -#define EBADRQC 56
1355 -#define EBADSLT 57
1356 -#define EDEADLOCK EDEADLK
1357 -#define EBFONT 59
1358 -#define ENOSTR 60
1359 -#define ENODATA 61
1360 -#define ETIME 62
1361 -#define ENOSR 63
1362 -#define ENONET 64
1363 -#define ENOPKG 65
1364 -#define EREMOTE 66
1365 -#define ENOLINK 67
1366 -#define EADV 68
1367 -#define ESRMNT 69
1368 -#define ECOMM 70
1369 -#define EPROTO 71
1370 -#define EMULTIHOP 72
1371 -#define EDOTDOT 73
1372 -#define EBADMSG 74
1373 -#define EOVERFLOW 75
1374 -#define ENOTUNIQ 76
1375 -#define EBADFD 77
1376 -#define EREMCHG 78
1377 -#define ELIBACC 79
1378 -#define ELIBBAD 80
1379 -#define ELIBSCN 81
1380 -#define ELIBMAX 82
1381 -#define ELIBEXEC 83
1382 -#define EILSEQ 84
1383 -#define ERESTART 85
1384 -#define ESTRPIPE 86
1385 -#define EUSERS 87
1386 -#define ENOTSOCK 88
1387 -#define EDESTADDRREQ 89
1388 -#define EMSGSIZE 90
1389 -#define EPROTOTYPE 91
1390 -#define ENOPROTOOPT 92
1391 -#define EPROTONOSUPPORT 93
1392 -#define ESOCKTNOSUPPORT 94
1393 -#define EOPNOTSUPP 95
1394 -#define ENOTSUP EOPNOTSUPP
1395 -#define EPFNOSUPPORT 96
1396 -#define EAFNOSUPPORT 97
1397 -#define EADDRINUSE 98
1398 -#define EADDRNOTAVAIL 99
1399 -#define ENETDOWN 100
1400 -#define ENETUNREACH 101
1401 -#define ENETRESET 102
1402 -#define ECONNABORTED 103
1403 -#define ECONNRESET 104
1404 -#define ENOBUFS 105
1405 -#define EISCONN 106
1406 -#define ENOTCONN 107
1407 -#define ESHUTDOWN 108
1408 -#define ETOOMANYREFS 109
1409 -#define ETIMEDOUT 110
1410 -#define ECONNREFUSED 111
1411 -#define EHOSTDOWN 112
1412 -#define EHOSTUNREACH 113
1413 -#define EALREADY 114
1414 -#define EINPROGRESS 115
1415 -#define ESTALE 116
1416 -#define EUCLEAN 117
1417 -#define ENOTNAM 118
1418 -#define ENAVAIL 119
1419 -#define EISNAM 120
1420 -#define EREMOTEIO 121
1421 -#define EDQUOT 122
1422 -#define ENOMEDIUM 123
1423 -#define EMEDIUMTYPE 124
1424 -#define ECANCELED 125
1425 -#define ENOKEY 126
1426 -#define EKEYEXPIRED 127
1427 -#define EKEYREVOKED 128
1428 -#define EKEYREJECTED 129
1429 -#define EOWNERDEAD 130
1430 -#define ENOTRECOVERABLE 131
1431 -#define ERFKILL 132
1432 -#define EHWPOISON 133
1433 --- a/arch/arm/bits/ioctl.h
1434 +++ /dev/null
1435 @@ -1,197 +0,0 @@
1436 -#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
1437 -#define _IOC_NONE 0U
1438 -#define _IOC_WRITE 1U
1439 -#define _IOC_READ 2U
1440 -
1441 -#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
1442 -#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
1443 -#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
1444 -#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
1445 -
1446 -#define TCGETS 0x5401
1447 -#define TCSETS 0x5402
1448 -#define TCSETSW 0x5403
1449 -#define TCSETSF 0x5404
1450 -#define TCGETA 0x5405
1451 -#define TCSETA 0x5406
1452 -#define TCSETAW 0x5407
1453 -#define TCSETAF 0x5408
1454 -#define TCSBRK 0x5409
1455 -#define TCXONC 0x540A
1456 -#define TCFLSH 0x540B
1457 -#define TIOCEXCL 0x540C
1458 -#define TIOCNXCL 0x540D
1459 -#define TIOCSCTTY 0x540E
1460 -#define TIOCGPGRP 0x540F
1461 -#define TIOCSPGRP 0x5410
1462 -#define TIOCOUTQ 0x5411
1463 -#define TIOCSTI 0x5412
1464 -#define TIOCGWINSZ 0x5413
1465 -#define TIOCSWINSZ 0x5414
1466 -#define TIOCMGET 0x5415
1467 -#define TIOCMBIS 0x5416
1468 -#define TIOCMBIC 0x5417
1469 -#define TIOCMSET 0x5418
1470 -#define TIOCGSOFTCAR 0x5419
1471 -#define TIOCSSOFTCAR 0x541A
1472 -#define FIONREAD 0x541B
1473 -#define TIOCINQ FIONREAD
1474 -#define TIOCLINUX 0x541C
1475 -#define TIOCCONS 0x541D
1476 -#define TIOCGSERIAL 0x541E
1477 -#define TIOCSSERIAL 0x541F
1478 -#define TIOCPKT 0x5420
1479 -#define FIONBIO 0x5421
1480 -#define TIOCNOTTY 0x5422
1481 -#define TIOCSETD 0x5423
1482 -#define TIOCGETD 0x5424
1483 -#define TCSBRKP 0x5425
1484 -#define TIOCTTYGSTRUCT 0x5426
1485 -#define TIOCSBRK 0x5427
1486 -#define TIOCCBRK 0x5428
1487 -#define TIOCGSID 0x5429
1488 -#define TIOCGPTN 0x80045430
1489 -#define TIOCSPTLCK 0x40045431
1490 -#define TCGETX 0x5432
1491 -#define TCSETX 0x5433
1492 -#define TCSETXF 0x5434
1493 -#define TCSETXW 0x5435
1494 -
1495 -#define FIONCLEX 0x5450
1496 -#define FIOCLEX 0x5451
1497 -#define FIOASYNC 0x5452
1498 -#define TIOCSERCONFIG 0x5453
1499 -#define TIOCSERGWILD 0x5454
1500 -#define TIOCSERSWILD 0x5455
1501 -#define TIOCGLCKTRMIOS 0x5456
1502 -#define TIOCSLCKTRMIOS 0x5457
1503 -#define TIOCSERGSTRUCT 0x5458
1504 -#define TIOCSERGETLSR 0x5459
1505 -#define TIOCSERGETMULTI 0x545A
1506 -#define TIOCSERSETMULTI 0x545B
1507 -
1508 -#define TIOCMIWAIT 0x545C
1509 -#define TIOCGICOUNT 0x545D
1510 -#define TIOCGHAYESESP 0x545E
1511 -#define TIOCSHAYESESP 0x545F
1512 -#define FIOQSIZE 0x5460
1513 -
1514 -#define TIOCPKT_DATA 0
1515 -#define TIOCPKT_FLUSHREAD 1
1516 -#define TIOCPKT_FLUSHWRITE 2
1517 -#define TIOCPKT_STOP 4
1518 -#define TIOCPKT_START 8
1519 -#define TIOCPKT_NOSTOP 16
1520 -#define TIOCPKT_DOSTOP 32
1521 -#define TIOCPKT_IOCTL 64
1522 -
1523 -#define TIOCSER_TEMT 0x01
1524 -
1525 -struct winsize {
1526 - unsigned short ws_row;
1527 - unsigned short ws_col;
1528 - unsigned short ws_xpixel;
1529 - unsigned short ws_ypixel;
1530 -};
1531 -
1532 -#define TIOCM_LE 0x001
1533 -#define TIOCM_DTR 0x002
1534 -#define TIOCM_RTS 0x004
1535 -#define TIOCM_ST 0x008
1536 -#define TIOCM_SR 0x010
1537 -#define TIOCM_CTS 0x020
1538 -#define TIOCM_CAR 0x040
1539 -#define TIOCM_RNG 0x080
1540 -#define TIOCM_DSR 0x100
1541 -#define TIOCM_CD TIOCM_CAR
1542 -#define TIOCM_RI TIOCM_RNG
1543 -#define TIOCM_OUT1 0x2000
1544 -#define TIOCM_OUT2 0x4000
1545 -#define TIOCM_LOOP 0x8000
1546 -#define TIOCM_MODEM_BITS TIOCM_OUT2
1547 -
1548 -#define N_TTY 0
1549 -#define N_SLIP 1
1550 -#define N_MOUSE 2
1551 -#define N_PPP 3
1552 -#define N_STRIP 4
1553 -#define N_AX25 5
1554 -#define N_X25 6
1555 -#define N_6PACK 7
1556 -#define N_MASC 8
1557 -#define N_R3964 9
1558 -#define N_PROFIBUS_FDL 10
1559 -#define N_IRDA 11
1560 -#define N_SMSBLOCK 12
1561 -#define N_HDLC 13
1562 -#define N_SYNC_PPP 14
1563 -#define N_HCI 15
1564 -
1565 -#define FIOSETOWN 0x8901
1566 -#define SIOCSPGRP 0x8902
1567 -#define FIOGETOWN 0x8903
1568 -#define SIOCGPGRP 0x8904
1569 -#define SIOCATMARK 0x8905
1570 -#define SIOCGSTAMP 0x8906
1571 -
1572 -#define SIOCADDRT 0x890B
1573 -#define SIOCDELRT 0x890C
1574 -#define SIOCRTMSG 0x890D
1575 -
1576 -#define SIOCGIFNAME 0x8910
1577 -#define SIOCSIFLINK 0x8911
1578 -#define SIOCGIFCONF 0x8912
1579 -#define SIOCGIFFLAGS 0x8913
1580 -#define SIOCSIFFLAGS 0x8914
1581 -#define SIOCGIFADDR 0x8915
1582 -#define SIOCSIFADDR 0x8916
1583 -#define SIOCGIFDSTADDR 0x8917
1584 -#define SIOCSIFDSTADDR 0x8918
1585 -#define SIOCGIFBRDADDR 0x8919
1586 -#define SIOCSIFBRDADDR 0x891a
1587 -#define SIOCGIFNETMASK 0x891b
1588 -#define SIOCSIFNETMASK 0x891c
1589 -#define SIOCGIFMETRIC 0x891d
1590 -#define SIOCSIFMETRIC 0x891e
1591 -#define SIOCGIFMEM 0x891f
1592 -#define SIOCSIFMEM 0x8920
1593 -#define SIOCGIFMTU 0x8921
1594 -#define SIOCSIFMTU 0x8922
1595 -#define SIOCSIFHWADDR 0x8924
1596 -#define SIOCGIFENCAP 0x8925
1597 -#define SIOCSIFENCAP 0x8926
1598 -#define SIOCGIFHWADDR 0x8927
1599 -#define SIOCGIFSLAVE 0x8929
1600 -#define SIOCSIFSLAVE 0x8930
1601 -#define SIOCADDMULTI 0x8931
1602 -#define SIOCDELMULTI 0x8932
1603 -#define SIOCGIFINDEX 0x8933
1604 -#define SIOGIFINDEX SIOCGIFINDEX
1605 -#define SIOCSIFPFLAGS 0x8934
1606 -#define SIOCGIFPFLAGS 0x8935
1607 -#define SIOCDIFADDR 0x8936
1608 -#define SIOCSIFHWBROADCAST 0x8937
1609 -#define SIOCGIFCOUNT 0x8938
1610 -
1611 -#define SIOCGIFBR 0x8940
1612 -#define SIOCSIFBR 0x8941
1613 -
1614 -#define SIOCGIFTXQLEN 0x8942
1615 -#define SIOCSIFTXQLEN 0x8943
1616 -
1617 -#define SIOCDARP 0x8953
1618 -#define SIOCGARP 0x8954
1619 -#define SIOCSARP 0x8955
1620 -
1621 -#define SIOCDRARP 0x8960
1622 -#define SIOCGRARP 0x8961
1623 -#define SIOCSRARP 0x8962
1624 -
1625 -#define SIOCGIFMAP 0x8970
1626 -#define SIOCSIFMAP 0x8971
1627 -
1628 -#define SIOCADDDLCI 0x8980
1629 -#define SIOCDELDLCI 0x8981
1630 -
1631 -#define SIOCDEVPRIVATE 0x89F0
1632 -#define SIOCPROTOPRIVATE 0x89E0
1633 --- a/arch/arm/bits/ipc.h
1634 +++ /dev/null
1635 @@ -1,14 +0,0 @@
1636 -struct ipc_perm
1637 -{
1638 - key_t __ipc_perm_key;
1639 - uid_t uid;
1640 - gid_t gid;
1641 - uid_t cuid;
1642 - gid_t cgid;
1643 - mode_t mode;
1644 - int __ipc_perm_seq;
1645 - long __pad1;
1646 - long __pad2;
1647 -};
1648 -
1649 -#define IPC_64 0x100
1650 --- a/arch/arm/bits/mman.h
1651 +++ b/arch/arm/bits/mman.h
1652 @@ -37,6 +37,7 @@
1653
1654 #define MCL_CURRENT 1
1655 #define MCL_FUTURE 2
1656 +#define MCL_ONFAULT 4
1657
1658 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
1659 #define MADV_NORMAL 0
1660 --- a/arch/arm/bits/msg.h
1661 +++ /dev/null
1662 @@ -1,16 +0,0 @@
1663 -struct msqid_ds
1664 -{
1665 - struct ipc_perm msg_perm;
1666 - time_t msg_stime;
1667 - int __unused1;
1668 - time_t msg_rtime;
1669 - int __unused2;
1670 - time_t msg_ctime;
1671 - int __unused3;
1672 - unsigned long msg_cbytes;
1673 - msgqnum_t msg_qnum;
1674 - msglen_t msg_qbytes;
1675 - pid_t msg_lspid;
1676 - pid_t msg_lrpid;
1677 - unsigned long __unused[2];
1678 -};
1679 --- a/arch/arm/bits/sem.h
1680 +++ /dev/null
1681 @@ -1,16 +0,0 @@
1682 -struct semid_ds {
1683 - struct ipc_perm sem_perm;
1684 - time_t sem_otime;
1685 - time_t __unused1;
1686 - time_t sem_ctime;
1687 - time_t __unused2;
1688 -#if __BYTE_ORDER == __LITTLE_ENDIAN
1689 - unsigned short sem_nsems;
1690 - char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
1691 -#else
1692 - char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
1693 - unsigned short sem_nsems;
1694 -#endif
1695 - time_t __unused3;
1696 - time_t __unused4;
1697 -};
1698 --- a/arch/arm/bits/shm.h
1699 +++ /dev/null
1700 @@ -1,29 +0,0 @@
1701 -#define SHMLBA 4096
1702 -
1703 -struct shmid_ds
1704 -{
1705 - struct ipc_perm shm_perm;
1706 - size_t shm_segsz;
1707 - time_t shm_atime;
1708 - int __unused1;
1709 - time_t shm_dtime;
1710 - int __unused2;
1711 - time_t shm_ctime;
1712 - int __unused3;
1713 - pid_t shm_cpid;
1714 - pid_t shm_lpid;
1715 - unsigned long shm_nattch;
1716 - unsigned long __pad1;
1717 - unsigned long __pad2;
1718 -};
1719 -
1720 -struct shminfo {
1721 - unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
1722 -};
1723 -
1724 -struct shm_info {
1725 - int __used_ids;
1726 - unsigned long shm_tot, shm_rss, shm_swp;
1727 - unsigned long __swap_attempts, __swap_successes;
1728 -};
1729 -
1730 --- a/arch/arm/bits/socket.h
1731 +++ /dev/null
1732 @@ -1,17 +0,0 @@
1733 -struct msghdr
1734 -{
1735 - void *msg_name;
1736 - socklen_t msg_namelen;
1737 - struct iovec *msg_iov;
1738 - int msg_iovlen;
1739 - void *msg_control;
1740 - socklen_t msg_controllen;
1741 - int msg_flags;
1742 -};
1743 -
1744 -struct cmsghdr
1745 -{
1746 - socklen_t cmsg_len;
1747 - int cmsg_level;
1748 - int cmsg_type;
1749 -};
1750 --- a/arch/arm/bits/statfs.h
1751 +++ /dev/null
1752 @@ -1,7 +0,0 @@
1753 -struct statfs {
1754 - unsigned long f_type, f_bsize;
1755 - fsblkcnt_t f_blocks, f_bfree, f_bavail;
1756 - fsfilcnt_t f_files, f_ffree;
1757 - fsid_t f_fsid;
1758 - unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
1759 -};
1760 --- a/arch/arm/bits/stdarg.h
1761 +++ /dev/null
1762 @@ -1,4 +0,0 @@
1763 -#define va_start(v,l) __builtin_va_start(v,l)
1764 -#define va_end(v) __builtin_va_end(v)
1765 -#define va_arg(v,l) __builtin_va_arg(v,l)
1766 -#define va_copy(d,s) __builtin_va_copy(d,s)
1767 --- a/arch/arm/bits/syscall.h
1768 +++ b/arch/arm/bits/syscall.h
1769 @@ -341,6 +341,9 @@
1770 #define __NR_memfd_create 385
1771 #define __NR_bpf 386
1772 #define __NR_execveat 387
1773 +#define __NR_userfaultfd 388
1774 +#define __NR_membarrier 389
1775 +#define __NR_mlock2 390
1776
1777 #define __ARM_NR_breakpoint 0x0f0001
1778 #define __ARM_NR_cacheflush 0x0f0002
1779 @@ -693,3 +696,6 @@
1780 #define SYS_memfd_create 385
1781 #define SYS_bpf 386
1782 #define SYS_execveat 387
1783 +#define SYS_userfaultfd 388
1784 +#define SYS_membarrier 389
1785 +#define SYS_mlock2 390
1786 --- a/arch/arm/bits/termios.h
1787 +++ /dev/null
1788 @@ -1,160 +0,0 @@
1789 -struct termios
1790 -{
1791 - tcflag_t c_iflag;
1792 - tcflag_t c_oflag;
1793 - tcflag_t c_cflag;
1794 - tcflag_t c_lflag;
1795 - cc_t c_line;
1796 - cc_t c_cc[NCCS];
1797 - speed_t __c_ispeed;
1798 - speed_t __c_ospeed;
1799 -};
1800 -
1801 -#define VINTR 0
1802 -#define VQUIT 1
1803 -#define VERASE 2
1804 -#define VKILL 3
1805 -#define VEOF 4
1806 -#define VTIME 5
1807 -#define VMIN 6
1808 -#define VSWTC 7
1809 -#define VSTART 8
1810 -#define VSTOP 9
1811 -#define VSUSP 10
1812 -#define VEOL 11
1813 -#define VREPRINT 12
1814 -#define VDISCARD 13
1815 -#define VWERASE 14
1816 -#define VLNEXT 15
1817 -#define VEOL2 16
1818 -
1819 -#define IGNBRK 0000001
1820 -#define BRKINT 0000002
1821 -#define IGNPAR 0000004
1822 -#define PARMRK 0000010
1823 -#define INPCK 0000020
1824 -#define ISTRIP 0000040
1825 -#define INLCR 0000100
1826 -#define IGNCR 0000200
1827 -#define ICRNL 0000400
1828 -#define IUCLC 0001000
1829 -#define IXON 0002000
1830 -#define IXANY 0004000
1831 -#define IXOFF 0010000
1832 -#define IMAXBEL 0020000
1833 -#define IUTF8 0040000
1834 -
1835 -#define OPOST 0000001
1836 -#define OLCUC 0000002
1837 -#define ONLCR 0000004
1838 -#define OCRNL 0000010
1839 -#define ONOCR 0000020
1840 -#define ONLRET 0000040
1841 -#define OFILL 0000100
1842 -#define OFDEL 0000200
1843 -#define NLDLY 0000400
1844 -#define NL0 0000000
1845 -#define NL1 0000400
1846 -#define CRDLY 0003000
1847 -#define CR0 0000000
1848 -#define CR1 0001000
1849 -#define CR2 0002000
1850 -#define CR3 0003000
1851 -#define TABDLY 0014000
1852 -#define TAB0 0000000
1853 -#define TAB1 0004000
1854 -#define TAB2 0010000
1855 -#define TAB3 0014000
1856 -#define BSDLY 0020000
1857 -#define BS0 0000000
1858 -#define BS1 0020000
1859 -#define FFDLY 0100000
1860 -#define FF0 0000000
1861 -#define FF1 0100000
1862 -
1863 -#define VTDLY 0040000
1864 -#define VT0 0000000
1865 -#define VT1 0040000
1866 -
1867 -#define B0 0000000
1868 -#define B50 0000001
1869 -#define B75 0000002
1870 -#define B110 0000003
1871 -#define B134 0000004
1872 -#define B150 0000005
1873 -#define B200 0000006
1874 -#define B300 0000007
1875 -#define B600 0000010
1876 -#define B1200 0000011
1877 -#define B1800 0000012
1878 -#define B2400 0000013
1879 -#define B4800 0000014
1880 -#define B9600 0000015
1881 -#define B19200 0000016
1882 -#define B38400 0000017
1883 -
1884 -#define B57600 0010001
1885 -#define B115200 0010002
1886 -#define B230400 0010003
1887 -#define B460800 0010004
1888 -#define B500000 0010005
1889 -#define B576000 0010006
1890 -#define B921600 0010007
1891 -#define B1000000 0010010
1892 -#define B1152000 0010011
1893 -#define B1500000 0010012
1894 -#define B2000000 0010013
1895 -#define B2500000 0010014
1896 -#define B3000000 0010015
1897 -#define B3500000 0010016
1898 -#define B4000000 0010017
1899 -
1900 -#define CBAUD 0010017
1901 -
1902 -#define CSIZE 0000060
1903 -#define CS5 0000000
1904 -#define CS6 0000020
1905 -#define CS7 0000040
1906 -#define CS8 0000060
1907 -#define CSTOPB 0000100
1908 -#define CREAD 0000200
1909 -#define PARENB 0000400
1910 -#define PARODD 0001000
1911 -#define HUPCL 0002000
1912 -#define CLOCAL 0004000
1913 -
1914 -#define ISIG 0000001
1915 -#define ICANON 0000002
1916 -#define ECHO 0000010
1917 -#define ECHOE 0000020
1918 -#define ECHOK 0000040
1919 -#define ECHONL 0000100
1920 -#define NOFLSH 0000200
1921 -#define TOSTOP 0000400
1922 -#define IEXTEN 0100000
1923 -
1924 -#define ECHOCTL 0001000
1925 -#define ECHOPRT 0002000
1926 -#define ECHOKE 0004000
1927 -#define FLUSHO 0010000
1928 -#define PENDIN 0040000
1929 -
1930 -#define TCOOFF 0
1931 -#define TCOON 1
1932 -#define TCIOFF 2
1933 -#define TCION 3
1934 -
1935 -#define TCIFLUSH 0
1936 -#define TCOFLUSH 1
1937 -#define TCIOFLUSH 2
1938 -
1939 -#define TCSANOW 0
1940 -#define TCSADRAIN 1
1941 -#define TCSAFLUSH 2
1942 -
1943 -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
1944 -#define CBAUDEX 0010000
1945 -#define CRTSCTS 020000000000
1946 -#define EXTPROC 0200000
1947 -#define XTABS 0014000
1948 -#endif
1949 --- a/arch/arm/pthread_arch.h
1950 +++ b/arch/arm/pthread_arch.h
1951 @@ -27,4 +27,4 @@ static inline pthread_t __pthread_self()
1952 #define TLS_ABOVE_TP
1953 #define TP_ADJ(p) ((char *)(p) + sizeof(struct pthread) - 8)
1954
1955 -#define CANCEL_REG_IP 18
1956 +#define MC_PC arm_pc
1957 --- a/arch/arm/reloc.h
1958 +++ b/arch/arm/reloc.h
1959 @@ -6,10 +6,10 @@
1960 #define ENDIAN_SUFFIX ""
1961 #endif
1962
1963 -#if __SOFTFP__
1964 -#define FP_SUFFIX ""
1965 -#else
1966 +#if __ARM_PCS_VFP
1967 #define FP_SUFFIX "hf"
1968 +#else
1969 +#define FP_SUFFIX ""
1970 #endif
1971
1972 #define LDSO_ARCH "arm" ENDIAN_SUFFIX FP_SUFFIX
1973 @@ -28,10 +28,5 @@
1974 #define REL_TPOFF R_ARM_TLS_TPOFF32
1975 //#define REL_TLSDESC R_ARM_TLS_DESC
1976
1977 -#ifdef __thumb__
1978 #define CRTJMP(pc,sp) __asm__ __volatile__( \
1979 "mov sp,%1 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
1980 -#else
1981 -#define CRTJMP(pc,sp) __asm__ __volatile__( \
1982 - "mov sp,%1 ; tst %0,#1 ; moveq pc,%0 ; bx %0" : : "r"(pc), "r"(sp) : "memory" )
1983 -#endif
1984 --- a/arch/arm/src/__aeabi_atexit.c
1985 +++ /dev/null
1986 @@ -1,6 +0,0 @@
1987 -int __cxa_atexit(void (*func)(void *), void *arg, void *dso);
1988 -
1989 -int __aeabi_atexit (void *obj, void (*func) (void *), void *d)
1990 -{
1991 - return __cxa_atexit (func, obj, d);
1992 -}
1993 --- a/arch/arm/src/__aeabi_memclr.c
1994 +++ /dev/null
1995 @@ -1,9 +0,0 @@
1996 -#include <string.h>
1997 -#include "libc.h"
1998 -
1999 -void __aeabi_memclr(void *dest, size_t n)
2000 -{
2001 - memset(dest, 0, n);
2002 -}
2003 -weak_alias(__aeabi_memclr, __aeabi_memclr4);
2004 -weak_alias(__aeabi_memclr, __aeabi_memclr8);
2005 --- a/arch/arm/src/__aeabi_memcpy.c
2006 +++ /dev/null
2007 @@ -1,9 +0,0 @@
2008 -#include <string.h>
2009 -#include "libc.h"
2010 -
2011 -void __aeabi_memcpy(void *restrict dest, const void *restrict src, size_t n)
2012 -{
2013 - memcpy(dest, src, n);
2014 -}
2015 -weak_alias(__aeabi_memcpy, __aeabi_memcpy4);
2016 -weak_alias(__aeabi_memcpy, __aeabi_memcpy8);
2017 --- a/arch/arm/src/__aeabi_memmove.c
2018 +++ /dev/null
2019 @@ -1,9 +0,0 @@
2020 -#include <string.h>
2021 -#include "libc.h"
2022 -
2023 -void __aeabi_memmove(void *dest, const void *src, size_t n)
2024 -{
2025 - memmove(dest, src, n);
2026 -}
2027 -weak_alias(__aeabi_memmove, __aeabi_memmove4);
2028 -weak_alias(__aeabi_memmove, __aeabi_memmove8);
2029 --- a/arch/arm/src/__aeabi_memset.c
2030 +++ /dev/null
2031 @@ -1,9 +0,0 @@
2032 -#include <string.h>
2033 -#include "libc.h"
2034 -
2035 -void __aeabi_memset(void *dest, size_t n, int c)
2036 -{
2037 - memset(dest, c, n);
2038 -}
2039 -weak_alias(__aeabi_memset, __aeabi_memset4);
2040 -weak_alias(__aeabi_memset, __aeabi_memset8);
2041 --- a/arch/arm/src/__set_thread_area.c
2042 +++ /dev/null
2043 @@ -1,49 +0,0 @@
2044 -#include <stdint.h>
2045 -#include <elf.h>
2046 -#include "pthread_impl.h"
2047 -#include "libc.h"
2048 -
2049 -#define HWCAP_TLS (1 << 15)
2050 -
2051 -extern const unsigned char __attribute__((__visibility__("hidden")))
2052 - __a_barrier_dummy[], __a_barrier_oldkuser[],
2053 - __a_barrier_v6[], __a_barrier_v7[],
2054 - __a_cas_dummy[], __a_cas_v6[], __a_cas_v7[],
2055 - __a_gettp_dummy[];
2056 -
2057 -#define __a_barrier_kuser 0xffff0fa0
2058 -#define __a_cas_kuser 0xffff0fc0
2059 -#define __a_gettp_kuser 0xffff0fe0
2060 -
2061 -extern uintptr_t __attribute__((__visibility__("hidden")))
2062 - __a_barrier_ptr, __a_cas_ptr, __a_gettp_ptr;
2063 -
2064 -#define SET(op,ver) (__a_##op##_ptr = \
2065 - (uintptr_t)__a_##op##_##ver - (uintptr_t)__a_##op##_dummy)
2066 -
2067 -int __set_thread_area(void *p)
2068 -{
2069 -#if !__ARM_ARCH_7A__ && !__ARM_ARCH_7R__ && __ARM_ARCH < 7
2070 - if (__hwcap & HWCAP_TLS) {
2071 - size_t *aux;
2072 - SET(cas, v7);
2073 - SET(barrier, v7);
2074 - for (aux=libc.auxv; *aux; aux+=2) {
2075 - if (*aux != AT_PLATFORM) continue;
2076 - const char *s = (void *)aux[1];
2077 - if (s[0]!='v' || s[1]!='6' || s[2]-'0'<10u) break;
2078 - SET(cas, v6);
2079 - SET(barrier, v6);
2080 - break;
2081 - }
2082 - } else {
2083 - int ver = *(int *)0xffff0ffc;
2084 - SET(gettp, kuser);
2085 - SET(cas, kuser);
2086 - SET(barrier, kuser);
2087 - if (ver < 2) a_crash();
2088 - if (ver < 3) SET(barrier, oldkuser);
2089 - }
2090 -#endif
2091 - return __syscall(0xf0005, p);
2092 -}
2093 --- a/arch/arm/src/arm/atomics.s
2094 +++ /dev/null
2095 @@ -1,116 +0,0 @@
2096 -.text
2097 -
2098 -.global __a_barrier
2099 -.hidden __a_barrier
2100 -.type __a_barrier,%function
2101 -__a_barrier:
2102 - ldr ip,1f
2103 - ldr ip,[pc,ip]
2104 - add pc,pc,ip
2105 -1: .word __a_barrier_ptr-1b
2106 -.global __a_barrier_dummy
2107 -.hidden __a_barrier_dummy
2108 -__a_barrier_dummy:
2109 - tst lr,#1
2110 - moveq pc,lr
2111 - bx lr
2112 -.global __a_barrier_oldkuser
2113 -.hidden __a_barrier_oldkuser
2114 -__a_barrier_oldkuser:
2115 - push {r0,r1,r2,r3,ip,lr}
2116 - mov r1,r0
2117 - mov r2,sp
2118 - ldr ip,=0xffff0fc0
2119 - mov lr,pc
2120 - mov pc,ip
2121 - pop {r0,r1,r2,r3,ip,lr}
2122 - tst lr,#1
2123 - moveq pc,lr
2124 - bx lr
2125 -.global __a_barrier_v6
2126 -.hidden __a_barrier_v6
2127 -__a_barrier_v6:
2128 - mcr p15,0,r0,c7,c10,5
2129 - bx lr
2130 -.global __a_barrier_v7
2131 -.hidden __a_barrier_v7
2132 -__a_barrier_v7:
2133 - .word 0xf57ff05b /* dmb ish */
2134 - bx lr
2135 -
2136 -.global __a_cas
2137 -.hidden __a_cas
2138 -.type __a_cas,%function
2139 -__a_cas:
2140 - ldr ip,1f
2141 - ldr ip,[pc,ip]
2142 - add pc,pc,ip
2143 -1: .word __a_cas_ptr-1b
2144 -.global __a_cas_dummy
2145 -.hidden __a_cas_dummy
2146 -__a_cas_dummy:
2147 - mov r3,r0
2148 - ldr r0,[r2]
2149 - subs r0,r3,r0
2150 - streq r1,[r2]
2151 - tst lr,#1
2152 - moveq pc,lr
2153 - bx lr
2154 -.global __a_cas_v6
2155 -.hidden __a_cas_v6
2156 -__a_cas_v6:
2157 - mov r3,r0
2158 - mcr p15,0,r0,c7,c10,5
2159 -1: .word 0xe1920f9f /* ldrex r0,[r2] */
2160 - subs r0,r3,r0
2161 - .word 0x01820f91 /* strexeq r0,r1,[r2] */
2162 - teqeq r0,#1
2163 - beq 1b
2164 - mcr p15,0,r0,c7,c10,5
2165 - bx lr
2166 -.global __a_cas_v7
2167 -.hidden __a_cas_v7
2168 -__a_cas_v7:
2169 - mov r3,r0
2170 - .word 0xf57ff05b /* dmb ish */
2171 -1: .word 0xe1920f9f /* ldrex r0,[r2] */
2172 - subs r0,r3,r0
2173 - .word 0x01820f91 /* strexeq r0,r1,[r2] */
2174 - teqeq r0,#1
2175 - beq 1b
2176 - .word 0xf57ff05b /* dmb ish */
2177 - bx lr
2178 -
2179 -.global __aeabi_read_tp
2180 -.type __aeabi_read_tp,%function
2181 -__aeabi_read_tp:
2182 -
2183 -.global __a_gettp
2184 -.hidden __a_gettp
2185 -.type __a_gettp,%function
2186 -__a_gettp:
2187 - ldr r0,1f
2188 - ldr r0,[pc,r0]
2189 - add pc,pc,r0
2190 -1: .word __a_gettp_ptr-1b
2191 -.global __a_gettp_dummy
2192 -.hidden __a_gettp_dummy
2193 -__a_gettp_dummy:
2194 - mrc p15,0,r0,c13,c0,3
2195 - bx lr
2196 -
2197 -.data
2198 -.global __a_barrier_ptr
2199 -.hidden __a_barrier_ptr
2200 -__a_barrier_ptr:
2201 - .word 0
2202 -
2203 -.global __a_cas_ptr
2204 -.hidden __a_cas_ptr
2205 -__a_cas_ptr:
2206 - .word 0
2207 -
2208 -.global __a_gettp_ptr
2209 -.hidden __a_gettp_ptr
2210 -__a_gettp_ptr:
2211 - .word 0
2212 --- a/arch/arm/src/find_exidx.c
2213 +++ /dev/null
2214 @@ -1,42 +0,0 @@
2215 -#define _GNU_SOURCE
2216 -#include <link.h>
2217 -#include <stdint.h>
2218 -
2219 -struct find_exidx_data {
2220 - uintptr_t pc, exidx_start;
2221 - int exidx_len;
2222 -};
2223 -
2224 -static int find_exidx(struct dl_phdr_info *info, size_t size, void *ptr)
2225 -{
2226 - struct find_exidx_data *data = ptr;
2227 - const ElfW(Phdr) *phdr = info->dlpi_phdr;
2228 - uintptr_t addr, exidx_start = 0;
2229 - int i, match = 0, exidx_len = 0;
2230 -
2231 - for (i = info->dlpi_phnum; i > 0; i--, phdr++) {
2232 - addr = info->dlpi_addr + phdr->p_vaddr;
2233 - switch (phdr->p_type) {
2234 - case PT_LOAD:
2235 - match |= data->pc >= addr && data->pc < addr + phdr->p_memsz;
2236 - break;
2237 - case PT_ARM_EXIDX:
2238 - exidx_start = addr;
2239 - exidx_len = phdr->p_memsz;
2240 - break;
2241 - }
2242 - }
2243 - data->exidx_start = exidx_start;
2244 - data->exidx_len = exidx_len;
2245 - return match;
2246 -}
2247 -
2248 -uintptr_t __gnu_Unwind_Find_exidx(uintptr_t pc, int *pcount)
2249 -{
2250 - struct find_exidx_data data;
2251 - data.pc = pc;
2252 - if (dl_iterate_phdr(find_exidx, &data) <= 0)
2253 - return 0;
2254 - *pcount = data.exidx_len / 8;
2255 - return data.exidx_start;
2256 -}
2257 --- /dev/null
2258 +++ b/arch/generic/bits/errno.h
2259 @@ -0,0 +1,134 @@
2260 +#define EPERM 1
2261 +#define ENOENT 2
2262 +#define ESRCH 3
2263 +#define EINTR 4
2264 +#define EIO 5
2265 +#define ENXIO 6
2266 +#define E2BIG 7
2267 +#define ENOEXEC 8
2268 +#define EBADF 9
2269 +#define ECHILD 10
2270 +#define EAGAIN 11
2271 +#define ENOMEM 12
2272 +#define EACCES 13
2273 +#define EFAULT 14
2274 +#define ENOTBLK 15
2275 +#define EBUSY 16
2276 +#define EEXIST 17
2277 +#define EXDEV 18
2278 +#define ENODEV 19
2279 +#define ENOTDIR 20
2280 +#define EISDIR 21
2281 +#define EINVAL 22
2282 +#define ENFILE 23
2283 +#define EMFILE 24
2284 +#define ENOTTY 25
2285 +#define ETXTBSY 26
2286 +#define EFBIG 27
2287 +#define ENOSPC 28
2288 +#define ESPIPE 29
2289 +#define EROFS 30
2290 +#define EMLINK 31
2291 +#define EPIPE 32
2292 +#define EDOM 33
2293 +#define ERANGE 34
2294 +#define EDEADLK 35
2295 +#define ENAMETOOLONG 36
2296 +#define ENOLCK 37
2297 +#define ENOSYS 38
2298 +#define ENOTEMPTY 39
2299 +#define ELOOP 40
2300 +#define EWOULDBLOCK EAGAIN
2301 +#define ENOMSG 42
2302 +#define EIDRM 43
2303 +#define ECHRNG 44
2304 +#define EL2NSYNC 45
2305 +#define EL3HLT 46
2306 +#define EL3RST 47
2307 +#define ELNRNG 48
2308 +#define EUNATCH 49
2309 +#define ENOCSI 50
2310 +#define EL2HLT 51
2311 +#define EBADE 52
2312 +#define EBADR 53
2313 +#define EXFULL 54
2314 +#define ENOANO 55
2315 +#define EBADRQC 56
2316 +#define EBADSLT 57
2317 +#define EDEADLOCK EDEADLK
2318 +#define EBFONT 59
2319 +#define ENOSTR 60
2320 +#define ENODATA 61
2321 +#define ETIME 62
2322 +#define ENOSR 63
2323 +#define ENONET 64
2324 +#define ENOPKG 65
2325 +#define EREMOTE 66
2326 +#define ENOLINK 67
2327 +#define EADV 68
2328 +#define ESRMNT 69
2329 +#define ECOMM 70
2330 +#define EPROTO 71
2331 +#define EMULTIHOP 72
2332 +#define EDOTDOT 73
2333 +#define EBADMSG 74
2334 +#define EOVERFLOW 75
2335 +#define ENOTUNIQ 76
2336 +#define EBADFD 77
2337 +#define EREMCHG 78
2338 +#define ELIBACC 79
2339 +#define ELIBBAD 80
2340 +#define ELIBSCN 81
2341 +#define ELIBMAX 82
2342 +#define ELIBEXEC 83
2343 +#define EILSEQ 84
2344 +#define ERESTART 85
2345 +#define ESTRPIPE 86
2346 +#define EUSERS 87
2347 +#define ENOTSOCK 88
2348 +#define EDESTADDRREQ 89
2349 +#define EMSGSIZE 90
2350 +#define EPROTOTYPE 91
2351 +#define ENOPROTOOPT 92
2352 +#define EPROTONOSUPPORT 93
2353 +#define ESOCKTNOSUPPORT 94
2354 +#define EOPNOTSUPP 95
2355 +#define ENOTSUP EOPNOTSUPP
2356 +#define EPFNOSUPPORT 96
2357 +#define EAFNOSUPPORT 97
2358 +#define EADDRINUSE 98
2359 +#define EADDRNOTAVAIL 99
2360 +#define ENETDOWN 100
2361 +#define ENETUNREACH 101
2362 +#define ENETRESET 102
2363 +#define ECONNABORTED 103
2364 +#define ECONNRESET 104
2365 +#define ENOBUFS 105
2366 +#define EISCONN 106
2367 +#define ENOTCONN 107
2368 +#define ESHUTDOWN 108
2369 +#define ETOOMANYREFS 109
2370 +#define ETIMEDOUT 110
2371 +#define ECONNREFUSED 111
2372 +#define EHOSTDOWN 112
2373 +#define EHOSTUNREACH 113
2374 +#define EALREADY 114
2375 +#define EINPROGRESS 115
2376 +#define ESTALE 116
2377 +#define EUCLEAN 117
2378 +#define ENOTNAM 118
2379 +#define ENAVAIL 119
2380 +#define EISNAM 120
2381 +#define EREMOTEIO 121
2382 +#define EDQUOT 122
2383 +#define ENOMEDIUM 123
2384 +#define EMEDIUMTYPE 124
2385 +#define ECANCELED 125
2386 +#define ENOKEY 126
2387 +#define EKEYEXPIRED 127
2388 +#define EKEYREVOKED 128
2389 +#define EKEYREJECTED 129
2390 +#define EOWNERDEAD 130
2391 +#define ENOTRECOVERABLE 131
2392 +#define ERFKILL 132
2393 +#define EHWPOISON 133
2394 --- /dev/null
2395 +++ b/arch/generic/bits/fcntl.h
2396 @@ -0,0 +1,40 @@
2397 +#define O_CREAT 0100
2398 +#define O_EXCL 0200
2399 +#define O_NOCTTY 0400
2400 +#define O_TRUNC 01000
2401 +#define O_APPEND 02000
2402 +#define O_NONBLOCK 04000
2403 +#define O_DSYNC 010000
2404 +#define O_SYNC 04010000
2405 +#define O_RSYNC 04010000
2406 +#define O_DIRECTORY 0200000
2407 +#define O_NOFOLLOW 0400000
2408 +#define O_CLOEXEC 02000000
2409 +
2410 +#define O_ASYNC 020000
2411 +#define O_DIRECT 040000
2412 +#define O_LARGEFILE 0100000
2413 +#define O_NOATIME 01000000
2414 +#define O_PATH 010000000
2415 +#define O_TMPFILE 020200000
2416 +#define O_NDELAY O_NONBLOCK
2417 +
2418 +#define F_DUPFD 0
2419 +#define F_GETFD 1
2420 +#define F_SETFD 2
2421 +#define F_GETFL 3
2422 +#define F_SETFL 4
2423 +
2424 +#define F_SETOWN 8
2425 +#define F_GETOWN 9
2426 +#define F_SETSIG 10
2427 +#define F_GETSIG 11
2428 +
2429 +#define F_GETLK 12
2430 +#define F_SETLK 13
2431 +#define F_SETLKW 14
2432 +
2433 +#define F_SETOWN_EX 15
2434 +#define F_GETOWN_EX 16
2435 +
2436 +#define F_GETOWNER_UIDS 17
2437 --- /dev/null
2438 +++ b/arch/generic/bits/fenv.h
2439 @@ -0,0 +1,10 @@
2440 +#define FE_ALL_EXCEPT 0
2441 +#define FE_TONEAREST 0
2442 +
2443 +typedef unsigned long fexcept_t;
2444 +
2445 +typedef struct {
2446 + unsigned long __cw;
2447 +} fenv_t;
2448 +
2449 +#define FE_DFL_ENV ((const fenv_t *) -1)
2450 --- /dev/null
2451 +++ b/arch/generic/bits/ioctl.h
2452 @@ -0,0 +1,197 @@
2453 +#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
2454 +#define _IOC_NONE 0U
2455 +#define _IOC_WRITE 1U
2456 +#define _IOC_READ 2U
2457 +
2458 +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
2459 +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
2460 +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
2461 +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
2462 +
2463 +#define TCGETS 0x5401
2464 +#define TCSETS 0x5402
2465 +#define TCSETSW 0x5403
2466 +#define TCSETSF 0x5404
2467 +#define TCGETA 0x5405
2468 +#define TCSETA 0x5406
2469 +#define TCSETAW 0x5407
2470 +#define TCSETAF 0x5408
2471 +#define TCSBRK 0x5409
2472 +#define TCXONC 0x540A
2473 +#define TCFLSH 0x540B
2474 +#define TIOCEXCL 0x540C
2475 +#define TIOCNXCL 0x540D
2476 +#define TIOCSCTTY 0x540E
2477 +#define TIOCGPGRP 0x540F
2478 +#define TIOCSPGRP 0x5410
2479 +#define TIOCOUTQ 0x5411
2480 +#define TIOCSTI 0x5412
2481 +#define TIOCGWINSZ 0x5413
2482 +#define TIOCSWINSZ 0x5414
2483 +#define TIOCMGET 0x5415
2484 +#define TIOCMBIS 0x5416
2485 +#define TIOCMBIC 0x5417
2486 +#define TIOCMSET 0x5418
2487 +#define TIOCGSOFTCAR 0x5419
2488 +#define TIOCSSOFTCAR 0x541A
2489 +#define FIONREAD 0x541B
2490 +#define TIOCINQ FIONREAD
2491 +#define TIOCLINUX 0x541C
2492 +#define TIOCCONS 0x541D
2493 +#define TIOCGSERIAL 0x541E
2494 +#define TIOCSSERIAL 0x541F
2495 +#define TIOCPKT 0x5420
2496 +#define FIONBIO 0x5421
2497 +#define TIOCNOTTY 0x5422
2498 +#define TIOCSETD 0x5423
2499 +#define TIOCGETD 0x5424
2500 +#define TCSBRKP 0x5425
2501 +#define TIOCTTYGSTRUCT 0x5426
2502 +#define TIOCSBRK 0x5427
2503 +#define TIOCCBRK 0x5428
2504 +#define TIOCGSID 0x5429
2505 +#define TIOCGPTN 0x80045430
2506 +#define TIOCSPTLCK 0x40045431
2507 +#define TCGETX 0x5432
2508 +#define TCSETX 0x5433
2509 +#define TCSETXF 0x5434
2510 +#define TCSETXW 0x5435
2511 +
2512 +#define FIONCLEX 0x5450
2513 +#define FIOCLEX 0x5451
2514 +#define FIOASYNC 0x5452
2515 +#define TIOCSERCONFIG 0x5453
2516 +#define TIOCSERGWILD 0x5454
2517 +#define TIOCSERSWILD 0x5455
2518 +#define TIOCGLCKTRMIOS 0x5456
2519 +#define TIOCSLCKTRMIOS 0x5457
2520 +#define TIOCSERGSTRUCT 0x5458
2521 +#define TIOCSERGETLSR 0x5459
2522 +#define TIOCSERGETMULTI 0x545A
2523 +#define TIOCSERSETMULTI 0x545B
2524 +
2525 +#define TIOCMIWAIT 0x545C
2526 +#define TIOCGICOUNT 0x545D
2527 +#define TIOCGHAYESESP 0x545E
2528 +#define TIOCSHAYESESP 0x545F
2529 +#define FIOQSIZE 0x5460
2530 +
2531 +#define TIOCPKT_DATA 0
2532 +#define TIOCPKT_FLUSHREAD 1
2533 +#define TIOCPKT_FLUSHWRITE 2
2534 +#define TIOCPKT_STOP 4
2535 +#define TIOCPKT_START 8
2536 +#define TIOCPKT_NOSTOP 16
2537 +#define TIOCPKT_DOSTOP 32
2538 +#define TIOCPKT_IOCTL 64
2539 +
2540 +#define TIOCSER_TEMT 0x01
2541 +
2542 +struct winsize {
2543 + unsigned short ws_row;
2544 + unsigned short ws_col;
2545 + unsigned short ws_xpixel;
2546 + unsigned short ws_ypixel;
2547 +};
2548 +
2549 +#define TIOCM_LE 0x001
2550 +#define TIOCM_DTR 0x002
2551 +#define TIOCM_RTS 0x004
2552 +#define TIOCM_ST 0x008
2553 +#define TIOCM_SR 0x010
2554 +#define TIOCM_CTS 0x020
2555 +#define TIOCM_CAR 0x040
2556 +#define TIOCM_RNG 0x080
2557 +#define TIOCM_DSR 0x100
2558 +#define TIOCM_CD TIOCM_CAR
2559 +#define TIOCM_RI TIOCM_RNG
2560 +#define TIOCM_OUT1 0x2000
2561 +#define TIOCM_OUT2 0x4000
2562 +#define TIOCM_LOOP 0x8000
2563 +#define TIOCM_MODEM_BITS TIOCM_OUT2
2564 +
2565 +#define N_TTY 0
2566 +#define N_SLIP 1
2567 +#define N_MOUSE 2
2568 +#define N_PPP 3
2569 +#define N_STRIP 4
2570 +#define N_AX25 5
2571 +#define N_X25 6
2572 +#define N_6PACK 7
2573 +#define N_MASC 8
2574 +#define N_R3964 9
2575 +#define N_PROFIBUS_FDL 10
2576 +#define N_IRDA 11
2577 +#define N_SMSBLOCK 12
2578 +#define N_HDLC 13
2579 +#define N_SYNC_PPP 14
2580 +#define N_HCI 15
2581 +
2582 +#define FIOSETOWN 0x8901
2583 +#define SIOCSPGRP 0x8902
2584 +#define FIOGETOWN 0x8903
2585 +#define SIOCGPGRP 0x8904
2586 +#define SIOCATMARK 0x8905
2587 +#define SIOCGSTAMP 0x8906
2588 +
2589 +#define SIOCADDRT 0x890B
2590 +#define SIOCDELRT 0x890C
2591 +#define SIOCRTMSG 0x890D
2592 +
2593 +#define SIOCGIFNAME 0x8910
2594 +#define SIOCSIFLINK 0x8911
2595 +#define SIOCGIFCONF 0x8912
2596 +#define SIOCGIFFLAGS 0x8913
2597 +#define SIOCSIFFLAGS 0x8914
2598 +#define SIOCGIFADDR 0x8915
2599 +#define SIOCSIFADDR 0x8916
2600 +#define SIOCGIFDSTADDR 0x8917
2601 +#define SIOCSIFDSTADDR 0x8918
2602 +#define SIOCGIFBRDADDR 0x8919
2603 +#define SIOCSIFBRDADDR 0x891a
2604 +#define SIOCGIFNETMASK 0x891b
2605 +#define SIOCSIFNETMASK 0x891c
2606 +#define SIOCGIFMETRIC 0x891d
2607 +#define SIOCSIFMETRIC 0x891e
2608 +#define SIOCGIFMEM 0x891f
2609 +#define SIOCSIFMEM 0x8920
2610 +#define SIOCGIFMTU 0x8921
2611 +#define SIOCSIFMTU 0x8922
2612 +#define SIOCSIFHWADDR 0x8924
2613 +#define SIOCGIFENCAP 0x8925
2614 +#define SIOCSIFENCAP 0x8926
2615 +#define SIOCGIFHWADDR 0x8927
2616 +#define SIOCGIFSLAVE 0x8929
2617 +#define SIOCSIFSLAVE 0x8930
2618 +#define SIOCADDMULTI 0x8931
2619 +#define SIOCDELMULTI 0x8932
2620 +#define SIOCGIFINDEX 0x8933
2621 +#define SIOGIFINDEX SIOCGIFINDEX
2622 +#define SIOCSIFPFLAGS 0x8934
2623 +#define SIOCGIFPFLAGS 0x8935
2624 +#define SIOCDIFADDR 0x8936
2625 +#define SIOCSIFHWBROADCAST 0x8937
2626 +#define SIOCGIFCOUNT 0x8938
2627 +
2628 +#define SIOCGIFBR 0x8940
2629 +#define SIOCSIFBR 0x8941
2630 +
2631 +#define SIOCGIFTXQLEN 0x8942
2632 +#define SIOCSIFTXQLEN 0x8943
2633 +
2634 +#define SIOCDARP 0x8953
2635 +#define SIOCGARP 0x8954
2636 +#define SIOCSARP 0x8955
2637 +
2638 +#define SIOCDRARP 0x8960
2639 +#define SIOCGRARP 0x8961
2640 +#define SIOCSRARP 0x8962
2641 +
2642 +#define SIOCGIFMAP 0x8970
2643 +#define SIOCSIFMAP 0x8971
2644 +
2645 +#define SIOCADDDLCI 0x8980
2646 +#define SIOCDELDLCI 0x8981
2647 +
2648 +#define SIOCDEVPRIVATE 0x89F0
2649 +#define SIOCPROTOPRIVATE 0x89E0
2650 --- /dev/null
2651 +++ b/arch/generic/bits/ipc.h
2652 @@ -0,0 +1,14 @@
2653 +struct ipc_perm
2654 +{
2655 + key_t __ipc_perm_key;
2656 + uid_t uid;
2657 + gid_t gid;
2658 + uid_t cuid;
2659 + gid_t cgid;
2660 + mode_t mode;
2661 + int __ipc_perm_seq;
2662 + long __pad1;
2663 + long __pad2;
2664 +};
2665 +
2666 +#define IPC_64 0x100
2667 --- /dev/null
2668 +++ b/arch/generic/bits/msg.h
2669 @@ -0,0 +1,16 @@
2670 +struct msqid_ds
2671 +{
2672 + struct ipc_perm msg_perm;
2673 + time_t msg_stime;
2674 + int __unused1;
2675 + time_t msg_rtime;
2676 + int __unused2;
2677 + time_t msg_ctime;
2678 + int __unused3;
2679 + unsigned long msg_cbytes;
2680 + msgqnum_t msg_qnum;
2681 + msglen_t msg_qbytes;
2682 + pid_t msg_lspid;
2683 + pid_t msg_lrpid;
2684 + unsigned long __unused[2];
2685 +};
2686 --- /dev/null
2687 +++ b/arch/generic/bits/sem.h
2688 @@ -0,0 +1,16 @@
2689 +struct semid_ds {
2690 + struct ipc_perm sem_perm;
2691 + time_t sem_otime;
2692 + time_t __unused1;
2693 + time_t sem_ctime;
2694 + time_t __unused2;
2695 +#if __BYTE_ORDER == __LITTLE_ENDIAN
2696 + unsigned short sem_nsems;
2697 + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
2698 +#else
2699 + char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
2700 + unsigned short sem_nsems;
2701 +#endif
2702 + time_t __unused3;
2703 + time_t __unused4;
2704 +};
2705 --- /dev/null
2706 +++ b/arch/generic/bits/shm.h
2707 @@ -0,0 +1,29 @@
2708 +#define SHMLBA 4096
2709 +
2710 +struct shmid_ds
2711 +{
2712 + struct ipc_perm shm_perm;
2713 + size_t shm_segsz;
2714 + time_t shm_atime;
2715 + int __unused1;
2716 + time_t shm_dtime;
2717 + int __unused2;
2718 + time_t shm_ctime;
2719 + int __unused3;
2720 + pid_t shm_cpid;
2721 + pid_t shm_lpid;
2722 + unsigned long shm_nattch;
2723 + unsigned long __pad1;
2724 + unsigned long __pad2;
2725 +};
2726 +
2727 +struct shminfo {
2728 + unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
2729 +};
2730 +
2731 +struct shm_info {
2732 + int __used_ids;
2733 + unsigned long shm_tot, shm_rss, shm_swp;
2734 + unsigned long __swap_attempts, __swap_successes;
2735 +};
2736 +
2737 --- /dev/null
2738 +++ b/arch/generic/bits/socket.h
2739 @@ -0,0 +1,17 @@
2740 +struct msghdr
2741 +{
2742 + void *msg_name;
2743 + socklen_t msg_namelen;
2744 + struct iovec *msg_iov;
2745 + int msg_iovlen;
2746 + void *msg_control;
2747 + socklen_t msg_controllen;
2748 + int msg_flags;
2749 +};
2750 +
2751 +struct cmsghdr
2752 +{
2753 + socklen_t cmsg_len;
2754 + int cmsg_level;
2755 + int cmsg_type;
2756 +};
2757 --- /dev/null
2758 +++ b/arch/generic/bits/statfs.h
2759 @@ -0,0 +1,7 @@
2760 +struct statfs {
2761 + unsigned long f_type, f_bsize;
2762 + fsblkcnt_t f_blocks, f_bfree, f_bavail;
2763 + fsfilcnt_t f_files, f_ffree;
2764 + fsid_t f_fsid;
2765 + unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
2766 +};
2767 --- /dev/null
2768 +++ b/arch/generic/bits/stdarg.h
2769 @@ -0,0 +1,4 @@
2770 +#define va_start(v,l) __builtin_va_start(v,l)
2771 +#define va_end(v) __builtin_va_end(v)
2772 +#define va_arg(v,l) __builtin_va_arg(v,l)
2773 +#define va_copy(d,s) __builtin_va_copy(d,s)
2774 --- /dev/null
2775 +++ b/arch/generic/bits/termios.h
2776 @@ -0,0 +1,160 @@
2777 +struct termios
2778 +{
2779 + tcflag_t c_iflag;
2780 + tcflag_t c_oflag;
2781 + tcflag_t c_cflag;
2782 + tcflag_t c_lflag;
2783 + cc_t c_line;
2784 + cc_t c_cc[NCCS];
2785 + speed_t __c_ispeed;
2786 + speed_t __c_ospeed;
2787 +};
2788 +
2789 +#define VINTR 0
2790 +#define VQUIT 1
2791 +#define VERASE 2
2792 +#define VKILL 3
2793 +#define VEOF 4
2794 +#define VTIME 5
2795 +#define VMIN 6
2796 +#define VSWTC 7
2797 +#define VSTART 8
2798 +#define VSTOP 9
2799 +#define VSUSP 10
2800 +#define VEOL 11
2801 +#define VREPRINT 12
2802 +#define VDISCARD 13
2803 +#define VWERASE 14
2804 +#define VLNEXT 15
2805 +#define VEOL2 16
2806 +
2807 +#define IGNBRK 0000001
2808 +#define BRKINT 0000002
2809 +#define IGNPAR 0000004
2810 +#define PARMRK 0000010
2811 +#define INPCK 0000020
2812 +#define ISTRIP 0000040
2813 +#define INLCR 0000100
2814 +#define IGNCR 0000200
2815 +#define ICRNL 0000400
2816 +#define IUCLC 0001000
2817 +#define IXON 0002000
2818 +#define IXANY 0004000
2819 +#define IXOFF 0010000
2820 +#define IMAXBEL 0020000
2821 +#define IUTF8 0040000
2822 +
2823 +#define OPOST 0000001
2824 +#define OLCUC 0000002
2825 +#define ONLCR 0000004
2826 +#define OCRNL 0000010
2827 +#define ONOCR 0000020
2828 +#define ONLRET 0000040
2829 +#define OFILL 0000100
2830 +#define OFDEL 0000200
2831 +#define NLDLY 0000400
2832 +#define NL0 0000000
2833 +#define NL1 0000400
2834 +#define CRDLY 0003000
2835 +#define CR0 0000000
2836 +#define CR1 0001000
2837 +#define CR2 0002000
2838 +#define CR3 0003000
2839 +#define TABDLY 0014000
2840 +#define TAB0 0000000
2841 +#define TAB1 0004000
2842 +#define TAB2 0010000
2843 +#define TAB3 0014000
2844 +#define BSDLY 0020000
2845 +#define BS0 0000000
2846 +#define BS1 0020000
2847 +#define FFDLY 0100000
2848 +#define FF0 0000000
2849 +#define FF1 0100000
2850 +
2851 +#define VTDLY 0040000
2852 +#define VT0 0000000
2853 +#define VT1 0040000
2854 +
2855 +#define B0 0000000
2856 +#define B50 0000001
2857 +#define B75 0000002
2858 +#define B110 0000003
2859 +#define B134 0000004
2860 +#define B150 0000005
2861 +#define B200 0000006
2862 +#define B300 0000007
2863 +#define B600 0000010
2864 +#define B1200 0000011
2865 +#define B1800 0000012
2866 +#define B2400 0000013
2867 +#define B4800 0000014
2868 +#define B9600 0000015
2869 +#define B19200 0000016
2870 +#define B38400 0000017
2871 +
2872 +#define B57600 0010001
2873 +#define B115200 0010002
2874 +#define B230400 0010003
2875 +#define B460800 0010004
2876 +#define B500000 0010005
2877 +#define B576000 0010006
2878 +#define B921600 0010007
2879 +#define B1000000 0010010
2880 +#define B1152000 0010011
2881 +#define B1500000 0010012
2882 +#define B2000000 0010013
2883 +#define B2500000 0010014
2884 +#define B3000000 0010015
2885 +#define B3500000 0010016
2886 +#define B4000000 0010017
2887 +
2888 +#define CBAUD 0010017
2889 +
2890 +#define CSIZE 0000060
2891 +#define CS5 0000000
2892 +#define CS6 0000020
2893 +#define CS7 0000040
2894 +#define CS8 0000060
2895 +#define CSTOPB 0000100
2896 +#define CREAD 0000200
2897 +#define PARENB 0000400
2898 +#define PARODD 0001000
2899 +#define HUPCL 0002000
2900 +#define CLOCAL 0004000
2901 +
2902 +#define ISIG 0000001
2903 +#define ICANON 0000002
2904 +#define ECHO 0000010
2905 +#define ECHOE 0000020
2906 +#define ECHOK 0000040
2907 +#define ECHONL 0000100
2908 +#define NOFLSH 0000200
2909 +#define TOSTOP 0000400
2910 +#define IEXTEN 0100000
2911 +
2912 +#define ECHOCTL 0001000
2913 +#define ECHOPRT 0002000
2914 +#define ECHOKE 0004000
2915 +#define FLUSHO 0010000
2916 +#define PENDIN 0040000
2917 +
2918 +#define TCOOFF 0
2919 +#define TCOON 1
2920 +#define TCIOFF 2
2921 +#define TCION 3
2922 +
2923 +#define TCIFLUSH 0
2924 +#define TCOFLUSH 1
2925 +#define TCIOFLUSH 2
2926 +
2927 +#define TCSANOW 0
2928 +#define TCSADRAIN 1
2929 +#define TCSAFLUSH 2
2930 +
2931 +#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
2932 +#define CBAUDEX 0010000
2933 +#define CRTSCTS 020000000000
2934 +#define EXTPROC 0200000
2935 +#define XTABS 0014000
2936 +#endif
2937 --- a/arch/i386/atomic.h
2938 +++ /dev/null
2939 @@ -1,110 +0,0 @@
2940 -#ifndef _INTERNAL_ATOMIC_H
2941 -#define _INTERNAL_ATOMIC_H
2942 -
2943 -#include <stdint.h>
2944 -
2945 -static inline int a_ctz_64(uint64_t x)
2946 -{
2947 - int r;
2948 - __asm__( "bsf %1,%0 ; jnz 1f ; bsf %2,%0 ; addl $32,%0\n1:"
2949 - : "=&r"(r) : "r"((unsigned)x), "r"((unsigned)(x>>32)) );
2950 - return r;
2951 -}
2952 -
2953 -static inline int a_ctz_l(unsigned long x)
2954 -{
2955 - long r;
2956 - __asm__( "bsf %1,%0" : "=r"(r) : "r"(x) );
2957 - return r;
2958 -}
2959 -
2960 -static inline void a_and_64(volatile uint64_t *p, uint64_t v)
2961 -{
2962 - __asm__( "lock ; andl %1, (%0) ; lock ; andl %2, 4(%0)"
2963 - : : "r"((long *)p), "r"((unsigned)v), "r"((unsigned)(v>>32)) : "memory" );
2964 -}
2965 -
2966 -static inline void a_or_64(volatile uint64_t *p, uint64_t v)
2967 -{
2968 - __asm__( "lock ; orl %1, (%0) ; lock ; orl %2, 4(%0)"
2969 - : : "r"((long *)p), "r"((unsigned)v), "r"((unsigned)(v>>32)) : "memory" );
2970 -}
2971 -
2972 -static inline void a_or_l(volatile void *p, long v)
2973 -{
2974 - __asm__( "lock ; orl %1, %0"
2975 - : "=m"(*(long *)p) : "r"(v) : "memory" );
2976 -}
2977 -
2978 -static inline void *a_cas_p(volatile void *p, void *t, void *s)
2979 -{
2980 - __asm__( "lock ; cmpxchg %3, %1"
2981 - : "=a"(t), "=m"(*(long *)p) : "a"(t), "r"(s) : "memory" );
2982 - return t;
2983 -}
2984 -
2985 -static inline int a_cas(volatile int *p, int t, int s)
2986 -{
2987 - __asm__( "lock ; cmpxchg %3, %1"
2988 - : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" );
2989 - return t;
2990 -}
2991 -
2992 -static inline void a_or(volatile int *p, int v)
2993 -{
2994 - __asm__( "lock ; orl %1, %0"
2995 - : "=m"(*p) : "r"(v) : "memory" );
2996 -}
2997 -
2998 -static inline void a_and(volatile int *p, int v)
2999 -{
3000 - __asm__( "lock ; andl %1, %0"
3001 - : "=m"(*p) : "r"(v) : "memory" );
3002 -}
3003 -
3004 -static inline int a_swap(volatile int *x, int v)
3005 -{
3006 - __asm__( "xchg %0, %1" : "=r"(v), "=m"(*x) : "0"(v) : "memory" );
3007 - return v;
3008 -}
3009 -
3010 -#define a_xchg a_swap
3011 -
3012 -static inline int a_fetch_add(volatile int *x, int v)
3013 -{
3014 - __asm__( "lock ; xadd %0, %1" : "=r"(v), "=m"(*x) : "0"(v) : "memory" );
3015 - return v;
3016 -}
3017 -
3018 -static inline void a_inc(volatile int *x)
3019 -{
3020 - __asm__( "lock ; incl %0" : "=m"(*x) : "m"(*x) : "memory" );
3021 -}
3022 -
3023 -static inline void a_dec(volatile int *x)
3024 -{
3025 - __asm__( "lock ; decl %0" : "=m"(*x) : "m"(*x) : "memory" );
3026 -}
3027 -
3028 -static inline void a_store(volatile int *p, int x)
3029 -{
3030 - __asm__( "movl %1, %0 ; lock ; orl $0,(%%esp)" : "=m"(*p) : "r"(x) : "memory" );
3031 -}
3032 -
3033 -static inline void a_spin()
3034 -{
3035 - __asm__ __volatile__( "pause" : : : "memory" );
3036 -}
3037 -
3038 -static inline void a_barrier()
3039 -{
3040 - __asm__ __volatile__( "" : : : "memory" );
3041 -}
3042 -
3043 -static inline void a_crash()
3044 -{
3045 - __asm__ __volatile__( "hlt" : : : "memory" );
3046 -}
3047 -
3048 -
3049 -#endif
3050 --- /dev/null
3051 +++ b/arch/i386/atomic_arch.h
3052 @@ -0,0 +1,101 @@
3053 +#define a_cas a_cas
3054 +static inline int a_cas(volatile int *p, int t, int s)
3055 +{
3056 + __asm__ __volatile__ (
3057 + "lock ; cmpxchg %3, %1"
3058 + : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" );
3059 + return t;
3060 +}
3061 +
3062 +#define a_swap a_swap
3063 +static inline int a_swap(volatile int *p, int v)
3064 +{
3065 + __asm__ __volatile__(
3066 + "xchg %0, %1"
3067 + : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
3068 + return v;
3069 +}
3070 +
3071 +#define a_fetch_add a_fetch_add
3072 +static inline int a_fetch_add(volatile int *p, int v)
3073 +{
3074 + __asm__ __volatile__(
3075 + "lock ; xadd %0, %1"
3076 + : "=r"(v), "=m"(*p) : "0"(v) : "memory" );
3077 + return v;
3078 +}
3079 +
3080 +#define a_and a_and
3081 +static inline void a_and(volatile int *p, int v)
3082 +{
3083 + __asm__ __volatile__(
3084 + "lock ; and %1, %0"
3085 + : "=m"(*p) : "r"(v) : "memory" );
3086 +}
3087 +
3088 +#define a_or a_or
3089 +static inline void a_or(volatile int *p, int v)
3090 +{
3091 + __asm__ __volatile__(
3092 + "lock ; or %1, %0"
3093 + : "=m"(*p) : "r"(v) : "memory" );
3094 +}
3095 +
3096 +#define a_inc a_inc
3097 +static inline void a_inc(volatile int *p)
3098 +{
3099 + __asm__ __volatile__(
3100 + "lock ; incl %0"
3101 + : "=m"(*p) : "m"(*p) : "memory" );
3102 +}
3103 +
3104 +#define a_dec a_dec
3105 +static inline void a_dec(volatile int *p)
3106 +{
3107 + __asm__ __volatile__(
3108 + "lock ; decl %0"
3109 + : "=m"(*p) : "m"(*p) : "memory" );
3110 +}
3111 +
3112 +#define a_store a_store
3113 +static inline void a_store(volatile int *p, int x)
3114 +{
3115 + __asm__ __volatile__(
3116 + "mov %1, %0 ; lock ; orl $0,(%%esp)"
3117 + : "=m"(*p) : "r"(x) : "memory" );
3118 +}
3119 +
3120 +#define a_barrier a_barrier
3121 +static inline void a_barrier()
3122 +{
3123 + __asm__ __volatile__( "" : : : "memory" );
3124 +}
3125 +
3126 +#define a_pause a_pause
3127 +static inline void a_spin()
3128 +{
3129 + __asm__ __volatile__( "pause" : : : "memory" );
3130 +}
3131 +
3132 +#define a_crash a_crash
3133 +static inline void a_crash()
3134 +{
3135 + __asm__ __volatile__( "hlt" : : : "memory" );
3136 +}
3137 +
3138 +#define a_ctz_64 a_ctz_64
3139 +static inline int a_ctz_64(uint64_t x)
3140 +{
3141 + int r;
3142 + __asm__( "bsf %1,%0 ; jnz 1f ; bsf %2,%0 ; add $32,%0\n1:"
3143 + : "=&r"(r) : "r"((unsigned)x), "r"((unsigned)(x>>32)) );
3144 + return r;
3145 +}
3146 +
3147 +#define a_ctz_l a_ctz_l
3148 +static inline int a_ctz_l(unsigned long x)
3149 +{
3150 + long r;
3151 + __asm__( "bsf %1,%0" : "=r"(r) : "r"(x) );
3152 + return r;
3153 +}
3154 --- a/arch/i386/bits/alltypes.h.in
3155 +++ b/arch/i386/bits/alltypes.h.in
3156 @@ -26,10 +26,12 @@ TYPEDEF long double float_t;
3157 TYPEDEF long double double_t;
3158 #endif
3159
3160 -#ifdef __cplusplus
3161 -TYPEDEF struct { alignas(8) long long __ll; long double __ld; } max_align_t;
3162 -#else
3163 +#if !defined(__cplusplus)
3164 TYPEDEF struct { _Alignas(8) long long __ll; long double __ld; } max_align_t;
3165 +#elif defined(__GNUC__)
3166 +TYPEDEF struct { __attribute__((__aligned__(8))) long long __ll; long double __ld; } max_align_t;
3167 +#else
3168 +TYPEDEF struct { alignas(8) long long __ll; long double __ld; } max_align_t;
3169 #endif
3170
3171 TYPEDEF long time_t;
3172 --- a/arch/i386/bits/errno.h
3173 +++ /dev/null
3174 @@ -1,134 +0,0 @@
3175 -#define EPERM 1
3176 -#define ENOENT 2
3177 -#define ESRCH 3
3178 -#define EINTR 4
3179 -#define EIO 5
3180 -#define ENXIO 6
3181 -#define E2BIG 7
3182 -#define ENOEXEC 8
3183 -#define EBADF 9
3184 -#define ECHILD 10
3185 -#define EAGAIN 11
3186 -#define ENOMEM 12
3187 -#define EACCES 13
3188 -#define EFAULT 14
3189 -#define ENOTBLK 15
3190 -#define EBUSY 16
3191 -#define EEXIST 17
3192 -#define EXDEV 18
3193 -#define ENODEV 19
3194 -#define ENOTDIR 20
3195 -#define EISDIR 21
3196 -#define EINVAL 22
3197 -#define ENFILE 23
3198 -#define EMFILE 24
3199 -#define ENOTTY 25
3200 -#define ETXTBSY 26
3201 -#define EFBIG 27
3202 -#define ENOSPC 28
3203 -#define ESPIPE 29
3204 -#define EROFS 30
3205 -#define EMLINK 31
3206 -#define EPIPE 32
3207 -#define EDOM 33
3208 -#define ERANGE 34
3209 -#define EDEADLK 35
3210 -#define ENAMETOOLONG 36
3211 -#define ENOLCK 37
3212 -#define ENOSYS 38
3213 -#define ENOTEMPTY 39
3214 -#define ELOOP 40
3215 -#define EWOULDBLOCK EAGAIN
3216 -#define ENOMSG 42
3217 -#define EIDRM 43
3218 -#define ECHRNG 44
3219 -#define EL2NSYNC 45
3220 -#define EL3HLT 46
3221 -#define EL3RST 47
3222 -#define ELNRNG 48
3223 -#define EUNATCH 49
3224 -#define ENOCSI 50
3225 -#define EL2HLT 51
3226 -#define EBADE 52
3227 -#define EBADR 53
3228 -#define EXFULL 54
3229 -#define ENOANO 55
3230 -#define EBADRQC 56
3231 -#define EBADSLT 57
3232 -#define EDEADLOCK EDEADLK
3233 -#define EBFONT 59
3234 -#define ENOSTR 60
3235 -#define ENODATA 61
3236 -#define ETIME 62
3237 -#define ENOSR 63
3238 -#define ENONET 64
3239 -#define ENOPKG 65
3240 -#define EREMOTE 66
3241 -#define ENOLINK 67
3242 -#define EADV 68
3243 -#define ESRMNT 69
3244 -#define ECOMM 70
3245 -#define EPROTO 71
3246 -#define EMULTIHOP 72
3247 -#define EDOTDOT 73
3248 -#define EBADMSG 74
3249 -#define EOVERFLOW 75
3250 -#define ENOTUNIQ 76
3251 -#define EBADFD 77
3252 -#define EREMCHG 78
3253 -#define ELIBACC 79
3254 -#define ELIBBAD 80
3255 -#define ELIBSCN 81
3256 -#define ELIBMAX 82
3257 -#define ELIBEXEC 83
3258 -#define EILSEQ 84
3259 -#define ERESTART 85
3260 -#define ESTRPIPE 86
3261 -#define EUSERS 87
3262 -#define ENOTSOCK 88
3263 -#define EDESTADDRREQ 89
3264 -#define EMSGSIZE 90
3265 -#define EPROTOTYPE 91
3266 -#define ENOPROTOOPT 92
3267 -#define EPROTONOSUPPORT 93
3268 -#define ESOCKTNOSUPPORT 94
3269 -#define EOPNOTSUPP 95
3270 -#define ENOTSUP EOPNOTSUPP
3271 -#define EPFNOSUPPORT 96
3272 -#define EAFNOSUPPORT 97
3273 -#define EADDRINUSE 98
3274 -#define EADDRNOTAVAIL 99
3275 -#define ENETDOWN 100
3276 -#define ENETUNREACH 101
3277 -#define ENETRESET 102
3278 -#define ECONNABORTED 103
3279 -#define ECONNRESET 104
3280 -#define ENOBUFS 105
3281 -#define EISCONN 106
3282 -#define ENOTCONN 107
3283 -#define ESHUTDOWN 108
3284 -#define ETOOMANYREFS 109
3285 -#define ETIMEDOUT 110
3286 -#define ECONNREFUSED 111
3287 -#define EHOSTDOWN 112
3288 -#define EHOSTUNREACH 113
3289 -#define EALREADY 114
3290 -#define EINPROGRESS 115
3291 -#define ESTALE 116
3292 -#define EUCLEAN 117
3293 -#define ENOTNAM 118
3294 -#define ENAVAIL 119
3295 -#define EISNAM 120
3296 -#define EREMOTEIO 121
3297 -#define EDQUOT 122
3298 -#define ENOMEDIUM 123
3299 -#define EMEDIUMTYPE 124
3300 -#define ECANCELED 125
3301 -#define ENOKEY 126
3302 -#define EKEYEXPIRED 127
3303 -#define EKEYREVOKED 128
3304 -#define EKEYREJECTED 129
3305 -#define EOWNERDEAD 130
3306 -#define ENOTRECOVERABLE 131
3307 -#define ERFKILL 132
3308 -#define EHWPOISON 133
3309 --- a/arch/i386/bits/fcntl.h
3310 +++ /dev/null
3311 @@ -1,40 +0,0 @@
3312 -#define O_CREAT 0100
3313 -#define O_EXCL 0200
3314 -#define O_NOCTTY 0400
3315 -#define O_TRUNC 01000
3316 -#define O_APPEND 02000
3317 -#define O_NONBLOCK 04000
3318 -#define O_DSYNC 010000
3319 -#define O_SYNC 04010000
3320 -#define O_RSYNC 04010000
3321 -#define O_DIRECTORY 0200000
3322 -#define O_NOFOLLOW 0400000
3323 -#define O_CLOEXEC 02000000
3324 -
3325 -#define O_ASYNC 020000
3326 -#define O_DIRECT 040000
3327 -#define O_LARGEFILE 0100000
3328 -#define O_NOATIME 01000000
3329 -#define O_PATH 010000000
3330 -#define O_TMPFILE 020200000
3331 -#define O_NDELAY O_NONBLOCK
3332 -
3333 -#define F_DUPFD 0
3334 -#define F_GETFD 1
3335 -#define F_SETFD 2
3336 -#define F_GETFL 3
3337 -#define F_SETFL 4
3338 -
3339 -#define F_SETOWN 8
3340 -#define F_GETOWN 9
3341 -#define F_SETSIG 10
3342 -#define F_GETSIG 11
3343 -
3344 -#define F_GETLK 12
3345 -#define F_SETLK 13
3346 -#define F_SETLKW 14
3347 -
3348 -#define F_SETOWN_EX 15
3349 -#define F_GETOWN_EX 16
3350 -
3351 -#define F_GETOWNER_UIDS 17
3352 --- a/arch/i386/bits/ioctl.h
3353 +++ /dev/null
3354 @@ -1,197 +0,0 @@
3355 -#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
3356 -#define _IOC_NONE 0U
3357 -#define _IOC_WRITE 1U
3358 -#define _IOC_READ 2U
3359 -
3360 -#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
3361 -#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
3362 -#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
3363 -#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
3364 -
3365 -#define TCGETS 0x5401
3366 -#define TCSETS 0x5402
3367 -#define TCSETSW 0x5403
3368 -#define TCSETSF 0x5404
3369 -#define TCGETA 0x5405
3370 -#define TCSETA 0x5406
3371 -#define TCSETAW 0x5407
3372 -#define TCSETAF 0x5408
3373 -#define TCSBRK 0x5409
3374 -#define TCXONC 0x540A
3375 -#define TCFLSH 0x540B
3376 -#define TIOCEXCL 0x540C
3377 -#define TIOCNXCL 0x540D
3378 -#define TIOCSCTTY 0x540E
3379 -#define TIOCGPGRP 0x540F
3380 -#define TIOCSPGRP 0x5410
3381 -#define TIOCOUTQ 0x5411
3382 -#define TIOCSTI 0x5412
3383 -#define TIOCGWINSZ 0x5413
3384 -#define TIOCSWINSZ 0x5414
3385 -#define TIOCMGET 0x5415
3386 -#define TIOCMBIS 0x5416
3387 -#define TIOCMBIC 0x5417
3388 -#define TIOCMSET 0x5418
3389 -#define TIOCGSOFTCAR 0x5419
3390 -#define TIOCSSOFTCAR 0x541A
3391 -#define FIONREAD 0x541B
3392 -#define TIOCINQ FIONREAD
3393 -#define TIOCLINUX 0x541C
3394 -#define TIOCCONS 0x541D
3395 -#define TIOCGSERIAL 0x541E
3396 -#define TIOCSSERIAL 0x541F
3397 -#define TIOCPKT 0x5420
3398 -#define FIONBIO 0x5421
3399 -#define TIOCNOTTY 0x5422
3400 -#define TIOCSETD 0x5423
3401 -#define TIOCGETD 0x5424
3402 -#define TCSBRKP 0x5425
3403 -#define TIOCTTYGSTRUCT 0x5426
3404 -#define TIOCSBRK 0x5427
3405 -#define TIOCCBRK 0x5428
3406 -#define TIOCGSID 0x5429
3407 -#define TIOCGPTN 0x80045430
3408 -#define TIOCSPTLCK 0x40045431
3409 -#define TCGETX 0x5432
3410 -#define TCSETX 0x5433
3411 -#define TCSETXF 0x5434
3412 -#define TCSETXW 0x5435
3413 -
3414 -#define FIONCLEX 0x5450
3415 -#define FIOCLEX 0x5451
3416 -#define FIOASYNC 0x5452
3417 -#define TIOCSERCONFIG 0x5453
3418 -#define TIOCSERGWILD 0x5454
3419 -#define TIOCSERSWILD 0x5455
3420 -#define TIOCGLCKTRMIOS 0x5456
3421 -#define TIOCSLCKTRMIOS 0x5457
3422 -#define TIOCSERGSTRUCT 0x5458
3423 -#define TIOCSERGETLSR 0x5459
3424 -#define TIOCSERGETMULTI 0x545A
3425 -#define TIOCSERSETMULTI 0x545B
3426 -
3427 -#define TIOCMIWAIT 0x545C
3428 -#define TIOCGICOUNT 0x545D
3429 -#define TIOCGHAYESESP 0x545E
3430 -#define TIOCSHAYESESP 0x545F
3431 -#define FIOQSIZE 0x5460
3432 -
3433 -#define TIOCPKT_DATA 0
3434 -#define TIOCPKT_FLUSHREAD 1
3435 -#define TIOCPKT_FLUSHWRITE 2
3436 -#define TIOCPKT_STOP 4
3437 -#define TIOCPKT_START 8
3438 -#define TIOCPKT_NOSTOP 16
3439 -#define TIOCPKT_DOSTOP 32
3440 -#define TIOCPKT_IOCTL 64
3441 -
3442 -#define TIOCSER_TEMT 0x01
3443 -
3444 -struct winsize {
3445 - unsigned short ws_row;
3446 - unsigned short ws_col;
3447 - unsigned short ws_xpixel;
3448 - unsigned short ws_ypixel;
3449 -};
3450 -
3451 -#define TIOCM_LE 0x001
3452 -#define TIOCM_DTR 0x002
3453 -#define TIOCM_RTS 0x004
3454 -#define TIOCM_ST 0x008
3455 -#define TIOCM_SR 0x010
3456 -#define TIOCM_CTS 0x020
3457 -#define TIOCM_CAR 0x040
3458 -#define TIOCM_RNG 0x080
3459 -#define TIOCM_DSR 0x100
3460 -#define TIOCM_CD TIOCM_CAR
3461 -#define TIOCM_RI TIOCM_RNG
3462 -#define TIOCM_OUT1 0x2000
3463 -#define TIOCM_OUT2 0x4000
3464 -#define TIOCM_LOOP 0x8000
3465 -#define TIOCM_MODEM_BITS TIOCM_OUT2
3466 -
3467 -#define N_TTY 0
3468 -#define N_SLIP 1
3469 -#define N_MOUSE 2
3470 -#define N_PPP 3
3471 -#define N_STRIP 4
3472 -#define N_AX25 5
3473 -#define N_X25 6
3474 -#define N_6PACK 7
3475 -#define N_MASC 8
3476 -#define N_R3964 9
3477 -#define N_PROFIBUS_FDL 10
3478 -#define N_IRDA 11
3479 -#define N_SMSBLOCK 12
3480 -#define N_HDLC 13
3481 -#define N_SYNC_PPP 14
3482 -#define N_HCI 15
3483 -
3484 -#define FIOSETOWN 0x8901
3485 -#define SIOCSPGRP 0x8902
3486 -#define FIOGETOWN 0x8903
3487 -#define SIOCGPGRP 0x8904
3488 -#define SIOCATMARK 0x8905
3489 -#define SIOCGSTAMP 0x8906
3490 -
3491 -#define SIOCADDRT 0x890B
3492 -#define SIOCDELRT 0x890C
3493 -#define SIOCRTMSG 0x890D
3494 -
3495 -#define SIOCGIFNAME 0x8910
3496 -#define SIOCSIFLINK 0x8911
3497 -#define SIOCGIFCONF 0x8912
3498 -#define SIOCGIFFLAGS 0x8913
3499 -#define SIOCSIFFLAGS 0x8914
3500 -#define SIOCGIFADDR 0x8915
3501 -#define SIOCSIFADDR 0x8916
3502 -#define SIOCGIFDSTADDR 0x8917
3503 -#define SIOCSIFDSTADDR 0x8918
3504 -#define SIOCGIFBRDADDR 0x8919
3505 -#define SIOCSIFBRDADDR 0x891a
3506 -#define SIOCGIFNETMASK 0x891b
3507 -#define SIOCSIFNETMASK 0x891c
3508 -#define SIOCGIFMETRIC 0x891d
3509 -#define SIOCSIFMETRIC 0x891e
3510 -#define SIOCGIFMEM 0x891f
3511 -#define SIOCSIFMEM 0x8920
3512 -#define SIOCGIFMTU 0x8921
3513 -#define SIOCSIFMTU 0x8922
3514 -#define SIOCSIFHWADDR 0x8924
3515 -#define SIOCGIFENCAP 0x8925
3516 -#define SIOCSIFENCAP 0x8926
3517 -#define SIOCGIFHWADDR 0x8927
3518 -#define SIOCGIFSLAVE 0x8929
3519 -#define SIOCSIFSLAVE 0x8930
3520 -#define SIOCADDMULTI 0x8931
3521 -#define SIOCDELMULTI 0x8932
3522 -#define SIOCGIFINDEX 0x8933
3523 -#define SIOGIFINDEX SIOCGIFINDEX
3524 -#define SIOCSIFPFLAGS 0x8934
3525 -#define SIOCGIFPFLAGS 0x8935
3526 -#define SIOCDIFADDR 0x8936
3527 -#define SIOCSIFHWBROADCAST 0x8937
3528 -#define SIOCGIFCOUNT 0x8938
3529 -
3530 -#define SIOCGIFBR 0x8940
3531 -#define SIOCSIFBR 0x8941
3532 -
3533 -#define SIOCGIFTXQLEN 0x8942
3534 -#define SIOCSIFTXQLEN 0x8943
3535 -
3536 -#define SIOCDARP 0x8953
3537 -#define SIOCGARP 0x8954
3538 -#define SIOCSARP 0x8955
3539 -
3540 -#define SIOCDRARP 0x8960
3541 -#define SIOCGRARP 0x8961
3542 -#define SIOCSRARP 0x8962
3543 -
3544 -#define SIOCGIFMAP 0x8970
3545 -#define SIOCSIFMAP 0x8971
3546 -
3547 -#define SIOCADDDLCI 0x8980
3548 -#define SIOCDELDLCI 0x8981
3549 -
3550 -#define SIOCDEVPRIVATE 0x89F0
3551 -#define SIOCPROTOPRIVATE 0x89E0
3552 --- a/arch/i386/bits/ipc.h
3553 +++ /dev/null
3554 @@ -1,14 +0,0 @@
3555 -struct ipc_perm
3556 -{
3557 - key_t __ipc_perm_key;
3558 - uid_t uid;
3559 - gid_t gid;
3560 - uid_t cuid;
3561 - gid_t cgid;
3562 - mode_t mode;
3563 - int __ipc_perm_seq;
3564 - long __pad1;
3565 - long __pad2;
3566 -};
3567 -
3568 -#define IPC_64 0x100
3569 --- a/arch/i386/bits/mman.h
3570 +++ b/arch/i386/bits/mman.h
3571 @@ -38,6 +38,7 @@
3572
3573 #define MCL_CURRENT 1
3574 #define MCL_FUTURE 2
3575 +#define MCL_ONFAULT 4
3576
3577 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3578 #define MADV_NORMAL 0
3579 --- a/arch/i386/bits/msg.h
3580 +++ /dev/null
3581 @@ -1,16 +0,0 @@
3582 -struct msqid_ds
3583 -{
3584 - struct ipc_perm msg_perm;
3585 - time_t msg_stime;
3586 - int __unused1;
3587 - time_t msg_rtime;
3588 - int __unused2;
3589 - time_t msg_ctime;
3590 - int __unused3;
3591 - unsigned long msg_cbytes;
3592 - msgqnum_t msg_qnum;
3593 - msglen_t msg_qbytes;
3594 - pid_t msg_lspid;
3595 - pid_t msg_lrpid;
3596 - unsigned long __unused[2];
3597 -};
3598 --- a/arch/i386/bits/sem.h
3599 +++ /dev/null
3600 @@ -1,16 +0,0 @@
3601 -struct semid_ds {
3602 - struct ipc_perm sem_perm;
3603 - time_t sem_otime;
3604 - time_t __unused1;
3605 - time_t sem_ctime;
3606 - time_t __unused2;
3607 -#if __BYTE_ORDER == __LITTLE_ENDIAN
3608 - unsigned short sem_nsems;
3609 - char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
3610 -#else
3611 - char __sem_nsems_pad[sizeof(time_t)-sizeof(short)];
3612 - unsigned short sem_nsems;
3613 -#endif
3614 - time_t __unused3;
3615 - time_t __unused4;
3616 -};
3617 --- a/arch/i386/bits/shm.h
3618 +++ /dev/null
3619 @@ -1,29 +0,0 @@
3620 -#define SHMLBA 4096
3621 -
3622 -struct shmid_ds
3623 -{
3624 - struct ipc_perm shm_perm;
3625 - size_t shm_segsz;
3626 - time_t shm_atime;
3627 - int __unused1;
3628 - time_t shm_dtime;
3629 - int __unused2;
3630 - time_t shm_ctime;
3631 - int __unused3;
3632 - pid_t shm_cpid;
3633 - pid_t shm_lpid;
3634 - unsigned long shm_nattch;
3635 - unsigned long __pad1;
3636 - unsigned long __pad2;
3637 -};
3638 -
3639 -struct shminfo {
3640 - unsigned long shmmax, shmmin, shmmni, shmseg, shmall, __unused[4];
3641 -};
3642 -
3643 -struct shm_info {
3644 - int __used_ids;
3645 - unsigned long shm_tot, shm_rss, shm_swp;
3646 - unsigned long __swap_attempts, __swap_successes;
3647 -};
3648 -
3649 --- a/arch/i386/bits/socket.h
3650 +++ /dev/null
3651 @@ -1,17 +0,0 @@
3652 -struct msghdr
3653 -{
3654 - void *msg_name;
3655 - socklen_t msg_namelen;
3656 - struct iovec *msg_iov;
3657 - int msg_iovlen;
3658 - void *msg_control;
3659 - socklen_t msg_controllen;
3660 - int msg_flags;
3661 -};
3662 -
3663 -struct cmsghdr
3664 -{
3665 - socklen_t cmsg_len;
3666 - int cmsg_level;
3667 - int cmsg_type;
3668 -};
3669 --- a/arch/i386/bits/statfs.h
3670 +++ /dev/null
3671 @@ -1,7 +0,0 @@
3672 -struct statfs {
3673 - unsigned long f_type, f_bsize;
3674 - fsblkcnt_t f_blocks, f_bfree, f_bavail;
3675 - fsfilcnt_t f_files, f_ffree;
3676 - fsid_t f_fsid;
3677 - unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
3678 -};
3679 --- a/arch/i386/bits/syscall.h
3680 +++ b/arch/i386/bits/syscall.h
3681 @@ -357,6 +357,24 @@
3682 #define __NR_memfd_create 356
3683 #define __NR_bpf 357
3684 #define __NR_execveat 358
3685 +#define __NR_socket 359
3686 +#define __NR_socketpair 360
3687 +#define __NR_bind 361
3688 +#define __NR_connect 362
3689 +#define __NR_listen 363
3690 +#define __NR_accept4 364
3691 +#define __NR_getsockopt 365
3692 +#define __NR_setsockopt 366
3693 +#define __NR_getsockname 367
3694 +#define __NR_getpeername 368
3695 +#define __NR_sendto 369
3696 +#define __NR_sendmsg 370
3697 +#define __NR_recvfrom 371
3698 +#define __NR_recvmsg 372
3699 +#define __NR_shutdown 373
3700 +#define __NR_userfaultfd 374
3701 +#define __NR_membarrier 375
3702 +#define __NR_mlock2 376
3703
3704
3705 /* Repeated with SYS_ prefix */
3706 @@ -720,3 +738,21 @@
3707 #define SYS_memfd_create 356
3708 #define SYS_bpf 357
3709 #define SYS_execveat 358
3710 +#define SYS_socket 359
3711 +#define SYS_socketpair 360
3712 +#define SYS_bind 361
3713 +#define SYS_connect 362
3714 +#define SYS_listen 363
3715 +#define SYS_accept4 364
3716 +#define SYS_getsockopt 365
3717 +#define SYS_setsockopt 366
3718 +#define SYS_getsockname 367
3719 +#define SYS_getpeername 368
3720 +#define SYS_sendto 369
3721 +#define SYS_sendmsg 370
3722 +#define SYS_recvfrom 371
3723 +#define SYS_recvmsg 372
3724 +#define SYS_shutdown 373
3725 +#define SYS_userfaultfd 374
3726 +#define SYS_membarrier 375
3727 +#define SYS_mlock2 376
3728 --- a/arch/i386/bits/termios.h
3729 +++ /dev/null
3730 @@ -1,160 +0,0 @@
3731 -struct termios
3732 -{
3733 - tcflag_t c_iflag;
3734 - tcflag_t c_oflag;
3735 - tcflag_t c_cflag;
3736 - tcflag_t c_lflag;
3737 - cc_t c_line;
3738 - cc_t c_cc[NCCS];
3739 - speed_t __c_ispeed;
3740 - speed_t __c_ospeed;
3741 -};
3742 -
3743 -#define VINTR 0
3744 -#define VQUIT 1
3745 -#define VERASE 2
3746 -#define VKILL 3
3747 -#define VEOF 4
3748 -#define VTIME 5
3749 -#define VMIN 6
3750 -#define VSWTC 7
3751 -#define VSTART 8
3752 -#define VSTOP 9
3753 -#define VSUSP 10
3754 -#define VEOL 11
3755 -#define VREPRINT 12
3756 -#define VDISCARD 13
3757 -#define VWERASE 14
3758 -#define VLNEXT 15
3759 -#define VEOL2 16
3760 -
3761 -#define IGNBRK 0000001
3762 -#define BRKINT 0000002
3763 -#define IGNPAR 0000004
3764 -#define PARMRK 0000010
3765 -#define INPCK 0000020
3766 -#define ISTRIP 0000040
3767 -#define INLCR 0000100
3768 -#define IGNCR 0000200
3769 -#define ICRNL 0000400
3770 -#define IUCLC 0001000
3771 -#define IXON 0002000
3772 -#define IXANY 0004000
3773 -#define IXOFF 0010000
3774 -#define IMAXBEL 0020000
3775 -#define IUTF8 0040000
3776 -
3777 -#define OPOST 0000001
3778 -#define OLCUC 0000002
3779 -#define ONLCR 0000004
3780 -#define OCRNL 0000010
3781 -#define ONOCR 0000020
3782 -#define ONLRET 0000040
3783 -#define OFILL 0000100
3784 -#define OFDEL 0000200
3785 -#define NLDLY 0000400
3786 -#define NL0 0000000
3787 -#define NL1 0000400
3788 -#define CRDLY 0003000
3789 -#define CR0 0000000
3790 -#define CR1 0001000
3791 -#define CR2 0002000
3792 -#define CR3 0003000
3793 -#define TABDLY 0014000
3794 -#define TAB0 0000000
3795 -#define TAB1 0004000
3796 -#define TAB2 0010000
3797 -#define TAB3 0014000
3798 -#define BSDLY 0020000
3799 -#define BS0 0000000
3800 -#define BS1 0020000
3801 -#define FFDLY 0100000
3802 -#define FF0 0000000
3803 -#define FF1 0100000
3804 -
3805 -#define VTDLY 0040000
3806 -#define VT0 0000000
3807 -#define VT1 0040000
3808 -
3809 -#define B0 0000000
3810 -#define B50 0000001
3811 -#define B75 0000002
3812 -#define B110 0000003
3813 -#define B134 0000004
3814 -#define B150 0000005
3815 -#define B200 0000006
3816 -#define B300 0000007
3817 -#define B600 0000010
3818 -#define B1200 0000011
3819 -#define B1800 0000012
3820 -#define B2400 0000013
3821 -#define B4800 0000014
3822 -#define B9600 0000015
3823 -#define B19200 0000016
3824 -#define B38400 0000017
3825 -
3826 -#define B57600 0010001
3827 -#define B115200 0010002
3828 -#define B230400 0010003
3829 -#define B460800 0010004
3830 -#define B500000 0010005
3831 -#define B576000 0010006
3832 -#define B921600 0010007
3833 -#define B1000000 0010010
3834 -#define B1152000 0010011
3835 -#define B1500000 0010012
3836 -#define B2000000 0010013
3837 -#define B2500000 0010014
3838 -#define B3000000 0010015
3839 -#define B3500000 0010016
3840 -#define B4000000 0010017
3841 -
3842 -#define CBAUD 0010017
3843 -
3844 -#define CSIZE 0000060
3845 -#define CS5 0000000
3846 -#define CS6 0000020
3847 -#define CS7 0000040
3848 -#define CS8 0000060
3849 -#define CSTOPB 0000100
3850 -#define CREAD 0000200
3851 -#define PARENB 0000400
3852 -#define PARODD 0001000
3853 -#define HUPCL 0002000
3854 -#define CLOCAL 0004000
3855 -
3856 -#define ISIG 0000001
3857 -#define ICANON 0000002
3858 -#define ECHO 0000010
3859 -#define ECHOE 0000020
3860 -#define ECHOK 0000040
3861 -#define ECHONL 0000100
3862 -#define NOFLSH 0000200
3863 -#define TOSTOP 0000400
3864 -#define IEXTEN 0100000
3865 -
3866 -#define ECHOCTL 0001000
3867 -#define ECHOPRT 0002000
3868 -#define ECHOKE 0004000
3869 -#define FLUSHO 0010000
3870 -#define PENDIN 0040000
3871 -
3872 -#define TCOOFF 0
3873 -#define TCOON 1
3874 -#define TCIOFF 2
3875 -#define TCION 3
3876 -
3877 -#define TCIFLUSH 0
3878 -#define TCOFLUSH 1
3879 -#define TCIOFLUSH 2
3880 -
3881 -#define TCSANOW 0
3882 -#define TCSADRAIN 1
3883 -#define TCSAFLUSH 2
3884 -
3885 -#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3886 -#define CBAUDEX 0010000
3887 -#define CRTSCTS 020000000000
3888 -#define EXTPROC 0200000
3889 -#define XTABS 0014000
3890 -#endif
3891 --- a/arch/i386/pthread_arch.h
3892 +++ b/arch/i386/pthread_arch.h
3893 @@ -7,4 +7,4 @@ static inline struct pthread *__pthread_
3894
3895 #define TP_ADJ(p) (p)
3896
3897 -#define CANCEL_REG_IP 14
3898 +#define MC_PC gregs[REG_EIP]
3899 --- a/arch/i386/syscall_arch.h
3900 +++ b/arch/i386/syscall_arch.h
3901 @@ -55,3 +55,5 @@ static inline long __syscall6(long n, lo
3902 #define VDSO_USEFUL
3903 #define VDSO_CGT_SYM "__vdso_clock_gettime"
3904 #define VDSO_CGT_VER "LINUX_2.6"
3905 +
3906 +#define SYSCALL_USE_SOCKETCALL
3907 --- a/arch/microblaze/atomic.h
3908 +++ /dev/null
3909 @@ -1,143 +0,0 @@
3910 -#ifndef _INTERNAL_ATOMIC_H
3911 -#define _INTERNAL_ATOMIC_H
3912 -
3913 -#include <stdint.h>
3914 -
3915 -static inline int a_ctz_l(unsigned long x)
3916 -{
3917 - static const char debruijn32[32] = {
3918 - 0, 1, 23, 2, 29, 24, 19, 3, 30, 27, 25, 11, 20, 8, 4, 13,
3919 - 31, 22, 28, 18, 26, 10, 7, 12, 21, 17, 9, 6, 16, 5, 15, 14
3920 - };
3921 - return debruijn32[(x&-x)*0x076be629 >> 27];
3922 -}
3923 -
3924 -static inline int a_ctz_64(uint64_t x)
3925 -{
3926 - uint32_t y = x;
3927 - if (!y) {
3928 - y = x>>32;
3929 - return 32 + a_ctz_l(y);
3930 - }
3931 - return a_ctz_l(y);
3932 -}
3933 -
3934 -static inline int a_cas(volatile int *p, int t, int s)
3935 -{
3936 - register int old, tmp;
3937 - __asm__ __volatile__ (
3938 - " addi %0, r0, 0\n"
3939 - "1: lwx %0, %2, r0\n"
3940 - " rsubk %1, %0, %3\n"
3941 - " bnei %1, 1f\n"
3942 - " swx %4, %2, r0\n"
3943 - " addic %1, r0, 0\n"
3944 - " bnei %1, 1b\n"
3945 - "1: "
3946 - : "=&r"(old), "=&r"(tmp)
3947 - : "r"(p), "r"(t), "r"(s)
3948 - : "cc", "memory" );
3949 - return old;
3950 -}
3951 -
3952 -static inline void *a_cas_p(volatile void *p, void *t, void *s)
3953 -{
3954 - return (void *)a_cas(p, (int)t, (int)s);
3955 -}
3956 -
3957 -static inline int a_swap(volatile int *x, int v)
3958 -{
3959 - register int old, tmp;
3960 - __asm__ __volatile__ (
3961 - " addi %0, r0, 0\n"
3962 - "1: lwx %0, %2, r0\n"
3963 - " swx %3, %2, r0\n"
3964 - " addic %1, r0, 0\n"
3965 - " bnei %1, 1b\n"
3966 - "1: "
3967 - : "=&r"(old), "=&r"(tmp)
3968 - : "r"(x), "r"(v)
3969 - : "cc", "memory" );
3970 - return old;
3971 -}
3972 -
3973 -static inline int a_fetch_add(volatile int *x, int v)
3974 -{
3975 - register int new, tmp;
3976 - __asm__ __volatile__ (
3977 - " addi %0, r0, 0\n"
3978 - "1: lwx %0, %2, r0\n"
3979 - " addk %0, %0, %3\n"
3980 - " swx %0, %2, r0\n"
3981 - " addic %1, r0, 0\n"
3982 - " bnei %1, 1b\n"
3983 - "1: "
3984 - : "=&r"(new), "=&r"(tmp)
3985 - : "r"(x), "r"(v)
3986 - : "cc", "memory" );
3987 - return new-v;
3988 -}
3989 -
3990 -static inline void a_inc(volatile int *x)
3991 -{
3992 - a_fetch_add(x, 1);
3993 -}
3994 -
3995 -static inline void a_dec(volatile int *x)
3996 -{
3997 - a_fetch_add(x, -1);
3998 -}
3999 -
4000 -static inline void a_store(volatile int *p, int x)
4001 -{
4002 - __asm__ __volatile__ (
4003 - "swi %1, %0"
4004 - : "=m"(*p) : "r"(x) : "memory" );
4005 -}
4006 -
4007 -#define a_spin a_barrier
4008 -
4009 -static inline void a_barrier()
4010 -{
4011 - a_cas(&(int){0}, 0, 0);
4012 -}
4013 -
4014 -static inline void a_crash()
4015 -{
4016 - *(volatile char *)0=0;
4017 -}
4018 -
4019 -static inline void a_and(volatile int *p, int v)
4020 -{
4021 - int old;
4022 - do old = *p;
4023 - while (a_cas(p, old, old&v) != old);
4024 -}
4025 -
4026 -static inline void a_or(volatile int *p, int v)
4027 -{
4028 - int old;
4029 - do old = *p;
4030 - while (a_cas(p, old, old|v) != old);
4031 -}
4032 -
4033 -static inline void a_or_l(volatile void *p, long v)
4034 -{
4035 - a_or(p, v);
4036 -}
4037 -
4038 -static inline void a_and_64(volatile uint64_t *p, uint64_t v)
4039 -{
4040 - union { uint64_t v; uint32_t r[2]; } u = { v };
4041 - a_and((int *)p, u.r[0]);
4042 - a_and((int *)p+1, u.r[1]);
4043 -}
4044 -
4045 -static inline void a_or_64(volatile uint64_t *p, uint64_t v)
4046 -{
4047 - union { uint64_t v; uint32_t r[2]; } u = { v };
4048 - a_or((int *)p, u.r[0]);
4049 - a_or((int *)p+1, u.r[1]);
4050 -}
4051 -
4052 -#endif
4053 --- /dev/null
4054 +++ b/arch/microblaze/atomic_arch.h
4055 @@ -0,0 +1,53 @@
4056 +#define a_cas a_cas
4057 +static inline int a_cas(volatile int *p, int t, int s)
4058 +{
4059 + register int old, tmp;
4060 + __asm__ __volatile__ (
4061 + " addi %0, r0, 0\n"
4062 + "1: lwx %0, %2, r0\n"
4063 + " rsubk %1, %0, %3\n"
4064 + " bnei %1, 1f\n"
4065 + " swx %4, %2, r0\n"
4066 + " addic %1, r0, 0\n"
4067 + " bnei %1, 1b\n"
4068 + "1: "
4069 + : "=&r"(old), "=&r"(tmp)
4070 + : "r"(p), "r"(t), "r"(s)
4071 + : "cc", "memory" );
4072 + return old;
4073 +}
4074 +
4075 +#define a_swap a_swap
4076 +static inline int a_swap(volatile int *x, int v)
4077 +{
4078 + register int old, tmp;
4079 + __asm__ __volatile__ (
4080 + " addi %0, r0, 0\n"
4081 + "1: lwx %0, %2, r0\n"
4082 + " swx %3, %2, r0\n"
4083 + " addic %1, r0, 0\n"
4084 + " bnei %1, 1b\n"
4085 + "1: "
4086 + : "=&r"(old), "=&r"(tmp)
4087 + : "r"(x), "r"(v)
4088 + : "cc", "memory" );
4089 + return old;
4090 +}
4091 +
4092 +#define a_fetch_add a_fetch_add
4093 +static inline int a_fetch_add(volatile int *x, int v)
4094 +{
4095 + register int new, tmp;
4096 + __asm__ __volatile__ (
4097 + " addi %0, r0, 0\n"
4098 + "1: lwx %0, %2, r0\n"
4099 + " addk %0, %0, %3\n"
4100 + " swx %0, %2, r0\n"
4101 + " addic %1, r0, 0\n"
4102 + " bnei %1, 1b\n"
4103 + "1: "
4104 + : "=&r"(new), "=&r"(tmp)
4105 + : "r"(x), "r"(v)
4106 + : "cc", "memory" );
4107 + return new-v;
4108 +}
4109 --- a/arch/microblaze/bits/errno.h
4110 +++ /dev/null
4111 @@ -1,134 +0,0 @@
4112 -#define EPERM 1
4113 -#define ENOENT 2
4114 -#define ESRCH 3
4115 -#define EINTR 4
4116 -#define EIO 5
4117 -#define ENXIO 6
4118 -#define E2BIG 7
4119 -#define ENOEXEC 8
4120 -#define EBADF 9
4121 -#define ECHILD 10
4122 -#define EAGAIN 11
4123 -#define ENOMEM 12
4124 -#define EACCES 13
4125 -#define EFAULT 14
4126 -#define ENOTBLK 15
4127 -#define EBUSY 16
4128 -#define EEXIST 17
4129 -#define EXDEV 18
4130 -#define ENODEV 19
4131 -#define ENOTDIR 20
4132 -#define EISDIR 21
4133 -#define EINVAL 22
4134 -#define ENFILE 23
4135 -#define EMFILE 24
4136 -#define ENOTTY 25
4137 -#define ETXTBSY 26
4138 -#define EFBIG 27
4139 -#define ENOSPC 28
4140 -#define ESPIPE 29
4141 -#define EROFS 30
4142 -#define EMLINK 31
4143 -#define EPIPE 32
4144 -#define EDOM 33
4145 -#define ERANGE 34
4146 -#define EDEADLK 35
4147 -#define ENAMETOOLONG 36
4148 -#define ENOLCK 37
4149 -#define ENOSYS 38
4150 -#define ENOTEMPTY 39
4151 -#define ELOOP 40
4152 -#define EWOULDBLOCK EAGAIN
4153 -#define ENOMSG 42
4154 -#define EIDRM 43
4155 -#define ECHRNG 44
4156 -#define EL2NSYNC 45
4157 -#define EL3HLT 46
4158 -#define EL3RST 47
4159 -#define ELNRNG 48
4160 -#define EUNATCH 49
4161 -#define ENOCSI 50
4162 -#define EL2HLT 51
4163 -#define EBADE 52
4164 -#define EBADR 53
4165 -#define EXFULL 54
4166 -#define ENOANO 55
4167 -#define EBADRQC 56
4168 -#define EBADSLT 57
4169 -#define EDEADLOCK EDEADLK
4170 -#define EBFONT 59
4171 -#define ENOSTR 60
4172 -#define ENODATA 61
4173 -#define ETIME 62
4174 -#define ENOSR 63
4175 -#define ENONET 64
4176 -#define ENOPKG 65
4177 -#define EREMOTE 66
4178 -#define ENOLINK 67
4179 -#define EADV 68
4180 -#define ESRMNT 69
4181 -#define ECOMM 70
4182 -#define EPROTO 71
4183 -#define EMULTIHOP 72
4184 -#define EDOTDOT 73
4185 -#define EBADMSG 74
4186 -#define EOVERFLOW 75
4187 -#define ENOTUNIQ 76
4188 -#define EBADFD 77
4189 -#define EREMCHG 78
4190 -#define ELIBACC 79
4191 -#define ELIBBAD 80
4192 -#define ELIBSCN 81
4193 -#define ELIBMAX 82
4194 -#define ELIBEXEC 83
4195 -#define EILSEQ 84
4196 -#define ERESTART 85
4197 -#define ESTRPIPE 86
4198 -#define EUSERS 87
4199 -#define ENOTSOCK 88
4200 -#define EDESTADDRREQ 89
4201 -#define EMSGSIZE 90
4202 -#define EPROTOTYPE 91
4203 -#define ENOPROTOOPT 92
4204 -#define EPROTONOSUPPORT 93
4205 -#define ESOCKTNOSUPPORT 94
4206 -#define EOPNOTSUPP 95
4207 -#define ENOTSUP EOPNOTSUPP
4208 -#define EPFNOSUPPORT 96
4209 -#define EAFNOSUPPORT 97
4210 -#define EADDRINUSE 98
4211 -#define EADDRNOTAVAIL 99
4212 -#define ENETDOWN 100
4213 -#define ENETUNREACH 101
4214 -#define ENETRESET 102
4215 -#define ECONNABORTED 103
4216 -#define ECONNRESET 104
4217 -#define ENOBUFS 105
4218 -#define EISCONN 106
4219 -#define ENOTCONN 107
4220 -#define ESHUTDOWN 108
4221 -#define ETOOMANYREFS 109
4222 -#define ETIMEDOUT 110
4223 -#define ECONNREFUSED 111
4224 -#define EHOSTDOWN 112
4225 -#define EHOSTUNREACH 113
4226 -#define EALREADY 114
4227 -#define EINPROGRESS 115
4228 -#define ESTALE 116
4229 -#define EUCLEAN 117
4230 -#define ENOTNAM 118
4231 -#define ENAVAIL 119
4232 -#define EISNAM 120
4233 -#define EREMOTEIO 121
4234 -#define EDQUOT 122
4235 -#define ENOMEDIUM 123
4236 -#define EMEDIUMTYPE 124
4237 -#define ECANCELED 125
4238 -#define ENOKEY 126
4239 -#define EKEYEXPIRED 127
4240 -#define EKEYREVOKED 128
4241 -#define EKEYREJECTED 129
4242 -#define EOWNERDEAD 130
4243 -#define ENOTRECOVERABLE 131
4244 -#define ERFKILL 132
4245 -#define EHWPOISON 133
4246 --- a/arch/microblaze/bits/fcntl.h
4247 +++ /dev/null
4248 @@ -1,40 +0,0 @@
4249 -#define O_CREAT 0100
4250 -#define O_EXCL 0200
4251 -#define O_NOCTTY 0400
4252 -#define O_TRUNC 01000
4253 -#define O_APPEND 02000
4254 -#define O_NONBLOCK 04000
4255 -#define O_DSYNC 010000
4256 -#define O_SYNC 04010000
4257 -#define O_RSYNC 04010000
4258 -#define O_DIRECTORY 0200000
4259 -#define O_NOFOLLOW 0400000
4260 -#define O_CLOEXEC 02000000
4261 -
4262 -#define O_ASYNC 020000
4263 -#define O_DIRECT 040000
4264 -#define O_LARGEFILE 0100000
4265 -#define O_NOATIME 01000000
4266 -#define O_PATH 010000000
4267 -#define O_TMPFILE 020200000
4268 -#define O_NDELAY O_NONBLOCK
4269 -
4270 -#define F_DUPFD 0
4271 -#define F_GETFD 1
4272 -#define F_SETFD 2
4273 -#define F_GETFL 3
4274 -#define F_SETFL 4
4275 -
4276 -#define F_SETOWN 8
4277 -#define F_GETOWN 9
4278 -#define F_SETSIG 10
4279 -#define F_GETSIG 11
4280 -
4281 -#define F_GETLK 12
4282 -#define F_SETLK 13
4283 -#define F_SETLKW 14
4284 -
4285 -#define F_SETOWN_EX 15
4286 -#define F_GETOWN_EX 16
4287 -
4288 -#define F_GETOWNER_UIDS 17
4289 --- a/arch/microblaze/bits/fenv.h
4290 +++ /dev/null
4291 @@ -1,10 +0,0 @@
4292 -#define FE_ALL_EXCEPT 0
4293 -#define FE_TONEAREST 0
4294 -
4295 -typedef unsigned long fexcept_t;
4296 -
4297 -typedef struct {
4298 - unsigned long __cw;
4299 -} fenv_t;
4300 -
4301 -#define FE_DFL_ENV ((const fenv_t *) -1)
4302 --- a/arch/microblaze/bits/ioctl.h
4303 +++ /dev/null
4304 @@ -1,197 +0,0 @@
4305 -#define _IOC(a,b,c,d) ( ((a)<<30) | ((b)<<8) | (c) | ((d)<<16) )
4306 -#define _IOC_NONE 0U
4307 -#define _IOC_WRITE 1U
4308 -#define _IOC_READ 2U
4309 -
4310 -#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0)
4311 -#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c))
4312 -#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c))
4313 -#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c))
4314 -
4315 -#define TCGETS 0x5401
4316 -#define TCSETS 0x5402
4317 -#define TCSETSW 0x5403
4318 -#define TCSETSF 0x5404
4319 -#define TCGETA 0x5405
4320 -#define TCSETA 0x5406
4321 -#define TCSETAW 0x5407
4322 -#define TCSETAF 0x5408
4323 -#define TCSBRK 0x5409
4324 -#define TCXONC 0x540A
4325 -#define TCFLSH 0x540B
4326 -#define TIOCEXCL 0x540C
4327 -#define TIOCNXCL 0x540D
4328 -#define TIOCSCTTY 0x540E
4329 -#define TIOCGPGRP 0x540F
4330 -#define TIOCSPGRP 0x5410
4331 -#define TIOCOUTQ 0x5411
4332 -#define TIOCSTI 0x5412
4333 -#define TIOCGWINSZ 0x5413
4334 -#define TIOCSWINSZ 0x5414
4335 -#define TIOCMGET 0x5415
4336 -#define TIOCMBIS 0x5416
4337 -#define TIOCMBIC 0x5417
4338 -#define TIOCMSET 0x5418
4339 -#define TIOCGSOFTCAR 0x5419
4340 -#define TIOCSSOFTCAR 0x541A
4341 -#define FIONREAD 0x541B
4342 -#define TIOCINQ FIONREAD
4343 -#define TIOCLINUX 0x541C
4344 -#define TIOCCONS 0x541D
4345 -#define TIOCGSERIAL 0x541E
4346 -#define TIOCSSERIAL 0x541F
4347 -#define TIOCPKT 0x5420
4348 -#define FIONBIO 0x5421
4349 -#define TIOCNOTTY 0x5422
4350 -#define TIOCSETD 0x5423
4351 -#define TIOCGETD 0x5424
4352 -#define TCSBRKP 0x5425
4353 -#define TIOCTTYGSTRUCT 0x5426
4354 -#define TIOCSBRK 0x5427
4355 -#define TIOCCBRK 0x5428
4356 -#define TIOCGSID 0x5429
4357 -#define TIOCGPTN 0x80045430
4358 -#define TIOCSPTLCK 0x40045431
4359 -#define TCGETX 0x5432
4360 -#define TCSETX 0x5433
4361 -#define TCSETXF 0x5434
4362 -#define TCSETXW 0x5435
4363 -
4364 -#define FIONCLEX 0x5450
4365 -#define FIOCLEX 0x5451
4366 -#define FIOASYNC 0x5452
4367 -#define TIOCSERCONFIG 0x5453
4368 -#define TIOCSERGWILD 0x5454
4369 -#define TIOCSERSWILD 0x5455
4370 -#define TIOCGLCKTRMIOS 0x5456
4371 -#define TIOCSLCKTRMIOS 0x5457
4372 -#define TIOCSERGSTRUCT 0x5458
4373 -#define TIOCSERGETLSR 0x5459
4374 -#define TIOCSERGETMULTI 0x545A
4375 -#define TIOCSERSETMULTI 0x545B
4376 -
4377 -#define TIOCMIWAIT 0x545C
4378 -#define TIOCGICOUNT 0x545D
4379 -#define TIOCGHAYESESP 0x545E
4380 -#define TIOCSHAYESESP 0x545F
4381 -#define FIOQSIZE 0x5460
4382 -
4383 -#define TIOCPKT_DATA 0
4384 -#define TIOCPKT_FLUSHREAD 1
4385 -#define TIOCPKT_FLUSHWRITE 2
4386 -#define TIOCPKT_STOP 4
4387 -#define TIOCPKT_START 8
4388 -#define TIOCPKT_NOSTOP 16
4389 -#define TIOCPKT_DOSTOP 32
4390 -#define TIOCPKT_IOCTL 64
4391 -
4392 -#define TIOCSER_TEMT 0x01
4393 -
4394 -struct winsize {
4395 - unsigned short ws_row;
4396 - unsigned short ws_col;
4397 - unsigned short ws_xpixel;
4398 - unsigned short ws_ypixel;
4399 -};
4400 -
4401 -#define TIOCM_LE 0x001
4402 -#define TIOCM_DTR 0x002
4403 -#define TIOCM_RTS 0x004
4404 -#define TIOCM_ST 0x008
4405 -#define TIOCM_SR 0x010
4406 -#define TIOCM_CTS 0x020
4407 -#define TIOCM_CAR 0x040
4408 -#define TIOCM_RNG 0x080
4409 -#define TIOCM_DSR 0x100
4410 -#define TIOCM_CD TIOCM_CAR
4411 -#define TIOCM_RI TIOCM_RNG
4412 -#define TIOCM_OUT1 0x2000
4413 -#define TIOCM_OUT2 0x4000
4414 -#define TIOCM_LOOP 0x8000
4415 -#define TIOCM_MODEM_BITS TIOCM_OUT2
4416 -
4417 -#define N_TTY 0
4418 -#define N_SLIP 1
4419 -#define N_MOUSE 2
4420 -#define N_PPP 3
4421 -#define N_STRIP 4
4422 -#define N_AX25 5
4423 -#define N_X25 6
4424 -#define N_6PACK 7
4425 -#define N_MASC 8
4426 -#define N_R3964 9
4427 -#define N_PROFIBUS_FDL 10
4428 -#define N_IRDA 11
4429 -#define N_SMSBLOCK 12
4430 -#define N_HDLC 13
4431 -#define N_SYNC_PPP 14
4432 -#define N_HCI 15
4433 -
4434 -#define FIOSETOWN 0x8901
4435 -#define SIOCSPGRP 0x8902
4436 -#define FIOGETOWN 0x8903
4437 -#define SIOCGPGRP 0x8904
4438 -#define SIOCATMARK 0x8905
4439 -#define SIOCGSTAMP 0x8906
4440 -
4441 -#define SIOCADDRT 0x890B
4442 -#define SIOCDELRT 0x890C
4443 -#define SIOCRTMSG 0x890D
4444 -
4445 -#define SIOCGIFNAME 0x8910
4446 -#define SIOCSIFLINK 0x8911