zte's code,first commit

Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/Makefile b/ap/build/uClibc/libc/sysdeps/linux/bfin/Makefile
new file mode 100644
index 0000000..3970f62
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+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/bfin/Makefile.arch b/ap/build/uClibc/libc/sysdeps/linux/bfin/Makefile.arch
new file mode 100644
index 0000000..425a688
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/Makefile.arch
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+CSRC := bsdsetjmp.c clone.c \
+	sram-alloc.c sram-free.c dma-memcpy.c cacheflush.c
+
+SSRC := __longjmp.S setjmp.S bsd-_setjmp.S
+
+ARCH_HEADERS := bfin_fixed_code.h bfin_l1layout.h bfin_sram.h
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/__longjmp.S b/ap/build/uClibc/libc/sysdeps/linux/bfin/__longjmp.S
new file mode 100644
index 0000000..b2fafbb
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/__longjmp.S
@@ -0,0 +1,109 @@
+/* longjmp for the Blackfin project
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ * Copyright (C) 2004 Metrowerks
+ * Based on code from Analog Devices.
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+.text
+.global ___longjmp;
+.type	___longjmp,STT_FUNC;
+.align 4;
+
+___longjmp:
+	P0 = R0;
+	R0 = [P0 + 0x00];
+	[--SP] = R0;		/* Put P0 on the stack */
+
+	P1 = [P0 + 0x04];
+	P2 = [P0 + 0x08];
+	P3 = [P0 + 0x0C];
+	P4 = [P0 + 0x10];
+	P5 = [P0 + 0x14];
+
+	FP = [P0 + 0x18];
+	R0 = [SP++];		/* Grab P0 from old stack */
+	SP = [P0 + 0x1C];	/* Update Stack Pointer */
+	[--SP] = R0;		/* Put P0 on new stack */
+	[--SP] = R1;		/* Put VAL arg on new stack */
+
+	R0 = [P0 + 0x20];	/* Data Registers */
+	R1 = [P0 + 0x24];
+	R2 = [P0 + 0x28];
+	R3 = [P0 + 0x2C];
+	R4 = [P0 + 0x30];
+	R5 = [P0 + 0x34];
+	R6 = [P0 + 0x38];
+	R7 = [P0 + 0x3C];
+
+	R0 = [P0 + 0x40];
+	ASTAT = R0;
+
+	R0 = [P0 + 0x44];	/* Loop Counters */
+	LC0 = R0;
+	R0 = [P0 + 0x48];
+	LC1 = R0;
+
+	R0 = [P0 + 0x4C];	/* Accumulators */
+	A0.W = R0;
+	R0 = [P0 + 0x50];
+	A0.X = R0;
+	R0 = [P0 + 0x54];
+	A1.W = R0;
+	R0 = [P0 + 0x58];
+	A1.X = R0;
+
+	R0 = [P0 + 0x5C];	/* Index Registers */
+	I0 = R0;
+	R0 = [P0 + 0x60];
+	I1 = R0;
+	R0 = [P0 + 0x64];
+	I2 = R0;
+	R0 = [P0 + 0x68];
+	I3 = R0;
+
+	R0 = [P0 + 0x6C];	/* Modifier Registers */
+	M0 = R0;
+	R0 = [P0 + 0x70];
+	M1 = R0;
+	R0 = [P0 + 0x74];
+	M2 = R0;
+	R0 = [P0 + 0x78];
+	M3 = R0;
+
+	R0 = [P0 + 0x7C];	/* Length Registers */
+	L0 = R0;
+	R0 = [P0 + 0x80];
+	L1 = R0;
+	R0 = [P0 + 0x84];
+	L2 = R0;
+	R0 = [P0 + 0x88];
+	L3 = R0;
+
+	R0 = [P0 + 0x8C];	/* Base Registers */
+	B0 = R0;
+	R0 = [P0 + 0x90];
+	B1 = R0;
+	R0 = [P0 + 0x94];
+	B2 = R0;
+	R0 = [P0 + 0x98];
+	B3 = R0;
+
+	R0 = [P0 + 0x9C];	/* Return Address (PC) */
+	RETS = R0;
+
+	R0 = [SP++];
+	P0 = [SP++];
+
+	CC = R0 == 0;
+	IF !CC JUMP .Lfinished;
+	R0 = 1;
+.Lfinished:
+	RTS;
+.size ___longjmp,.-___longjmp
+
+libc_hidden_def(__longjmp)
+
+.section .note.GNU-stack,"",%progbits
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bfin_fixed_code.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bfin_fixed_code.h
new file mode 100644
index 0000000..9142571
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bfin_fixed_code.h
@@ -0,0 +1,155 @@
+/* Atomic instructions for userspace.
+ *
+ * The actual implementations can be found in the kernel.
+ *
+ * Copyright (c) 2008 Analog Devices, Inc.
+ *
+ * Licensed under the LGPL v2.1.
+ */
+
+#ifndef __BFIN_FIXED_CODE_H__
+#define __BFIN_FIXED_CODE_H__
+
+#include <stdint.h>
+
+#include <asm/fixed_code.h>
+
+#ifndef __ASSEMBLY__
+
+static inline
+uint32_t bfin_atomic_xchg32(uint32_t *__bfin_ptr, uint32_t __bfin_newval)
+{
+	uint32_t __bfin_ret;
+	/* Input:    P0: memory address to use
+	 *           R1: value to store
+	 * Output:   R0: old contents of the memory address
+	 */
+	__asm__ __volatile__(
+		"CALL (%[__bfin_func])"
+		: "=q0" (__bfin_ret), "=m" (*__bfin_ptr)
+		: [__bfin_func] "a" (ATOMIC_XCHG32), "q1" (__bfin_newval),
+		  "qA" (__bfin_ptr), "m" (*__bfin_ptr)
+		: "RETS", "memory"
+	);
+	return __bfin_ret;
+}
+
+static inline
+uint32_t bfin_atomic_cas32(uint32_t *__bfin_ptr, uint32_t __bfin_exp, uint32_t __bfin_newval)
+{
+	uint32_t __bfin_ret;
+	/* Input:    P0: memory address to use
+	 *           R1: compare value
+	 *           R2: new value to store
+	 * Output:   R0: old contents of the memory address
+	 */
+	__asm__ __volatile__(
+		"CALL (%[__bfin_func])"
+		: "=q0" (__bfin_ret), "=m" (*__bfin_ptr)
+		: [__bfin_func] "a" (ATOMIC_CAS32), "q1" (__bfin_exp), "q2" (__bfin_newval),
+		  "qA" (__bfin_ptr), "m" (*__bfin_ptr)
+		: "RETS", "memory"
+	);
+	return __bfin_ret;
+}
+
+static inline
+uint32_t bfin_atomic_add32(uint32_t *__bfin_ptr, uint32_t __bfin_inc)
+{
+	uint32_t __bfin_ret;
+	/* Input:    P0: memory address to use
+	 *           R0: value to add
+	 * Output:   R0: new contents of the memory address
+	 *           R1: previous contents of the memory address
+	 */
+	__asm__ __volatile__(
+		"CALL (%[__bfin_func])"
+		: "=q0" (__bfin_ret), "=m" (*__bfin_ptr)
+		: [__bfin_func] "a" (ATOMIC_ADD32), "q0" (__bfin_inc),
+		  "qA" (__bfin_ptr), "m" (*__bfin_ptr)
+		: "R1", "RETS", "memory"
+	);
+	return __bfin_ret;
+}
+#define bfin_atomic_inc32(ptr) bfin_atomic_add32(ptr, 1)
+
+static inline
+uint32_t bfin_atomic_sub32(uint32_t *__bfin_ptr, uint32_t __bfin_dec)
+{
+	uint32_t __bfin_ret;
+	/* Input:    P0: memory address to use
+	 *           R0: value to subtract
+	 * Output:   R0: new contents of the memory address
+	 *           R1: previous contents of the memory address
+	 */
+	__asm__ __volatile__(
+		"CALL (%[__bfin_func])"
+		: "=q0" (__bfin_ret), "=m" (*__bfin_ptr)
+		: [__bfin_func] "a" (ATOMIC_SUB32), "q0" (__bfin_dec),
+		  "qA" (__bfin_ptr), "m" (*__bfin_ptr)
+		: "R1", "RETS", "memory"
+	);
+	return __bfin_ret;
+}
+#define bfin_atomic_dec32(ptr)        bfin_atomic_sub32(ptr, 1)
+
+static inline
+uint32_t bfin_atomic_ior32(uint32_t *__bfin_ptr, uint32_t __bfin_ior)
+{
+	uint32_t __bfin_ret;
+	/* Input:    P0: memory address to use
+	 *           R0: value to ior
+	 * Output:   R0: new contents of the memory address
+	 *           R1: previous contents of the memory address
+	 */
+	__asm__ __volatile__(
+		"CALL (%[__bfin_func])"
+		: "=q0" (__bfin_ret), "=m" (*__bfin_ptr)
+		: [__bfin_func] "a" (ATOMIC_IOR32), "q0" (__bfin_ior),
+		  "qA" (__bfin_ptr), "m" (*__bfin_ptr)
+		: "R1", "RETS", "memory"
+	);
+	return __bfin_ret;
+}
+
+static inline
+uint32_t bfin_atomic_and32(uint32_t *__bfin_ptr, uint32_t __bfin_and)
+{
+	uint32_t __bfin_ret;
+	/* Input:    P0: memory address to use
+	 *           R0: value to and
+	 * Output:   R0: new contents of the memory address
+	 *           R1: previous contents of the memory address
+	 */
+	__asm__ __volatile__(
+		"CALL (%[__bfin_func])"
+		: "=q0" (__bfin_ret), "=m" (*__bfin_ptr)
+		: [__bfin_func] "a" (ATOMIC_AND32), "q0" (__bfin_and),
+		  "qA" (__bfin_ptr), "m" (*__bfin_ptr)
+		: "R1", "RETS", "memory"
+	);
+	return __bfin_ret;
+}
+
+static inline
+uint32_t bfin_atomic_xor32(uint32_t *__bfin_ptr, uint32_t __bfin_xor)
+{
+	uint32_t __bfin_ret;
+	/* Input:    P0: memory address to use
+	 *           R0: value to xor
+	 * Output:   R0: new contents of the memory address
+	 *           R1: previous contents of the memory address
+	 */
+	__asm__ __volatile__(
+		"CALL (%[__bfin_func])"
+		: "=q0" (__bfin_ret), "=m" (*__bfin_ptr)
+		: [__bfin_func] "a" (ATOMIC_XOR32), "q0" (__bfin_xor),
+		  "qA" (__bfin_ptr), "m" (*__bfin_ptr)
+		: "R1", "RETS", "memory"
+	);
+	return __bfin_ret;
+}
+
+#endif
+
+#endif
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bfin_l1layout.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bfin_l1layout.h
new file mode 100644
index 0000000..00efd23
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bfin_l1layout.h
@@ -0,0 +1,17 @@
+#define L1_SCRATCH_START	0xFFB00000
+
+/* Data that is "mapped" into the process VM at the start of the L1 scratch
+   memory, so that each process can access it at a fixed address.  Used for
+   stack checking.  */
+struct l1_scratch_task_info
+{
+	/* Points to the start of the stack.  */
+	void *stack_start;
+	/* Not updated by the kernel; a user process can modify this to
+	   keep track of the lowest address of the stack pointer during its
+	   runtime.  */
+	void *lowest_sp;
+};
+
+/* A pointer to the structure in memory.  */
+#define L1_SCRATCH_TASK_INFO ((struct l1_scratch_task_info *)L1_SCRATCH_START)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bfin_sram.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bfin_sram.h
new file mode 100644
index 0000000..278514d
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bfin_sram.h
@@ -0,0 +1,31 @@
+/*
+ * bfin_sram.h - userspace interface to L1 memory allocator
+ *
+ * Copyright (c) 2007 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef __BFIN_SRAM_H__
+#define __BFIN_SRAM_H__
+
+#include <features.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+#define L1_INST_SRAM            0x00000001
+#define L1_DATA_A_SRAM          0x00000002
+#define L1_DATA_B_SRAM          0x00000004
+#define L1_DATA_SRAM            0x00000006
+#define L2_SRAM			0x00000008
+
+extern void *sram_alloc(size_t size, unsigned long flags)
+	__attribute_malloc__ __attribute_warn_unused_result__;
+extern int sram_free(const void *addr);
+extern void *dma_memcpy(void *dest, const void *src, size_t len)
+	__nonnull((1, 2));
+
+__END_DECLS
+
+#endif
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/byteswap.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/byteswap.h
new file mode 100644
index 0000000..a727002
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/byteswap.h
@@ -0,0 +1,34 @@
+/* File: libc/sysdeps/linux/bfin/bits/byteswap.h
+ *
+ * Copyright 2004-2006 Analog Devices Inc.
+ *
+ * Enter bugs at http://blackfin.uclinux.org/
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef _ASM_BITS_BYTESWAP_H
+#define _ASM_BITS_BYTESWAP_H 1
+
+#define __bswap_non_constant_16(x) \
+     (__extension__							      \
+      ({ register unsigned short int __v;				      \
+	 __asm__ ("%0 = PACK (%1.L, %1.L);"				      \
+		  "%0 >>= 8;"						      \
+		  : "=d" (__v)						      \
+		  : "d" (x));						      \
+	 __v; }))
+
+#define __bswap_non_constant_32(x) \
+     (__extension__							      \
+      ({ register unsigned int __v;					      \
+	 __asm__ ("%1 = %0 >> 8 (V);"					      \
+		  "%0 = %0 << 8 (V);"					      \
+		  "%0 = %0 | %1;"					      \
+		  "%1 = PACK(%0.L, %0.H);"				      \
+		  : "+d"(x), "=&d"(__v));				      \
+	 __v; }))
+
+#endif
+
+#include <bits/byteswap-common.h>
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/elf-fdpic.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/elf-fdpic.h
new file mode 100644
index 0000000..b7e87b8
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/elf-fdpic.h
@@ -0,0 +1,115 @@
+/* Copyright 2003, 2004 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.
+
+In addition to the permissions in the GNU Lesser General Public
+License, the Free Software Foundation gives you unlimited
+permission to link the compiled version of this file with other
+programs, and to distribute those programs without any restriction
+coming from the use of this file.  (The GNU Lesser General Public
+License restrictions do apply in other respects; for example, they
+cover modification of the file, and distribution when not linked
+into another program.)
+
+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
+Library 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; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#ifndef _BITS_ELF_FDPIC_H
+#define _BITS_ELF_FDPIC_H
+
+/* These data structures are described in the FDPIC ABI extension.
+   The kernel passes a process a memory map, such that for every LOAD
+   segment there is an elf32_fdpic_loadseg entry.  A pointer to an
+   elf32_fdpic_loadmap is passed in GR8 at start-up, and a pointer to
+   an additional such map is passed in GR9 for the interpreter, when
+   there is one.  */
+
+#include <elf.h>
+
+/* This data structure represents a PT_LOAD segment.  */
+struct elf32_fdpic_loadseg
+{
+  /* Core address to which the segment is mapped.  */
+  Elf32_Addr addr;
+  /* VMA recorded in the program header.  */
+  Elf32_Addr p_vaddr;
+  /* Size of this segment in memory.  */
+  Elf32_Word p_memsz;
+};
+
+struct elf32_fdpic_loadmap {
+  /* Protocol version number, must be zero.  */
+  Elf32_Half version;
+  /* Number of segments in this map.  */
+  Elf32_Half nsegs;
+  /* The actual memory map.  */
+  struct elf32_fdpic_loadseg segs[/*nsegs*/];
+};
+
+struct elf32_fdpic_loadaddr {
+  struct elf32_fdpic_loadmap *map;
+  void *got_value;
+};
+
+/* Map a pointer's VMA to its corresponding address according to the
+   load map.  */
+static __always_inline void *
+__reloc_pointer (void *p,
+		 const struct elf32_fdpic_loadmap *map)
+{
+  int c;
+
+#if 0
+  if (map->version != 0)
+    /* Crash.  */
+    ((void(*)())0)();
+#endif
+
+  /* No special provision is made for NULL.  We don't want NULL
+     addresses to go through relocation, so they shouldn't be in
+     .rofixup sections, and, if they're present in dynamic
+     relocations, they shall be mapped to the NULL address without
+     undergoing relocations.  */
+
+  for (c = 0;
+       /* Take advantage of the fact that the loadmap is ordered by
+	  virtual addresses.  In general there will only be 2 entries,
+	  so it's not profitable to do a binary search.  */
+       c < map->nsegs && p >= (void*)map->segs[c].p_vaddr;
+       c++)
+    {
+      /* This should be computed as part of the pointer comparison
+	 above, but we want to use the carry in the comparison, so we
+	 can't convert it to an integer type beforehand.  */
+      unsigned long offset = p - (void*)map->segs[c].p_vaddr;
+      /* We only check for one-past-the-end for the last segment,
+	 assumed to be the data segment, because other cases are
+	 ambiguous in the absence of padding between segments, and
+	 rofixup already serves as padding between text and data.
+	 Unfortunately, unless we special-case the last segment, we
+	 fail to relocate the _end symbol.  */
+      if (offset < map->segs[c].p_memsz
+	  || (offset == map->segs[c].p_memsz && c + 1 == map->nsegs))
+	return (char*)map->segs[c].addr + offset;
+    }
+
+  /* We might want to crash instead.  */
+  return (void*)-1;
+}
+
+# define __RELOC_POINTER(ptr, loadaddr) \
+  (__reloc_pointer ((void*)(ptr), \
+		    (loadaddr).map))
+
+#endif /* _BITS_ELF_FDPIC_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/endian.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/endian.h
new file mode 100644
index 0000000..8a36cf7
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/endian.h
@@ -0,0 +1,7 @@
+/* Blackfin is Little-endian.  */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/fcntl.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/fcntl.h
new file mode 100644
index 0000000..f019b71
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/fcntl.h
@@ -0,0 +1,238 @@
+/* O_*, F_*, FD_* bit values for Linux.
+   Copyright (C) 2000 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	_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	   0003
+#define O_RDONLY	     00
+#define O_WRONLY	     01
+#define O_RDWR		     02
+#define O_CREAT		   0100	/* not fcntl */
+#define O_EXCL		   0200	/* not fcntl */
+#define O_NOCTTY	   0400	/* not fcntl */
+#define O_TRUNC		  01000	/* not fcntl */
+#define O_APPEND	  02000
+#define O_NONBLOCK	  04000
+#define O_NDELAY	O_NONBLOCK
+#define O_SYNC		 010000
+#define O_FSYNC		 O_SYNC
+#define O_ASYNC		 020000
+
+#ifdef __USE_GNU
+# define O_DIRECTORY	 040000	/* Must be a directory.	 */
+# define O_NOFOLLOW	0100000	/* Do not follow links.	 */
+# define O_DIRECT	0200000	/* Direct disk access.	*/
+# define O_NOATIME	01000000	/* don't set atime */
+# define O_CLOEXEC	02000000	/* set close_on_exec */
+#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
+
+#ifdef __USE_LARGEFILE64
+# define O_LARGEFILE	0400000
+#endif
+
+/* Values for the second argument to `fcntl'.  */
+#define F_DUPFD		0	/* Duplicate file descriptor.  */
+#define F_GETFD		1	/* Get file descriptor flags.  */
+#define F_SETFD		2	/* Set file descriptor flags.  */
+#define F_GETFL		3	/* Get file status flags.  */
+#define F_SETFL		4	/* Set file status flags.  */
+#ifndef __USE_FILE_OFFSET64
+# define F_GETLK	5	/* Get record locking info.  */
+# define F_SETLK	6	/* Set record locking info (non-blocking).  */
+# define F_SETLKW	7	/* Set record locking info (blocking).	*/
+#else
+# define F_GETLK	F_GETLK64  /* Get record locking info.	*/
+# define F_SETLK	F_SETLK64  /* Set record locking info (non-blocking).*/
+# define F_SETLKW	F_SETLKW64 /* Set record locking info (blocking).  */
+#endif
+#define F_GETLK64	12	/* Get record locking info.  */
+#define F_SETLK64	13	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	14	/* Set record locking info (blocking).	*/
+
+#if defined __USE_BSD || defined __USE_XOPEN2K
+# define F_SETOWN	8	/* Get owner of socket (receiver of SIGIO).  */
+# define F_GETOWN	9	/* Set owner of socket (receiver of SIGIO).  */
+#endif
+
+#ifdef __USE_GNU
+# define F_SETSIG	10	/* Set number of signal to be sent.  */
+# define F_GETSIG	11	/* Get number of signal to be sent.  */
+#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.	 */
+# define F_DUPFD_CLOEXEC 1030	/* Duplicate file descriptor with
+				   close-on-exit set on new fd.  */
+#endif
+
+/* For F_[GET|SET]FL.  */
+#define FD_CLOEXEC	1	/* actually anything with low bit set goes */
+
+/* For posix fcntl() and `l_type' field of a `struct flock' for lockf().  */
+#define F_RDLCK		0	/* Read lock.  */
+#define F_WRLCK		1	/* Write lock.	*/
+#define F_UNLCK		2	/* Remove lock.	 */
+
+/* For old implementation of bsd flock().  */
+#define F_EXLCK		4	/* or 3 */
+#define F_SHLCK		8	/* or 4 */
+
+#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 operations.	 */
+#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 int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+#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.  */
+#endif
+
+__BEGIN_DECLS
+
+#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__
+
+/* 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);
+
+#endif
+__END_DECLS
+
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/huge_val.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/huge_val.h
new file mode 100644
index 0000000..9c8b721
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/huge_val.h
@@ -0,0 +1,56 @@
+/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity).
+   Used by <stdlib.h> and <math.h> functions for overflow.
+   Blackfin version.
+   Copyright (C) 1992, 95, 96, 97, 98, 99, 2000, 2004
+   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 _MATH_H
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+#endif
+
+/* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
+
+#if __GNUC_PREREQ(3,3)
+# define HUGE_VAL  (__builtin_huge_val())
+#elif __GNUC_PREREQ(2,96)
+# define HUGE_VAL (__extension__ 0x1.0p2047)
+#elif defined __GNUC__
+
+# define HUGE_VAL \
+  (__extension__							      \
+   ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; })   \
+    { __l: 0x000000007ff00000ULL }).__d)
+
+#else /* not GCC */
+
+# include <endian.h>
+
+typedef union { unsigned char __c[8]; double __d; } __huge_val_t;
+
+# if __BYTE_ORDER == __BIG_ENDIAN
+#  define __HUGE_VAL_bytes	{ 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 }
+# endif
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+#  define __HUGE_VAL_bytes	{ 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }
+# endif
+
+static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
+# define HUGE_VAL	(__huge_val.__d)
+
+#endif	/* GCC.  */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/kernel_stat.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/kernel_stat.h
new file mode 100644
index 0000000..7700d61
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/kernel_stat.h
@@ -0,0 +1,49 @@
+#ifndef _BITS_STAT_STRUCT_H
+#define _BITS_STAT_STRUCT_H
+
+/* This file provides whatever this particular arch's kernel thinks
+ * struct kernel_stat should look like...  It turns out each arch has a
+ * different opinion on the subject... */
+
+struct kernel_stat {
+	unsigned short st_dev;
+	unsigned short __pad1;
+	unsigned long st_ino;
+	unsigned short st_mode;
+	unsigned short st_nlink;
+	unsigned short st_uid;
+	unsigned short st_gid;
+	unsigned short st_rdev;
+	unsigned short __pad2;
+	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 short	st_dev;
+	unsigned char	__pad0[10];
+#define _HAVE_STAT64___ST_INO
+	unsigned long	__st_ino;
+	unsigned int	st_mode;
+	unsigned int	st_nlink;
+	unsigned long	st_uid;
+	unsigned long	st_gid;
+	unsigned short	st_rdev;
+	unsigned char	__pad3[10];
+	long long	st_size;
+	unsigned long	st_blksize;
+	unsigned long	st_blocks;	/* Number 512-byte blocks allocated. */
+	unsigned long	__pad4;		/* future possible st_blocks high bits */
+	struct timespec	st_atim;
+	struct timespec	st_mtim;
+	struct timespec	st_ctim;
+	unsigned long long	st_ino;
+};
+
+#endif	/*  _BITS_STAT_STRUCT_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/kernel_types.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/kernel_types.h
new file mode 100644
index 0000000..9fec595
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/kernel_types.h
@@ -0,0 +1,46 @@
+/* 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 __ARCH_BFIN_POSIX_TYPES_H
+#define __ARCH_BFIN_POSIX_TYPES_H
+typedef unsigned short	__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 int	__kernel_ipc_pid_t;
+typedef unsigned int	__kernel_uid_t;
+typedef unsigned int	__kernel_gid_t;
+typedef unsigned int	__kernel_size_t;
+typedef int		__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_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 long long	__kernel_loff_t;
+typedef __kernel_dev_t	__kernel_old_dev_t;
+typedef long		__kernel_long_t;
+typedef unsigned long	__kernel_ulong_t;
+
+typedef struct {
+#ifdef __USE_ALL
+	int val[2];
+#else
+	int __val[2];
+#endif
+} __kernel_fsid_t;
+
+#endif /* __ARCH_BFIN_POSIX_TYPES_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/setjmp.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/setjmp.h
new file mode 100644
index 0000000..adb9c23
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/setjmp.h
@@ -0,0 +1,57 @@
+/* Copyright (C) 1997, 1998 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.  */
+
+/* Define the machine-dependent type `jmp_buf'.  bfin version.  Lineo, Inc. 2001*/
+#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
+/* Jump buffer contains r7-r4, p5-p3, fp, sp and pc.  Other registers are not saved.  */
+typedef struct
+{
+	unsigned long __pregs[6];
+	unsigned long fp;
+	unsigned long sp;
+	unsigned long __rregs[8];
+	unsigned long astat;
+	unsigned long __lcregs[2];
+	unsigned long a0w;
+	unsigned long a0x;
+	unsigned long a1w;
+	unsigned long a1x;
+	unsigned long __iregs[4];
+	unsigned long __mregs[4];
+	unsigned long __lregs[4];
+	unsigned long __bregs[4];
+	unsigned long pc;
+}__jmp_buf[1];
+
+#endif
+
+#define __JMP_BUF_SP	8
+
+/* Test if longjmp to JMPBUF would unwind the frame
+   containing a local variable at ADDRESS.  */
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((void *) (address) < (void *) (jmpbuf)->fp)
+
+#endif	/* bits/setjmp.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/sigcontextinfo.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/sigcontextinfo.h
new file mode 100644
index 0000000..b7e08cf
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/sigcontextinfo.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>, 1998.
+
+   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.  */
+
+#define SIGCONTEXT int _code, struct sigcontext *
+#define SIGCONTEXT_EXTRA_ARGS _code,
+#define GET_PC(ctx)	((void *) (ctx)->sc_pc)
+#define GET_FRAME(ctx)	((void *) __builtin_frame_address (1))
+#define GET_STACK(ctx)	((void *) (ctx)->sc_usp)
+#define CALL_SIGHANDLER(handler, signo, ctx) \
+  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/stackinfo.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/stackinfo.h
new file mode 100644
index 0000000..9e26de1
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/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 blackfin the stack grows down.  */
+#define _STACK_GROWS_DOWN	1
+
+#endif	/* stackinfo.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/syscalls.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/syscalls.h
new file mode 100644
index 0000000..da549ff
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/syscalls.h
@@ -0,0 +1,47 @@
+#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__
+
+#define INTERNAL_SYSCALL_NCS(name, err, nr, args...)	\
+(__extension__ \
+ ({							\
+	long __res;					\
+	__asm__ __volatile__ (				\
+		"excpt 0;\n\t"				\
+		: "=q0" (__res)				\
+		: "qA"  (name) ASMFMT_##nr(args)	\
+		: "memory","CC");			\
+	__res;						\
+  }) \
+)
+#define ASMFMT_0()
+
+#define ASMFMT_1(arg1) \
+	, "q0" ((long)(arg1))
+
+#define ASMFMT_2(arg1, arg2) \
+	ASMFMT_1(arg1) \
+	, "q1" ((long)(arg2))
+
+#define ASMFMT_3(arg1, arg2, arg3) \
+	ASMFMT_2(arg1, arg2) \
+	, "q2" ((long)(arg3))
+
+#define ASMFMT_4(arg1, arg2, arg3, arg4) \
+	ASMFMT_3(arg1, arg2, arg3) \
+	, "q3" ((long)(arg4))
+
+#define ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
+	ASMFMT_4(arg1, arg2, arg3, arg4) \
+	, "q4" ((long)(arg5))
+
+#define ASMFMT_6(arg1, arg2, arg3, arg4, arg5, arg6) \
+	ASMFMT_5(arg1, arg2, arg3, arg4, arg5) \
+	, "q5" ((long)(arg6))
+
+#endif /* __ASSEMBLER__ */
+#endif /* _BITS_SYSCALLS_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/typesizes.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/typesizes.h
new file mode 100644
index 0000000..eb61fc9
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/typesizes.h
@@ -0,0 +1,66 @@
+/* bits/typesizes.h -- underlying types for *_t.  Generic version.
+   Copyright (C) 2002, 2003 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 _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_TYPE
+#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __MODE_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
+#define __OFF_T_TYPE		__SLONGWORD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__ID_T_TYPE		__U32_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __SWBLK_T_TYPE		__SLONGWORD_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		void *
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+#define __SSIZE_T_TYPE		__SLONGWORD_TYPE
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h
new file mode 100644
index 0000000..ce63c80
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h
@@ -0,0 +1,47 @@
+/*
+ * 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 */
+#define __UCLIBC_ABORT_INSTRUCTION__ ".short 2"	/* invalid 116bit insn */
+
+/* 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/bfin/bits/wordsize.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/wordsize.h
new file mode 100644
index 0000000..ba643b6
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bits/wordsize.h
@@ -0,0 +1,19 @@
+/* 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.  */
+
+#define __WORDSIZE	32
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bsd-_setjmp.S b/ap/build/uClibc/libc/sysdeps/linux/bfin/bsd-_setjmp.S
new file mode 100644
index 0000000..c365b4e
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bsd-_setjmp.S
@@ -0,0 +1,99 @@
+/* __setjmp for the Blackfin project
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ * Copyright (C) 2002, David McCullough <davidm@snapgear.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+.text
+.global __setjmp;
+.type	__setjmp,STT_FUNC;
+.align 4;
+
+__setjmp:
+	[--SP] = P0;	/* Save P0 */
+	P0 = R0;
+	R0 = [SP++];
+	[P0 + 0x00] = R0;	/* Save saved P0 */
+	[P0 + 0x04] = P1;
+	[P0 + 0x08] = P2;
+	[P0 + 0x0C] = P3;
+	[P0 + 0x10] = P4;
+	[P0 + 0x14] = P5;
+
+	[P0 + 0x18] = FP;	/* Frame Pointer */
+	[P0 + 0x1C] = SP;	/* Stack Pointer */
+
+	[P0 + 0x20] = P0;	/* Data Registers */
+	[P0 + 0x24] = R1;
+	[P0 + 0x28] = R2;
+	[P0 + 0x2C] = R3;
+	[P0 + 0x30] = R4;
+	[P0 + 0x34] = R5;
+	[P0 + 0x38] = R6;
+	[P0 + 0x3C] = R7;
+
+	R0 = ASTAT;
+	[P0 + 0x40] = R0;
+
+	R0 = LC0;		/* Loop Counters */
+	[P0 + 0x44] = R0;
+	R0 = LC1;
+	[P0 + 0x48] = R0;
+
+	R0 = A0.W;		/* Accumulators */
+	[P0 + 0x4C] = R0;
+	R0 = A0.X;
+	[P0 + 0x50] = R0;
+	R0 = A1.W;
+	[P0 + 0x54] = R0;
+	R0 = A1.X;
+	[P0 + 0x58] = R0;
+
+	R0 = I0;		/* Index Registers */
+	[P0 + 0x5C] = R0;
+	R0 = I1;
+	[P0 + 0x60] = R0;
+	R0 = I2;
+	[P0 + 0x64] = R0;
+	R0 = I3;
+	[P0 + 0x68] = R0;
+
+	R0 = M0;		/* Modifier Registers */
+	[P0 + 0x6C] = R0;
+	R0 = M1;
+	[P0 + 0x70] = R0;
+	R0 = M2;
+	[P0 + 0x74] = R0;
+	R0 = M3;
+	[P0 + 0x78] = R0;
+
+	R0 = L0;		/* Length Registers */
+	[P0 + 0x7c] = R0;
+	R0 = L1;
+	[P0 + 0x80] = R0;
+	R0 = L2;
+	[P0 + 0x84] = R0;
+	R0 = L3;
+	[P0 + 0x88] = R0;
+
+	R0 = B0;		/* Base Registers */
+	[P0 + 0x8C] = R0;
+	R0 = B1;
+	[P0 + 0x90] = R0;
+	R0 = B2;
+	[P0 + 0x94] = R0;
+	R0 = B3;
+	[P0 + 0x98] = R0;
+
+	R0 = RETS;
+	[P0 + 0x9C] = R0;
+
+	R0 = [P0 + 0x20];
+	R1 = 0;
+	JUMP.L ___sigjmp_save;
+
+.size __setjmp,.-__setjmp
+
+.section .note.GNU-stack,"",%progbits
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/bsdsetjmp.c b/ap/build/uClibc/libc/sysdeps/linux/bfin/bsdsetjmp.c
new file mode 100644
index 0000000..0a57d34
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/bsdsetjmp.c
@@ -0,0 +1,103 @@
+/* setjmp for the Blackfin project
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ * Copyright (C) 2003 Metrowerks
+ * Based on code from Analog Devices.
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <setjmp.h>
+
+#undef setjmp
+
+int setjmp(jmp_buf env)
+{
+	__asm__ __volatile__(
+		"[--SP] = p0;\n\t"
+		"p0 = r0;\n\t"
+		"r0 = [SP++];\n\t"
+
+		"[p0++] = r0;\n\t"       /* GP address registers */
+		"[p0++] = p1;\n\t"
+		"[p0++] = p2;\n\t"
+		"[p0++] = p3;\n\t"
+		"[p0++] = p4;\n\t"
+		"[p0++] = p5;\n\t"
+
+		"[p0++] = FP;\n\t"       /* frame pointer */
+		"[p0++] = SP;\n\t"       /* stack pointer */
+
+		"[p0++] = p0;\n\t"       /* data regs */
+		"[p0++] = r1;\n\t"
+		"[p0++] = r2;\n\t"
+		"[p0++] = r3;\n\t"
+		"[p0++] = r4;\n\t"
+		"[p0++] = r5;\n\t"
+		"[p0++] = r6;\n\t"
+		"[p0++] = r7;\n\t"
+
+		"r0 = ASTAT;\n\t"
+		"[p0++] = r0;\n\t"
+
+		"r0 = LC0;\n\t"          /* loop counters */
+		"[p0++] = r0;\n\t"
+		"r0 = LC1;\n\t"
+		"[p0++] = r0;\n\t"
+
+		"r0 = A0.w;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0.l = A0.x;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0 = A1.w;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0.l = A1.x;\n\t"
+		"[p0++] = r0;\n\t"
+
+                                 /* Dag regs */
+		"r0 = i0;\n\t"           /* index registers */
+		"[p0++] = r0;\n\t"
+		"r0 = i1;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0 = i2;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0 = i3;\n\t"
+		"[p0++] = r0;\n\t"
+
+		"r0 = m0;\n\t"           /* modifier registers */
+		"[p0++] = r0;\n\t"
+		"r0 = m1;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0 = m2;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0 = m3;\n\t"
+		"[p0++] = r0;\n\t"
+
+		"r0 = l0;\n\t"           /* length registers */
+		"[p0++] = r0;\n\t"
+		"r0 = l1;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0 = l2;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0 = l3;\n\t"
+		"[p0++] = r0;\n\t"
+
+		"r0 = b0;\n\t"           /* base registers */
+		"[p0++] = r0;\n\t"
+		"r0 = b1;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0 = b2;\n\t"
+		"[p0++] = r0;\n\t"
+		"r0 = b3;\n\t"
+		"[p0++] = r0;\n\t"
+
+		"r0 = RETS;\n\t"         /* store return address */
+		"[p0++] = r0;\n\t"
+
+		"r0 = 0;\n\t"
+		:
+		:
+	);
+
+	return 0;
+}
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/cacheflush.c b/ap/build/uClibc/libc/sysdeps/linux/bfin/cacheflush.c
new file mode 100644
index 0000000..a8d81c4
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/cacheflush.c
@@ -0,0 +1,14 @@
+/*
+ * cacheflush.c - Cache control functions for Blackfin.
+ *
+ * Copyright (C) 2010 Analog Devices Inc.
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/cachectl.h>
+
+_syscall3 (int, cacheflush, void *, start, const int, nbytes, const int, flags)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/clone.c b/ap/build/uClibc/libc/sysdeps/linux/bfin/clone.c
new file mode 100644
index 0000000..067fdc7
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/clone.c
@@ -0,0 +1,45 @@
+/*
+ * libc/sysdeps/linux/bfin/clone.c -- `clone' syscall for linux/blackfin
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sched.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+int
+clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...)
+{
+	long rval = -1;
+
+	if (fn && child_stack) {
+
+		__asm__ __volatile__ (
+			"excpt 0;"	/* Call sys_clone */
+			"cc = r0 == 0;"
+			"if !cc jump 1f;"	/* if (rval != 0) skip to parent */
+			"r0 = %4;"
+			"p0 = %5;"
+			"fp = 0;"
+#ifdef __BFIN_FDPIC__
+			"p1 = [p0];"
+			"p3 = [p0 + 4];"
+			"call (p1);"	/* Call cloned function */
+#else
+			"call (p0);"	/* Call cloned function */
+#endif
+			"p0 = %6;"
+			"excpt 0;"	/* Call sys_exit */
+			"1: nop;"
+			: "=q0" (rval)
+			: "qA" (__NR_clone), "q1" (child_stack), "q0" (flags), "a" (arg), "a" (fn), "i" (__NR_exit)
+			: "CC");
+
+	} else
+		__set_errno(EINVAL);
+
+	return rval;
+}
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/crt1.S b/ap/build/uClibc/libc/sysdeps/linux/bfin/crt1.S
new file mode 100644
index 0000000..22b2b76
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/crt1.S
@@ -0,0 +1,168 @@
+/* Copyright (C) 1991, 1992 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 Library General Public License as
+published by the Free Software Foundation; either version 2 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
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+
+/* When we enter this piece of code, the user stack looks like this:
+*      argc            argument counter (integer)
+*      argv[0]         program name (pointer)
+*      argv[1...N]     program args (pointers)
+*      NULL
+*      env[0...N]      environment variables (pointers)
+*      NULL
+	
+*   When we are done here, we want
+*	R0=argc
+*	R1=*argv[0]
+*	R2=*envp[0]  
+*/
+
+#include <features.h>
+
+#undef USE_GOT
+#if defined (__UCLIBC_FORMAT_SHARED_FLAT__) || defined (__UCLIBC_FORMAT_FLAT_SEP_DATA__)
+#define USE_GOT
+#endif
+
+#if !(defined L_Scrt1 && defined __UCLIBC_FORMAT_SHARED_FLAT__)
+
+.text
+.align 2
+.global __start;
+.type	__start,STT_FUNC;
+.weak	__init;
+.weak	__fini;
+.global	___uClibc_main;
+.type	___uClibc_main,STT_FUNC;
+
+/* Stick in a dummy reference to main(), so that if an application
+ * is linking when the main() function is in a static library (.a)
+ * we can be sure that main() actually gets linked in */
+
+.type	_main,STT_FUNC;
+
+__start:
+
+#if defined(__BFIN_FDPIC__) && !defined(L_Scrt1)
+	/* P0 contains a pointer to the program's load map.  */
+	call	.Lcall;
+.Lcall:
+	R4 = RETS;
+	SP += -12;
+	R0.L = .Lcall;
+	R0.H = .Lcall;
+	R1.L = __ROFIXUP_LIST__;
+	R1.H = __ROFIXUP_LIST__;
+	R2.L = __ROFIXUP_END__;
+	R2.H = __ROFIXUP_END__;
+	R1 = R1 - R0;
+	R1 = R1 + R4;
+	R2 = R2 - R0;
+	R2 = R2 + R4;
+	R0 = P0;
+	CALL	___self_reloc;
+	SP += 12;
+	P3 = R0;
+#endif
+
+/*	clear the frame pointer and the L registers.  */
+	FP = 0;
+	L0 = 0;
+	L1 = 0;
+	L2 = 0;
+	L3 = 0;
+
+#ifdef __ID_SHARED_LIB__
+	/* We know we have a local copy, so we can avoid the GOT.  */
+	CALL ___shared_flat_add_library;
+#endif
+/*	Load register R1 (argc) from the stack to its final resting place */
+	P0 = SP;
+	R1 = [P0++];
+
+/*	Copy argv pointer into R2 -- which its final resting place */
+	R2 = P0;
+
+	SP += -28;
+
+#ifndef __BFIN_FDPIC__
+	R7 = 0;
+#endif
+	/* Pass highest stack pointer to the app.  */
+	[SP + 24] = P2;
+	/* Store the pointer to ld.so's fini that we got in P1.  */
+	[SP + 20] = R7;
+
+/*	Ok, now run uClibc's main() -- shouldn't return */
+#if (defined L_crt1 || defined L_Scrt1) && defined __UCLIBC_CTOR_DTOR__
+
+#ifdef __BFIN_FDPIC__
+	R3 = [P3 + __init@FUNCDESC_GOT17M4];
+#elif defined USE_GOT
+	R3 = [P5 + ___shared_flat_init@GOT];
+#else
+	R3.H = __init;
+	R3.L = __init;
+#endif
+	[SP+12] = R3;
+
+
+#ifdef __BFIN_FDPIC__
+	R3 = [P3 + __fini@FUNCDESC_GOT17M4];
+#elif defined USE_GOT
+	R3 = [P5 + ___shared_flat_fini@GOT];
+#else	
+	R3.H = __fini;
+	R3.L = __fini;
+#endif
+	[SP+16] = R3;
+#else /* no ctor/dtor handling */
+	R3 = 0;
+	[SP + 12] = R3;
+	[SP + 16] = R3;
+#endif
+
+#ifdef __BFIN_FDPIC__
+	R0 = [P3 + _main@FUNCDESC_GOT17M4];
+#elif defined USE_GOT
+	R0 = [P5 + _main@GOT];
+#else
+	R0.H = _main;
+	R0.L = _main;
+#endif
+#ifdef USE_GOT
+	P0 = [P5 + ___uClibc_main@GOT];
+	jump (P0)
+#else
+	jump.l	___uClibc_main;
+#endif
+
+#else
+	.text
+	.global lib_main
+	.hidden lib_main
+	.type lib_main,@function
+lib_main:
+	RETS = [SP++];
+	/* We know we have a local copy, so we can avoid the GOT.  */
+	JUMP.L ___shared_flat_add_library;
+
+	.hidden _current_shared_library_p5_offset_
+#endif
+
+.section .note.GNU-stack,"",%progbits
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/crti.S b/ap/build/uClibc/libc/sysdeps/linux/bfin/crti.S
new file mode 100644
index 0000000..f2831cc
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/crti.S
@@ -0,0 +1,64 @@
+/* Specialized code needed to support construction and destruction of
+   file-scope objects in C++ and Java code, and to support exception handling.
+   Copyright (C) 1999 Free Software Foundation, Inc.
+   Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, if you link this library with files
+   compiled with GCC to produce an executable, this does not cause
+   the resulting executable to be covered by the GNU General Public License.
+   This exception does not however invalidate any other reasons why
+   the executable file might be covered by the GNU General Public License.  */
+
+/*
+ * This file just supplies function prologues for the .init and .fini
+ * sections.  It is linked in before crtbegin.o.
+ */
+
+	.file   "crti.o"
+	.ident  "GNU C crti.o"
+
+	.section .init
+	.globl  __init
+	.type   __init,@function
+__init:
+#if defined __ID_SHARED_LIB__
+	[--SP] = P5;
+#elif defined __BFIN_FDPIC__
+	[--SP] = P3; 
+#endif
+	LINK 12;
+#if defined __ID_SHARED_LIB__
+	P5 = [P5 + _current_shared_library_p5_offset_]
+#endif	
+	.section .fini
+	.globl  __fini
+	.type   __fini,@function
+__fini:
+#if defined __ID_SHARED_LIB__
+	[--SP] = P5; 
+#elif defined __BFIN_FDPIC__
+	[--SP] = P3; 
+#endif
+	LINK 12; 
+#if defined __ID_SHARED_LIB__
+	P5 = [P5 + _current_shared_library_p5_offset_]
+#endif	
+
+.section .note.GNU-stack,"",%progbits
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/crtn.S b/ap/build/uClibc/libc/sysdeps/linux/bfin/crtn.S
new file mode 100644
index 0000000..a35ebe0
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/crtn.S
@@ -0,0 +1,55 @@
+/* Specialized code needed to support construction and destruction of
+   file-scope objects in C++ and Java code, and to support exception handling.
+   Copyright (C) 1999 Free Software Foundation, Inc.
+   Contributed by Charles-Antoine Gauthier (charles.gauthier@iit.nrc.ca).
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, if you link this library with files
+   compiled with GCC to produce an executable, this does not cause
+   the resulting executable to be covered by the GNU General Public License.
+   This exception does not however invalidate any other reasons why
+   the executable file might be covered by the GNU General Public License.  */
+
+/*
+ * This file supplies function epilogues for the .init and .fini sections.
+ * It is linked in after all other files.
+ */
+
+	.file   "crtn.o"
+	.ident  "GNU C crtn.o"
+
+	.section .init
+	unlink; 
+#if defined __ID_SHARED_LIB__
+	P5 = [SP++];
+#elif defined __BFIN_FDPIC__
+	P3 = [SP++];
+#endif
+	rts;
+
+	.section .fini
+	unlink;
+#if defined __ID_SHARED_LIB__
+	P5 = [SP++];
+#elif defined __BFIN_FDPIC__
+	P3 = [SP++];
+#endif
+	rts;
+
+.section .note.GNU-stack,"",%progbits
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/crtreloc.c b/ap/build/uClibc/libc/sysdeps/linux/bfin/crtreloc.c
new file mode 100644
index 0000000..a44b50b
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/crtreloc.c
@@ -0,0 +1,145 @@
+/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   written by Alexandre Oliva <aoliva@redhat.com>
+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.
+
+In addition to the permissions in the GNU Lesser General Public
+License, the Free Software Foundation gives you unlimited
+permission to link the compiled version of this file with other
+programs, and to distribute those programs without any restriction
+coming from the use of this file.  (The GNU Lesser General Public
+License restrictions do apply in other respects; for example, they
+cover modification of the file, and distribution when not linked
+into another program.)
+
+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
+Library 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; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#ifdef __BFIN_FDPIC__
+
+#include <sys/types.h>
+#include <link.h>
+
+/* This file is to be compiled into crt object files, to enable
+   executables to easily self-relocate.  */
+
+union word {
+    char c[4];
+    void *v;
+};
+
+/* Compute the runtime address of pointer in the range [p,e), and then
+   map the pointer pointed by it.  */
+static __always_inline void ***
+reloc_range_indirect (void ***p, void ***e,
+		      const struct elf32_fdpic_loadmap *map)
+{
+  while (p < e)
+    {
+      if (*p != (void **)-1)
+	{
+	  void *ptr = __reloc_pointer (*p, map);
+	  if (ptr != (void *)-1)
+	    {
+	      void *pt;
+	      if ((long)ptr & 3)
+		{
+		  unsigned char *c = ptr;
+		  int i;
+		  unsigned long v = 0;
+		  for (i = 0; i < 4; i++)
+		    v |= c[i] << 8 * i;
+		  pt = (void *)v;
+		}
+	      else
+		pt = *(void**)ptr;
+	      pt = __reloc_pointer (pt, map);
+	      if ((long)ptr & 3)
+		{
+		  unsigned char *c = ptr;
+		  int i;
+		  unsigned long v = (unsigned long)pt;
+		  for (i = 0; i < 4; i++, v >>= 8)
+		    c[i] = v;
+		}
+	      else
+		*(void**)ptr = pt;
+	    }
+	}
+      p++;
+    }
+  return p;
+}
+
+/* Call __reloc_range_indirect for the given range except for the last
+   entry, whose contents are only relocated.  It's expected to hold
+   the GOT value.  */
+attribute_hidden void*
+__self_reloc (const struct elf32_fdpic_loadmap *map,
+	      void ***p, void ***e)
+{
+  p = reloc_range_indirect (p, e-1, map);
+
+  if (p >= e)
+    return (void*)-1;
+
+  return __reloc_pointer (*p, map);
+}
+
+#if 0
+/* These are other functions that might be useful, but that we don't
+   need.  */
+
+/* Remap pointers in [p,e).  */
+static __always_inline void**
+reloc_range (void **p, void **e,
+	     const struct elf32_fdpic_loadmap *map)
+{
+  while (p < e)
+    {
+      *p = __reloc_pointer (*p, map);
+      p++;
+    }
+  return p;
+}
+
+/* Remap p, adjust e by the same offset, then map the pointers in the
+   range determined by them.  */
+void attribute_hidden
+__reloc_range (const struct elf32_fdpic_loadmap *map,
+	       void **p, void **e)
+{
+  void **old = p;
+
+  p = __reloc_pointer (p, map);
+  e += p - old;
+  reloc_range (p, e, map);
+}
+
+/* Remap p, adjust e by the same offset, then map pointers referenced
+   by the (unadjusted) pointers in the range.  Return the relocated
+   value of the last pointer in the range.  */
+void* attribute_hidden
+__reloc_range_indirect (const struct elf32_fdpic_loadmap *map,
+			void ***p, void ***e)
+{
+  void ***old = p;
+
+  p = __reloc_pointer (p, map);
+  e += p - old;
+  return reloc_range_indirect (p, e, map);
+}
+#endif
+
+#endif /* __BFIN_FDPIC__ */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/dma-memcpy.c b/ap/build/uClibc/libc/sysdeps/linux/bfin/dma-memcpy.c
new file mode 100644
index 0000000..b715aeb
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/dma-memcpy.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+#include <bfin_sram.h>
+
+_syscall3 (void *, dma_memcpy, void *, dest, const void *, src, size_t, len)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/setjmp.S b/ap/build/uClibc/libc/sysdeps/linux/bfin/setjmp.S
new file mode 100644
index 0000000..a2b6176
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/setjmp.S
@@ -0,0 +1,98 @@
+/* setjmp for the Blackfin project
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ * Copyright (C) 2003 Metrowerks
+ * Based on code from Analog Devices.
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+.text
+.global ___sigsetjmp;
+.type	___sigsetjmp,STT_FUNC;
+.align 4;
+
+___sigsetjmp:
+	[--SP] = P0;	/* Save P0 */
+	P0 = R0;
+	R0 = [SP++];
+	[P0 + 0x00] = R0;	/* Save saved P0 */
+	[P0 + 0x04] = P1;
+	[P0 + 0x08] = P2;
+	[P0 + 0x0C] = P3;
+	[P0 + 0x10] = P4;
+	[P0 + 0x14] = P5;
+
+	[P0 + 0x18] = FP;	/* Frame Pointer */
+	[P0 + 0x1C] = SP;	/* Stack Pointer */
+
+	[P0 + 0x20] = P0;	/* Data Registers */
+	[P0 + 0x24] = R1;
+	[P0 + 0x28] = R2;
+	[P0 + 0x2C] = R3;
+	[P0 + 0x30] = R4;
+	[P0 + 0x34] = R5;
+	[P0 + 0x38] = R6;
+	[P0 + 0x3C] = R7;
+
+	R0 = ASTAT;
+	[P0 + 0x40] = R0;
+
+	R0 = LC0;		/* Loop Counters */
+	[P0 + 0x44] = R0;
+	R0 = LC1;
+	[P0 + 0x48] = R0;
+
+	R0 = A0.W;		/* Accumulators */
+	[P0 + 0x4C] = R0;
+	R0 = A0.X;
+	[P0 + 0x50] = R0;
+	R0 = A1.W;
+	[P0 + 0x54] = R0;
+	R0 = A1.X;
+	[P0 + 0x58] = R0;
+
+	R0 = I0;		/* Index Registers */
+	[P0 + 0x5C] = R0;
+	R0 = I1;
+	[P0 + 0x60] = R0;
+	R0 = I2;
+	[P0 + 0x64] = R0;
+	R0 = I3;
+	[P0 + 0x68] = R0;
+
+	R0 = M0;		/* Modifier Registers */
+	[P0 + 0x6C] = R0;
+	R0 = M1;
+	[P0 + 0x70] = R0;
+	R0 = M2;
+	[P0 + 0x74] = R0;
+	R0 = M3;
+	[P0 + 0x78] = R0;
+
+	R0 = L0;		/* Length Registers */
+	[P0 + 0x7c] = R0;
+	R0 = L1;
+	[P0 + 0x80] = R0;
+	R0 = L2;
+	[P0 + 0x84] = R0;
+	R0 = L3;
+	[P0 + 0x88] = R0;
+
+	R0 = B0;		/* Base Registers */
+	[P0 + 0x8C] = R0;
+	R0 = B1;
+	[P0 + 0x90] = R0;
+	R0 = B2;
+	[P0 + 0x94] = R0;
+	R0 = B3;
+	[P0 + 0x98] = R0;
+
+	R0 = RETS;
+	[P0 + 0x9C] = R0;
+
+	R0 = [P0 + 0x20];
+	JUMP.L ___sigjmp_save; 
+.size ___sigsetjmp, .-___sigsetjmp
+
+.section .note.GNU-stack,"",%progbits
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/sram-alloc.c b/ap/build/uClibc/libc/sysdeps/linux/bfin/sram-alloc.c
new file mode 100644
index 0000000..8518119
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/sram-alloc.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+#include <bfin_sram.h>
+
+_syscall2 (__ptr_t, sram_alloc, size_t, len, unsigned long, flags)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/sram-free.c b/ap/build/uClibc/libc/sysdeps/linux/bfin/sram-free.c
new file mode 100644
index 0000000..8260eb6
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/sram-free.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+#include <bfin_sram.h>
+
+_syscall1 (int, sram_free, const void *, addr)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/cachectl.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/cachectl.h
new file mode 100644
index 0000000..ee4c031
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/cachectl.h
@@ -0,0 +1,25 @@
+/*
+ * cachectl.h - Functions for cache control on Blackfin.
+ *
+ * Copyright (C) 2010 Analog Devices, Inc.
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef _SYS_CACHECTL_H
+#define _SYS_CACHECTL_H	1
+
+#include <features.h>
+
+/*
+ * Get the kernel definition for the flag bits
+ */
+#include <asm/cachectl.h>
+
+__BEGIN_DECLS
+
+extern int cacheflush (void *addr, __const int nbytes, __const int flags);
+
+__END_DECLS
+
+#endif	/* sys/cachectl.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/elf.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/elf.h
new file mode 100644
index 0000000..d959cdc
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/elf.h
@@ -0,0 +1,26 @@
+/* Copyright (C) 1998, 2000 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/bfin/sys/io.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/io.h
new file mode 100644
index 0000000..81762be
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/io.h
@@ -0,0 +1,49 @@
+/* Copyright (C) 1996, 1998, 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.  */
+
+#ifndef	_SYS_IO_H
+
+#define	_SYS_IO_H	1
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* If TURN_ON is TRUE, request for permission to do direct i/o on the
+   port numbers in the range [FROM,FROM+NUM-1].  Otherwise, turn I/O
+   permission off for that range.  This call requires root privileges.  */
+extern int ioperm (unsigned long int __from, unsigned long int __num,
+		   int __turn_on) __THROW;
+libc_hidden_proto(ioperm)
+
+/* Set the I/O privilege level to LEVEL.  If LEVEL is nonzero,
+   permission to access any I/O port is granted.  This call requires
+   root privileges. */
+extern int iopl (int __level) __THROW;
+
+/* The functions that actually perform reads and writes.  */
+extern unsigned char inb (unsigned long int port) __THROW;
+extern unsigned short int inw (unsigned long int port) __THROW;
+extern unsigned long int inl (unsigned long int port) __THROW;
+
+extern void outb (unsigned char value, unsigned long int port) __THROW;
+extern void outw (unsigned short value, unsigned long int port) __THROW;
+extern void outl (unsigned long value, unsigned long int port) __THROW;
+
+__END_DECLS
+
+#endif /* _SYS_IO_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/procfs.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/procfs.h
new file mode 100644
index 0000000..45a65f3
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/procfs.h
@@ -0,0 +1,125 @@
+/* Copyright (C) 1996, 1997, 1999, 2000, 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_struct' 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_struct) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+/* Register set for the floating-point registers.  Empty on the Blackfin.  */
+typedef struct { } 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/bfin/sys/ucontext.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/ucontext.h
new file mode 100644
index 0000000..ac2ef94
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/ucontext.h
@@ -0,0 +1,152 @@
+/* Copyright (C) 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.  */
+
+/* System V/blackfin ABI compliant context switching support.  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+
+/* Type for general register.  */
+typedef int greg_t;
+
+/* Number of general registers.  */
+#define NGREG	47
+
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NGREG];
+
+/* Number of each register is the `gregset_t' array.  */
+enum
+{
+  REG_R0 = 0,
+#define REG_R0	REG_R0
+  REG_R1 = 1,
+#define REG_R1	REG_R1
+  REG_R2 = 2,
+#define REG_R2	REG_R2
+  REG_R3 = 3,
+#define REG_R3	REG_R3
+  REG_R4 = 4,
+#define REG_R4	REG_R4
+  REG_R5 = 5,
+#define REG_R5	REG_R5
+  REG_R6 = 6,
+#define REG_R6	REG_R6
+  REG_R7 = 7,
+#define REG_R7	REG_R7
+  REG_P0 = 8,
+#define REG_P0	REG_P0
+  REG_P1 = 9,
+#define REG_P1	REG_P1
+  REG_P2 = 10,
+#define REG_P2	REG_P2
+  REG_P3 = 11,
+#define REG_P3	REG_P3
+  REG_P4 = 12,
+#define REG_P4	REG_P4
+  REG_P5 = 13,
+#define REG_P5	REG_P5
+  REG_USP = 14,
+#define REG_USP	REG_USP
+  REG_A0W = 15,
+#define REG_A0W	REG_A0W
+  REG_A1W = 16,
+#define REG_A1W	REG_A1W
+  REG_A0X = 17,
+#define REG_A0X	REG_A0X
+  REG_A1X = 18,
+#define REG_A1X	REG_A1X
+  REG_ASTAT = 19,
+#define REG_ASTAT	REG_ASTAT
+  REG_RETS = 20,
+#define REG_RETS	REG_RETS
+  REG_PC= 21,
+#define REG_PC	REG_PC
+  REG_RETX = 22,
+#define REG_RETX	REG_RETX
+  REG_FP = 23,
+#define REG_FP	REG_FP
+  REG_I0 = 24,
+#define REG_I0	REG_I0
+  REG_I1 = 25,
+#define REG_I1	REG_I1
+  REG_I2 = 26,
+#define REG_I2	REG_I2
+  REG_I3 = 27,
+#define REG_I3	REG_I3
+  REG_M0 = 28,
+#define REG_M0	REG_M0
+  REG_M1 = 29,
+#define REG_M1	REG_M1
+  REG_M2 = 30,
+#define REG_M2	REG_M2
+  REG_M3 = 31,
+#define REG_M3	REG_M3
+  REG_L0 = 32,
+#define REG_L0	REG_L0
+  REG_L1 = 33,
+#define REG_L1	REG_L1
+  REG_L2 = 34,
+#define REG_L2	REG_L2
+  REG_L3 = 35,
+#define REG_L3	REG_L3
+  REG_B_0 = 36,
+#define REG_B0	REG_B0
+  REG_B1 = 37,
+#define REG_B1	REG_B1
+  REG_B2 = 38,
+#define REG_B2	REG_B2
+  REG_B3 = 39,
+#define REG_B3	REG_B3
+  REG_LC0 = 40,
+#define REG_LC0	REG_LC0
+  REG_LC1 = 41,
+#define REG_LC1	REG_LC1
+  REG_LT0 = 42,
+#define REG_LT0	REG_LT0
+  REG_LT1 = 43,
+#define REG_LT1	REG_LT1
+  REG_LB0 = 44,
+#define REG_LB0	REG_LB0
+  REG_LB1 = 45,
+#define REG_LB1	REG_LB1
+  REG_SEQSTAT = 46
+#define	REG_SEQSTAT	REG_SEQSTAT
+};
+
+/* Context to describe whole processor state.  */
+typedef struct
+{
+  gregset_t gregs;
+} mcontext_t;
+
+
+/* Userlevel context.  */
+typedef struct ucontext
+{
+  unsigned long int uc_flags;
+  struct ucontext *uc_link;
+  stack_t uc_stack;
+  mcontext_t uc_mcontext;
+  __sigset_t uc_sigmask;
+} ucontext_t;
+
+#endif /* sys/ucontext.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/user.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/user.h
new file mode 100644
index 0000000..558abd6
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/sys/user.h
@@ -0,0 +1,57 @@
+#ifndef _SYS_USER_H
+#define _SYS_USER_H
+
+struct user_bfinfp_struct {
+};
+
+/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
+   is still the layout used by user (the new pt_regs doesn't have
+   all registers). */
+struct user_regs_struct {
+	long r0, r1, r2, r3, r4, r5, r6, r7;
+	long p0, p1, p2, p3, p4, p5, usp, fp;
+	long i0, i1, i2, i3;
+	long l0, l1, l2, l3;
+	long b0, b1, b2, b3;
+	long m0, m1, m2, m3;
+	long a0w, a1w;
+	long a0x, a1x;
+	unsigned long rets;
+	unsigned long astat;
+	unsigned long pc;
+	unsigned long orig_p0;
+};
+
+/* When the kernel dumps core, it starts by dumping the user struct -
+   this will be used by gdb to figure out where the data and stack segments
+   are within the file, and what virtual addresses to use. */
+
+struct user {
+/* We start with the registers, to mimic the way that "memory" is returned
+   from the ptrace(3,...) function.  */
+
+	struct user_regs_struct regs;	/* Where the registers are actually stored */
+
+/* The rest of this junk is to help gdb figure out what goes where */
+	unsigned long int u_tsize;	/* Text segment size (pages). */
+	unsigned long int u_dsize;	/* Data segment size (pages). */
+	unsigned long int u_ssize;	/* Stack segment size (pages). */
+	unsigned long start_code;	/* Starting virtual address of text. */
+	unsigned long start_stack;	/* Starting virtual address of stack area.
+					   This is actually the bottom of the stack,
+					   the top of the stack is always found in the
+					   esp register.  */
+	long int signal;	/* Signal that caused the core dump. */
+	int reserved;		/* No longer used */
+	unsigned long u_ar0;
+	/* Used by gdb to help find the values for */
+	/* the registers. */
+	unsigned long magic;	/* To uniquely identify a core file */
+	char u_comm[32];	/* User command that was responsible */
+};
+#define NBPG PAGE_SIZE
+#define UPAGES 1
+#define HOST_TEXT_START_ADDR (u.start_code)
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
+
+#endif
diff --git a/ap/build/uClibc/libc/sysdeps/linux/bfin/sysdep.h b/ap/build/uClibc/libc/sysdeps/linux/bfin/sysdep.h
new file mode 100644
index 0000000..352fbf4
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/bfin/sysdep.h
@@ -0,0 +1,21 @@
+/*
+ * libc/sysdeps/linux/bfin/sysdep.h
+ *
+ * Copyright (C) 2007 Analog Devices Inc.
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef __BFIN_SYSDEP_H__
+#define __BFIN_SYSDEP_H__
+
+#include <common/sysdep.h>
+
+#ifdef __ASSEMBLER__
+
+#define ENTRY(sym) .global sym; .type sym, STT_FUNC; sym:
+#define ENDPROC(sym) .size sym, . - sym
+
+#endif
+
+#endif