remove broken status from uml target
[openwrt.git] / toolchain / uClibc / patches / 0.9.28.2 / 400-avr32-arch-2.patch
1 Subject: [PATCH] AVR32 Architecture support
2
3 Add support for the AVR32 architecture in the core libc and build system.
4 This also adds AVR32-ELF definitions to elf.h
5
6 ---
7
8 Rules.mak | 4
9 extra/Configs/Config.avr32 | 38 +++++
10 extra/Configs/Config.in | 7 +
11 include/elf.h | 51 +++++++
12 libc/sysdeps/linux/avr32/Makefile | 93 +++++++++++++
13 libc/sysdeps/linux/avr32/__longjmp.S | 17 ++
14 libc/sysdeps/linux/avr32/_mmap.c | 33 ++++
15 libc/sysdeps/linux/avr32/bits/atomicity.h | 86 ++++++++++++
16 libc/sysdeps/linux/avr32/bits/byteswap.h | 80 +++++++++++
17 libc/sysdeps/linux/avr32/bits/endian.h | 7 +
18 libc/sysdeps/linux/avr32/bits/fcntl.h | 167 +++++++++++++++++++++++++
19 libc/sysdeps/linux/avr32/bits/kernel_stat.h | 63 +++++++++
20 libc/sysdeps/linux/avr32/bits/kernel_types.h | 56 ++++++++
21 libc/sysdeps/linux/avr32/bits/machine-gmon.h | 69 ++++++++++
22 libc/sysdeps/linux/avr32/bits/mman.h | 95 ++++++++++++++
23 libc/sysdeps/linux/avr32/bits/profil-counter.h | 26 +++
24 libc/sysdeps/linux/avr32/bits/setjmp.h | 21 +++
25 libc/sysdeps/linux/avr32/bits/syscalls.h | 143 +++++++++++++++++++++
26 libc/sysdeps/linux/avr32/bits/wordsize.h | 1
27 libc/sysdeps/linux/avr32/brk.c | 23 +++
28 libc/sysdeps/linux/avr32/bsd-_setjmp.S | 12 +
29 libc/sysdeps/linux/avr32/bsd-setjmp.S | 12 +
30 libc/sysdeps/linux/avr32/clone.c | 37 +++++
31 libc/sysdeps/linux/avr32/crt1.S | 93 +++++++++++++
32 libc/sysdeps/linux/avr32/crti.S | 17 ++
33 libc/sysdeps/linux/avr32/crtn.S | 14 ++
34 libc/sysdeps/linux/avr32/mmap.c | 31 ++++
35 libc/sysdeps/linux/avr32/setjmp.S | 43 ++++++
36 libc/sysdeps/linux/avr32/sigaction.c | 49 +++++++
37 libc/sysdeps/linux/avr32/sigrestorer.S | 11 +
38 libc/sysdeps/linux/avr32/sys/elf.h | 26 +++
39 libc/sysdeps/linux/avr32/sys/io.h | 48 +++++++
40 libc/sysdeps/linux/avr32/sys/procfs.h | 123 ++++++++++++++++++
41 libc/sysdeps/linux/avr32/sys/ucontext.h | 94 ++++++++++++++
42 libc/sysdeps/linux/avr32/sys/user.h | 46 ++++++
43 libc/sysdeps/linux/avr32/syscall.S | 81 ++++++++++++
44 libc/sysdeps/linux/avr32/vfork.S | 55 ++++++++
45 37 files changed, 1872 insertions(+)
46
47 Index: uClibc-0.9.28/extra/Configs/Config.avr32
48 ===================================================================
49 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
50 +++ uClibc-0.9.28/extra/Configs/Config.avr32 2006-05-05 09:27:17.000000000 +0200
51 @@ -0,0 +1,38 @@
52 +#
53 +# For a description of the syntax of this configuration file,
54 +# see extra/config/Kconfig-language.txt
55 +#
56 +
57 +config HAVE_ELF
58 + bool
59 + default y
60 +
61 +config TARGET_ARCH
62 + default "avr32"
63 +
64 +config ARCH_CFLAGS
65 + string
66 +
67 +config ARCH_LDFLAGS
68 + string
69 +
70 +config LIBGCC_CFLAGS
71 + string
72 +
73 +config ARCH_SUPPORTS_BIG_ENDIAN
74 + bool
75 + default y
76 +
77 +config UCLIBC_COMPLETELY_PIC
78 + select FORCE_SHAREABLE_TEXT_SEGMENTS
79 + bool
80 + default y
81 +
82 +choice
83 + prompt "Target CPU Type"
84 + default CONFIG_AP7000
85 +
86 +config CONFIG_AP7000
87 + bool "AP7000"
88 +
89 +endchoice
90 Index: uClibc-0.9.28/extra/Configs/Config.in
91 ===================================================================
92 --- uClibc-0.9.28.orig/extra/Configs/Config.in 2006-04-19 12:47:48.000000000 +0200
93 +++ uClibc-0.9.28/extra/Configs/Config.in 2006-04-19 12:48:33.000000000 +0200
94 @@ -16,6 +16,9 @@ config TARGET_alpha
95 config TARGET_arm
96 bool "arm"
97
98 +config TARGET_avr32
99 + bool "avr32"
100 +
101 config TARGET_bfin
102 bool "bfin"
103
104 @@ -83,6 +86,10 @@ if TARGET_arm
105 source "extra/Configs/Config.arm"
106 endif
107
108 +if TARGET_avr32
109 +source "extra/Configs/Config.avr32"
110 +endif
111 +
112 if TARGET_bfin
113 source "extra/Configs/Config.bfin"
114 endif
115 Index: uClibc-0.9.28/include/elf.h
116 ===================================================================
117 --- uClibc-0.9.28.orig/include/elf.h 2006-04-19 12:47:48.000000000 +0200
118 +++ uClibc-0.9.28/include/elf.h 2006-05-05 09:28:38.000000000 +0200
119 @@ -261,6 +261,8 @@ typedef struct
120 #define EM_NIOS32 0xfebb /* Altera Nios 32 */
121 #define EM_ALTERA_NIOS2 0x9ee5 /* Altera Nios II */
122
123 +#define EM_AVR32 0x18ad
124 +
125 /* V850 backend magic number. Written in the absense of an ABI. */
126 #define EM_CYGNUS_V850 0x9080
127
128 @@ -2687,6 +2689,55 @@ typedef Elf32_Addr Elf32_Conflict;
129 /* Keep this the last entry. */
130 #define R_V850_NUM 25
131
132 +/* Atmel AVR32 relocations. */
133 +#define R_AVR32_NONE 0
134 +#define R_AVR32_32 1
135 +#define R_AVR32_16 2
136 +#define R_AVR32_8 3
137 +#define R_AVR32_32_PCREL 4
138 +#define R_AVR32_16_PCREL 5
139 +#define R_AVR32_8_PCREL 6
140 +#define R_AVR32_DIFF32 7
141 +#define R_AVR32_DIFF16 8
142 +#define R_AVR32_DIFF8 9
143 +#define R_AVR32_GOT32 10
144 +#define R_AVR32_GOT16 11
145 +#define R_AVR32_GOT8 12
146 +#define R_AVR32_21S 13
147 +#define R_AVR32_16U 14
148 +#define R_AVR32_16S 15
149 +#define R_AVR32_8S 16
150 +#define R_AVR32_8S_EXT 17
151 +#define R_AVR32_22H_PCREL 18
152 +#define R_AVR32_18W_PCREL 19
153 +#define R_AVR32_16B_PCREL 20
154 +#define R_AVR32_16N_PCREL 21
155 +#define R_AVR32_14UW_PCREL 22
156 +#define R_AVR32_11H_PCREL 23
157 +#define R_AVR32_10UW_PCREL 24
158 +#define R_AVR32_9H_PCREL 25
159 +#define R_AVR32_9UW_PCREL 26
160 +#define R_AVR32_HI16 27
161 +#define R_AVR32_LO16 28
162 +#define R_AVR32_GOTPC 29
163 +#define R_AVR32_GOTCALL 30
164 +#define R_AVR32_LDA_GOT 31
165 +#define R_AVR32_GOT21S 32
166 +#define R_AVR32_GOT18SW 33
167 +#define R_AVR32_GOT16S 34
168 +#define R_AVR32_GOT7UW 35
169 +#define R_AVR32_32_CPENT 36
170 +#define R_AVR32_CPCALL 37
171 +#define R_AVR32_16_CP 38
172 +#define R_AVR32_9W_CP 39
173 +#define R_AVR32_RELATIVE 40
174 +#define R_AVR32_GLOB_DAT 41
175 +#define R_AVR32_JMP_SLOT 42
176 +#define R_AVR32_ALIGN 43
177 +#define R_AVR32_NUM 44
178 +
179 +/* AVR32 dynamic tags */
180 +#define DT_AVR32_GOTSZ 0x70000001 /* Total size of GOT in bytes */
181
182 #define R_H8_NONE 0
183 #define R_H8_DIR32 1
184 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/Makefile
185 ===================================================================
186 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
187 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/Makefile 2006-04-19 12:48:33.000000000 +0200
188 @@ -0,0 +1,93 @@
189 +# Makefile for uClibc
190 +#
191 +# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
192 +#
193 +# This program is free software; you can redistribute it and/or modify it under
194 +# the terms of the GNU Library General Public License as published by the Free
195 +# Software Foundation; either version 2 of the License, or (at your option) any
196 +# later version.
197 +#
198 +# This program is distributed in the hope that it will be useful, but WITHOUT
199 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
200 +# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
201 +# details.
202 +#
203 +# You should have received a copy of the GNU Library General Public License
204 +# along with this program; if not, write to the Free Software Foundation, Inc.,
205 +# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
206 +
207 +TOPDIR=../../../../
208 +include $(TOPDIR)Rules.mak
209 +ASFLAGS=$(CFLAGS)
210 +
211 +CRT_SRC = crt1.S
212 +CRT_OBJ = crt1.o
213 +SCRT_OBJ = $(patsubst %,S%, $(CRT_OBJ))
214 +CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
215 +
216 +SSRC=__longjmp.S setjmp.S bsd-setjmp.S vfork.S \
217 + bsd-_setjmp.S sigrestorer.S syscall.S
218 +SOBJS=$(patsubst %.S,%.o, $(SSRC))
219 +
220 +CSRC=clone.c brk.c sigaction.c mmap.c
221 +COBJS=$(patsubst %.c,%.o, $(CSRC))
222 +
223 +OBJS=$(SOBJS) $(COBJS)
224 +
225 +OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
226 +
227 +all: $(OBJ_LIST)
228 +
229 +$(OBJ_LIST): $(OBJS) $(CRT_OBJ) $(SCRT_OBJ) $(CTOR_TARGETS)
230 + echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
231 + $(INSTALL) -d $(TOPDIR)lib/
232 + cp $(CRT_OBJ) $(SCRT_OBJ) $(TOPDIR)lib/
233 +
234 +$(CRT_OBJ): $(CRT_SRC)
235 + $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
236 + $(STRIPTOOL) -x -R .note -R .comment $*.o
237 +
238 +$(SCRT_OBJ): $(CRT_SRC)
239 + $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* $< -c -o $*.o
240 + $(STRIPTOOL) -x -R .note -R .comment $*.o
241 +
242 +$(SOBJS): %.o : %.S
243 + $(CC) $(ASFLAGS) -c $< -o $@
244 + $(STRIPTOOL) -x -R .note -R .comment $*.o
245 +
246 +$(COBJS): %.o : %.c
247 + $(CC) $(CFLAGS) -c $< -o $@
248 + $(STRIPTOOL) -x -R .note -R .comment $*.o
249 +
250 +ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
251 +crti.o: crti.S
252 + $(CC) $(ASFLAGS) -c crti.S -o crti.o
253 +
254 +$(TOPDIR)lib/crti.o: crti.o
255 + $(INSTALL) -d $(TOPDIR)lib/
256 + cp crti.o $(TOPDIR)lib/
257 +
258 +crtn.o: crtn.S
259 + $(CC) $(ASFLAGS) -c crtn.S -o crtn.o
260 +
261 +$(TOPDIR)lib/crtn.o: crtn.o
262 + $(INSTALL) -d $(TOPDIR)lib/
263 + cp crtn.o $(TOPDIR)lib/
264 +else
265 +$(TOPDIR)lib/crti.o:
266 + $(INSTALL) -d $(TOPDIR)lib/
267 + $(AR) $(ARFLAGS) $(TOPDIR)lib/crti.o
268 +$(TOPDIR)lib/crtn.o:
269 + $(INSTALL) -d $(TOPDIR)lib/
270 + $(AR) $(ARFLAGS) $(TOPDIR)lib/crtn.o
271 +endif
272 +
273 +
274 +headers:
275 +# $(LN) -fs ../libc/sysdeps/linux/avr32/fpu_control.h $(TOPDIR)/include/
276 +
277 +clean:
278 + $(RM) *.[oa] *~ core
279 + $(RM) bits/sysnum.h
280 + $(RM) gmon-start.S
281 +
282 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/__longjmp.S
283 ===================================================================
284 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
285 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/__longjmp.S 2006-04-19 12:48:33.000000000 +0200
286 @@ -0,0 +1,17 @@
287 +/* longjmp for AVR32
288 + *
289 + * Copyright (C) 2004 Atmel Norway AS
290 + */
291 +
292 + .global __longjmp
293 + .type __longjmp,"function"
294 + .align 1
295 +__longjmp:
296 + ldm r12++, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
297 + mov r12, r11 /* get the return value right */
298 + mustr r8 /* restore status register (lower half) */
299 + cp r12, 0 /* can't return zero */
300 + frs
301 + moveq r12, 1
302 + mov pc,lr
303 + .size __longjmp, . - __longjmp
304 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/_mmap.c
305 ===================================================================
306 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
307 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/_mmap.c 2006-04-19 12:48:33.000000000 +0200
308 @@ -0,0 +1,33 @@
309 +/* Copyright (C) 2005 Atmel Norway
310 +
311 + This program is free software; you can redistribute it and/or modify it under
312 + the terms of the GNU Library General Public License as published by the Free
313 + Software Foundation; either version 2 of the License, or (at your option) any
314 + later version.
315 +
316 + This program is distributed in the hope that it will be useful, but WITHOUT
317 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
318 + FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
319 + details.
320 +
321 + You should have received a copy of the GNU Library General Public License
322 + along with this program; if not, write to the Free Software Foundation, Inc.,
323 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
324 +
325 + Derived in part from the Linux-8086 C library, the GNU C Library, and several
326 + other sundry sources. Files within this library are copyright by their
327 + respective copyright holders.
328 + */
329 +
330 +#include <errno.h>
331 +#include <sys/mman.h>
332 +#include <sys/syscall.h>
333 +
334 +#define __NR_mmap2 __NR_mmap
335 +
336 +static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
337 +
338 +__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
339 +{
340 + return mmap2(addr, len, prot, flags, fd, offset >> 12);
341 +}
342 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/atomicity.h
343 ===================================================================
344 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
345 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/atomicity.h 2006-04-19 12:48:33.000000000 +0200
346 @@ -0,0 +1,86 @@
347 +/* Low-level functions for atomic operations. AVR32 version.
348 + Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
349 + This file is part of the GNU C Library.
350 +
351 + The GNU C Library is free software; you can redistribute it and/or
352 + modify it under the terms of the GNU Lesser General Public
353 + License as published by the Free Software Foundation; either
354 + version 2.1 of the License, or (at your option) any later version.
355 +
356 + The GNU C Library is distributed in the hope that it will be useful,
357 + but WITHOUT ANY WARRANTY; without even the implied warranty of
358 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
359 + Lesser General Public License for more details.
360 +
361 + You should have received a copy of the GNU Lesser General Public
362 + License along with the GNU C Library; if not, write to the Free
363 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
364 + 02111-1307 USA. */
365 +
366 +#ifndef _ATOMICITY_H
367 +#define _ATOMICITY_H 1
368 +
369 +#include <inttypes.h>
370 +
371 +static inline int
372 +__attribute__((unused))
373 +exchange_and_add (volatile uint32_t *mem, int val)
374 +{
375 + int tmp, result;
376 +
377 + __asm__ __volatile__(
378 + "/* Inline exchange and add */\n"
379 + "1: ssrf 5\n"
380 + " ld.w %0, %3\n"
381 + " add %1, %0, %4\n"
382 + " stcond %2, %1\n"
383 + " brne 1b"
384 + : "=&r"(result), "=&r"(tmp), "=m"(*mem)
385 + : "m"(*mem), "r"(val)
386 + : "cc", "memory");
387 +
388 + return result;
389 +}
390 +
391 +static inline void
392 +__attribute__((unused))
393 +atomic_add (volatile uin32_t *mem, int val)
394 +{
395 + int result;
396 +
397 + __asm__ __volatile__(
398 + "/* Inline atomic add */\n"
399 + "1: ssrf 5\n"
400 + " ld.w %0, %2\n"
401 + " add %0, %3\n"
402 + " stcond %2, %0\n"
403 + " brne 1b"
404 + : "=&r"(result), "=m"(*mem)
405 + : "m"(*mem), "r"(val)
406 + : "cc", "memory");
407 +}
408 +
409 +static inline int
410 +__attribute__((unused))
411 +compare_and_swap(volatile long int *p, long int oldval, long int newval)
412 +{
413 + long int result, tmp;
414 +
415 + __asm__ __volatile__(
416 + "/* Inline compare and swap */\n"
417 + "1: ssrf 5\n"
418 + " ld.w %1, %3\n"
419 + " cp.w %1, %5\n"
420 + " sreq %0\n"
421 + " brne 2f\n"
422 + " stcond %2, %4\n"
423 + " brne 1b\n"
424 + "2:"
425 + : "=&r"(result), "=&r"(tmp), "=m"(*p)
426 + : "m"(*p), "r"(newval), "r"(oldval)
427 + : "cc", "memory");
428 +
429 + return result;
430 +}
431 +
432 +#endif /* atomicity.h */
433 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/byteswap.h
434 ===================================================================
435 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
436 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/byteswap.h 2006-04-19 12:48:33.000000000 +0200
437 @@ -0,0 +1,80 @@
438 +/* Macros to swap the order of bytes in integer values.
439 + Copyright (C) 2005 Atmel Norway.
440 +
441 + The GNU C Library is free software; you can redistribute it and/or
442 + modify it under the terms of the GNU Lesser General Public
443 + License as published by the Free Software Foundation; either
444 + version 2.1 of the License, or (at your option) any later version.
445 +
446 + The GNU C Library is distributed in the hope that it will be useful,
447 + but WITHOUT ANY WARRANTY; without even the implied warranty of
448 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
449 + Lesser General Public License for more details.
450 +
451 + You should have received a copy of the GNU Lesser General Public
452 + License along with the GNU C Library; if not, write to the Free
453 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
454 + 02111-1307 USA. */
455 +
456 +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
457 +# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
458 +#endif
459 +
460 +#ifndef _BITS_BYTESWAP_H
461 +#define _BITS_BYTESWAP_H 1
462 +
463 +/* Swap bytes in 16 bit value. */
464 +#if defined __GNUC__
465 +# define __bswap_16(x) (__extension__ __builtin_bswap_16(x))
466 +#else
467 +/* This is better than nothing. */
468 +static __inline unsigned short int
469 +__bswap_16 (unsigned short int __bsx)
470 +{
471 + return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
472 +}
473 +#endif
474 +
475 +/* Swap bytes in 32 bit value. */
476 +#if defined __GNUC__
477 +# define __bswap_32(x) (__extension__ __builtin_bswap_32(x))
478 +#else
479 +static __inline unsigned int
480 +__bswap_32 (unsigned int __bsx)
481 +{
482 + return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
483 + (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
484 +}
485 +#endif
486 +
487 +#if defined __GNUC__
488 +/* Swap bytes in 64 bit value. */
489 +# define __bswap_constant_64(x) \
490 + ((((x) & 0xff00000000000000ull) >> 56) \
491 + | (((x) & 0x00ff000000000000ull) >> 40) \
492 + | (((x) & 0x0000ff0000000000ull) >> 24) \
493 + | (((x) & 0x000000ff00000000ull) >> 8) \
494 + | (((x) & 0x00000000ff000000ull) << 8) \
495 + | (((x) & 0x0000000000ff0000ull) << 24) \
496 + | (((x) & 0x000000000000ff00ull) << 40) \
497 + | (((x) & 0x00000000000000ffull) << 56))
498 +
499 +# define __bswap_64(x) \
500 + (__extension__ \
501 + ({ \
502 + union { \
503 + __extension__ unsigned long long int __ll; \
504 + unsigned int __l[2]; \
505 + } __w, __r; \
506 + if (__builtin_constant_p(x)) \
507 + __r.__ll = __bswap_constant_64(x); \
508 + else { \
509 + __w.__ll = (x); \
510 + __r.__l[0] = __bswap_32(__w.__l[1]); \
511 + __r.__l[1] = __bswap_32(__w.__l[0]); \
512 + } \
513 + __r.__ll; \
514 + }))
515 +#endif
516 +
517 +#endif /* _BITS_BYTESWAP_H */
518 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/endian.h
519 ===================================================================
520 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
521 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/endian.h 2006-04-19 12:48:33.000000000 +0200
522 @@ -0,0 +1,7 @@
523 +/* AVR32 is big-endian */
524 +
525 +#ifndef _ENDIAN_H
526 +# error "Never use <bits/endian.h> directly; include <endian.h> instead."
527 +#endif
528 +
529 +#define __BYTE_ORDER __BIG_ENDIAN
530 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/fcntl.h
531 ===================================================================
532 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
533 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/fcntl.h 2006-04-19 12:48:33.000000000 +0200
534 @@ -0,0 +1,167 @@
535 +/*
536 + * Copyright (C) 2004 Atmel Norway AS
537 + *
538 + * This file is part of the Linux kernel
539 + */
540 +#ifndef _FCNTL_H
541 +# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
542 +#endif
543 +
544 +#include <sys/types.h>
545 +
546 +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
547 + located on an ext2 file system */
548 +#define O_ACCMODE 0003
549 +#define O_RDONLY 00
550 +#define O_WRONLY 01
551 +#define O_RDWR 02
552 +#define O_CREAT 0100 /* not fcntl */
553 +#define O_EXCL 0200 /* not fcntl */
554 +#define O_NOCTTY 0400 /* not fcntl */
555 +#define O_TRUNC 01000 /* not fcntl */
556 +#define O_APPEND 02000
557 +#define O_NONBLOCK 04000
558 +#define O_NDELAY O_NONBLOCK
559 +#define O_SYNC 010000
560 +#define O_ASYNC 020000
561 +
562 +#ifdef __USE_GNU
563 +# define O_DIRECTORY 040000 /* must be a directory */
564 +# define O_NOFOLLOW 0100000 /* don't follow links */
565 +# define O_DIRECT 0200000 /* direct disk access */
566 +#endif
567 +
568 +#ifdef __USE_LARGEFILE64
569 +# define O_LARGEFILE 0400000
570 +#endif
571 +
572 +/* For now Linux has synchronisity options for data and read operations.
573 + We define the symbols here but let them do the same as O_SYNC since
574 + this is a superset. */
575 +#if defined __USE_POSIX199309 || defined __USE_UNIX98
576 +# define O_DSYNC O_SYNC /* Synchronize data. */
577 +# define O_RSYNC O_SYNC /* Synchronize read operations. */
578 +#endif
579 +
580 +#define F_DUPFD 0 /* dup */
581 +#define F_GETFD 1 /* get close_on_exec */
582 +#define F_SETFD 2 /* set/clear close_on_exec */
583 +#define F_GETFL 3 /* get file->f_flags */
584 +#define F_SETFL 4 /* set file->f_flags */
585 +
586 +#ifndef __USE_FILE_OFFSET64
587 +# define F_GETLK 5
588 +# define F_SETLK 6
589 +# define F_SETLKW 7
590 +#else
591 +# define F_GETLK F_GETLK64
592 +# define F_SETLK F_SETLK64
593 +# define F_SETLKW F_SETLKW64
594 +#endif
595 +#define F_GETLK64 12 /* using 'struct flock64' */
596 +#define F_SETLK64 13
597 +#define F_SETLKW64 14
598 +
599 +#if defined __USE_BSD || defined __USE_XOPEN2K
600 +# define F_SETOWN 8 /* for sockets. */
601 +# define F_GETOWN 9 /* for sockets. */
602 +#endif
603 +
604 +#ifdef __USE_GNU
605 +# define F_SETSIG 10 /* for sockets. */
606 +# define F_GETSIG 11 /* for sockets. */
607 +#endif
608 +
609 +#ifdef __USE_GNU
610 +# define F_SETLEASE 1024 /* Set a lease. */
611 +# define F_GETLEASE 1025 /* Enquire what lease is active. */
612 +# define F_NOTIFY 1026 /* Request notfications on a directory. */
613 +#endif
614 +
615 +/* for F_[GET|SET]FL */
616 +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
617 +
618 +/* for posix fcntl() and lockf() */
619 +#define F_RDLCK 0
620 +#define F_WRLCK 1
621 +#define F_UNLCK 2
622 +
623 +/* for old implementation of bsd flock () */
624 +#define F_EXLCK 4 /* or 3 */
625 +#define F_SHLCK 8 /* or 4 */
626 +
627 +/* for leases */
628 +#define F_INPROGRESS 16
629 +
630 +#ifdef __USE_BSD
631 +/* operations for bsd flock(), also used by the kernel implementation */
632 +# define LOCK_SH 1 /* shared lock */
633 +# define LOCK_EX 2 /* exclusive lock */
634 +# define LOCK_NB 4 /* or'd with one of the above to prevent
635 + blocking */
636 +# define LOCK_UN 8 /* remove lock */
637 +#endif
638 +
639 +#ifdef __USE_GNU
640 +# define LOCK_MAND 32 /* This is a mandatory flock */
641 +# define LOCK_READ 64 /* ... Which allows concurrent
642 + read operations */
643 +# define LOCK_WRITE 128 /* ... Which allows concurrent
644 + write operations */
645 +# define LOCK_RW 192 /* ... Which allows concurrent
646 + read & write ops */
647 +#endif
648 +
649 +#ifdef __USE_GNU
650 +/* Types of directory notifications that may be requested with F_NOTIFY. */
651 +# define DN_ACCESS 0x00000001 /* File accessed. */
652 +# define DN_MODIFY 0x00000002 /* File modified. */
653 +# define DN_CREATE 0x00000004 /* File created. */
654 +# define DN_DELETE 0x00000008 /* File removed. */
655 +# define DN_RENAME 0x00000010 /* File renamed. */
656 +# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
657 +# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
658 +#endif
659 +
660 +struct flock {
661 + short l_type;
662 + short l_whence;
663 +#ifndef __USE_FILE_OFFSET64
664 + __off_t l_start;
665 + __off_t l_len;
666 +#else
667 + __off64_t l_start;
668 + __off64_t l_len;
669 +#endif
670 + __pid_t l_pid;
671 +};
672 +
673 +#ifdef __USE_LARGEFILE64
674 +struct flock64 {
675 + short l_type;
676 + short l_whence;
677 + __off64_t l_start;
678 + __off64_t l_len;
679 + __pid_t l_pid;
680 +};
681 +#endif
682 +
683 +/* Define some more compatibility macros to be backward compatible with
684 + * BSD systems which did not managed to hide these kernel macros. */
685 +#ifdef __USE_BSD
686 +# define FAPPEND O_APPEND
687 +# define FFSYNC O_FSYNC
688 +# define FASYNC O_ASYNC
689 +# define FNONBLOCK O_NONBLOCK
690 +# define FNDELAY O_NDELAY
691 +#endif /* Use BSD. */
692 +
693 +/* Advise to `posix_fadvise'. */
694 +#ifdef __USE_XOPEN2K
695 +# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
696 +# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
697 +# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
698 +# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
699 +# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
700 +# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
701 +#endif
702 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_stat.h
703 ===================================================================
704 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
705 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_stat.h 2006-05-05 09:28:32.000000000 +0200
706 @@ -0,0 +1,63 @@
707 +#ifndef _BITS_STAT_STRUCT_H
708 +#define _BITS_STAT_STRUCT_H
709 +
710 +/*
711 + * This file provides struct stat, taken from kernel 2.6.4
712 + * (include/asm-avr32/stat.h revision 1.1).
713 + */
714 +
715 +struct kernel_stat {
716 + unsigned long st_dev;
717 + unsigned long st_ino;
718 + unsigned short st_mode;
719 + unsigned short st_nlink;
720 + unsigned short st_uid;
721 + unsigned short st_gid;
722 + unsigned long st_rdev;
723 + unsigned long st_size;
724 + unsigned long st_blksize;
725 + unsigned long st_blocks;
726 + unsigned long st_atime;
727 + unsigned long st_atime_nsec;
728 + unsigned long st_mtime;
729 + unsigned long st_mtime_nsec;
730 + unsigned long st_ctime;
731 + unsigned long st_ctime_nsec;
732 + unsigned long __unused4;
733 + unsigned long __unused5;
734 +};
735 +
736 +#define STAT_HAVE_NSEC 1
737 +
738 +struct kernel_stat64 {
739 + unsigned long long st_dev;
740 +
741 + unsigned long long st_ino;
742 + unsigned int st_mode;
743 + unsigned int st_nlink;
744 +
745 + unsigned long st_uid;
746 + unsigned long st_gid;
747 +
748 + unsigned long long st_rdev;
749 +
750 + long long st_size;
751 + unsigned long __pad1;
752 + unsigned long st_blksize;
753 +
754 + unsigned long long st_blocks;
755 +
756 + unsigned long st_atime;
757 + unsigned long st_atime_nsec;
758 +
759 + unsigned long st_mtime;
760 + unsigned long st_mtime_nsec;
761 +
762 + unsigned long st_ctime;
763 + unsigned long st_ctime_nsec;
764 +
765 + unsigned long __unused1;
766 + unsigned long __unused2;
767 +};
768 +
769 +#endif /* _BITS_STAT_STRUCT_H */
770 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_types.h
771 ===================================================================
772 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
773 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_types.h 2006-04-19 12:48:33.000000000 +0200
774 @@ -0,0 +1,56 @@
775 +/* Note that we use the exact same include guard #define names
776 + * as asm/posix_types.h. This will avoid gratuitous conflicts
777 + * with the posix_types.h kernel header, and will ensure that
778 + * our private content, and not the kernel header, will win.
779 + * -Erik
780 + */
781 +#ifndef __ASM_AVR32_POSIX_TYPES_H
782 +#define __ASM_AVR32_POSIX_TYPES_H
783 +
784 +/*
785 + * This file is generally used by user-level software, so you need to
786 + * be a little careful about namespace pollution etc. Also, we cannot
787 + * assume GCC is being used.
788 + */
789 +
790 +typedef unsigned long __kernel_dev_t;
791 +typedef unsigned long __kernel_ino_t;
792 +typedef unsigned short __kernel_mode_t;
793 +typedef unsigned short __kernel_nlink_t;
794 +typedef long __kernel_off_t;
795 +typedef int __kernel_pid_t;
796 +typedef unsigned short __kernel_ipc_pid_t;
797 +typedef unsigned int __kernel_uid_t;
798 +typedef unsigned int __kernel_gid_t;
799 +typedef unsigned long __kernel_size_t;
800 +typedef int __kernel_ssize_t;
801 +typedef int __kernel_ptrdiff_t;
802 +typedef long __kernel_time_t;
803 +typedef long __kernel_suseconds_t;
804 +typedef long __kernel_clock_t;
805 +typedef int __kernel_timer_t;
806 +typedef int __kernel_clockid_t;
807 +typedef int __kernel_daddr_t;
808 +typedef char * __kernel_caddr_t;
809 +typedef unsigned short __kernel_uid16_t;
810 +typedef unsigned short __kernel_gid16_t;
811 +typedef unsigned int __kernel_uid32_t;
812 +typedef unsigned int __kernel_gid32_t;
813 +
814 +typedef unsigned short __kernel_old_uid_t;
815 +typedef unsigned short __kernel_old_gid_t;
816 +typedef unsigned short __kernel_old_dev_t;
817 +
818 +#ifdef __GNUC__
819 +typedef long long __kernel_loff_t;
820 +#endif
821 +
822 +typedef struct {
823 +#if defined(__USE_ALL)
824 + int val[2];
825 +#else
826 + int __val[2];
827 +#endif
828 +} __kernel_fsid_t;
829 +
830 +#endif /* __ASM_AVR32_POSIX_TYPES_H */
831 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/machine-gmon.h
832 ===================================================================
833 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
834 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/machine-gmon.h 2006-04-19 12:48:33.000000000 +0200
835 @@ -0,0 +1,69 @@
836 +/* Machine-dependent definitions for profiling support. AVR32 version.
837 + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
838 + This file is part of the GNU C Library.
839 +
840 + The GNU C Library is free software; you can redistribute it and/or
841 + modify it under the terms of the GNU Lesser General Public
842 + License as published by the Free Software Foundation; either
843 + version 2.1 of the License, or (at your option) any later version.
844 +
845 + The GNU C Library is distributed in the hope that it will be useful,
846 + but WITHOUT ANY WARRANTY; without even the implied warranty of
847 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
848 + Lesser General Public License for more details.
849 +
850 + You should have received a copy of the GNU Lesser General Public
851 + License along with the GNU C Library; if not, write to the Free
852 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
853 + 02111-1307 USA. */
854 +
855 +#define mcount_internal __mcount_internal
856 +
857 +#define _MCOUNT_DECL(frompc, selfpc) \
858 +static void __attribute((used)) mcount_internal(unsigned long frompc, unsigned long selfpc)
859 +
860 +/*
861 + * This mcount implementation expects to get called after the prologue
862 + * has been run. It also expects that r7 contains a valid frame
863 + * pointer.
864 + *
865 + * When profiling, the compiler should generate something like this at
866 + * each function entry:
867 + *
868 + * pushm r0-r7,lr // lr mandatory, others optional
869 + * mov r7, sp
870 + * // rest of prologue goes here
871 + * mcall pc[.LC1 - .]
872 + * // rest of function goes here
873 + * .LC1:
874 + * .long mcount
875 + *
876 + * or for PIC:
877 + *
878 + * pushm r0-r7,lr
879 + * mov r7, sp
880 + * // rest of prologue goes here
881 + * lddpc r0, .LC1
882 + * .L1: rsub r0, pc
883 + * mcall r0[mcount@GOT]
884 + * // rest of function goes here
885 + * .LC1:
886 + * .long .L1 - _GLOBAL_OFFSET_TABLE_
887 + *
888 + * This way, when mcount() is called, r7 points to the calling
889 + * function's return address. It is guaranteed that calling mcount
890 + * will clobber no registers except LR, which is unavoidable.
891 + */
892 +#define MCOUNT asm( \
893 + " .align 4\n" \
894 + " .global _mcount\n" \
895 + " .type _mcount,@function\n" \
896 + "_mcount:\n" \
897 + " pushm r8-r12,lr\n" \
898 + " mov r11, lr\n" \
899 + " ld.w r12, r7[0]\n" \
900 + " rcall __mcount_internal\n" \
901 + " popm r8-r12,pc\n" \
902 + " .size _mcount, . - _mcount\n" \
903 + " .weak mcount\n" \
904 + " mcount = _mcount");
905 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/mman.h
906 ===================================================================
907 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
908 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/mman.h 2006-04-19 12:48:33.000000000 +0200
909 @@ -0,0 +1,95 @@
910 +/* Definitions for POSIX memory map interface. Linux/AVR32 version.
911 + Copyright (C) 1997, 2000 Free Software Foundation, Inc.
912 + This file is part of the GNU C Library.
913 +
914 + The GNU C Library is free software; you can redistribute it and/or
915 + modify it under the terms of the GNU Lesser General Public
916 + License as published by the Free Software Foundation; either
917 + version 2.1 of the License, or (at your option) any later version.
918 +
919 + The GNU C Library is distributed in the hope that it will be useful,
920 + but WITHOUT ANY WARRANTY; without even the implied warranty of
921 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
922 + Lesser General Public License for more details.
923 +
924 + You should have received a copy of the GNU Lesser General Public
925 + License along with the GNU C Library; if not, write to the Free
926 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
927 + 02111-1307 USA. */
928 +
929 +#ifndef _SYS_MMAN_H
930 +# error "Never include this file directly. Use <sys/mman.h> instead"
931 +#endif
932 +
933 +/* The following definitions basically come from the kernel headers.
934 + But the kernel header is not namespace clean. */
935 +
936 +
937 +/* Protections are chosen from these bits, OR'd together. The
938 + implementation does not necessarily support PROT_EXEC or PROT_WRITE
939 + without PROT_READ. The only guarantees are that no writing will be
940 + allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
941 +
942 +#define PROT_READ 0x1 /* Page can be read. */
943 +#define PROT_WRITE 0x2 /* Page can be written. */
944 +#define PROT_EXEC 0x4 /* Page can be executed. */
945 +#define PROT_NONE 0x0 /* Page can not be accessed. */
946 +
947 +/* Sharing types (must choose one and only one of these). */
948 +#define MAP_SHARED 0x01 /* Share changes. */
949 +#define MAP_PRIVATE 0x02 /* Changes are private. */
950 +#ifdef __USE_MISC
951 +# define MAP_TYPE 0x0f /* Mask for type of mapping. */
952 +#endif
953 +
954 +/* Other flags. */
955 +#define MAP_FIXED 0x10 /* Interpret addr exactly. */
956 +#ifdef __USE_MISC
957 +# define MAP_FILE 0
958 +# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
959 +# define MAP_ANON MAP_ANONYMOUS
960 +#endif
961 +
962 +/* These are Linux-specific. */
963 +#ifdef __USE_MISC
964 +# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
965 +# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
966 +# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
967 +# define MAP_LOCKED 0x2000 /* Lock the mapping. */
968 +# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
969 +# define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
970 +# define MAP_NONBLOCK 0x10000 /* do not block on IO */
971 +#endif
972 +
973 +/* Flags to `msync'. */
974 +#define MS_ASYNC 1 /* Sync memory asynchronously. */
975 +#define MS_SYNC 4 /* Synchronous memory sync. */
976 +#define MS_INVALIDATE 2 /* Invalidate the caches. */
977 +
978 +/* Flags for `mlockall'. */
979 +#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
980 +#define MCL_FUTURE 2 /* Lock all additions to address
981 + space. */
982 +
983 +/* Flags for `mremap'. */
984 +#ifdef __USE_GNU
985 +# define MREMAP_MAYMOVE 1
986 +#endif
987 +
988 +/* Advise to `madvise'. */
989 +#ifdef __USE_BSD
990 +# define MADV_NORMAL 0 /* No further special treatment. */
991 +# define MADV_RANDOM 1 /* Expect random page references. */
992 +# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
993 +# define MADV_WILLNEED 3 /* Will need these pages. */
994 +# define MADV_DONTNEED 4 /* Don't need these pages. */
995 +#endif
996 +
997 +/* The POSIX people had to invent similar names for the same things. */
998 +#ifdef __USE_XOPEN2K
999 +# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
1000 +# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
1001 +# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
1002 +# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
1003 +# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
1004 +#endif
1005 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/profil-counter.h
1006 ===================================================================
1007 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1008 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/profil-counter.h 2006-04-19 12:48:33.000000000 +0200
1009 @@ -0,0 +1,26 @@
1010 +/* Low-level statistical profiling support function. Linux/AVR32 version.
1011 + Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
1012 + This file is part of the GNU C Library.
1013 +
1014 + The GNU C Library is free software; you can redistribute it and/or
1015 + modify it under the terms of the GNU Lesser General Public
1016 + License as published by the Free Software Foundation; either
1017 + version 2.1 of the License, or (at your option) any later version.
1018 +
1019 + The GNU C Library is distributed in the hope that it will be useful,
1020 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1021 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1022 + Lesser General Public License for more details.
1023 +
1024 + You should have received a copy of the GNU Lesser General Public
1025 + License along with the GNU C Library; if not, write to the Free
1026 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1027 + 02111-1307 USA. */
1028 +
1029 +#include <signal.h>
1030 +
1031 +void
1032 +profil_counter(int signo, siginfo_t *si, struct sigcontext *sc)
1033 +{
1034 + profil_count((void *)sc->pc);
1035 +}
1036 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/setjmp.h
1037 ===================================================================
1038 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1039 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/setjmp.h 2006-04-19 12:48:33.000000000 +0200
1040 @@ -0,0 +1,21 @@
1041 +/*
1042 + * Copyright (C) 2004-2005 Atmel Norway
1043 + */
1044 +#ifndef _SETJMP_H
1045 +# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
1046 +#endif
1047 +
1048 +#ifndef _ASM
1049 +/*
1050 + * The jump buffer contains r0-r7, sr, sp and lr. Other registers are
1051 + * not saved.
1052 + */
1053 +typedef int __jmp_buf[11];
1054 +#endif
1055 +
1056 +#define __JMP_BUF_SP 4
1057 +
1058 +/* Test if longjmp to JMPBUF would unwind the frame containing a local
1059 + variable at ADDRESS. */
1060 +#define _JMPBUF_UNWINDS(jmpbuf, address) \
1061 + ((void *)(address) < (void *)(jmpbuf[__JMP_BUF_SP]))
1062 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/syscalls.h
1063 ===================================================================
1064 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1065 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/syscalls.h 2006-04-19 12:48:33.000000000 +0200
1066 @@ -0,0 +1,143 @@
1067 +#ifndef _SYSCALL_H
1068 +# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
1069 +#endif
1070 +
1071 +/*
1072 + * This includes the `__NR_<name>' syscall numbers taken from the
1073 + * Linux kernel header files. It also defines the traditional
1074 + * `SYS_<name>' macros for older programs.
1075 + */
1076 +#include <bits/sysnum.h>
1077 +
1078 +#ifndef __set_errno
1079 +# define __set_errno(val) (*__errno_location()) = (val)
1080 +#endif
1081 +#ifndef SYS_ify
1082 +# define SYS_ify(syscall_name) (__NR_##syscall_name)
1083 +#endif
1084 +
1085 +#ifndef __ASSEMBLER__
1086 +
1087 +#undef _syscall0
1088 +#define _syscall0(type,name) \
1089 + type name(void) \
1090 + { \
1091 + return (type)(INLINE_SYSCALL(name, 0)); \
1092 + }
1093 +
1094 +#undef _syscall1
1095 +#define _syscall1(type,name,type1,arg1) \
1096 + type name(type1 arg1) \
1097 + { \
1098 + return (type)(INLINE_SYSCALL(name, 1, arg1)); \
1099 + }
1100 +
1101 +#undef _syscall2
1102 +#define _syscall2(type,name,type1,arg1,type2,arg2) \
1103 + type name(type1 arg1, type2 arg2) \
1104 + { \
1105 + return (type)(INLINE_SYSCALL(name, 2, arg1, arg2)); \
1106 + }
1107 +
1108 +#undef _syscall3
1109 +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
1110 + type name(type1 arg1, type2 arg2, type3 arg3) \
1111 + { \
1112 + return (type)(INLINE_SYSCALL(name, 3, arg1, \
1113 + arg2, arg3)); \
1114 + }
1115 +
1116 +#undef _syscall4
1117 +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
1118 + type4,arg4) \
1119 + type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
1120 + { \
1121 + return (type)(INLINE_SYSCALL(name, 4, arg1, arg2, \
1122 + arg3, arg4)); \
1123 + }
1124 +
1125 +#undef _syscall5
1126 +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
1127 + type4,arg4,type5,arg5) \
1128 + type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
1129 + type5 arg5) \
1130 + { \
1131 + return (type)(INLINE_SYSCALL(name, 5, arg1, arg2, \
1132 + arg3, arg4, arg5)); \
1133 + }
1134 +
1135 +#undef _syscall6
1136 +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3, \
1137 + type4,arg4,type5,arg5,type6,arg6) \
1138 + type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
1139 + type5 arg5, type6 arg6) \
1140 + { \
1141 + return (type)(INLINE_SYSCALL(name, 6, arg1, arg2, arg3, \
1142 + arg4, arg5, arg6)); \
1143 + }
1144 +
1145 +#undef unlikely
1146 +#define unlikely(x) __builtin_expect((x), 0)
1147 +
1148 +#undef INLINE_SYSCALL
1149 +#define INLINE_SYSCALL(name, nr, args...) \
1150 + ({ \
1151 + unsigned _sys_result = INTERNAL_SYSCALL(name, , nr, args); \
1152 + if (unlikely(INTERNAL_SYSCALL_ERROR_P(_sys_result, ))) { \
1153 + __set_errno(INTERNAL_SYSCALL_ERRNO(_sys_result, )); \
1154 + _sys_result = (unsigned int) -1; \
1155 + } \
1156 + (int) _sys_result; \
1157 + })
1158 +
1159 +#undef INTERNAL_SYSCALL_DECL
1160 +#define INTERNAL_SYSCALL_DECL(err) do { } while(0)
1161 +
1162 +#undef INTERNAL_SYSCALL
1163 +#define INTERNAL_SYSCALL(name, err, nr, args...) \
1164 + ({ \
1165 + register int _a1 asm ("r12"); \
1166 + register int _scno asm("r8") = SYS_ify(name); \
1167 + LOAD_ARGS_##nr (args); \
1168 + asm volatile ("scall /* syscall " #name " */" \
1169 + : "=r" (_a1) \
1170 + : "r"(_scno) ASM_ARGS_##nr \
1171 + : "lr", "cc", "memory"); \
1172 + _a1; \
1173 + })
1174 +
1175 +#undef INTERNAL_SYSCALL_ERROR_P
1176 +#define INTERNAL_SYSCALL_ERROR_P(val, err) \
1177 + ((unsigned int)(val) >= 0xfffff001U)
1178 +
1179 +#undef INTERNAL_SYSCALL_ERRNO
1180 +#define INTERNAL_SYSCALL_ERRNO(val, errr) (-(val))
1181 +
1182 +#define LOAD_ARGS_0() do { } while(0)
1183 +#define ASM_ARGS_0
1184 +#define LOAD_ARGS_1(a1) \
1185 + _a1 = (int) (a1); \
1186 + LOAD_ARGS_0()
1187 +#define ASM_ARGS_1 ASM_ARGS_0, "r"(_a1)
1188 +#define LOAD_ARGS_2(a1, a2) \
1189 + register int _a2 asm("r11") = (int)(a2); \
1190 + LOAD_ARGS_1(a1)
1191 +#define ASM_ARGS_2 ASM_ARGS_1, "r"(_a2)
1192 +#define LOAD_ARGS_3(a1, a2, a3) \
1193 + register int _a3 asm("r10") = (int)(a3); \
1194 + LOAD_ARGS_2(a1, a2)
1195 +#define ASM_ARGS_3 ASM_ARGS_2, "r"(_a3)
1196 +#define LOAD_ARGS_4(a1, a2, a3, a4) \
1197 + register int _a4 asm("r9") = (int)(a4); \
1198 + LOAD_ARGS_3(a1, a2, a3)
1199 +#define ASM_ARGS_4 ASM_ARGS_3, "r"(_a4)
1200 +#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
1201 + register int _a5 asm("r5") = (int)(a5); \
1202 + LOAD_ARGS_4(a1, a2, a3, a4)
1203 +#define ASM_ARGS_5 ASM_ARGS_4, "r"(_a5)
1204 +#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
1205 + register int _a6 asm("r3") = (int)(a6); \
1206 + LOAD_ARGS_5(a1, a2, a3, a4, a5)
1207 +#define ASM_ARGS_6 ASM_ARGS_5, "r"(_a6)
1208 +
1209 +#endif /* __ASSEMBLER__ */
1210 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/wordsize.h
1211 ===================================================================
1212 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1213 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/wordsize.h 2006-04-19 12:48:33.000000000 +0200
1214 @@ -0,0 +1 @@
1215 +#define __WORDSIZE 32
1216 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/brk.c
1217 ===================================================================
1218 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1219 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/brk.c 2006-04-19 12:48:33.000000000 +0200
1220 @@ -0,0 +1,23 @@
1221 +/*
1222 + * Copyright (C) 2004 Atmel Norway AS
1223 + */
1224 +#include <errno.h>
1225 +#include <sys/syscall.h>
1226 +
1227 +void *__curbrk = 0;
1228 +
1229 +int brk (void *addr)
1230 +{
1231 + void *newbrk;
1232 +
1233 + newbrk = INLINE_SYSCALL(brk, 1, addr);
1234 +
1235 + __curbrk = newbrk;
1236 +
1237 + if (newbrk < addr) {
1238 + __set_errno (ENOMEM);
1239 + return -1;
1240 + }
1241 +
1242 + return 0;
1243 +}
1244 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-_setjmp.S
1245 ===================================================================
1246 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1247 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-_setjmp.S 2006-05-05 09:26:42.000000000 +0200
1248 @@ -0,0 +1,12 @@
1249 +/*
1250 + * Copyright (C) 2004 Atmel Norway AS
1251 + */
1252 +
1253 + /* This just does a tail-call to __sigsetjmp(env, 0) */
1254 + .global _setjmp
1255 + .type _setjmp,"function"
1256 + .align 1
1257 +_setjmp:
1258 + mov r11, 0
1259 + bral __sigsetjmp_internal
1260 + .size _setjmp, . - _setjmp
1261 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-setjmp.S
1262 ===================================================================
1263 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1264 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-setjmp.S 2006-05-05 09:26:42.000000000 +0200
1265 @@ -0,0 +1,12 @@
1266 +/*
1267 + * Copyright (C) 2004 Atmel Norway AS
1268 + */
1269 +
1270 + /* This just does a tail-call to __sigsetjmp(env, 1) */
1271 + .global setjmp
1272 + .type setjmp,"function"
1273 + .align 1
1274 +setjmp:
1275 + mov r11, 1
1276 + bral __sigsetjmp_internal
1277 + .size setjmp, . - setjmp
1278 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/clone.c
1279 ===================================================================
1280 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1281 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/clone.c 2006-04-19 12:48:33.000000000 +0200
1282 @@ -0,0 +1,37 @@
1283 +/*
1284 + * Copyright (C) 2004 Atmel Norway AS
1285 + */
1286 +#include <errno.h>
1287 +#include <sys/syscall.h>
1288 +#include <unistd.h>
1289 +
1290 +/*
1291 + * I don't know if we can be absolutely certain that the fn and arg
1292 + * parameters are preserved when returning as the child. If the
1293 + * compiler stores them in registers (r0-r7), they should be.
1294 + */
1295 +int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg)
1296 +{
1297 + register int (*_fn)(void *arg) = fn;
1298 + register void *_arg = arg;
1299 + int err;
1300 +
1301 + /* Sanity check the arguments */
1302 + err = -EINVAL;
1303 + if (!fn)
1304 + goto syscall_error;
1305 + if (!child_stack)
1306 + goto syscall_error;
1307 +
1308 + err = INLINE_SYSCALL(clone, 2, flags, child_stack);
1309 + if (err < 0)
1310 + goto syscall_error;
1311 + else if (err != 0)
1312 + return err;
1313 +
1314 + _exit(_fn(_arg));
1315 +
1316 +syscall_error:
1317 + __set_errno (-err);
1318 + return -1;
1319 +}
1320 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/crt1.S
1321 ===================================================================
1322 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1323 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/crt1.S 2006-05-05 09:28:23.000000000 +0200
1324 @@ -0,0 +1,93 @@
1325 +/*
1326 + * Copyright (C) 2004 Atmel Norway AS
1327 + *
1328 + * When we enter _start, the stack looks like this:
1329 + * argc argument counter
1330 + * argv[0] pointer to program name
1331 + * argv[1..argc-1] pointers to program args
1332 + * NULL
1333 + * env[0..N] pointers to environment variables
1334 + * NULL
1335 + *
1336 + * r12 contains a function pointer to be registered with `atexit'.
1337 + * This is how the dynamic linker arranges to have DT_FINI functions
1338 + * called for shared libraries that have been loaded before this
1339 + * code runs.
1340 + *
1341 + * We're going to call the following function:
1342 + * __uClibc_main(int (*main)(int, char **, char **), int argc,
1343 + * char **argv, void (*app_init)(void), void (*app_fini)(void),
1344 + * void (*rtld_fini)(void), void *stack_end)
1345 + *
1346 + * So we need to set up things as follows:
1347 + * r12 = address of main
1348 + * r11 = argc
1349 + * r10 = &argv[0]
1350 + * r9 = address of _init
1351 + * r8 = address of _fini
1352 + * sp[0] = whatever we got passed in r12
1353 + */
1354 +
1355 +#include <features.h>
1356 +
1357 + .text
1358 + .global _start
1359 + .type _start, @function
1360 +_start:
1361 + /* Clear the frame pointer and link register since this is the outermost frame. */
1362 + mov r7, 0
1363 + mov lr, 0
1364 +
1365 + ld.w r11, sp++ /* argc */
1366 + mov r10, sp /* &argv[0] */
1367 +
1368 + st.w --sp, r10 /* stack_end */
1369 + st.w --sp, r12 /* rtld_fini */
1370 +
1371 +#ifdef __PIC__
1372 + lddpc r6, .L_GOT
1373 +.L_RGOT:
1374 + rsub r6, pc
1375 + lda.w r9, _init
1376 + lda.w r8, _fini
1377 + lda.w r12, main
1378 +
1379 + /* Ok, now run uClibc's main() -- should not return */
1380 + call __uClibc_main
1381 +
1382 + .align 2
1383 +.L_GOT:
1384 + .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
1385 +#else
1386 + lddpc r9, __init_addr /* app_init */
1387 + lddpc r8, __fini_addr /* app_fini */
1388 + lddpc r12, __main_addr /* main */
1389 +
1390 + /* Ok, now run uClibc's main() -- should not return */
1391 + lddpc pc, ___uClibc_main_addr
1392 +
1393 + .align 2
1394 +__init_addr:
1395 + .long _init
1396 +__fini_addr:
1397 + .long _fini
1398 +__main_addr:
1399 + .long main
1400 +___uClibc_main_addr:
1401 + .long __uClibc_main
1402 +#endif
1403 + .size _start, . - _start
1404 +
1405 + /*
1406 + * The LSB says we need this.
1407 + */
1408 + .section ".note.ABI-tag", "a"
1409 + .align 4
1410 + .long 2f - 1f /* namesz */
1411 + .long 4f - 3f /* descsz */
1412 + .long 1 /* type */
1413 +1: .asciz "GNU" /* name */
1414 +2: .align 4
1415 +3: .long 0 /* Linux executable */
1416 + .long 2,6,0 /* Earliest compatible kernel */
1417 +4: .align 4
1418 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/crti.S
1419 ===================================================================
1420 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1421 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/crti.S 2006-04-19 12:48:33.000000000 +0200
1422 @@ -0,0 +1,17 @@
1423 +
1424 + .section .init
1425 + .align 2
1426 + .global _init
1427 + .type _init, @function
1428 +_init:
1429 + /* Use a four-byte instruction to avoid NOPs */
1430 + stm --sp, r0-r7,lr
1431 + .align 2
1432 +
1433 + .section .fini
1434 + .align 2
1435 + .global _fini
1436 + .type _fini, @function
1437 +_fini:
1438 + stm --sp, r0-r7,lr
1439 + .align 2
1440 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/crtn.S
1441 ===================================================================
1442 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1443 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/crtn.S 2006-04-19 12:48:33.000000000 +0200
1444 @@ -0,0 +1,14 @@
1445 +
1446 + .section .init
1447 + .align 2
1448 + .global _init
1449 + .type _init, @function
1450 + ldm sp++, r0-r7,pc
1451 + .size _init, . - _init
1452 +
1453 + .section .fini
1454 + .align 2
1455 + .global _fini
1456 + .type _fini, @function
1457 + ldm sp++, r0-r7,pc
1458 + .size _fini, . - _fini
1459 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/mmap.c
1460 ===================================================================
1461 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1462 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/mmap.c 2006-04-19 12:48:33.000000000 +0200
1463 @@ -0,0 +1,31 @@
1464 +/* Copyright (C) 2005 Atmel Norway
1465 +
1466 + This program is free software; you can redistribute it and/or modify it under
1467 + the terms of the GNU Library General Public License as published by the Free
1468 + Software Foundation; either version 2 of the License, or (at your option) any
1469 + later version.
1470 +
1471 + This program is distributed in the hope that it will be useful, but WITHOUT
1472 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1473 + FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
1474 + details.
1475 +
1476 + You should have received a copy of the GNU Library General Public License
1477 + along with this program; if not, write to the Free Software Foundation, Inc.,
1478 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1479 +
1480 + Derived in part from the Linux-8086 C library, the GNU C Library, and several
1481 + other sundry sources. Files within this library are copyright by their
1482 + respective copyright holders.
1483 + */
1484 +
1485 +#include <errno.h>
1486 +#include <sys/mman.h>
1487 +#include <sys/syscall.h>
1488 +
1489 +static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
1490 +
1491 +__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
1492 +{
1493 + return mmap2(addr, len, prot, flags, fd, offset >> 12);
1494 +}
1495 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/setjmp.S
1496 ===================================================================
1497 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1498 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/setjmp.S 2006-05-05 09:28:28.000000000 +0200
1499 @@ -0,0 +1,43 @@
1500 +/*
1501 + * Copyright (C) 2004 Atmel Norway AS
1502 + */
1503 +#define _SETJMP_H
1504 +#define _ASM
1505 +#include <bits/setjmp.h>
1506 +
1507 + .text
1508 +
1509 + .global __sigsetjmp
1510 + .type __sigsetjmp,"function"
1511 +
1512 + /* Create a global, hidden symbol for use by setjmp() and _setjmp().
1513 + If it's not hidden, the linker will complain about a relative
1514 + jump to a dynamic symbol when building a shared library.
1515 +
1516 + Also, if a user overrides the __sigsetjmp function, he might not
1517 + expect the setjmp() and _setjmp() function to effectively be
1518 + overridden as well. */
1519 + .global __sigsetjmp_internal
1520 + .hidden __sigsetjmp_internal
1521 + .type __sigsetjmp_internal,"function"
1522 + .align 1
1523 +__sigsetjmp:
1524 +__sigsetjmp_internal:
1525 + mustr r8
1526 + stm r12, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
1527 +
1528 + /* Make a tail call to __sigjmp_save; it takes the same args. */
1529 +#ifdef __PIC__
1530 + mov r9, r6
1531 + lddpc r6, .LG
1532 +.L1: rsub r6, pc
1533 + ld.w r8, r6[__sigjmp_save@got]
1534 + mov r6, r9
1535 + mov pc, r8
1536 +
1537 + .align 2
1538 +.LG: .long .L1 - _GLOBAL_OFFSET_TABLE_
1539 +#else
1540 + rjmp __sigjmp_save
1541 +#endif
1542 + .size __sigsetjmp, . - __sigsetjmp
1543 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sigaction.c
1544 ===================================================================
1545 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1546 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sigaction.c 2006-04-19 12:48:33.000000000 +0200
1547 @@ -0,0 +1,49 @@
1548 +/*
1549 + * Copyright (C) 2004 Atmel Norway AS
1550 + */
1551 +#include <errno.h>
1552 +#include <signal.h>
1553 +#include <string.h>
1554 +#include <sys/syscall.h>
1555 +#include <bits/kernel_sigaction.h>
1556 +
1557 +#define SA_RESTORER 0x04000000
1558 +extern void __default_rt_sa_restorer(void);
1559 +
1560 +/*
1561 + * If act is not NULL, change the action for sig to *act.
1562 + * If oact is not NULL, put the old action for sig in *oact.
1563 + */
1564 +int __libc_sigaction(int signum, const struct sigaction *act,
1565 + struct sigaction *oldact)
1566 +{
1567 + struct kernel_sigaction kact, koact;
1568 + int result;
1569 +
1570 + if (act) {
1571 + kact.k_sa_handler = act->sa_handler;
1572 + memcpy(&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
1573 + kact.sa_flags = act->sa_flags;
1574 + if (kact.sa_flags & (SA_RESTORER | SA_ONSTACK))
1575 + kact.sa_restorer = act->sa_restorer;
1576 + else
1577 + kact.sa_restorer = __default_rt_sa_restorer;
1578 + kact.sa_flags |= SA_RESTORER;
1579 + }
1580 +
1581 + result = __syscall_rt_sigaction(signum, act ? __ptrvalue(&kact) : NULL,
1582 + oldact ? __ptrvalue(&koact) : NULL,
1583 + _NSIG / 8);
1584 +
1585 + if (oldact && result >= 0) {
1586 + oldact->sa_handler = koact.k_sa_handler;
1587 + memcpy(&oldact->sa_mask, &koact.sa_mask,
1588 + sizeof(oldact->sa_mask));
1589 + oldact->sa_flags = koact.sa_flags;
1590 + oldact->sa_restorer = koact.sa_restorer;
1591 + }
1592 +
1593 + return result;
1594 +}
1595 +
1596 +weak_alias(__libc_sigaction, sigaction)
1597 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sigrestorer.S
1598 ===================================================================
1599 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1600 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sigrestorer.S 2006-04-19 12:48:33.000000000 +0200
1601 @@ -0,0 +1,11 @@
1602 +/*
1603 + * Copyright (C) 2004 Atmel Norway AS
1604 + */
1605 +#include <sys/syscall.h>
1606 +
1607 + .global __default_rt_sa_restorer
1608 + .type __default_rt_sa_restorer,"function"
1609 + .align 1
1610 +__default_rt_sa_restorer:
1611 + mov r8, __NR_rt_sigreturn
1612 + scall
1613 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/elf.h
1614 ===================================================================
1615 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1616 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/elf.h 2006-04-19 12:48:33.000000000 +0200
1617 @@ -0,0 +1,26 @@
1618 +/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
1619 + This file is part of the GNU C Library.
1620 +
1621 + The GNU C Library is free software; you can redistribute it and/or
1622 + modify it under the terms of the GNU Lesser General Public
1623 + License as published by the Free Software Foundation; either
1624 + version 2.1 of the License, or (at your option) any later version.
1625 +
1626 + The GNU C Library is distributed in the hope that it will be useful,
1627 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1628 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1629 + Lesser General Public License for more details.
1630 +
1631 + You should have received a copy of the GNU Lesser General Public
1632 + License along with the GNU C Library; if not, write to the Free
1633 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1634 + 02111-1307 USA. */
1635 +
1636 +#ifndef _SYS_ELF_H
1637 +#define _SYS_ELF_H 1
1638 +
1639 +#warning "This header is obsolete; use <sys/procfs.h> instead."
1640 +
1641 +#include <sys/procfs.h>
1642 +
1643 +#endif /* sys/elf.h */
1644 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/io.h
1645 ===================================================================
1646 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1647 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/io.h 2006-04-19 12:48:33.000000000 +0200
1648 @@ -0,0 +1,48 @@
1649 +/* Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
1650 + This file is part of the GNU C Library.
1651 +
1652 + The GNU C Library is free software; you can redistribute it and/or
1653 + modify it under the terms of the GNU Lesser General Public
1654 + License as published by the Free Software Foundation; either
1655 + version 2.1 of the License, or (at your option) any later version.
1656 +
1657 + The GNU C Library is distributed in the hope that it will be useful,
1658 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1659 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1660 + Lesser General Public License for more details.
1661 +
1662 + You should have received a copy of the GNU Lesser General Public
1663 + License along with the GNU C Library; if not, write to the Free
1664 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1665 + 02111-1307 USA. */
1666 +
1667 +#ifndef _SYS_IO_H
1668 +
1669 +#define _SYS_IO_H 1
1670 +#include <features.h>
1671 +
1672 +__BEGIN_DECLS
1673 +
1674 +/* If TURN_ON is TRUE, request for permission to do direct i/o on the
1675 + port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
1676 + permission off for that range. This call requires root privileges. */
1677 +extern int ioperm (unsigned long int __from, unsigned long int __num,
1678 + int __turn_on) __THROW;
1679 +
1680 +/* Set the I/O privilege level to LEVEL. If LEVEL is nonzero,
1681 + permission to access any I/O port is granted. This call requires
1682 + root privileges. */
1683 +extern int iopl (int __level) __THROW;
1684 +
1685 +/* The functions that actually perform reads and writes. */
1686 +extern unsigned char inb (unsigned long int port) __THROW;
1687 +extern unsigned short int inw (unsigned long int port) __THROW;
1688 +extern unsigned long int inl (unsigned long int port) __THROW;
1689 +
1690 +extern void outb (unsigned char value, unsigned long int port) __THROW;
1691 +extern void outw (unsigned short value, unsigned long int port) __THROW;
1692 +extern void outl (unsigned long value, unsigned long int port) __THROW;
1693 +
1694 +__END_DECLS
1695 +
1696 +#endif /* _SYS_IO_H */
1697 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/procfs.h
1698 ===================================================================
1699 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1700 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/procfs.h 2006-04-19 12:48:33.000000000 +0200
1701 @@ -0,0 +1,123 @@
1702 +/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
1703 + This file is part of the GNU C Library.
1704 +
1705 + The GNU C Library is free software; you can redistribute it and/or
1706 + modify it under the terms of the GNU Lesser General Public
1707 + License as published by the Free Software Foundation; either
1708 + version 2.1 of the License, or (at your option) any later version.
1709 +
1710 + The GNU C Library is distributed in the hope that it will be useful,
1711 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1712 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1713 + Lesser General Public License for more details.
1714 +
1715 + You should have received a copy of the GNU Lesser General Public
1716 + License along with the GNU C Library; if not, write to the Free
1717 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1718 + 02111-1307 USA. */
1719 +
1720 +#ifndef _SYS_PROCFS_H
1721 +#define _SYS_PROCFS_H 1
1722 +
1723 +/* This is somewhat modelled after the file of the same name on SVR4
1724 + systems. It provides a definition of the core file format for ELF
1725 + used on Linux. It doesn't have anything to do with the /proc file
1726 + system, even though Linux has one.
1727 +
1728 + Anyway, the whole purpose of this file is for GDB and GDB only.
1729 + Don't read too much into it. Don't use it for anything other than
1730 + GDB unless you know what you are doing. */
1731 +
1732 +#include <features.h>
1733 +#include <sys/time.h>
1734 +#include <sys/types.h>
1735 +#include <sys/user.h>
1736 +
1737 +__BEGIN_DECLS
1738 +
1739 +/* Type for a general-purpose register. */
1740 +typedef unsigned long elf_greg_t;
1741 +
1742 +/* And the whole bunch of them. We could have used `struct
1743 + user_regs' directly in the typedef, but tradition says that
1744 + the register set is an array, which does have some peculiar
1745 + semantics, so leave it that way. */
1746 +#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t))
1747 +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
1748 +
1749 +/* Register set for the floating-point registers. */
1750 +typedef struct user_fpregs elf_fpregset_t;
1751 +
1752 +/* Signal info. */
1753 +struct elf_siginfo
1754 + {
1755 + int si_signo; /* Signal number. */
1756 + int si_code; /* Extra code. */
1757 + int si_errno; /* Errno. */
1758 + };
1759 +
1760 +/* Definitions to generate Intel SVR4-like core files. These mostly
1761 + have the same names as the SVR4 types with "elf_" tacked on the
1762 + front to prevent clashes with Linux definitions, and the typedef
1763 + forms have been avoided. This is mostly like the SVR4 structure,
1764 + but more Linuxy, with things that Linux does not support and which
1765 + GDB doesn't really use excluded. */
1766 +
1767 +struct elf_prstatus
1768 + {
1769 + struct elf_siginfo pr_info; /* Info associated with signal. */
1770 + short int pr_cursig; /* Current signal. */
1771 + unsigned long int pr_sigpend; /* Set of pending signals. */
1772 + unsigned long int pr_sighold; /* Set of held signals. */
1773 + __pid_t pr_pid;
1774 + __pid_t pr_ppid;
1775 + __pid_t pr_pgrp;
1776 + __pid_t pr_sid;
1777 + struct timeval pr_utime; /* User time. */
1778 + struct timeval pr_stime; /* System time. */
1779 + struct timeval pr_cutime; /* Cumulative user time. */
1780 + struct timeval pr_cstime; /* Cumulative system time. */
1781 + elf_gregset_t pr_reg; /* GP registers. */
1782 + int pr_fpvalid; /* True if math copro being used. */
1783 + };
1784 +
1785 +
1786 +#define ELF_PRARGSZ (80) /* Number of chars for args. */
1787 +
1788 +struct elf_prpsinfo
1789 + {
1790 + char pr_state; /* Numeric process state. */
1791 + char pr_sname; /* Char for pr_state. */
1792 + char pr_zomb; /* Zombie. */
1793 + char pr_nice; /* Nice val. */
1794 + unsigned long int pr_flag; /* Flags. */
1795 + unsigned short int pr_uid;
1796 + unsigned short int pr_gid;
1797 + int pr_pid, pr_ppid, pr_pgrp, pr_sid;
1798 + /* Lots missing */
1799 + char pr_fname[16]; /* Filename of executable. */
1800 + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
1801 + };
1802 +
1803 +/* The rest of this file provides the types for emulation of the
1804 + Solaris <proc_service.h> interfaces that should be implemented by
1805 + users of libthread_db. */
1806 +
1807 +/* Addresses. */
1808 +typedef void *psaddr_t;
1809 +
1810 +/* Register sets. Linux has different names. */
1811 +typedef elf_gregset_t prgregset_t;
1812 +typedef elf_fpregset_t prfpregset_t;
1813 +
1814 +/* We don't have any differences between processes and threads,
1815 + therefore have only one PID type. */
1816 +typedef __pid_t lwpid_t;
1817 +
1818 +/* Process status and info. In the end we do provide typedefs for them. */
1819 +typedef struct elf_prstatus prstatus_t;
1820 +typedef struct elf_prpsinfo prpsinfo_t;
1821 +
1822 +__END_DECLS
1823 +
1824 +#endif /* sys/procfs.h */
1825 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/ucontext.h
1826 ===================================================================
1827 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1828 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/ucontext.h 2006-04-19 12:48:33.000000000 +0200
1829 @@ -0,0 +1,94 @@
1830 +/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
1831 + This file is part of the GNU C Library.
1832 +
1833 + The GNU C Library is free software; you can redistribute it and/or
1834 + modify it under the terms of the GNU Lesser General Public
1835 + License as published by the Free Software Foundation; either
1836 + version 2.1 of the License, or (at your option) any later version.
1837 +
1838 + The GNU C Library is distributed in the hope that it will be useful,
1839 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1840 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1841 + Lesser General Public License for more details.
1842 +
1843 + You should have received a copy of the GNU Lesser General Public
1844 + License along with the GNU C Library; if not, write to the Free
1845 + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1846 + 02111-1307 USA. */
1847 +
1848 +/* Linux/AVR32 ABI compliant context switching support. */
1849 +
1850 +#ifndef _SYS_UCONTEXT_H
1851 +#define _SYS_UCONTEXT_H 1
1852 +
1853 +#include <features.h>
1854 +#include <signal.h>
1855 +#include <sys/procfs.h>
1856 +#include <bits/sigcontext.h>
1857 +
1858 +typedef int greg_t;
1859 +
1860 +/* Number of general registers. */
1861 +#define NGREG 16
1862 +
1863 +/* Container for all general registers. */
1864 +typedef elf_gregset_t gregset_t;
1865 +
1866 +/* Number of each register is the `gregset_t' array. */
1867 +enum
1868 +{
1869 + R0 = 0,
1870 +#define R0 R0
1871 + R1 = 1,
1872 +#define R1 R1
1873 + R2 = 2,
1874 +#define R2 R2
1875 + R3 = 3,
1876 +#define R3 R3
1877 + R4 = 4,
1878 +#define R4 R4
1879 + R5 = 5,
1880 +#define R5 R5
1881 + R6 = 6,
1882 +#define R6 R6
1883 + R7 = 7,
1884 +#define R7 R7
1885 + R8 = 8,
1886 +#define R8 R8
1887 + R9 = 9,
1888 +#define R9 R9
1889 + R10 = 10,
1890 +#define R10 R10
1891 + R11 = 11,
1892 +#define R11 R11
1893 + R12 = 12,
1894 +#define R12 R12
1895 + R13 = 13,
1896 +#define R13 R13
1897 + R14 = 14,
1898 +#define R14 R14
1899 + R15 = 15
1900 +#define R15 R15
1901 +};
1902 +
1903 +/* Structure to describe FPU registers. */
1904 +typedef elf_fpregset_t fpregset_t;
1905 +
1906 +/* Context to describe whole processor state. */
1907 +typedef struct
1908 + {
1909 + gregset_t gregs;
1910 + fpregset_t fpregs;
1911 + } mcontext_t;
1912 +
1913 +/* Userlevel context. */
1914 +typedef struct ucontext
1915 +{
1916 + unsigned long uc_flags;
1917 + struct ucontext *uc_link;
1918 + stack_t uc_stack;
1919 + struct sigcontext uc_mcontext;
1920 + sigset_t uc_sigmask; /* mask last for extensibility */
1921 +} ucontext_t;
1922 +
1923 +#endif /* sys/ucontext.h */
1924 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/user.h
1925 ===================================================================
1926 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1927 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/user.h 2006-04-19 12:48:33.000000000 +0200
1928 @@ -0,0 +1,46 @@
1929 +#ifndef _SYS_USER_H
1930 +#define _SYS_USER_H
1931 +
1932 +struct user_fpregs
1933 +{
1934 +
1935 +};
1936 +
1937 +struct user_regs
1938 +{
1939 + unsigned long sr;
1940 + unsigned long pc;
1941 + unsigned long lr;
1942 + unsigned long sp;
1943 + unsigned long r12;
1944 + unsigned long r11;
1945 + unsigned long r10;
1946 + unsigned long r9;
1947 + unsigned long r8;
1948 + unsigned long r7;
1949 + unsigned long r6;
1950 + unsigned long r5;
1951 + unsigned long r4;
1952 + unsigned long r3;
1953 + unsigned long r2;
1954 + unsigned long r1;
1955 + unsigned long r0;
1956 + unsigned long r12_orig;
1957 +};
1958 +
1959 +struct user
1960 +{
1961 + struct user_regs regs; /* general registers */
1962 + size_t u_tsize; /* text size (pages) */
1963 + size_t u_dsize; /* data size (pages) */
1964 + size_t u_ssize; /* stack size (pages) */
1965 + unsigned long start_code; /* text starting address */
1966 + unsigned long start_data; /* data starting address */
1967 + unsigned long start_stack; /* stack starting address */
1968 + long int signal; /* signal causing core dump */
1969 + struct user_regs * u_ar0; /* help gdb find registers */
1970 + unsigned long magic; /* identifies a core file */
1971 + char u_comm[32]; /* user command name */
1972 +};
1973 +
1974 +#endif /* _SYS_USER_H */
1975 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/syscall.S
1976 ===================================================================
1977 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1978 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/syscall.S 2006-04-19 12:48:33.000000000 +0200
1979 @@ -0,0 +1,81 @@
1980 +/*
1981 + * syscall for AVR32/uClibc
1982 + *
1983 + * Copyright (C) 2004 Atmel Norway
1984 + *
1985 + * This program is free software; you can redistribute it and/or modify it
1986 + * under the terms of the GNU Library General Public License as published by
1987 + * the Free Software Foundation; either version 2 of the License, or (at your
1988 + * option) any later version.
1989 + *
1990 + * This program is distributed in the hope that it will be useful, but WITHOUT
1991 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1992 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
1993 + * for more details.
1994 + *
1995 + * You should have received a copy of the GNU Library General Public License
1996 + * along with this program; if not, write to the Free Software Foundation,
1997 + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1998 + */
1999 +#include <features.h>
2000 +
2001 + .text
2002 +
2003 + /*
2004 + * long int syscall(long int sysno, ...)
2005 + */
2006 + .global syscall
2007 + .type syscall, @function
2008 + .align 2
2009 +syscall:
2010 + stm --sp, r3,r5,lr
2011 + sub lr, sp, -12
2012 + mov r8, r12
2013 + ldm lr, r3,r5,r9-r12
2014 + scall
2015 + cp.w r12, -4095
2016 + brlo .Ldone
2017 +
2018 +#ifdef __PIC__
2019 + lddpc r5, .Lgot
2020 +.Lgotcalc:
2021 + rsub r5, pc
2022 +# ifdef __UCLIBC_HAS_THREADS__
2023 + mov r3, r12
2024 + mcall r5[__errno_location@got]
2025 + st.w r12[0], r3
2026 +# else
2027 + ld.w r3, r5[errno@got]
2028 + st.w r3[0], r12
2029 +# endif
2030 +#else
2031 +# ifdef __UCLIBC_HAS_THREADS__
2032 + mov r3, r12
2033 + mcall .Lerrno_location
2034 + st.w r12[0], r3
2035 +# else
2036 + lddpc r3, .Lerrno
2037 + st.w r3[0], r12
2038 +# endif
2039 +#endif
2040 + mov r12, -1
2041 +
2042 +.Ldone:
2043 + ldm sp++, r3,r5,pc
2044 +
2045 + .align 2
2046 +#ifdef __PIC__
2047 +.Lgot:
2048 + .long .Lgotcalc - _GLOBAL_OFFSET_TABLE_
2049 +#else
2050 +# ifdef __UCLIBC_HAS_THREADS__
2051 +.Lerrno_location:
2052 + .long __errno_location
2053 +# else
2054 +.Lerrno:
2055 + .long errno
2056 +# endif
2057 +#endif
2058 +
2059 +
2060 + .size syscall, . - syscall
2061 Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/vfork.S
2062 ===================================================================
2063 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2064 +++ uClibc-0.9.28/libc/sysdeps/linux/avr32/vfork.S 2006-04-19 12:48:33.000000000 +0200
2065 @@ -0,0 +1,55 @@
2066 + /*
2067 + * vfork for uClibc
2068 + *
2069 + * Copyright (C) 2005 Atmel Norway
2070 + */
2071 +
2072 + /*
2073 + * Clone the process without copying the address space. The
2074 + * calling process is suspended until the child either exits
2075 + * or calls execve.
2076 + *
2077 + * This all means that we cannot rely on the stack to store
2078 + * away registers, since they will be overwritten by the child
2079 + * as soon as it makes another function call (e.g. execve()).
2080 + * Fortunately, the Linux kernel preserves LR across system calls.
2081 + */
2082 +#include <features.h>
2083 +#include <sys/syscall.h>
2084 +
2085 + .global __vfork
2086 + .type __vfork,@function
2087 + .align 1
2088 +__vfork:
2089 + mov r8, __NR_vfork
2090 + scall
2091 + cp.w r12, -4096
2092 + retls r12
2093 +
2094 + /* vfork failed, so we may use the stack freely */
2095 + pushm r4-r7,lr
2096 +#ifdef __PIC__
2097 + lddpc r6, .L_GOT
2098 + rsub r4, r12, 0
2099 +.L_RGOT:
2100 + rsub r6, pc
2101 + mcall r6[__errno_location@got]
2102 +#else
2103 + rsub r4, r12, 0
2104 + mcall .L__errno_location
2105 +#endif
2106 + st.w r12[0], r4
2107 + popm r4-r7,pc,r12=-1
2108 +
2109 + .align 2
2110 +#ifdef __PIC__
2111 +.L_GOT:
2112 + .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
2113 +#else
2114 +.L__errno_location:
2115 + .long __errno_location
2116 +#endif
2117 + .size __vfork, . - __vfork
2118 +
2119 + .weak vfork
2120 + vfork = __vfork
2121 Index: uClibc-0.9.28/Rules.mak
2122 ===================================================================
2123 --- uClibc-0.9.28.orig/Rules.mak 2006-05-05 09:26:01.000000000 +0200
2124 +++ uClibc-0.9.28/Rules.mak 2006-05-05 09:27:17.000000000 +0200
2125 @@ -231,6 +231,10 @@ ifeq ($(strip $(TARGET_ARCH)),frv)
2126 UCLIBC_LDSO=ld.so.1
2127 endif
2128
2129 +ifeq ($(strip $(TARGET_ARCH)),avr32)
2130 + CPU_CFLAGS-$(CONFIG_AP7000) += -mcpu=ap7000
2131 +endif
2132 +
2133 # Keep the check_gcc from being needlessly executed
2134 ifndef PIEFLAG
2135 ifneq ($(UCLIBC_BUILD_PIE),y)
This page took 0.147199 seconds and 5 git commands to generate.