zte's code,first commit

Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/Makefile b/ap/build/uClibc/libc/sysdeps/linux/avr32/Makefile
new file mode 100644
index 0000000..338abc0
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/Makefile
@@ -0,0 +1,25 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+top_srcdir=../../../../
+top_builddir=../../../../
+all: objs
+
+include $(top_builddir)Rules.mak
+include Makefile.arch
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/Makefile.arch b/ap/build/uClibc/libc/sysdeps/linux/avr32/Makefile.arch
new file mode 100644
index 0000000..98b85a7
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/Makefile.arch
@@ -0,0 +1,11 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+CSRC	:= brk.c clone.c mmap.c prctl.c sigaction.c
+
+SSRC	:= __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S	\
+		sigrestorer.S syscall.S vfork.S
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/__longjmp.S b/ap/build/uClibc/libc/sysdeps/linux/avr32/__longjmp.S
new file mode 100644
index 0000000..6154bb2
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/__longjmp.S
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+	.global	__longjmp
+	.type	__longjmp,"function"
+	.align	1
+__longjmp:
+	ldm	r12++, r0-r8,sp,lr
+	mustr	r8		/* restore status register (lower half) */
+	cp	r11, 0		/* can't return zero */
+	frs
+	moveq	r11, 1
+	retal	r11
+	.size	__longjmp, . - __longjmp
+
+libc_hidden_def(__longjmp)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/atomic.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/atomic.h
new file mode 100644
index 0000000..e6be41f
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/atomic.h
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#ifndef _AVR32_BITS_ATOMIC_H
+#define _AVR32_BITS_ATOMIC_H 1
+
+#include <inttypes.h>
+
+typedef int32_t atomic32_t;
+typedef uint32_t uatomic32_t;
+typedef int_fast32_t atomic_fast32_t;
+typedef uint_fast32_t uatomic_fast32_t;
+
+typedef intptr_t atomicptr_t;
+typedef uintptr_t uatomicptr_t;
+typedef intmax_t atomic_max_t;
+typedef uintmax_t uatomic_max_t;
+
+#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval)	\
+	(abort(), 0)
+
+#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval)	\
+	(abort(), 0)
+
+#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval)	\
+	({								\
+		__typeof__(*(mem)) __prev;				\
+		__asm__ __volatile__(					\
+			"/* __arch_compare_and_exchange_val_32_acq */\n" \
+			"1:	ssrf	5\n"				\
+			"	ld.w	%[result], %[m]\n"		\
+			"	cp.w	%[result], %[old]\n"		\
+			"	brne	2f\n"				\
+			"	stcond	%[m], %[new]\n"			\
+			"	brne	1b\n"				\
+			"2:"						\
+			: [result] "=&r"(__result), [m] "=m"(*(mem))	\
+			: "m"(*(mem)), [old] "ir"(oldval),		\
+			  [new] "r"(newval)				\
+			: "memory", "cc");				\
+		__prev;							\
+	})
+
+#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval)	\
+	(abort(), 0)
+
+#define __arch_exchange_32_acq(mem, newval)				\
+	({								\
+		__typeof__(*(mem)) __oldval;				\
+		__asm__ __volatile__(					\
+			"/*__arch_exchange_32_acq */\n"			\
+			"	xchg	%[old], %[m], %[new]"		\
+			: [old] "=&r"(__oldval)				\
+			: [m] "r"(mem), [new] "r"(newval)		\
+			: "memory");					\
+		__oldval;						\
+	})
+
+#define __arch_atomic_exchange_and_add_32(mem, value)			\
+	({								\
+		__typeof__(*(mem)) __oldval, __tmp;			\
+		__asm__ __volatile__(					\
+			"/* __arch_atomic_exchange_and_add_32 */\n"	\
+			"1:	ssrf	5\n"				\
+			"	ld.w	%[old], %[m]\n"			\
+			"	add	%[tmp], %[old], %[val]\n"	\
+			"	stcond	%[m], %[tmp]\n"			\
+			"	brne	1b"				\
+			: [old] "=&r"(__oldval), [tmp] "=&r"(__tmp),	\
+			  [m] "=m"(*(mem))				\
+			: "m"(*(mem)), [val] "r"(value)			\
+			: "memory", "cc");				\
+		__oldval;						\
+	})
+
+#define __arch_atomic_decrement_if_positive_32(mem)			\
+	({								\
+		__typeof__(*(mem)) __oldval, __tmp;			\
+		__asm__ __volatile__(					\
+			"/* __arch_atomic_decrement_if_positive_32 */\n" \
+			"1:	ssrf	5\n"				\
+			"	ld.w	%[old], %[m]\n"			\
+			"	sub	%[tmp], %[old], 1\n"		\
+			"	brlt	2f\n"				\
+			"	stcond	%[m], %[tmp]\n"			\
+			"	brne	1b"				\
+			"2:"						\
+			: [old] "=&r"(__oldval), [tmp] "=&r"(__tmp),	\
+			  [m] "=m"(*(mem))				\
+			: "m"(*(mem))					\
+			: "memory", "cc");				\
+		__oldval;						\
+	})
+
+#define atomic_exchange_acq(mem, newval)				\
+	({								\
+		if (sizeof(*(mem)) != 4)				\
+			abort();					\
+		__arch_exchange_32_acq(mem, newval);			\
+	})
+
+#define atomic_exchange_and_add(mem, newval)				\
+	({								\
+		if (sizeof(*(mem)) != 4)				\
+			abort();					\
+		__arch_atomic_exchange_and_add_32(mem, newval);		\
+	})
+
+#define atomic_decrement_if_positive(mem)				\
+	({								\
+		if (sizeof(*(mem)) != 4)				\
+			abort();					\
+		__arch_atomic_decrement_if_positive_32(mem);		\
+	})
+
+#endif /* _AVR32_BITS_ATOMIC_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/endian.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/endian.h
new file mode 100644
index 0000000..7bb6358
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/endian.h
@@ -0,0 +1,7 @@
+/* AVR32 is big-endian */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#define __BYTE_ORDER __BIG_ENDIAN
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/fcntl.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/fcntl.h
new file mode 100644
index 0000000..767243e
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/fcntl.h
@@ -0,0 +1,215 @@
+#ifndef _FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+#include <sys/types.h>
+#ifdef __USE_GNU
+# include <bits/uio.h>
+#endif
+
+/*
+ * open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ * located on an ext2 file system
+ */
+#define O_ACCMODE	00000003
+#define O_RDONLY	00000000
+#define O_WRONLY	00000001
+#define O_RDWR		00000002
+#define O_CREAT		00000100	/* not fcntl */
+#define O_EXCL		00000200	/* not fcntl */
+#define O_NOCTTY	00000400	/* not fcntl */
+#define O_TRUNC		00001000	/* not fcntl */
+#define O_APPEND	00002000
+#define O_NONBLOCK	00004000
+#define O_NDELAY	O_NONBLOCK
+#define O_SYNC		00010000
+#define O_ASYNC		00020000
+
+#ifdef __USE_GNU
+# define O_DIRECT	00040000	/* must be a directory */
+# define O_DIRECTORY	00200000	/* direct disk access */
+# define O_NOFOLLOW	00400000	/* don't follow links */
+# define O_NOATIME	01000000	/* don't set atime */
+# define O_CLOEXEC	02000000	/* set close_on_exec */
+#endif
+
+#ifdef __USE_LARGEFILE64
+# define O_LARGEFILE	00100000
+#endif
+
+/* For now Linux has synchronisity options for data and read operations.
+   We define the symbols here but let them do the same as O_SYNC since
+   this is a superset.	*/
+#if defined __USE_POSIX199309 || defined __USE_UNIX98
+# define O_DSYNC	O_SYNC	/* Synchronize data.  */
+# define O_RSYNC	O_SYNC	/* Synchronize read operations.	 */
+#endif
+
+#define F_DUPFD		0	/* dup */
+#define F_GETFD		1	/* get close_on_exec */
+#define F_SETFD		2	/* set/clear close_on_exec */
+#define F_GETFL		3	/* get file->f_flags */
+#define F_SETFL		4	/* set file->f_flags */
+
+#ifndef __USE_FILE_OFFSET64
+# define F_GETLK	5
+# define F_SETLK	6
+# define F_SETLKW	7
+#else
+# define F_GETLK	F_GETLK64
+# define F_SETLK	F_SETLK64
+# define F_SETLKW	F_SETLKW64
+#endif
+#define F_GETLK64	12	/*  using 'struct flock64' */
+#define F_SETLK64	13
+#define F_SETLKW64	14
+
+#if defined __USE_BSD || defined __USE_XOPEN2K
+# define F_SETOWN	8	/*  for sockets. */
+# define F_GETOWN	9	/*  for sockets. */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETSIG	10	/*  for sockets. */
+# define F_GETSIG	11	/*  for sockets. */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETLEASE	1024	/* Set a lease.	 */
+# define F_GETLEASE	1025	/* Enquire what lease is active.  */
+# define F_NOTIFY	1026	/* Request notfications on a directory.	 */
+#endif
+
+/* for F_[GET|SET]FL */
+#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
+
+/* for posix fcntl() and lockf() */
+#define F_RDLCK		0
+#define F_WRLCK		1
+#define F_UNLCK		2
+
+/* for old implementation of bsd flock () */
+#define F_EXLCK		4	/* or 3 */
+#define F_SHLCK		8	/* or 4 */
+
+/* for leases */
+#define F_INPROGRESS	16
+
+#ifdef __USE_BSD
+/* operations for bsd flock(), also used by the kernel implementation */
+# define LOCK_SH	1	/* shared lock */
+# define LOCK_EX	2	/* exclusive lock */
+# define LOCK_NB	4	/* or'd with one of the above to prevent
+				   blocking */
+# define LOCK_UN	8	/* remove lock */
+#endif
+
+#ifdef __USE_GNU
+# define LOCK_MAND	32	/* This is a mandatory flock */
+# define LOCK_READ	64	/* ... Which allows concurrent
+				       read operations */
+# define LOCK_WRITE	128	/* ... Which allows concurrent
+				       write operations */
+# define LOCK_RW	192	/* ... Which allows concurrent
+				       read & write ops */
+#endif
+
+#ifdef __USE_GNU
+/* Types of directory notifications that may be requested with F_NOTIFY.  */
+# define DN_ACCESS	0x00000001	/* File accessed.  */
+# define DN_MODIFY	0x00000002	/* File modified.  */
+# define DN_CREATE	0x00000004	/* File created.  */
+# define DN_DELETE	0x00000008	/* File removed.  */
+# define DN_RENAME	0x00000010	/* File renamed.  */
+# define DN_ATTRIB	0x00000020	/* File changed attibutes.  */
+# define DN_MULTISHOT	0x80000000	/* Don't remove notifier.  */
+#endif
+
+struct flock {
+	short		l_type;
+	short		l_whence;
+#ifndef __USE_FILE_OFFSET64
+	__off_t		l_start;
+	__off_t		l_len;
+#else
+	__off64_t	l_start;
+	__off64_t	l_len;
+#endif
+	__pid_t		l_pid;
+};
+
+#ifdef __USE_LARGEFILE64
+struct flock64 {
+	short		l_type;
+	short		l_whence;
+	__off64_t	l_start;
+	__off64_t	l_len;
+	__pid_t		l_pid;
+};
+#endif
+
+/* Define some more compatibility macros to be backward compatible with
+ *    BSD systems which did not managed to hide these kernel macros.  */
+#ifdef  __USE_BSD
+# define FAPPEND        O_APPEND
+# define FFSYNC         O_FSYNC
+# define FASYNC         O_ASYNC
+# define FNONBLOCK      O_NONBLOCK
+# define FNDELAY        O_NDELAY
+#endif /* Use BSD.  */
+
+/* Advise to `posix_fadvise'.  */
+#ifdef __USE_XOPEN2K
+# define POSIX_FADV_NORMAL      0 /* No further special treatment.  */
+# define POSIX_FADV_RANDOM      1 /* Expect random page references.  */
+# define POSIX_FADV_SEQUENTIAL  2 /* Expect sequential page references.  */
+# define POSIX_FADV_WILLNEED    3 /* Will need these pages.  */
+# define POSIX_FADV_DONTNEED    4 /* Don't need these pages.  */
+# define POSIX_FADV_NOREUSE     5 /* Data will be accessed once.  */
+#endif
+
+
+#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
+/* Flags for SYNC_FILE_RANGE.  */
+# define SYNC_FILE_RANGE_WAIT_BEFORE	1 /* Wait upon writeout of all pages
+					     in the range before performing
+					     the write */
+# define SYNC_FILE_RANGE_WRITE		2 /* Initiate writeout of all those
+					     dirty pages in the range which are
+					     not presently under writeback */
+# define SYNC_FILE_RANGE_WAIT_AFTER	4 /* Wait upon writeout of all pages
+					     in the range after performing the
+					     write */
+
+/* Flags for splice() and vmsplice() */
+# define SPLICE_F_MOVE		1	/* Move pages instead of copying */
+# define SPLICE_F_NONBLOCK	2	/* Don't block on the pipe splicing
+					   (but we may still block on the fd
+					   we splice from/to) */
+# define SPLICE_F_MORE		4	/* Expect more data */
+# define SPLICE_F_GIFT		8	/* Pages passed in are a gift */
+
+__BEGIN_DECLS
+
+/* Provide kernel hint to read ahead. */
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) __THROW;
+
+/* Selective file content synch'ing */
+extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
+			    unsigned int __flags);
+
+/* Splice address range into a pipe */
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+			 size_t __count, unsigned int __flags);
+
+/* Splice two files together */
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+		       __off64_t *__offout, size_t __len,
+		       unsigned int __flags);
+
+/* In-kernel implementation of tee for pipe buffers */
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+		    unsigned int __flags);
+
+__END_DECLS
+#endif
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/kernel_stat.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/kernel_stat.h
new file mode 100644
index 0000000..d98c6cf
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/kernel_stat.h
@@ -0,0 +1,53 @@
+#ifndef _BITS_STAT_STRUCT_H
+#define _BITS_STAT_STRUCT_H
+
+/*
+ * This file provides struct stat, taken from kernel 2.6.4. Verified
+ * to match kernel 2.6.22.
+ */
+
+struct kernel_stat {
+        unsigned long		st_dev;
+        unsigned long		st_ino;
+        unsigned short		st_mode;
+        unsigned short		st_nlink;
+        unsigned short		st_uid;
+        unsigned short		st_gid;
+        unsigned long		st_rdev;
+        unsigned long		st_size;
+        unsigned long		st_blksize;
+        unsigned long		st_blocks;
+        struct timespec		st_atim;
+        struct timespec		st_mtim;
+        struct timespec		st_ctim;
+        unsigned long		__unused4;
+        unsigned long		__unused5;
+};
+
+struct kernel_stat64 {
+	unsigned long long	st_dev;
+
+	unsigned long long	st_ino;
+	unsigned int		st_mode;
+	unsigned int		st_nlink;
+
+	unsigned long		st_uid;
+	unsigned long		st_gid;
+
+	unsigned long long	st_rdev;
+
+	long long		st_size;
+	unsigned long		__pad1;
+	unsigned long		st_blksize;
+
+	unsigned long long	st_blocks;
+
+	struct timespec		st_atim;
+	struct timespec		st_mtim;
+	struct timespec		st_ctim;
+
+	unsigned long		__unused1;
+	unsigned long		__unused2;
+};
+
+#endif /* _BITS_STAT_STRUCT_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/kernel_types.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/kernel_types.h
new file mode 100644
index 0000000..c551d57
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/kernel_types.h
@@ -0,0 +1,57 @@
+/* Note that we use the exact same include guard #define names
+ * as asm/posix_types.h.  This will avoid gratuitous conflicts
+ * with the posix_types.h kernel header, and will ensure that
+ * our private content, and not the kernel header, will win.
+ *  -Erik
+ */
+#ifndef __ASM_AVR32_POSIX_TYPES_H
+#define __ASM_AVR32_POSIX_TYPES_H
+
+/*
+ * This file is generally used by user-level software, so you need to
+ * be a little careful about namespace pollution etc.  Also, we cannot
+ * assume GCC is being used.
+ */
+
+typedef unsigned long		__kernel_dev_t;
+typedef unsigned long		__kernel_ino_t;
+typedef unsigned short		__kernel_mode_t;
+typedef unsigned short		__kernel_nlink_t;
+typedef long			__kernel_off_t;
+typedef int			__kernel_pid_t;
+typedef unsigned short		__kernel_ipc_pid_t;
+typedef unsigned int		__kernel_uid_t;
+typedef unsigned int		__kernel_gid_t;
+typedef unsigned long		__kernel_size_t;
+typedef long			__kernel_ssize_t;
+typedef int			__kernel_ptrdiff_t;
+typedef long			__kernel_time_t;
+typedef long			__kernel_suseconds_t;
+typedef long			__kernel_clock_t;
+typedef int			__kernel_timer_t;
+typedef int			__kernel_clockid_t;
+typedef int			__kernel_daddr_t;
+typedef char *			__kernel_caddr_t;
+typedef unsigned short		__kernel_uid16_t;
+typedef unsigned short		__kernel_gid16_t;
+typedef unsigned int		__kernel_uid32_t;
+typedef unsigned int		__kernel_gid32_t;
+typedef unsigned short		__kernel_old_uid_t;
+typedef unsigned short		__kernel_old_gid_t;
+typedef unsigned short		__kernel_old_dev_t;
+typedef long			__kernel_long_t;
+typedef unsigned long		__kernel_ulong_t;
+
+#ifdef __GNUC__
+typedef long long		__kernel_loff_t;
+#endif
+
+typedef struct {
+#if defined(__USE_ALL)
+	int	val[2];
+#else
+	int	__val[2];
+#endif
+} __kernel_fsid_t;
+
+#endif /* __ASM_AVR32_POSIX_TYPES_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/setjmp.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/setjmp.h
new file mode 100644
index 0000000..78348a3
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/setjmp.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2004-2005 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#ifndef _BITS_SETJMP_H
+#define _BITS_SETJMP_H	1
+
+#if !defined _SETJMP_H && !defined _PTHREAD_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+#ifndef _ASM
+/*
+ * The jump buffer contains r0-r7, sr, sp and lr. Other registers are
+ * not saved.
+ */
+typedef int __jmp_buf[11];
+#endif
+
+#define __JMP_BUF_SP	4
+
+/* Test if longjmp to JMPBUF would unwind the frame containing a local
+   variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((void *)(address) < (void *)(jmpbuf[__JMP_BUF_SP]))
+
+#endif /* _BITS_SETJMP_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/stackinfo.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/stackinfo.h
new file mode 100644
index 0000000..2c17d30
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/stackinfo.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* This file contains a bit of information about the stack allocation
+   of the processor.  */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H	1
+
+/* On AVR32 the stack grows down. */
+#define _STACK_GROWS_DOWN	1
+
+#endif /* stackinfo.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/syscalls.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/syscalls.h
new file mode 100644
index 0000000..70dc1d9
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/syscalls.h
@@ -0,0 +1,55 @@
+#ifndef _BITS_SYSCALLS_H
+#define _BITS_SYSCALLS_H
+#ifndef _SYSCALL_H
+# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
+#endif
+
+#ifndef __ASSEMBLER__
+
+#include <errno.h>
+
+#define INTERNAL_SYSCALL_NCS(name, err, nr, args...)			\
+(__extension__ \
+	({								\
+		register int __a1 __asm__("r12");			\
+		register int _scno __asm__("r8") = name;		\
+		LOAD_ARGS_##nr (args);					\
+		__asm__ __volatile__("scall	/* syscall " #name " */" \
+			      : "=r" (__a1)				\
+			      : "r"(_scno) ASM_ARGS_##nr		\
+			      : "cc", "memory");			\
+		__a1;							\
+	}) \
+)
+#define INTERNAL_SYSCALL_ERROR_P(val, err)		\
+	((unsigned int)(val) >= 0xfffff001U)
+
+#define LOAD_ARGS_0() do { } while(0)
+#define ASM_ARGS_0
+#define LOAD_ARGS_1(a1)					\
+	__a1 = (int) (a1);				\
+	LOAD_ARGS_0()
+#define ASM_ARGS_1	ASM_ARGS_0, "r"(__a1)
+#define LOAD_ARGS_2(a1, a2)				\
+	register int __a2 __asm__("r11") = (int)(a2);	\
+	LOAD_ARGS_1(a1)
+#define ASM_ARGS_2	ASM_ARGS_1, "r"(__a2)
+#define LOAD_ARGS_3(a1, a2, a3)				\
+	register int __a3 __asm__("r10") = (int)(a3);	\
+	LOAD_ARGS_2(a1, a2)
+#define ASM_ARGS_3	ASM_ARGS_2, "r"(__a3)
+#define LOAD_ARGS_4(a1, a2, a3, a4)			\
+	register int __a4 __asm__("r9") = (int)(a4);	\
+	LOAD_ARGS_3(a1, a2, a3)
+#define ASM_ARGS_4	ASM_ARGS_3, "r"(__a4)
+#define LOAD_ARGS_5(a1, a2, a3, a4, a5)			\
+	register int __a5 __asm__("r5") = (int)(a5);	\
+	LOAD_ARGS_4(a1, a2, a3, a4)
+#define ASM_ARGS_5	ASM_ARGS_4, "r"(__a5)
+#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)		\
+	register int __a6 __asm__("r3") = (int)(a6);	\
+	LOAD_ARGS_5(a1, a2, a3, a4, a5)
+#define ASM_ARGS_6	ASM_ARGS_5, "r"(__a6)
+
+#endif /* __ASSEMBLER__ */
+#endif /* _BITS_SYSCALLS_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h
new file mode 100644
index 0000000..c306577
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h
@@ -0,0 +1,48 @@
+/*
+ * Track misc arch-specific features that aren't config options
+ */
+
+#ifndef _BITS_UCLIBC_ARCH_FEATURES_H
+#define _BITS_UCLIBC_ARCH_FEATURES_H
+
+/* instruction used when calling abort() to kill yourself */
+/* trigger illegal instruction exception, same as BUG in Linux */
+#define __UCLIBC_ABORT_INSTRUCTION__ ".short 0x5df0"
+
+/* can your target use syscall6() for mmap ? */
+#define __UCLIBC_MMAP_HAS_6_ARGS__
+
+/* does your target use syscall4() for truncate64 ? (32bit arches only) */
+#undef __UCLIBC_TRUNCATE64_HAS_4_ARGS__
+
+/* does your target have a broken create_module() ? */
+#undef __UCLIBC_BROKEN_CREATE_MODULE__
+
+/* does your target have to worry about older [gs]etrlimit() ? */
+#undef __UCLIBC_HANDLE_OLDER_RLIMIT__
+
+/* does your target have an asm .set ? */
+#define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
+
+/* define if target doesn't like .global */
+#undef __UCLIBC_ASM_GLOBAL_DIRECTIVE__
+
+/* define if target supports .weak */
+#define __UCLIBC_HAVE_ASM_WEAK_DIRECTIVE__
+
+/* define if target supports .weakext */
+#undef __UCLIBC_HAVE_ASM_WEAKEXT_DIRECTIVE__
+
+/* needed probably only for ppc64 */
+#undef __UCLIBC_HAVE_ASM_GLOBAL_DOT_NAME__
+
+/* define if target supports CFI pseudo ops */
+#undef __UCLIBC_HAVE_ASM_CFI_DIRECTIVES__
+
+/* define if target supports IEEE signed zero floats */
+#define __UCLIBC_HAVE_SIGNED_ZERO__
+
+/* only weird assemblers generally need this */
+#undef __UCLIBC_ASM_LINE_SEP__
+
+#endif /* _BITS_UCLIBC_ARCH_FEATURES_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/wordsize.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/wordsize.h
new file mode 100644
index 0000000..1b5842a
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bits/wordsize.h
@@ -0,0 +1 @@
+#define __WORDSIZE	32
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/brk.c b/ap/build/uClibc/libc/sysdeps/linux/avr32/brk.c
new file mode 100644
index 0000000..58f04f9
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/brk.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+
+void *__curbrk attribute_hidden = 0;
+
+int brk (void *addr)
+{
+	void *newbrk;
+
+	newbrk = (void *)INLINE_SYSCALL(brk, 1, addr);
+
+	__curbrk = newbrk;
+
+	if (newbrk < addr) {
+		__set_errno (ENOMEM);
+		return -1;
+	}
+
+	return 0;
+}
+libc_hidden_def(brk)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bsd-_setjmp.S b/ap/build/uClibc/libc/sysdeps/linux/avr32/bsd-_setjmp.S
new file mode 100644
index 0000000..f23e73b
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bsd-_setjmp.S
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+	/* This just does a tail-call to __sigsetjmp(env, 0) */
+	.global	_setjmp
+	.type	_setjmp,"function"
+	.align	1
+_setjmp:
+	mov	r11, 0
+	bral	HIDDEN_JUMPTARGET(__sigsetjmp)
+	.size	_setjmp, . - _setjmp
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/bsd-setjmp.S b/ap/build/uClibc/libc/sysdeps/linux/avr32/bsd-setjmp.S
new file mode 100644
index 0000000..5247ec3
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/bsd-setjmp.S
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+	/* This just does a tail-call to __sigsetjmp(env, 1) */
+	.global	setjmp
+	.type	setjmp,"function"
+	.align	1
+setjmp:
+	mov	r11, 1
+	bral	HIDDEN_JUMPTARGET(__sigsetjmp)
+	.size	setjmp, . - setjmp
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/clone.c b/ap/build/uClibc/libc/sysdeps/linux/avr32/clone.c
new file mode 100644
index 0000000..06e3388
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/clone.c
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2004 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#include <sched.h>
+#include <errno.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+/*
+ * I don't know if we can be absolutely certain that the fn and arg
+ * parameters are preserved when returning as the child. If the
+ * compiler stores them in registers (r0-r7), they should be.
+ */
+int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...)
+{
+	register int (*_fn)(void *arg) = fn;
+	register void *_arg = arg;
+	int err;
+
+	/* Sanity check the arguments */
+	err = -EINVAL;
+	if (!fn)
+		goto syscall_error;
+	if (!child_stack)
+		goto syscall_error;
+
+	err = INLINE_SYSCALL(clone, 2, flags, child_stack);
+	if (err < 0)
+		goto syscall_error;
+	else if (err != 0)
+		return err;
+
+	_exit(_fn(_arg));
+
+syscall_error:
+	__set_errno (-err);
+	return -1;
+}
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/crt1.S b/ap/build/uClibc/libc/sysdeps/linux/avr32/crt1.S
new file mode 100644
index 0000000..ca1fa7a
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/crt1.S
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * When we enter _start, the stack looks like this:
+ *	argc		argument counter
+ *	argv[0]		pointer to program name
+ *	argv[1..argc-1]	pointers to program args
+ *	NULL
+ *	env[0..N]	pointers to environment variables
+ *	NULL
+ *
+ * r12 contains a function pointer to be registered with `atexit'.
+ * This is how the dynamic linker arranges to have DT_FINI functions
+ * called for shared libraries that have been loaded before this
+ * code runs.
+ *
+ * We're going to call the following function:
+ * __uClibc_main(int (*main)(int, char **, char **), int argc,
+ *		 char **argv, void (*app_init)(void), void (*app_fini)(void),
+ *		 void (*rtld_fini)(void), void *stack_end)
+ *
+ * So we need to set up things as follows:
+ *	r12 = address of main
+ *	r11 = argc
+ *	r10 = &argv[0]
+ *	r9  = address of _init
+ *	r8  = address of _fini
+ *	sp[0] = whatever we got passed in r12
+ */
+
+#include <features.h>
+
+	.text
+	.global _start
+	.type	_start, @function
+_start:
+	/* Clear the frame pointer and link register since this is the outermost frame.  */
+	mov	r7, 0
+	mov	lr, 0
+
+	ld.w	r11, sp++		/* argc		*/
+	mov	r10, sp			/* &argv[0]	*/
+
+	st.w	--sp, r10		/* stack_end */
+	st.w	--sp, r12		/* rtld_fini */
+
+#ifdef __PIC__
+	lddpc	r6, .L_GOT
+.L_RGOT:
+	rsub	r6, pc
+	lda.w	r9, _init
+	lda.w	r8, _fini
+	lda.w	r12, main
+
+	/* Ok, now run uClibc's main() -- should not return */
+	call	__uClibc_main
+
+	.align	2
+.L_GOT:
+	.long	.L_RGOT - _GLOBAL_OFFSET_TABLE_
+#else
+	lddpc	r9, __init_addr		/* app_init */
+	lddpc	r8, __fini_addr		/* app_fini */
+	lddpc	r12, __main_addr	/* main */
+
+	/* Ok, now run uClibc's main() -- should not return */
+	lddpc	pc, ___uClibc_main_addr
+
+	.align	2
+__init_addr:
+	.long	_init
+__fini_addr:
+	.long	_fini
+__main_addr:
+	.long	main
+___uClibc_main_addr:
+	.long	__uClibc_main
+#endif
+	.size	_start, . - _start
+
+	/*
+	 * The LSB says we need this.
+	 */
+	.section ".note.ABI-tag", "a"
+	.align	4
+	.long	2f - 1f		/* namesz */
+	.long	4f - 3f		/* descsz */
+	.long	1		/* type   */
+1:	.asciz	"GNU"		/* name */
+2:	.align	4
+3:	.long	0		/* Linux executable */
+	.long	2,6,0		/* Earliest compatible kernel */
+4:	.align	4
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/crti.S b/ap/build/uClibc/libc/sysdeps/linux/avr32/crti.S
new file mode 100644
index 0000000..660f47c
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/crti.S
@@ -0,0 +1,26 @@
+
+	.section .init
+	.align	2
+	.global	_init
+	.type	_init, @function
+_init:
+	stm	--sp, r6, lr
+	lddpc	r6, 2f
+1:	rsub	r6, pc
+	rjmp	3f
+	.align	2
+2:	.long	1b - _GLOBAL_OFFSET_TABLE_
+3:
+
+	.section .fini
+	.align	2
+	.global	_fini
+	.type	_fini, @function
+_fini:
+	stm	--sp, r6, lr
+	lddpc	r6, 2f
+1:	rsub	r6, pc
+	rjmp	3f
+	.align	2
+2:	.long	1b - _GLOBAL_OFFSET_TABLE_
+3:
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/crtn.S b/ap/build/uClibc/libc/sysdeps/linux/avr32/crtn.S
new file mode 100644
index 0000000..c37f7d2
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/crtn.S
@@ -0,0 +1,12 @@
+
+	.section .init
+	.align	2
+	.global	_init
+	.type	_init, @function
+	ldm	sp++, r6, pc
+
+	.section .fini
+	.align	2
+	.global _fini
+	.type	_fini, @function
+	ldm	sp++, r6, pc
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/mmap.c b/ap/build/uClibc/libc/sysdeps/linux/avr32/mmap.c
new file mode 100644
index 0000000..dee88aa
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/mmap.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/syscall.h>
+
+
+static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot,
+		 int, flags, int, fd, __off_t, pgoff)
+
+__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
+{
+	unsigned long page_size = sysconf(_SC_PAGESIZE);
+	unsigned long pgoff;
+
+	if (offset & (page_size - 1)) {
+		__set_errno(EINVAL);
+		return MAP_FAILED;
+	}
+
+	pgoff = (unsigned long)offset >> (31 - __builtin_clz(page_size));
+
+	return mmap2(addr, len, prot, flags, fd, pgoff);
+}
+libc_hidden_def(mmap)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/prctl.c b/ap/build/uClibc/libc/sysdeps/linux/avr32/prctl.c
new file mode 100644
index 0000000..4e146e3
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/prctl.c
@@ -0,0 +1,36 @@
+/*
+ * prctl syscall for AVR32 Linux.
+ *
+ * Copyright (C) 2010 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#include <sys/syscall.h>
+#include <sys/prctl.h>
+#include <stdarg.h>
+
+#ifdef __NR_prctl
+#define __NR___syscall_prctl	__NR_prctl
+static inline _syscall5(int, __syscall_prctl, int, option, long, arg2,
+		long, arg3, long, arg4, long, arg5);
+
+int prctl(int __option, ...)
+{
+	long arg2;
+	long arg3;
+	long arg4;
+	long arg5;
+	va_list ap;
+
+	va_start(ap, __option);
+	arg2 = va_arg(ap, long);
+	arg3 = va_arg(ap, long);
+	arg4 = va_arg(ap, long);
+	arg5 = va_arg(ap, long);
+	va_end(ap);
+
+	return INLINE_SYSCALL(prctl, 5, __option, arg2, arg3, arg4, arg5);
+}
+#endif
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/setjmp.S b/ap/build/uClibc/libc/sysdeps/linux/avr32/setjmp.S
new file mode 100644
index 0000000..7d0354b
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/setjmp.S
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#define _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+
+	.text
+
+	.global	__sigsetjmp
+	.type	__sigsetjmp,"function"
+
+	.align	1
+__sigsetjmp:
+	mustr	r8
+	stm	r12, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
+
+	/*
+	 * Make a tail call to __sigjmp_save; it takes the same args
+	 * and is hidden so we don't need to mess around with the GOT.
+	 */
+	rjmp	__sigjmp_save
+	.size	__sigsetjmp, . - __sigsetjmp
+
+libc_hidden_def(__sigsetjmp)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/sigaction.c b/ap/build/uClibc/libc/sysdeps/linux/avr32/sigaction.c
new file mode 100644
index 0000000..f5e586c
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/sigaction.c
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#include <errno.h>
+#include <signal.h>
+#include <string.h>
+#include <sys/syscall.h>
+#include <bits/kernel_sigaction.h>
+
+#define SA_RESTORER	0x04000000
+extern void __default_rt_sa_restorer(void);
+
+extern __typeof(sigaction) __libc_sigaction;
+
+/*
+ * If act is not NULL, change the action for sig to *act.
+ * If oact is not NULL, put the old action for sig in *oact.
+ */
+int __libc_sigaction(int sig, const struct sigaction *act,
+		     struct sigaction *oact)
+{
+	struct sigaction kact;
+
+	if (act && !(act->sa_flags & SA_RESTORER)) {
+		memcpy(&kact, act, sizeof(kact));
+		kact.sa_restorer = __default_rt_sa_restorer;
+		kact.sa_flags |= SA_RESTORER;
+		act = &kact;
+	}
+
+	/* NB: kernel (as of 2.6.25) will return EINVAL
+	 * if sizeof(act->sa_mask) does not match kernel's sizeof(sigset_t) */
+	return __syscall_rt_sigaction(sig, act, oact, sizeof(act->sa_mask));
+}
+
+#ifndef LIBC_SIGACTION
+# ifndef __UCLIBC_HAS_THREADS__
+strong_alias(__libc_sigaction,sigaction)
+libc_hidden_def(sigaction)
+# else
+weak_alias(__libc_sigaction,sigaction)
+libc_hidden_weak(sigaction)
+# endif
+#endif
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/sigrestorer.S b/ap/build/uClibc/libc/sysdeps/linux/avr32/sigrestorer.S
new file mode 100644
index 0000000..df6a1ba
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/sigrestorer.S
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2004 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#include <sys/syscall.h>
+
+	.global	__default_rt_sa_restorer
+	.type	__default_rt_sa_restorer,"function"
+	.align	1
+__default_rt_sa_restorer:
+	mov	r8, __NR_rt_sigreturn
+	scall
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/elf.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/elf.h
new file mode 100644
index 0000000..faa7310
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/elf.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_ELF_H
+#define _SYS_ELF_H	1
+
+#warning "This header is obsolete; use <sys/procfs.h> instead."
+
+#include <sys/procfs.h>
+
+#endif	/* sys/elf.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/procfs.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/procfs.h
new file mode 100644
index 0000000..3b37363
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/procfs.h
@@ -0,0 +1,123 @@
+/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_PROCFS_H
+#define _SYS_PROCFS_H	1
+
+/* This is somewhat modelled after the file of the same name on SVR4
+   systems.  It provides a definition of the core file format for ELF
+   used on Linux.  It doesn't have anything to do with the /proc file
+   system, even though Linux has one.
+
+   Anyway, the whole purpose of this file is for GDB and GDB only.
+   Don't read too much into it.  Don't use it for anything other than
+   GDB unless you know what you are doing.  */
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+__BEGIN_DECLS
+
+/* Type for a general-purpose register.  */
+typedef unsigned long elf_greg_t;
+
+/* And the whole bunch of them.  We could have used `struct
+   user_regs' directly in the typedef, but tradition says that
+   the register set is an array, which does have some peculiar
+   semantics, so leave it that way.  */
+#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+/* Register set for the floating-point registers.  */
+typedef struct user_fpregs elf_fpregset_t;
+
+/* Signal info.  */
+struct elf_siginfo
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
+
+/* Definitions to generate Intel SVR4-like core files.  These mostly
+   have the same names as the SVR4 types with "elf_" tacked on the
+   front to prevent clashes with Linux definitions, and the typedef
+   forms have been avoided.  This is mostly like the SVR4 structure,
+   but more Linuxy, with things that Linux does not support and which
+   GDB doesn't really use excluded.  */
+
+struct elf_prstatus
+  {
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
+
+
+#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
+
+struct elf_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    unsigned short int pr_uid;
+    unsigned short int pr_gid;
+    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
+
+/* The rest of this file provides the types for emulation of the
+   Solaris <proc_service.h> interfaces that should be implemented by
+   users of libthread_db.  */
+
+/* Addresses.  */
+typedef void *psaddr_t;
+
+/* Register sets.  Linux has different names.  */
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+   therefore have only one PID type.  */
+typedef __pid_t lwpid_t;
+
+/* Process status and info.  In the end we do provide typedefs for them.  */
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif	/* sys/procfs.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/ucontext.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/ucontext.h
new file mode 100644
index 0000000..82c7fe2
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/ucontext.h
@@ -0,0 +1,90 @@
+/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+/* Linux/AVR32 ABI compliant context switching support.  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+#include <sys/procfs.h>
+#include <bits/sigcontext.h>
+
+typedef int greg_t;
+
+/* Number of general registers.  */
+#define NGREG	16
+
+/* Container for all general registers.  */
+typedef elf_gregset_t gregset_t;
+
+/* Number of each register is the `gregset_t' array.  */
+enum
+{
+  R0 = 0,
+#define R0	R0
+  R1 = 1,
+#define R1	R1
+  R2 = 2,
+#define R2	R2
+  R3 = 3,
+#define R3	R3
+  R4 = 4,
+#define R4	R4
+  R5 = 5,
+#define R5	R5
+  R6 = 6,
+#define R6	R6
+  R7 = 7,
+#define R7	R7
+  R8 = 8,
+#define R8	R8
+  R9 = 9,
+#define R9	R9
+  R10 = 10,
+#define R10	R10
+  R11 = 11,
+#define R11	R11
+  R12 = 12,
+#define R12	R12
+  R13 = 13,
+#define R13	R13
+  R14 = 14,
+#define R14	R14
+  R15 = 15
+#define R15	R15
+};
+
+/* Structure to describe FPU registers.  */
+typedef elf_fpregset_t	fpregset_t;
+
+/* Context to describe whole processor state.  */
+typedef struct sigcontext mcontext_t;
+
+/* Userlevel context.  */
+typedef struct ucontext
+{
+	unsigned long	uc_flags;
+	struct ucontext	*uc_link;
+	stack_t		uc_stack;
+	mcontext_t	uc_mcontext;
+	sigset_t	uc_sigmask;   /* mask last for extensibility */
+} ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/user.h b/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/user.h
new file mode 100644
index 0000000..c0b3d38
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/sys/user.h
@@ -0,0 +1,46 @@
+#ifndef _SYS_USER_H
+#define _SYS_USER_H
+
+struct user_fpregs
+{
+
+};
+
+struct user_regs
+{
+	unsigned long sr;
+	unsigned long pc;
+	unsigned long lr;
+	unsigned long sp;
+	unsigned long r12;
+	unsigned long r11;
+	unsigned long r10;
+	unsigned long r9;
+	unsigned long r8;
+	unsigned long r7;
+	unsigned long r6;
+	unsigned long r5;
+	unsigned long r4;
+	unsigned long r3;
+	unsigned long r2;
+	unsigned long r1;
+	unsigned long r0;
+	unsigned long r12_orig;
+};
+
+struct user
+{
+	struct user_regs	regs;		/* general registers */
+	size_t			u_tsize;	/* text size (pages) */
+	size_t			u_dsize;	/* data size (pages) */
+	size_t			u_ssize;	/* stack size (pages) */
+	unsigned long		start_code;	/* text starting address */
+	unsigned long		start_data;	/* data starting address */
+	unsigned long		start_stack;	/* stack starting address */
+	long int		signal;		/* signal causing core dump */
+	struct user_regs *	u_ar0;		/* help gdb find registers */
+	unsigned long		magic;		/* identifies a core file */
+	char			u_comm[32];	/* user command name */
+};
+
+#endif /* _SYS_USER_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/syscall.S b/ap/build/uClibc/libc/sysdeps/linux/avr32/syscall.S
new file mode 100644
index 0000000..55c1b1f
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/syscall.S
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+#include <features.h>
+
+	.text
+
+	/*
+	 * long int syscall(long int sysno, ...)
+	 */
+	.global	syscall
+	.type	syscall, @function
+	.align	2
+syscall:
+	stm	--sp, r3,r5,r6,lr
+	sub	lr, sp, -16
+	mov	r8, r12
+	ldm	lr, r3,r5,r9-r12
+	scall
+	cp.w	r12, -4095
+	brlo	.Ldone
+
+#ifdef __PIC__
+	lddpc	r6, .Lgot
+.Lgotcalc:
+	rsub	r6, pc
+# ifdef __UCLIBC_HAS_THREADS__
+	rsub	r3, r12, 0
+	mcall	r6[__errno_location@got]
+	st.w	r12[0], r3
+# else
+	ld.w	r3, r6[errno@got]
+	neg	r12
+	st.w	r3[0], r12
+# endif
+#else
+# ifdef __UCLIBC_HAS_THREADS__
+	rsub	r3, r12, 0
+	mcall	.Lerrno_location
+	st.w	r12[0], r3
+# else
+	lddpc	r3, .Lerrno
+	neg	r12
+	st.w	r3[0], r12
+# endif
+#endif
+	mov	r12, -1
+
+.Ldone:
+	ldm	sp++, r3,r5,r6,pc
+
+	.align	2
+#ifdef __PIC__
+.Lgot:
+	.long	.Lgotcalc - _GLOBAL_OFFSET_TABLE_
+#else
+# ifdef __UCLIBC_HAS_THREADS__
+.Lerrno_location:
+	.long	__errno_location
+# else
+.Lerrno:
+	.long	errno
+# endif
+#endif
+
+
+	.size	syscall, . - syscall
diff --git a/ap/build/uClibc/libc/sysdeps/linux/avr32/vfork.S b/ap/build/uClibc/libc/sysdeps/linux/avr32/vfork.S
new file mode 100644
index 0000000..03ca99f
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/avr32/vfork.S
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2005 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License.  See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+/*
+ * Clone the process without copying the address space.  The
+ * calling process is suspended until the child either exits
+ * or calls execve.
+ *
+ * This all means that we cannot rely on the stack to store
+ * away registers, since they will be overwritten by the child
+ * as soon as it makes another function call (e.g. execve()).
+ * Fortunately, the Linux kernel preserves LR across system calls.
+ */
+
+#include <features.h>
+#include <sys/syscall.h>
+
+	.global	__vfork
+	.type	__vfork,@function
+	.align	1
+__vfork:
+	mov	r8, __NR_vfork
+	scall
+	cp.w	r12, -4096
+	retls	r12
+
+	/* vfork failed, so we may use the stack freely */
+	pushm	r4-r7,lr
+#ifdef __PIC__
+	lddpc	r6, .L_GOT
+	rsub	r4, r12, 0
+.L_RGOT:
+	rsub	r6, pc
+	mcall	r6[__errno_location@got]
+#else
+	rsub	r4, r12, 0
+	mcall	.L__errno_location
+#endif
+	st.w	r12[0], r4
+	popm	r4-r7,pc,r12=-1
+
+	.align	2
+#ifdef __PIC__
+.L_GOT:
+	.long	.L_RGOT - _GLOBAL_OFFSET_TABLE_
+#else
+.L__errno_location:
+	.long	__errno_location
+#endif
+	.size	__vfork, . - __vfork
+
+weak_alias(__vfork,vfork)
+libc_hidden_weak(vfork)