1 Subject: [PATCH] AVR32 Architecture support
3 Add support for the AVR32 architecture in the core libc and build system.
4 This also adds AVR32-ELF definitions to elf.h
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(+)
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
53 +# For a description of the syntax of this configuration file,
54 +# see extra/config/Kconfig-language.txt
73 +config ARCH_SUPPORTS_BIG_ENDIAN
77 +config UCLIBC_COMPLETELY_PIC
78 + select FORCE_SHAREABLE_TEXT_SEGMENTS
83 + prompt "Target CPU Type"
84 + default CONFIG_AP7000
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
104 @@ -83,6 +86,10 @@ if TARGET_arm
105 source "extra/Configs/Config.arm"
109 +source "extra/Configs/Config.avr32"
113 source "extra/Configs/Config.bfin"
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 */
123 +#define EM_AVR32 0x18ad
125 /* V850 backend magic number. Written in the absense of an ABI. */
126 #define EM_CYGNUS_V850 0x9080
128 @@ -2687,6 +2689,55 @@ typedef Elf32_Addr Elf32_Conflict;
129 /* Keep this the last entry. */
130 #define R_V850_NUM 25
132 +/* Atmel AVR32 relocations. */
133 +#define R_AVR32_NONE 0
134 +#define R_AVR32_32 1
135 +#define R_AVR32_16 2
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
179 +/* AVR32 dynamic tags */
180 +#define DT_AVR32_GOTSZ 0x70000001 /* Total size of GOT in bytes */
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
189 +# Makefile for uClibc
191 +# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
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
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
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
208 +include $(TOPDIR)Rules.mak
213 +SCRT_OBJ = $(patsubst %,S%, $(CRT_OBJ))
214 +CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
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))
220 +CSRC=clone.c brk.c sigaction.c mmap.c
221 +COBJS=$(patsubst %.c,%.o, $(CSRC))
223 +OBJS=$(SOBJS) $(COBJS)
225 +OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
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/
234 +$(CRT_OBJ): $(CRT_SRC)
235 + $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
236 + $(STRIPTOOL) -x -R .note -R .comment $*.o
238 +$(SCRT_OBJ): $(CRT_SRC)
239 + $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* $< -c -o $*.o
240 + $(STRIPTOOL) -x -R .note -R .comment $*.o
243 + $(CC) $(ASFLAGS) -c $< -o $@
244 + $(STRIPTOOL) -x -R .note -R .comment $*.o
247 + $(CC) $(CFLAGS) -c $< -o $@
248 + $(STRIPTOOL) -x -R .note -R .comment $*.o
250 +ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
252 + $(CC) $(ASFLAGS) -c crti.S -o crti.o
254 +$(TOPDIR)lib/crti.o: crti.o
255 + $(INSTALL) -d $(TOPDIR)lib/
256 + cp crti.o $(TOPDIR)lib/
259 + $(CC) $(ASFLAGS) -c crtn.S -o crtn.o
261 +$(TOPDIR)lib/crtn.o: crtn.o
262 + $(INSTALL) -d $(TOPDIR)lib/
263 + cp crtn.o $(TOPDIR)lib/
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
275 +# $(LN) -fs ../libc/sysdeps/linux/avr32/fpu_control.h $(TOPDIR)/include/
278 + $(RM) *.[oa] *~ core
279 + $(RM) bits/sysnum.h
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
287 +/* longjmp for AVR32
289 + * Copyright (C) 2004 Atmel Norway AS
293 + .type __longjmp,"function"
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 */
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
309 +/* Copyright (C) 2005 Atmel Norway
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
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
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
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.
331 +#include <sys/mman.h>
332 +#include <sys/syscall.h>
334 +#define __NR_mmap2 __NR_mmap
336 +static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
338 +__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
340 + return mmap2(addr, len, prot, flags, fd, offset >> 12);
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
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.
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.
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.
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
366 +#ifndef _ATOMICITY_H
367 +#define _ATOMICITY_H 1
369 +#include <inttypes.h>
372 +__attribute__((unused))
373 +exchange_and_add (volatile uint32_t *mem, int val)
377 + __asm__ __volatile__(
378 + "/* Inline exchange and add */\n"
381 + " add %1, %0, %4\n"
384 + : "=&r"(result), "=&r"(tmp), "=m"(*mem)
385 + : "m"(*mem), "r"(val)
392 +__attribute__((unused))
393 +atomic_add (volatile uin32_t *mem, int val)
397 + __asm__ __volatile__(
398 + "/* Inline atomic add */\n"
404 + : "=&r"(result), "=m"(*mem)
405 + : "m"(*mem), "r"(val)
410 +__attribute__((unused))
411 +compare_and_swap(volatile long int *p, long int oldval, long int newval)
413 + long int result, tmp;
415 + __asm__ __volatile__(
416 + "/* Inline compare and swap */\n"
425 + : "=&r"(result), "=&r"(tmp), "=m"(*p)
426 + : "m"(*p), "r"(newval), "r"(oldval)
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
438 +/* Macros to swap the order of bytes in integer values.
439 + Copyright (C) 2005 Atmel Norway.
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.
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.
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
456 +#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
457 +# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
460 +#ifndef _BITS_BYTESWAP_H
461 +#define _BITS_BYTESWAP_H 1
463 +/* Swap bytes in 16 bit value. */
464 +#if defined __GNUC__
465 +# define __bswap_16(x) (__extension__ __builtin_bswap_16(x))
467 +/* This is better than nothing. */
468 +static __inline unsigned short int
469 +__bswap_16 (unsigned short int __bsx)
471 + return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
475 +/* Swap bytes in 32 bit value. */
476 +#if defined __GNUC__
477 +# define __bswap_32(x) (__extension__ __builtin_bswap_32(x))
479 +static __inline unsigned int
480 +__bswap_32 (unsigned int __bsx)
482 + return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
483 + (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
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))
499 +# define __bswap_64(x) \
503 + __extension__ unsigned long long int __ll; \
504 + unsigned int __l[2]; \
506 + if (__builtin_constant_p(x)) \
507 + __r.__ll = __bswap_constant_64(x); \
510 + __r.__l[0] = __bswap_32(__w.__l[1]); \
511 + __r.__l[1] = __bswap_32(__w.__l[0]); \
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
523 +/* AVR32 is big-endian */
526 +# error "Never use <bits/endian.h> directly; include <endian.h> instead."
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
536 + * Copyright (C) 2004 Atmel Norway AS
538 + * This file is part of the Linux kernel
541 +# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
544 +#include <sys/types.h>
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
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
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 */
568 +#ifdef __USE_LARGEFILE64
569 +# define O_LARGEFILE 0400000
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. */
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 */
586 +#ifndef __USE_FILE_OFFSET64
591 +# define F_GETLK F_GETLK64
592 +# define F_SETLK F_SETLK64
593 +# define F_SETLKW F_SETLKW64
595 +#define F_GETLK64 12 /* using 'struct flock64' */
596 +#define F_SETLK64 13
597 +#define F_SETLKW64 14
599 +#if defined __USE_BSD || defined __USE_XOPEN2K
600 +# define F_SETOWN 8 /* for sockets. */
601 +# define F_GETOWN 9 /* for sockets. */
605 +# define F_SETSIG 10 /* for sockets. */
606 +# define F_GETSIG 11 /* for sockets. */
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. */
615 +/* for F_[GET|SET]FL */
616 +#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
618 +/* for posix fcntl() and lockf() */
623 +/* for old implementation of bsd flock () */
624 +#define F_EXLCK 4 /* or 3 */
625 +#define F_SHLCK 8 /* or 4 */
628 +#define F_INPROGRESS 16
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
636 +# define LOCK_UN 8 /* remove lock */
640 +# define LOCK_MAND 32 /* This is a mandatory flock */
641 +# define LOCK_READ 64 /* ... Which allows concurrent
643 +# define LOCK_WRITE 128 /* ... Which allows concurrent
644 + write operations */
645 +# define LOCK_RW 192 /* ... Which allows concurrent
646 + read & write ops */
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. */
663 +#ifndef __USE_FILE_OFFSET64
673 +#ifdef __USE_LARGEFILE64
683 +/* Define some more compatibility macros to be backward compatible with
684 + * BSD systems which did not managed to hide these kernel macros. */
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. */
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. */
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
707 +#ifndef _BITS_STAT_STRUCT_H
708 +#define _BITS_STAT_STRUCT_H
711 + * This file provides struct stat, taken from kernel 2.6.4
712 + * (include/asm-avr32/stat.h revision 1.1).
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;
736 +#define STAT_HAVE_NSEC 1
738 +struct kernel_stat64 {
739 + unsigned long long st_dev;
741 + unsigned long long st_ino;
742 + unsigned int st_mode;
743 + unsigned int st_nlink;
745 + unsigned long st_uid;
746 + unsigned long st_gid;
748 + unsigned long long st_rdev;
751 + unsigned long __pad1;
752 + unsigned long st_blksize;
754 + unsigned long long st_blocks;
756 + unsigned long st_atime;
757 + unsigned long st_atime_nsec;
759 + unsigned long st_mtime;
760 + unsigned long st_mtime_nsec;
762 + unsigned long st_ctime;
763 + unsigned long st_ctime_nsec;
765 + unsigned long __unused1;
766 + unsigned long __unused2;
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
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.
781 +#ifndef __ASM_AVR32_POSIX_TYPES_H
782 +#define __ASM_AVR32_POSIX_TYPES_H
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.
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;
814 +typedef unsigned short __kernel_old_uid_t;
815 +typedef unsigned short __kernel_old_gid_t;
816 +typedef unsigned short __kernel_old_dev_t;
819 +typedef long long __kernel_loff_t;
823 +#if defined(__USE_ALL)
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
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.
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.
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.
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
855 +#define mcount_internal __mcount_internal
857 +#define _MCOUNT_DECL(frompc, selfpc) \
858 +static void __attribute((used)) mcount_internal(unsigned long frompc, unsigned long selfpc)
861 + * This mcount implementation expects to get called after the prologue
862 + * has been run. It also expects that r7 contains a valid frame
865 + * When profiling, the compiler should generate something like this at
866 + * each function entry:
868 + * pushm r0-r7,lr // lr mandatory, others optional
870 + * // rest of prologue goes here
871 + * mcall pc[.LC1 - .]
872 + * // rest of function goes here
880 + * // rest of prologue goes here
883 + * mcall r0[mcount@GOT]
884 + * // rest of function goes here
886 + * .long .L1 - _GLOBAL_OFFSET_TABLE_
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.
892 +#define MCOUNT asm( \
894 + " .global _mcount\n" \
895 + " .type _mcount,@function\n" \
897 + " pushm r8-r12,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
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.
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.
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.
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
930 +# error "Never include this file directly. Use <sys/mman.h> instead"
933 +/* The following definitions basically come from the kernel headers.
934 + But the kernel header is not namespace clean. */
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. */
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. */
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. */
951 +# define MAP_TYPE 0x0f /* Mask for type of mapping. */
955 +#define MAP_FIXED 0x10 /* Interpret addr exactly. */
958 +# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
959 +# define MAP_ANON MAP_ANONYMOUS
962 +/* These are Linux-specific. */
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 */
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. */
978 +/* Flags for `mlockall'. */
979 +#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
980 +#define MCL_FUTURE 2 /* Lock all additions to address
983 +/* Flags for `mremap'. */
985 +# define MREMAP_MAYMOVE 1
988 +/* Advise to `madvise'. */
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. */
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. */
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
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.
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.
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.
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. */
1029 +#include <signal.h>
1032 +profil_counter(int signo, siginfo_t *si, struct sigcontext *sc)
1034 + profil_count((void *)sc->pc);
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
1042 + * Copyright (C) 2004-2005 Atmel Norway
1045 +# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
1050 + * The jump buffer contains r0-r7, sr, sp and lr. Other registers are
1053 +typedef int __jmp_buf[11];
1056 +#define __JMP_BUF_SP 4
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
1068 +# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
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.
1076 +#include <bits/sysnum.h>
1078 +#ifndef __set_errno
1079 +# define __set_errno(val) (*__errno_location()) = (val)
1082 +# define SYS_ify(syscall_name) (__NR_##syscall_name)
1085 +#ifndef __ASSEMBLER__
1088 +#define _syscall0(type,name) \
1091 + return (type)(INLINE_SYSCALL(name, 0)); \
1095 +#define _syscall1(type,name,type1,arg1) \
1096 + type name(type1 arg1) \
1098 + return (type)(INLINE_SYSCALL(name, 1, arg1)); \
1102 +#define _syscall2(type,name,type1,arg1,type2,arg2) \
1103 + type name(type1 arg1, type2 arg2) \
1105 + return (type)(INLINE_SYSCALL(name, 2, arg1, arg2)); \
1109 +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
1110 + type name(type1 arg1, type2 arg2, type3 arg3) \
1112 + return (type)(INLINE_SYSCALL(name, 3, arg1, \
1117 +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
1119 + type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
1121 + return (type)(INLINE_SYSCALL(name, 4, arg1, arg2, \
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, \
1131 + return (type)(INLINE_SYSCALL(name, 5, arg1, arg2, \
1132 + arg3, arg4, arg5)); \
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) \
1141 + return (type)(INLINE_SYSCALL(name, 6, arg1, arg2, arg3, \
1142 + arg4, arg5, arg6)); \
1146 +#define unlikely(x) __builtin_expect((x), 0)
1148 +#undef INLINE_SYSCALL
1149 +#define INLINE_SYSCALL(name, nr, args...) \
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; \
1156 + (int) _sys_result; \
1159 +#undef INTERNAL_SYSCALL_DECL
1160 +#define INTERNAL_SYSCALL_DECL(err) do { } while(0)
1162 +#undef INTERNAL_SYSCALL
1163 +#define INTERNAL_SYSCALL(name, err, nr, args...) \
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 " */" \
1170 + : "r"(_scno) ASM_ARGS_##nr \
1171 + : "lr", "cc", "memory"); \
1175 +#undef INTERNAL_SYSCALL_ERROR_P
1176 +#define INTERNAL_SYSCALL_ERROR_P(val, err) \
1177 + ((unsigned int)(val) >= 0xfffff001U)
1179 +#undef INTERNAL_SYSCALL_ERRNO
1180 +#define INTERNAL_SYSCALL_ERRNO(val, errr) (-(val))
1182 +#define LOAD_ARGS_0() do { } while(0)
1184 +#define LOAD_ARGS_1(a1) \
1185 + _a1 = (int) (a1); \
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); \
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)
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
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
1222 + * Copyright (C) 2004 Atmel Norway AS
1225 +#include <sys/syscall.h>
1227 +void *__curbrk = 0;
1229 +int brk (void *addr)
1233 + newbrk = INLINE_SYSCALL(brk, 1, addr);
1235 + __curbrk = newbrk;
1237 + if (newbrk < addr) {
1238 + __set_errno (ENOMEM);
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
1250 + * Copyright (C) 2004 Atmel Norway AS
1253 + /* This just does a tail-call to __sigsetjmp(env, 0) */
1255 + .type _setjmp,"function"
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
1267 + * Copyright (C) 2004 Atmel Norway AS
1270 + /* This just does a tail-call to __sigsetjmp(env, 1) */
1272 + .type setjmp,"function"
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
1284 + * Copyright (C) 2004 Atmel Norway AS
1287 +#include <sys/syscall.h>
1288 +#include <unistd.h>
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.
1295 +int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg)
1297 + register int (*_fn)(void *arg) = fn;
1298 + register void *_arg = arg;
1301 + /* Sanity check the arguments */
1304 + goto syscall_error;
1306 + goto syscall_error;
1308 + err = INLINE_SYSCALL(clone, 2, flags, child_stack);
1310 + goto syscall_error;
1311 + else if (err != 0)
1317 + __set_errno (-err);
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
1326 + * Copyright (C) 2004 Atmel Norway AS
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
1333 + * env[0..N] pointers to environment variables
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
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)
1346 + * So we need to set up things as follows:
1347 + * r12 = address of main
1350 + * r9 = address of _init
1351 + * r8 = address of _fini
1352 + * sp[0] = whatever we got passed in r12
1355 +#include <features.h>
1359 + .type _start, @function
1361 + /* Clear the frame pointer and link register since this is the outermost frame. */
1365 + ld.w r11, sp++ /* argc */
1366 + mov r10, sp /* &argv[0] */
1368 + st.w --sp, r10 /* stack_end */
1369 + st.w --sp, r12 /* rtld_fini */
1379 + /* Ok, now run uClibc's main() -- should not return */
1380 + call __uClibc_main
1384 + .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
1386 + lddpc r9, __init_addr /* app_init */
1387 + lddpc r8, __fini_addr /* app_fini */
1388 + lddpc r12, __main_addr /* main */
1390 + /* Ok, now run uClibc's main() -- should not return */
1391 + lddpc pc, ___uClibc_main_addr
1400 +___uClibc_main_addr:
1401 + .long __uClibc_main
1403 + .size _start, . - _start
1406 + * The LSB says we need this.
1408 + .section ".note.ABI-tag", "a"
1410 + .long 2f - 1f /* namesz */
1411 + .long 4f - 3f /* descsz */
1412 + .long 1 /* type */
1413 +1: .asciz "GNU" /* name */
1415 +3: .long 0 /* Linux executable */
1416 + .long 2,6,0 /* Earliest compatible kernel */
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
1427 + .type _init, @function
1429 + /* Use a four-byte instruction to avoid NOPs */
1430 + stm --sp, r0-r7,lr
1436 + .type _fini, @function
1438 + stm --sp, r0-r7,lr
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
1449 + .type _init, @function
1450 + ldm sp++, r0-r7,pc
1451 + .size _init, . - _init
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
1464 +/* Copyright (C) 2005 Atmel Norway
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
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
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
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.
1486 +#include <sys/mman.h>
1487 +#include <sys/syscall.h>
1489 +static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
1491 +__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
1493 + return mmap2(addr, len, prot, flags, fd, offset >> 12);
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
1501 + * Copyright (C) 2004 Atmel Norway AS
1505 +#include <bits/setjmp.h>
1509 + .global __sigsetjmp
1510 + .type __sigsetjmp,"function"
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.
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"
1524 +__sigsetjmp_internal:
1526 + stm r12, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
1528 + /* Make a tail call to __sigjmp_save; it takes the same args. */
1533 + ld.w r8, r6[__sigjmp_save@got]
1538 +.LG: .long .L1 - _GLOBAL_OFFSET_TABLE_
1540 + rjmp __sigjmp_save
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
1549 + * Copyright (C) 2004 Atmel Norway AS
1552 +#include <signal.h>
1553 +#include <string.h>
1554 +#include <sys/syscall.h>
1555 +#include <bits/kernel_sigaction.h>
1557 +#define SA_RESTORER 0x04000000
1558 +extern void __default_rt_sa_restorer(void);
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.
1564 +int __libc_sigaction(int signum, const struct sigaction *act,
1565 + struct sigaction *oldact)
1567 + struct kernel_sigaction kact, koact;
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;
1577 + kact.sa_restorer = __default_rt_sa_restorer;
1578 + kact.sa_flags |= SA_RESTORER;
1581 + result = __syscall_rt_sigaction(signum, act ? __ptrvalue(&kact) : NULL,
1582 + oldact ? __ptrvalue(&koact) : NULL,
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;
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
1603 + * Copyright (C) 2004 Atmel Norway AS
1605 +#include <sys/syscall.h>
1607 + .global __default_rt_sa_restorer
1608 + .type __default_rt_sa_restorer,"function"
1610 +__default_rt_sa_restorer:
1611 + mov r8, __NR_rt_sigreturn
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
1618 +/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
1619 + This file is part of the GNU C Library.
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.
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.
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. */
1637 +#define _SYS_ELF_H 1
1639 +#warning "This header is obsolete; use <sys/procfs.h> instead."
1641 +#include <sys/procfs.h>
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
1649 +/* Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
1650 + This file is part of the GNU C Library.
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.
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.
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. */
1669 +#define _SYS_IO_H 1
1670 +#include <features.h>
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;
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;
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;
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;
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
1702 +/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
1703 + This file is part of the GNU C Library.
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.
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.
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. */
1720 +#ifndef _SYS_PROCFS_H
1721 +#define _SYS_PROCFS_H 1
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.
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. */
1732 +#include <features.h>
1733 +#include <sys/time.h>
1734 +#include <sys/types.h>
1735 +#include <sys/user.h>
1739 +/* Type for a general-purpose register. */
1740 +typedef unsigned long elf_greg_t;
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];
1749 +/* Register set for the floating-point registers. */
1750 +typedef struct user_fpregs elf_fpregset_t;
1755 + int si_signo; /* Signal number. */
1756 + int si_code; /* Extra code. */
1757 + int si_errno; /* Errno. */
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. */
1767 +struct elf_prstatus
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. */
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. */
1786 +#define ELF_PRARGSZ (80) /* Number of chars for args. */
1788 +struct elf_prpsinfo
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. */
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. */
1808 +typedef void *psaddr_t;
1810 +/* Register sets. Linux has different names. */
1811 +typedef elf_gregset_t prgregset_t;
1812 +typedef elf_fpregset_t prfpregset_t;
1814 +/* We don't have any differences between processes and threads,
1815 + therefore have only one PID type. */
1816 +typedef __pid_t lwpid_t;
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;
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
1830 +/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
1831 + This file is part of the GNU C Library.
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.
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.
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. */
1848 +/* Linux/AVR32 ABI compliant context switching support. */
1850 +#ifndef _SYS_UCONTEXT_H
1851 +#define _SYS_UCONTEXT_H 1
1853 +#include <features.h>
1854 +#include <signal.h>
1855 +#include <sys/procfs.h>
1856 +#include <bits/sigcontext.h>
1858 +typedef int greg_t;
1860 +/* Number of general registers. */
1863 +/* Container for all general registers. */
1864 +typedef elf_gregset_t gregset_t;
1866 +/* Number of each register is the `gregset_t' array. */
1903 +/* Structure to describe FPU registers. */
1904 +typedef elf_fpregset_t fpregset_t;
1906 +/* Context to describe whole processor state. */
1910 + fpregset_t fpregs;
1913 +/* Userlevel context. */
1914 +typedef struct ucontext
1916 + unsigned long uc_flags;
1917 + struct ucontext *uc_link;
1919 + struct sigcontext uc_mcontext;
1920 + sigset_t uc_sigmask; /* mask last for extensibility */
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
1929 +#ifndef _SYS_USER_H
1930 +#define _SYS_USER_H
1943 + unsigned long r12;
1944 + unsigned long r11;
1945 + unsigned long r10;
1956 + unsigned long r12_orig;
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 */
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
1981 + * syscall for AVR32/uClibc
1983 + * Copyright (C) 2004 Atmel Norway
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.
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.
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
1999 +#include <features.h>
2004 + * long int syscall(long int sysno, ...)
2007 + .type syscall, @function
2010 + stm --sp, r3,r5,lr
2013 + ldm lr, r3,r5,r9-r12
2022 +# ifdef __UCLIBC_HAS_THREADS__
2024 + mcall r5[__errno_location@got]
2027 + ld.w r3, r5[errno@got]
2031 +# ifdef __UCLIBC_HAS_THREADS__
2033 + mcall .Lerrno_location
2043 + ldm sp++, r3,r5,pc
2048 + .long .Lgotcalc - _GLOBAL_OFFSET_TABLE_
2050 +# ifdef __UCLIBC_HAS_THREADS__
2052 + .long __errno_location
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
2067 + * vfork for uClibc
2069 + * Copyright (C) 2005 Atmel Norway
2073 + * Clone the process without copying the address space. The
2074 + * calling process is suspended until the child either exits
2075 + * or calls execve.
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.
2082 +#include <features.h>
2083 +#include <sys/syscall.h>
2086 + .type __vfork,@function
2089 + mov r8, __NR_vfork
2094 + /* vfork failed, so we may use the stack freely */
2101 + mcall r6[__errno_location@got]
2104 + mcall .L__errno_location
2107 + popm r4-r7,pc,r12=-1
2112 + .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
2114 +.L__errno_location:
2115 + .long __errno_location
2117 + .size __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)
2129 +ifeq ($(strip $(TARGET_ARCH)),avr32)
2130 + CPU_CFLAGS-$(CONFIG_AP7000) += -mcpu=ap7000
2133 # Keep the check_gcc from being needlessly executed
2135 ifneq ($(UCLIBC_BUILD_PIE),y)