zte's code,first commit
Change-Id: I9a04da59e459a9bc0d67f101f700d9d7dc8d681b
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/Makefile b/ap/build/uClibc/libc/sysdeps/linux/frv/Makefile
new file mode 100644
index 0000000..554fdb0
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/Makefile
@@ -0,0 +1,58 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+# ported to FR-V by Alexandre Oliva <aoliva@redhat.com>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+
+TOPDIR=../../../../
+include $(TOPDIR)Rules.mak
+
+CRT_SRC := crt0.S
+CRT_OBJ := crt0.o crt1.o
+SCRT_OBJ := $(patsubst %,S%, $(CRT_OBJ))
+
+CTOR_TARGETS := crti.o crtn.o
+
+SSRC := __longjmp.S setjmp.S clone.S vfork.S
+SOBJ := $(patsubst %.S,%.o, $(SSRC))
+
+CSRC = mmap.c sysdep.c syscall.c brk.c sbrk.c __init_brk.c dl-iterate-phdr.c
+CSRC += xstatconv.c stat.c stat64.c fstat.c fstat64.c lstat.c lstat64.c
+COBJ := $(patsubst %.c,%.o, $(CSRC))
+
+OBJS := $(SOBJ) $(COBJ)
+
+OBJ_LIST := ../../../obj.sysdeps.$(TARGET_ARCH)
+
+all: $(OBJ_LIST)
+
+$(OBJ_LIST): $(OBJS) $(CRT_OBJ) $(SCRT_OBJ) $(CTOR_TARGETS)
+ $(STRIPTOOL) -x -R .note -R .comment $^
+ $(INSTALL) -d $(TOPDIR)lib/
+ cp $(CRT_OBJ) $(SCRT_OBJ) $(CTOR_TARGETS) $(TOPDIR)lib/
+ echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $@
+
+$(CRT_OBJ): $(CRT_SRC) crtreloc.o
+ $(CC) $(ASFLAGS) -DL_$* -r -nostdlib $^ -o $*.o
+
+crtreloc.o: crtreloc.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(SCRT_OBJ): $(CRT_SRC) Scrtreloc.o
+ $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* -r -nostdlib $^ -o $*.o
+
+Scrtreloc.o: crtreloc.c
+ $(CC) $(CFLAGS) $(PIEFLAG) -c $< -o $@
+
+$(CTOR_TARGETS): %.o : %.S
+ $(CC) $(ASFLAGS) $(SSP_DISABLE_FLAGS) -c $< -o $@
+
+$(SOBJ): %.o : %.S
+ $(CC) $(ASFLAGS) -c $< -o $@
+
+$(COBJ): %.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ $(RM) *.o *~ core
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/__init_brk.c b/ap/build/uClibc/libc/sysdeps/linux/frv/__init_brk.c
new file mode 100644
index 0000000..7e4c8d1
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/__init_brk.c
@@ -0,0 +1,26 @@
+/* From libc-5.3.12 */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+void * __curbrk attribute_hidden = 0;
+
+#define __NR__brk __NR_brk
+attribute_hidden _syscall1(void *, _brk, void *, ptr)
+
+extern int __init_brk(void) attribute_hidden;
+int
+__init_brk (void)
+{
+ if (__curbrk == 0)
+ {
+ __curbrk = _brk(0);
+ if (__curbrk == 0)
+ {
+ __set_errno(ENOMEM);
+ return -1;
+ }
+ }
+ return 0;
+}
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/__longjmp.S b/ap/build/uClibc/libc/sysdeps/linux/frv/__longjmp.S
new file mode 100644
index 0000000..c3145c8
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/__longjmp.S
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+
+# setjmp/longjmp for Frv. The jmpbuf looks like this:
+#
+# Register jmpbuf offset
+# R16-R31 0x0-0x03c
+# R48-R63 0x40-0x7c
+# FR16-FR31 0x80-0xbc
+# FR48-FR63 0xc0-0xfc
+# LR 0x100
+# SP 0x104
+# FP 0x108
+#
+# R8 contains the pointer to jmpbuf
+
+ .text
+ .global __longjmp
+ .type __longjmp,@function
+__longjmp:
+ lddi @(gr8,0), gr16
+ lddi @(gr8,8), gr18
+ lddi @(gr8,16), gr20
+ lddi @(gr8,24), gr22
+ lddi @(gr8,32), gr24
+ lddi @(gr8,40), gr26
+ lddi @(gr8,48), gr28
+ lddi @(gr8,56), gr30
+#if __FRV_GPR__ != 32
+ lddi @(gr8,64), gr48
+ lddi @(gr8,72), gr50
+ lddi @(gr8,80), gr52
+ lddi @(gr8,88), gr54
+ lddi @(gr8,96), gr56
+ lddi @(gr8,104), gr58
+ lddi @(gr8,112), gr60
+ lddi @(gr8,120), gr62
+#endif
+
+#if __FRV_FPR__ != 0
+ lddfi @(gr8,128), fr16
+ lddfi @(gr8,136), fr18
+ lddfi @(gr8,144), fr20
+ lddfi @(gr8,152), fr22
+ lddfi @(gr8,160), fr24
+ lddfi @(gr8,168), fr26
+ lddfi @(gr8,176), fr28
+ lddfi @(gr8,184), fr30
+#if __FRV_FPR__ != 32
+ lddfi @(gr8,192), fr48
+ lddfi @(gr8,200), fr50
+ lddfi @(gr8,208), fr52
+ lddfi @(gr8,216), fr54
+ lddfi @(gr8,224), fr56
+ lddfi @(gr8,232), fr58
+ lddfi @(gr8,240), fr60
+ lddfi @(gr8,248), fr62
+#endif
+#endif
+
+ ldi @(gr8,256), gr4
+ movgs gr4,lr
+
+ ldi @(gr8,260), sp
+ ldi @(gr8,264), fp
+
+# Value to return is in r9. If zero, return 1
+ cmp gr9, gr0, icc0
+ setlos #1, gr8
+ ckne icc0, cc4
+ cmov gr9, gr8, cc4, 1
+ ret
+.Lend2:
+ .size __longjmp,.Lend2-__longjmp
+
+libc_hidden_def(__longjmp)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/bits/elf-fdpic.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/elf-fdpic.h
new file mode 100644
index 0000000..b7e87b8
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/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/frv/bits/endian.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/endian.h
new file mode 100644
index 0000000..3ce83c5
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/endian.h
@@ -0,0 +1,7 @@
+/* frv 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/frv/bits/fcntl.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/fcntl.h
new file mode 100644
index 0000000..d437175
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/fcntl.h
@@ -0,0 +1,217 @@
+/* O_*, F_*, FD_* bit values for Linux.
+ Copyright (C) 1995, 1996, 1997, 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 _FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+
+#include <sys/types.h>
+
+/* 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_DIRECT 040000 /* Direct disk access. */
+# define O_DIRECTORY 0200000 /* Must be a directory. */
+# define O_NOFOLLOW 0400000 /* Do not follow links. */
+# 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 0100000
+#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
+
+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/frv/bits/kernel_stat.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/kernel_stat.h
new file mode 100644
index 0000000..1cf5210
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/kernel_stat.h
@@ -0,0 +1,74 @@
+#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 char __pad1[6];
+ unsigned short st_dev;
+
+ unsigned long __pad2;
+ unsigned long st_ino;
+
+ unsigned short __pad3;
+ unsigned short st_mode;
+ unsigned short __pad4;
+ unsigned short st_nlink;
+
+ unsigned short __pad5;
+ unsigned short st_uid;
+ unsigned short __pad6;
+ unsigned short st_gid;
+
+ unsigned char __pad7[6];
+ unsigned short st_rdev;
+
+ unsigned long __pad8;
+ unsigned long st_size;
+
+ unsigned long __pad9; /* align 64-bit st_blocks to 2-word */
+ unsigned long st_blksize;
+
+ unsigned long __pad10; /* future possible st_blocks high bits */
+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
+
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+
+ unsigned long long __unused4;
+};
+
+struct kernel_stat64 {
+ unsigned char __pad1[6];
+ unsigned short st_dev;
+
+ unsigned long long st_ino;
+
+ unsigned int st_mode;
+ unsigned int st_nlink;
+
+ unsigned long st_uid;
+ unsigned long st_gid;
+
+ unsigned char __pad2[6];
+ unsigned short st_rdev;
+
+ long long st_size;
+
+ unsigned long __pad3; /* align 64-bit st_blocks to 2-word */
+ unsigned long st_blksize;
+
+ unsigned long __pad4; /* future possible st_blocks high bits */
+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
+
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+
+ unsigned long long __unused4;
+};
+
+#endif /* _BITS_STAT_STRUCT_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/bits/kernel_types.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/kernel_types.h
new file mode 100644
index 0000000..8403fd3
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/kernel_types.h
@@ -0,0 +1,43 @@
+/* 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_POSIX_TYPES_H
+#define _ASM_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 short __kernel_ipc_pid_t;
+typedef unsigned short __kernel_uid_t;
+typedef unsigned short __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 struct {
+#ifdef __USE_ALL
+ int val[2];
+#else
+ int __val[2];
+#endif
+} __kernel_fsid_t;
+
+#endif /* _ASM_POSIX_TYPES_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/bits/setjmp.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/setjmp.h
new file mode 100644
index 0000000..d49ad7b
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/setjmp.h
@@ -0,0 +1,58 @@
+/* Copyright (C) 1999, 2000, 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.
+
+ 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'. FRV version. */
+
+#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
+
+#define __SETJMP_NUM_INT 32 /* number of integer registers to save */
+#define __SETJMP_NUM_DBL 32 /* number of double registers to save */
+
+#define __SETJMP_INT(x) (x)
+#define __SETJMP_DBL(x) (__SETJMP_NUM_INT+(x))
+#define __SETJMP_LR (__SETJMP_NUM_INT+__SETJMP_NUM_DBL)
+#define __SETJMP_SP (__SETJMP_LR+1)
+#define __SETJMP_FP (__SETJMP_SP+1)
+
+
+#ifndef _ASM
+typedef struct
+/* Demand 64-bit alignment such that we can use std/ldd in
+ setjmp/longjmp. */
+__attribute__((__aligned__(8)))
+ {
+ /* Callee-saved registers. */
+ unsigned long __ints[__SETJMP_NUM_INT]; /* integer registers */
+ unsigned long __dbls[__SETJMP_NUM_DBL]; /* double registers */
+ unsigned long __lr; /* linkage register */
+ unsigned long __sp; /* stack pointer */
+ unsigned long __fp; /* frame pointer */
+ } __jmp_buf[1];
+#endif
+
+/* Test if longjmp to JMPBUF would unwind the frame
+ containing a local variable at ADDRESS. */
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+ ((void *) (address) < (void *) (jmpbuf)->__sp)
+
+#endif /* bits/setjmp.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/bits/stackinfo.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/stackinfo.h
new file mode 100644
index 0000000..03412e0
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/stackinfo.h
@@ -0,0 +1,28 @@
+/* Copyright (C) 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. */
+
+/* This file contains a bit of information about the stack allocation
+ of the processor. */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H 1
+
+/* On FRV the stack grows down. */
+#define _STACK_GROWS_DOWN 1
+
+#endif /* stackinfo.h */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/bits/stat.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/stat.h
new file mode 100644
index 0000000..0fcacf1
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/stat.h
@@ -0,0 +1,159 @@
+/* Copyright (C) 1992,95,96,97,98,99,2000,2001, 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 _SYS_STAT_H
+# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+#ifndef _BITS_STAT_H
+#define _BITS_STAT_H
+
+/* Versions of the `struct stat' data structure. */
+#define _STAT_VER_KERNEL 0
+#define _STAT_VER_LINUX 0
+#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
+
+/* Versions of the `xmknod' interface. */
+#define _MKNOD_VER_LINUX 1
+#define _MKNOD_VER_SVR4 2
+#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
+
+struct stat
+{
+ __dev_t st_dev; /* Device. */
+
+#ifndef __USE_FILE_OFFSET64
+ unsigned long __pad1;
+ __ino_t st_ino; /* File serial number. */
+#else
+ __ino64_t st_ino; /* File serial number. */
+#endif
+
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+
+ __dev_t st_rdev; /* Device number, if device. */
+
+#ifndef __USE_FILE_OFFSET64
+ unsigned long __pad2;
+ __off_t st_size; /* Size of file, in bytes. */
+
+ unsigned long __pad3;
+#else
+ __off64_t st_size; /* Size of file, in bytes. */
+
+ unsigned long __pad1;
+#endif
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+
+#ifndef __USE_FILE_OFFSET64
+ unsigned long __pad4;
+ __blkcnt_t st_blocks; /* Number 512-byte blocks allocated. */
+#else
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+#endif
+
+ unsigned long int __unused1;
+ __time_t st_atime; /* Time of last access. */
+
+ unsigned long int __unused2;
+ __time_t st_mtime; /* Time of last modification. */
+
+ unsigned long int __unused3;
+ __time_t st_ctime; /* Time of last status change. */
+
+ unsigned long long __unused4;
+};
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+{
+ __dev_t st_dev; /* Device. */
+
+ __ino64_t st_ino; /* File serial number. */
+
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+
+ __dev_t st_rdev; /* Device number, if device. */
+
+ __off64_t st_size; /* Size of file, in bytes. */
+
+ unsigned long __pad1;
+ __blksize_t st_blksize; /* Optimal block size for I/O. */
+
+ __blkcnt64_t st_blocks; /* Number 512-byte blocks allocated. */
+
+ unsigned long int __unused1;
+ __time_t st_atime; /* Time of last access. */
+
+ unsigned long int __unused2;
+ __time_t st_mtime; /* Time of last modification. */
+
+ unsigned long int __unused3;
+ __time_t st_ctime; /* Time of last status change. */
+
+ unsigned long long __unused4;
+};
+#endif
+
+
+/* Tell code we have these members. */
+#define _STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+
+/* Encoding of the file mode. */
+
+#define __S_IFMT 0170000 /* These bits determine file type. */
+
+/* File types. */
+#define __S_IFDIR 0040000 /* Directory. */
+#define __S_IFCHR 0020000 /* Character device. */
+#define __S_IFBLK 0060000 /* Block device. */
+#define __S_IFREG 0100000 /* Regular file. */
+#define __S_IFIFO 0010000 /* FIFO. */
+#define __S_IFLNK 0120000 /* Symbolic link. */
+#define __S_IFSOCK 0140000 /* Socket. */
+
+/* POSIX.1b objects. Note that these macros always evaluate to zero. But
+ they do it by enforcing the correct use of the macros. */
+#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
+#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
+
+/* Protection bits. */
+
+#define __S_ISUID 04000 /* Set user ID on execution. */
+#define __S_ISGID 02000 /* Set group ID on execution. */
+#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
+#define __S_IREAD 0400 /* Read by owner. */
+#define __S_IWRITE 0200 /* Write by owner. */
+#define __S_IEXEC 0100 /* Execute by owner. */
+
+#ifdef __USE_ATFILE
+# define UTIME_NOW ((1l << 30) - 1l)
+# define UTIME_OMIT ((1l << 30) - 2l)
+#endif
+
+#endif /* _BITS_STAT_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/bits/syscalls.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/syscalls.h
new file mode 100644
index 0000000..eea3050
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/syscalls.h
@@ -0,0 +1,139 @@
+#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 SYS_ify(syscall_name) (__NR_##syscall_name)
+
+/* user-visible error numbers are in the range -1 - -4095: see <asm-frv/errno.h> */
+#if defined _LIBC && !defined __set_errno
+# define __syscall_return(type, res) \
+do { \
+ unsigned long __sr2 = (res); \
+ if (__builtin_expect ((unsigned long)(__sr2) \
+ >= (unsigned long)(-4095), 0)) { \
+ extern int __syscall_error (int); \
+ return (type) __syscall_error (__sr2); \
+ } \
+ return (type) (__sr2); \
+} while (0)
+#else
+# define __syscall_return(type, res) \
+do { \
+ unsigned long __sr2 = (res); \
+ if (__builtin_expect ((unsigned long)(__sr2) \
+ >= (unsigned long)(-4095), 0)) { \
+ __set_errno (-__sr2); \
+ __sr2 = -1; \
+ } \
+ return (type) (__sr2); \
+} while (0)
+#endif
+
+#ifndef __set_errno
+# define __set_errno(val) ((*__errno_location ()) = (val))
+#endif
+
+/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
+
+#define _syscall0(type,name) \
+type name(void) \
+{ \
+register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
+register unsigned long __sc0 __asm__ ("gr8"); \
+__asm__ __volatile__ ("tra gr0,gr0" \
+ : "=r" (__sc0) \
+ : "r" (__scnum)); \
+__syscall_return(type,__sc0); \
+}
+
+#define _syscall1(type,name,type1,arg1) \
+type name(type1 arg1) \
+{ \
+register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
+register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
+__asm__ __volatile__ ("tra gr0,gr0" \
+ : "+r" (__sc0) \
+ : "r" (__scnum)); \
+__syscall_return(type,__sc0); \
+}
+
+#define _syscall2(type,name,type1,arg1,type2,arg2) \
+type name(type1 arg1,type2 arg2) \
+{ \
+register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
+register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
+register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) arg2; \
+__asm__ __volatile__ ("tra gr0,gr0" \
+ : "+r" (__sc0) \
+ : "r" (__scnum), "r" (__sc1)); \
+__syscall_return(type,__sc0); \
+}
+
+#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
+type name(type1 arg1,type2 arg2,type3 arg3) \
+{ \
+register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
+register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
+register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) arg2; \
+register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) arg3; \
+__asm__ __volatile__ ("tra gr0,gr0" \
+ : "+r" (__sc0) \
+ : "r" (__scnum), "r" (__sc1), "r" (__sc2)); \
+__syscall_return(type,__sc0); \
+}
+
+#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
+type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
+{ \
+register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
+register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
+register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) arg2; \
+register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) arg3; \
+register unsigned long __sc3 __asm__ ("gr11") = (unsigned long) arg4; \
+__asm__ __volatile__ ("tra gr0,gr0" \
+ : "+r" (__sc0) \
+ : "r" (__scnum), "r" (__sc1), "r" (__sc2), "r" (__sc3)); \
+__syscall_return(type,__sc0); \
+}
+
+#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \
+type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \
+{ \
+register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
+register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
+register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) arg2; \
+register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) arg3; \
+register unsigned long __sc3 __asm__ ("gr11") = (unsigned long) arg4; \
+register unsigned long __sc4 __asm__ ("gr12") = (unsigned long) arg5; \
+__asm__ __volatile__ ("tra gr0,gr0" \
+ : "+r" (__sc0) \
+ : "r" (__scnum), "r" (__sc1), "r" (__sc2), \
+ "r" (__sc3), "r" (__sc4)); \
+__syscall_return(type,__sc0); \
+}
+
+#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5, type6, arg6) \
+type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \
+{ \
+register unsigned long __scnum __asm__ ("gr7") = (__NR_##name); \
+register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) arg1; \
+register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) arg2; \
+register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) arg3; \
+register unsigned long __sc3 __asm__ ("gr11") = (unsigned long) arg4; \
+register unsigned long __sc4 __asm__ ("gr12") = (unsigned long) arg5; \
+register unsigned long __sc5 __asm__ ("gr13") = (unsigned long) arg6; \
+__asm__ __volatile__ ("tra gr0,gr0" \
+ : "+r" (__sc0) \
+ : "r" (__scnum), "r" (__sc1), "r" (__sc2), \
+ "r" (__sc3), "r" (__sc4), "r" (__sc5)); \
+__syscall_return(type,__sc0); \
+}
+
+#endif /* __ASSEMBLER__ */
+#endif /* _BITS_SYSCALLS_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/bits/uClibc_arch_features.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/uClibc_arch_features.h
new file mode 100644
index 0000000..2a9422e
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/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 */
+/*#define __UCLIBC_ABORT_INSTRUCTION__ "asm instruction"*/
+#undef __UCLIBC_ABORT_INSTRUCTION__
+
+/* can your target use syscall6() for mmap ? */
+#undef __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/frv/bits/uClibc_page.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/uClibc_page.h
new file mode 100644
index 0000000..51a6e15
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/uClibc_page.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 2004 Erik Andersen
+ *
+ * This 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.
+ *
+ * This 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 this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Supply an architecture specific value for PAGE_SIZE and friends. */
+
+#ifndef _UCLIBC_PAGE_H
+#define _UCLIBC_PAGE_H
+
+/* PAGE_SHIFT determines the page size -- in this case 4096 */
+#define PAGE_SHIFT (14)
+#ifndef __ASSEMBLY__
+#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#else
+#define PAGE_SIZE (1 << PAGE_SHIFT)
+#endif
+#define PAGE_MASK (~(PAGE_SIZE-1))
+
+#endif /* _UCLIBC_PAGE_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/bits/wordsize.h b/ap/build/uClibc/libc/sysdeps/linux/frv/bits/wordsize.h
new file mode 100644
index 0000000..ba643b6
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/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/frv/brk.c b/ap/build/uClibc/libc/sysdeps/linux/frv/brk.c
new file mode 100644
index 0000000..a98cd54
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/brk.c
@@ -0,0 +1,27 @@
+/* From libc-5.3.12 */
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+extern void * __curbrk attribute_hidden;
+extern int __init_brk (void) attribute_hidden;
+extern void *_brk(void *ptr) attribute_hidden;
+
+int brk(void * end_data_seg)
+{
+ if (__init_brk () == 0)
+ {
+ __curbrk = _brk(end_data_seg);
+ if (__curbrk == end_data_seg)
+ return 0;
+ __set_errno(ENOMEM);
+ }
+ return -1;
+}
+libc_hidden_def(brk)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/clone.S b/ap/build/uClibc/libc/sysdeps/linux/frv/clone.S
new file mode 100644
index 0000000..1456157
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/clone.S
@@ -0,0 +1,83 @@
+/* Copyright (C) 2003, 2004 Free Software Foudnation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Alexandre Oliva <aoliva@redhat.com>, 2003.
+
+ 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. */
+
+/* clone() is even more special than fork() as it mucks with stacks
+ and invokes a function in the right context after its all over. */
+
+#include <features.h>
+#include <asm/unistd.h>
+#define _ERRNO_H 1
+#include <bits/errno.h>
+
+ .text
+ .globl clone
+ .type clone,@function
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg) */
+clone:
+ /* Sanity check arguments. */
+ cmp.p gr8, gr0, icc0
+ cmp gr9, gr0, icc1
+ mov.p gr8, gr4
+ beq icc0, #0, .Lerror
+ mov.p gr11, gr5
+ beq icc1, #0, .Lerror
+
+ mov.p gr10, gr8
+ setlos #__NR_clone, gr7
+ tra gr0,gr0
+
+ cmp.p gr8, gr0, icc0
+ setlos #-4096, gr6
+ cmp.p gr8, gr6, icc1
+ beq icc0, #0, .Lthread_start
+ blslr icc1, #2
+
+.Lsys_error:
+ sethi.p #gotofffuncdeschi(__syscall_error), gr14
+ setlo #gotofffuncdesclo(__syscall_error), gr14
+ ldd @(gr14, gr15), gr14
+ jmpl @(gr14, gr0)
+
+.Lerror:
+ setlos.p #-EINVAL, gr8
+ bra .Lsys_error
+
+###############################################################################
+#
+# come here as the new thread [GR4 is fn, GR5 is arg]
+#
+###############################################################################
+.Lthread_start:
+ /* Save the PIC register. */
+ mov gr15, gr17
+
+ /* Call the user's function. */
+ ldd.p @(gr4, gr0), gr14
+ mov gr5, gr8
+ calll @(gr14, gr0)
+
+ /* Call _exit, rather simply inlining the syscall, such that
+ breakpoints work.*/
+
+ mov.p gr17, gr15
+ call HIDDEN_JUMPTARGET(_exit)
+
+ /* Should never get here. */
+ jmpl @(gr0, gr0)
+ .size clone,.-clone
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/crt0.S b/ap/build/uClibc/libc/sysdeps/linux/frv/crt0.S
new file mode 100644
index 0000000..a1d07bb
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/crt0.S
@@ -0,0 +1,125 @@
+/* Copyright (C) 1991, 1992, 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.
+
+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.
+
+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.)
+
+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. */
+
+
+/* Based on ../i386/crt0.S and newlib's libgloss/frv/crt0.S */
+
+/*
+ When we enter this piece of code, the program stack looks like this:
+ argc argument counter (integer)
+ argv[0] program name (pointer)
+ argv[1...N] program args (pointers)
+ argv[argc-1] end of args (integer)
+ NULL
+ env[0...N] environment variables (pointers)
+ NULL
+
+ Also, GR16 holds a pointer to a memory map. */
+
+#include <features.h>
+
+ .text
+ .global _start
+ .type _start,%function
+#if defined L_crt0 || defined L_Scrt0 || ! defined __UCLIBC_CTOR_DTOR__
+ .type __uClibc_main,%function
+#else
+ .weak _init
+ .weak _fini
+ .type __uClibc_start_main,%function
+#endif
+_start:
+ /* Make sure the stack pointer is properly aligned. Save the
+ original value in gr21 such that we can get to arguments and
+ such from there. */
+ mov.p sp, gr21
+ andi sp, #-8, sp
+ /* At program start-up, gr16 contains a pointer to a memory
+ map, that we use to relocate addresses. */
+ call .Lcall
+.Lcall:
+ movsg lr, gr4
+ sethi.p #gprelhi(.Lcall), gr5
+ setlo #gprello(.Lcall), gr5
+ sub.p gr4, gr5, gr4
+ /* gr4 now holds the _gp address. */
+
+ mov gr16, gr8
+ sethi.p #gprelhi(__ROFIXUP_LIST__), gr9
+ sethi #gprelhi(__ROFIXUP_END__), gr10
+ setlo.p #gprello(__ROFIXUP_LIST__), gr9
+ setlo #gprello(__ROFIXUP_END__), gr10
+ add.p gr9, gr4, gr9
+ add gr10, gr4, gr10
+ call __self_reloc
+ mov.p gr8, gr17
+ mov gr8, gr15
+ /* gr17 now holds the self-relocated _GLOBAL_OFFSET_TABLE_
+ address, because the linker added its unrelocated address as
+ the last entry in the ROFIXUP list, and __self_reloc returns
+ the last entry, relocated. */
+
+ /* Prepare arguments for uClibc main. */
+ ld @(gr21, gr0), gr8
+ slli gr8, #2, gr10
+ add gr21, gr10, gr10
+ addi.p gr21, #4, gr9
+ addi gr10, #8, gr10
+
+ /* Set up an invalid (NULL return address, NULL frame pointer)
+ callers stack frame so anybody unrolling the stack knows where
+ to stop */
+ mov gr0, fp
+ movgs gr0, lr
+
+#if (defined L_crt1 || defined L_Scrt1) && defined __UCLIBC_CTOR_DTOR__
+ /* Pass .init and .fini arguments to __uClibc_start_main(). */
+ sethi.p #gotfuncdeschi(_init), gr11
+ sethi #gotfuncdeschi(_fini), gr12
+ setlo.p #gotfuncdesclo(_init), gr11
+ setlo #gotfuncdesclo(_fini), gr12
+ ld.p @(gr11, gr17), gr11
+ mov gr17, gr15
+ ld.p @(gr12, gr17), gr12
+ call __uClibc_start_main
+#else
+ mov.p gr17, gr15
+ call __uClibc_main
+#endif
+
+ /* Crash if somehow `exit' returns anyways. */
+ jmpl @(gr0,gr0)
+.size _start,.-_start
+
+/* Define a symbol for the first piece of initialized data. */
+ .data
+ .globl __data_start
+__data_start:
+ .long 0
+ .weak data_start
+ data_start = __data_start
+
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/crti.S b/ap/build/uClibc/libc/sysdeps/linux/frv/crti.S
new file mode 100644
index 0000000..1788524
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/crti.S
@@ -0,0 +1,50 @@
+/* Copyright (C) 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. */
+
+ .section .init,"x"
+ .p2align 2
+ .globl _init
+ .type _init, @function
+_init:
+ addi sp,#-16,sp
+ st.p fp, @(sp,gr0)
+ mov sp, fp
+ movsg lr, gr5
+ sti gr15, @(fp,4)
+ sti gr5, @(fp,8)
+
+ .section .fini,"x"
+ .p2align 2
+ .globl _fini
+ .type _fini, @function
+_fini:
+ addi sp,#-16,sp
+ st.p fp, @(sp,gr0)
+ mov sp, fp
+ movsg lr, gr5
+ sti gr15, @(fp,4)
+ sti gr5, @(fp,8)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/crtn.S b/ap/build/uClibc/libc/sysdeps/linux/frv/crtn.S
new file mode 100644
index 0000000..bd11901
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/crtn.S
@@ -0,0 +1,42 @@
+/* Copyright (C) 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. */
+
+ .section .init,"x"
+ .globl _init
+ .type _init, @function
+ ldi @(fp,8), gr5
+ ld @(sp,gr0), fp
+ addi sp,#16,sp
+ jmpl @(gr5,gr0)
+
+ .section .fini,"x"
+ .globl _fini
+ .type _fini, @function
+ ldi @(fp,8), gr5
+ ld @(sp,gr0), fp
+ addi sp,#16,sp
+ jmpl @(gr5,gr0)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/crtreloc.c b/ap/build/uClibc/libc/sysdeps/linux/frv/crtreloc.c
new file mode 100644
index 0000000..ba934bc
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/crtreloc.c
@@ -0,0 +1,120 @@
+/* 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. */
+
+#include <sys/types.h>
+#include <link.h>
+
+/* This file is to be compiled into crt object files, to enable
+ executables to easily self-relocate. */
+
+/* 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)
+ {
+ void *ptr = __reloc_pointer (*p, map);
+ if (ptr)
+ {
+ void *pt;
+ if ((long)ptr & 3)
+ __builtin_memcpy(&pt, ptr, sizeof(pt));
+ else
+ pt = *(void**)ptr;
+ pt = __reloc_pointer (pt, map);
+ if ((long)ptr & 3)
+ __builtin_memcpy(ptr, &pt, sizeof(pt));
+ 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. */
+void* attribute_hidden
+__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
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/dl-iterate-phdr.c b/ap/build/uClibc/libc/sysdeps/linux/frv/dl-iterate-phdr.c
new file mode 100644
index 0000000..144e4c1
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/dl-iterate-phdr.c
@@ -0,0 +1,42 @@
+/* Copyright 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
+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. */
+
+#include <link.h>
+
+extern int weak_function
+__dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
+ size_t size, void *data),
+ void *data);
+
+/* Define it as a pointer, such that we get a pointer to the global
+ function descriptor, that won't be optimized away by the
+ linker. */
+static int (*ptr) (int (*callback) (struct dl_phdr_info *info,
+ size_t size, void *data),
+ void *data) = __dl_iterate_phdr;
+
+int
+dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info,
+ size_t size, void *data),
+ void *data)
+{
+ if (ptr)
+ return ptr (callback, data);
+
+ return 0;
+}
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/fstat.c b/ap/build/uClibc/libc/sysdeps/linux/frv/fstat.c
new file mode 100644
index 0000000..45d2746
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/fstat.c
@@ -0,0 +1,17 @@
+/*
+ * Syscalls 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.
+ */
+/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org>
+ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
+ */
+
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+_syscall2(int, fstat, int, fd, struct stat *, buf)
+libc_hidden_def(fstat)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/fstat64.c b/ap/build/uClibc/libc/sysdeps/linux/frv/fstat64.c
new file mode 100644
index 0000000..f795342
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/fstat64.c
@@ -0,0 +1,19 @@
+/*
+ * Syscalls 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.
+ */
+/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org>
+ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
+ */
+
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#ifdef __UCLIBC_HAS_LFS__
+_syscall2(int, fstat64, int, fd, struct stat64 *, buf)
+libc_hidden_def(fstat64)
+#endif
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/lstat.c b/ap/build/uClibc/libc/sysdeps/linux/frv/lstat.c
new file mode 100644
index 0000000..94f722f
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/lstat.c
@@ -0,0 +1,17 @@
+/*
+ * Syscalls 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.
+ */
+/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org>
+ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
+ */
+
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+_syscall2(int, lstat, const char *, file_name, struct stat *, buf)
+libc_hidden_def(lstat)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/lstat64.c b/ap/build/uClibc/libc/sysdeps/linux/frv/lstat64.c
new file mode 100644
index 0000000..f038fb0
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/lstat64.c
@@ -0,0 +1,19 @@
+/*
+ * Syscalls 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.
+ */
+/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org>
+ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
+ */
+
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#ifdef __UCLIBC_HAS_LFS__
+_syscall2(int, lstat64, const char *, file_name, struct stat64 *, buf)
+libc_hidden_def(lstat64)
+#endif
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/mmap.c b/ap/build/uClibc/libc/sysdeps/linux/frv/mmap.c
new file mode 100644
index 0000000..cb91124
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/mmap.c
@@ -0,0 +1,50 @@
+/* Copyright (C) 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Daniel Jacobowitz <dan@debian.org>, 1999.
+
+ 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. */
+
+/* Massivly hacked up for uClibc by Erik Andersen */
+
+/* Extracted from ../common/mmap64.c by Alexandre Oliva <aoliva@redhat.com>
+
+ We don't want to use the old mmap interface. */
+
+#include <features.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <sys/mman.h>
+
+
+#define __NR___syscall_mmap2 __NR_mmap2
+static __inline__ _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
+ size_t, len, int, prot, int, flags, int, fd, off_t, offset)
+
+/* This is always 12, even on architectures where PAGE_SHIFT != 12. */
+# ifndef MMAP2_PAGE_SHIFT
+# define MMAP2_PAGE_SHIFT 12
+# endif
+
+__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
+{
+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1)) {
+ __set_errno (EINVAL);
+ return MAP_FAILED;
+ }
+ return(__syscall_mmap2(addr, len, prot, flags, fd, (off_t) (offset >> MMAP2_PAGE_SHIFT)));
+}
+libc_hidden_def(mmap)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/sbrk.c b/ap/build/uClibc/libc/sysdeps/linux/frv/sbrk.c
new file mode 100644
index 0000000..2dc719a
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/sbrk.c
@@ -0,0 +1,25 @@
+/* From libc-5.3.12 */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+extern void * __curbrk attribute_hidden;
+extern int __init_brk (void) attribute_hidden;
+extern void *_brk(void *ptr) attribute_hidden;
+
+void *
+sbrk(intptr_t increment)
+{
+ if (__init_brk () == 0)
+ {
+ char * tmp = (char*)__curbrk+increment;
+ __curbrk = _brk(tmp);
+ if (__curbrk == tmp)
+ return tmp-increment;
+ __set_errno(ENOMEM);
+ return ((void *) -1);
+ }
+ return ((void *) -1);
+}
+libc_hidden_def(sbrk)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/setjmp.S b/ap/build/uClibc/libc/sysdeps/linux/frv/setjmp.S
new file mode 100644
index 0000000..66008d1
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/setjmp.S
@@ -0,0 +1,90 @@
+ .text
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
+ We cannot do it in C because it must be a tail-call, so frame-unwinding
+ in setjmp doesn't clobber the state restored by longjmp. */
+
+ .global _setjmp
+ .type _setjmp,@function
+_setjmp:
+ setlos #0, gr9
+ bra .Lsigsetjmp_intern
+ .size _setjmp,.-_setjmp
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+ We cannot do it in C because it must be a tail-call, so frame-unwinding
+ in setjmp doesn't clobber the state restored by longjmp. */
+
+ .align 4
+ .type setjmp,@function
+ .globl setjmp
+setjmp:
+ setlos #1, gr9
+ bra .Lsigsetjmp_intern
+ .size setjmp,.-setjmp
+
+# setjmp/longjmp for Frv. The jmpbuf looks like this:
+#
+# Register jmpbuf offset
+# R16-R31 0x0-0x03c
+# R48-R63 0x40-0x7c
+# FR16-FR31 0x80-0xbc
+# FR48-FR63 0xc0-0xfc
+# LR 0x100
+# SP 0x104
+# FP 0x108
+
+ .global __sigsetjmp
+ .type __sigsetjmp,@function
+__sigsetjmp:
+.Lsigsetjmp_intern:
+ stdi gr16, @(gr8,0)
+ stdi gr18, @(gr8,8)
+ stdi gr20, @(gr8,16)
+ stdi gr22, @(gr8,24)
+ stdi gr24, @(gr8,32)
+ stdi gr26, @(gr8,40)
+ stdi gr28, @(gr8,48)
+ stdi gr30, @(gr8,56)
+#if __FRV_GPR__ != 32
+ stdi gr48, @(gr8,64)
+ stdi gr50, @(gr8,72)
+ stdi gr52, @(gr8,80)
+ stdi gr54, @(gr8,88)
+ stdi gr56, @(gr8,96)
+ stdi gr58, @(gr8,104)
+ stdi gr60, @(gr8,112)
+ stdi gr62, @(gr8,120)
+#endif
+
+#if __FRV_FPR__ != 0
+ stdfi fr16, @(gr8,128)
+ stdfi fr18, @(gr8,136)
+ stdfi fr20, @(gr8,144)
+ stdfi fr22, @(gr8,152)
+ stdfi fr24, @(gr8,160)
+ stdfi fr26, @(gr8,168)
+ stdfi fr28, @(gr8,176)
+ stdfi fr30, @(gr8,184)
+#if __FRV_FPR__ != 32
+ stdfi fr48, @(gr8,192)
+ stdfi fr50, @(gr8,200)
+ stdfi fr52, @(gr8,208)
+ stdfi fr54, @(gr8,216)
+ stdfi fr56, @(gr8,224)
+ stdfi fr58, @(gr8,232)
+ stdfi fr60, @(gr8,240)
+ stdfi fr62, @(gr8,248)
+#endif
+#endif
+
+ movsg lr, gr4
+ sti gr4, @(gr8,256)
+ sti sp, @(gr8,260)
+ sti fp, @(gr8,264)
+
+ sethi.p #gotofffuncdeschi(__sigjmp_save), gr4
+ setlo #gotofffuncdesclo(__sigjmp_save), gr4
+ ldd @(gr15, gr4), gr14
+ jmpl @(gr14, gr0)
+ .size __sigsetjmp,.-__sigsetjmp
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/stat.c b/ap/build/uClibc/libc/sysdeps/linux/frv/stat.c
new file mode 100644
index 0000000..74e3100
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/stat.c
@@ -0,0 +1,17 @@
+/*
+ * Syscalls 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.
+ */
+/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org>
+ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
+ */
+
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+_syscall2(int, stat, const char *, file_name, struct stat *, buf)
+libc_hidden_def(stat)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/stat64.c b/ap/build/uClibc/libc/sysdeps/linux/frv/stat64.c
new file mode 100644
index 0000000..675e634
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/stat64.c
@@ -0,0 +1,19 @@
+/*
+ * Syscalls 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.
+ */
+/* Extracted from ../common/syscalls.c by Erik Andersen <andersen@codepoet.org>
+ * Adapted to FR-V by Alexandre Oliva <aoliva@redhat.com>
+ */
+
+#include <sys/syscall.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#ifdef __UCLIBC_HAS_LFS__
+_syscall2(int, stat64, const char *, file_name, struct stat64 *, buf)
+libc_hidden_def(stat64)
+#endif
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/sys/procfs.h b/ap/build/uClibc/libc/sysdeps/linux/frv/sys/procfs.h
new file mode 100644
index 0000000..f075233
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/sys/procfs.h
@@ -0,0 +1,125 @@
+/* Copyright (C) 1996, 1997, 1999, 2000, 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 _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_int_regs) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+/* Register set for the floating-point registers. */
+typedef struct user_fpmedia_regs 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/frv/sys/ptrace.h b/ap/build/uClibc/libc/sysdeps/linux/frv/sys/ptrace.h
new file mode 100644
index 0000000..6b0eca7
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/sys/ptrace.h
@@ -0,0 +1,139 @@
+/* `ptrace' debugger support interface. FRV-Linux version.
+ Copyright (C) 1996, 1997, 1998, 1999, 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 _SYS_PTRACE_H
+#define _SYS_PTRACE_H 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Type of the REQUEST argument to `ptrace.' */
+enum __ptrace_request
+{
+ /* Indicate that the process making this request should be traced.
+ All signals received by this process can be intercepted by its
+ parent, and its parent can use the other `ptrace' requests. */
+ PTRACE_TRACEME = 0,
+#define PT_TRACE_ME PTRACE_TRACEME
+
+ /* Return the word in the process's text space at address ADDR. */
+ PTRACE_PEEKTEXT = 1,
+#define PT_READ_I PTRACE_PEEKTEXT
+
+ /* Return the word in the process's data space at address ADDR. */
+ PTRACE_PEEKDATA = 2,
+#define PT_READ_D PTRACE_PEEKDATA
+
+ /* Return the word in the process's user area at offset ADDR. */
+ PTRACE_PEEKUSER = 3,
+#define PT_READ_U PTRACE_PEEKUSER
+
+ /* Write the word DATA into the process's text space at address ADDR. */
+ PTRACE_POKETEXT = 4,
+#define PT_WRITE_I PTRACE_POKETEXT
+
+ /* Write the word DATA into the process's data space at address ADDR. */
+ PTRACE_POKEDATA = 5,
+#define PT_WRITE_D PTRACE_POKEDATA
+
+ /* Write the word DATA into the process's user area at offset ADDR. */
+ PTRACE_POKEUSER = 6,
+#define PT_WRITE_U PTRACE_POKEUSER
+
+ /* Continue the process. */
+ PTRACE_CONT = 7,
+#define PT_CONTINUE PTRACE_CONT
+
+ /* Kill the process. */
+ PTRACE_KILL = 8,
+#define PT_KILL PTRACE_KILL
+
+ /* Single step the process.
+ This is not supported on all machines. */
+ PTRACE_SINGLESTEP = 9,
+#define PT_STEP PTRACE_SINGLESTEP
+
+ /* Get all general purpose registers used by a processes.
+ This is not supported on all machines. */
+ PTRACE_GETREGS = 12,
+#define PT_GETREGS PTRACE_GETREGS
+
+ /* Set all general purpose registers used by a processes.
+ This is not supported on all machines. */
+ PTRACE_SETREGS = 13,
+#define PT_SETREGS PTRACE_SETREGS
+
+ /* Get all floating point registers used by a processes.
+ This is not supported on all machines. */
+ PTRACE_GETFPREGS = 14,
+#define PT_GETFPREGS PTRACE_GETFPREGS
+
+ /* Set all floating point registers used by a processes.
+ This is not supported on all machines. */
+ PTRACE_SETFPREGS = 15,
+#define PT_SETFPREGS PTRACE_SETFPREGS
+
+ /* Attach to a process that is already running. */
+ PTRACE_ATTACH = 16,
+#define PT_ATTACH PTRACE_ATTACH
+
+ /* Detach from a process attached to with PTRACE_ATTACH. */
+ PTRACE_DETACH = 17,
+#define PT_DETACH PTRACE_DETACH
+
+ /* Get all extended floating point registers used by a processes.
+ This is not supported on all machines. */
+ PTRACE_GETFPXREGS = 18,
+#define PT_GETFPXREGS PTRACE_GETFPXREGS
+
+ /* Set all extended floating point registers used by a processes.
+ This is not supported on all machines. */
+ PTRACE_SETFPXREGS = 19,
+#define PT_SETFPXREGS PTRACE_SETFPXREGS
+
+ /* Continue and stop at the next (return from) syscall. */
+ PTRACE_SYSCALL = 24,
+#define PT_SYSCALL PTRACE_SYSCALL
+
+ /* Obtain the load map of the main program or the interpreter of the
+ ptraced process, depending on whether the addr argument is
+ (void*)0 or (void*)1, respectively. */
+ PTRACE_GETFDPIC = 31
+#define PT_GETFDPIC PTRACE_GETFDPIC
+};
+
+#define PTRACE_GETFDPIC_EXEC ((void*)0) /* [addr] request the executable loadmap */
+#define PTRACE_GETFDPIC_INTERP ((void*)1) /* [addr] request the interpreter loadmap */
+
+/* Perform process tracing functions. REQUEST is one of the values
+ above, and determines the action to be taken.
+ For all requests except PTRACE_TRACEME, PID specifies the process to be
+ traced.
+
+ PID and the other arguments described above for the various requests should
+ appear (those that are used for the particular request) as:
+ pid_t PID, void *ADDR, int DATA, void *ADDR2
+ after REQUEST. */
+extern long int ptrace (enum __ptrace_request __request, ...) __THROW;
+
+__END_DECLS
+
+#endif /* _SYS_PTRACE_H */
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/sys/ucontext.h b/ap/build/uClibc/libc/sysdeps/linux/frv/sys/ucontext.h
new file mode 100644
index 0000000..487c9ee
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/sys/ucontext.h
@@ -0,0 +1,451 @@
+/* Copyright (C) 1999, 2000, 2001, 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 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H 1
+
+#include <features.h>
+#include <signal.h>
+
+/* We need the signal context definitions even if they are not used
+ included in <signal.h>. */
+#include <bits/sigcontext.h>
+
+
+typedef unsigned long greg_t;
+
+/* Number of general registers. */
+#define NGREG (10+2+64)
+
+/* Container for all general registers. */
+typedef greg_t gregset_t[NGREG];
+
+#ifdef __USE_GNU
+/* Number of each register is the `gregset_t' array. */
+enum
+{
+ REG_PSR = 0,
+#define REG_PSR REG_PSR
+ REG_ISR = 1,
+#define REG_ISR REG_ISR
+ REG_CCR = 2,
+#define REG_CCR REG_CCR
+ REG_CCCR = 3,
+#define REG_CCCR REG_CCCR
+ REG_LR = 4,
+#define REG_LR REG_LR
+ REG_LCR = 5,
+#define REG_LCR REG_LCR
+ REG_PC = 6,
+#define REG_PC REG_PC
+ REG___STATUS = 7,
+#define REG___STATUS REG___STATUS
+ REG_SYSCALLNO = 8,
+#define REG_SYSCALLNO REG_SYSCALLNO
+ REG_ORIG_GR8 = 9,
+#define REG_ORIG_GR8 REG_ORIG_GR8
+ REG_GNER0 = 10,
+#define REG_GNER0 REG_GNER0
+ REG_GNER1 = 11,
+#define REG_GNER1 REG_GNER1
+ REG_GR0 = 12,
+#define REG_GR0 REG_GR0
+ REG_GR1 = 13,
+#define REG_GR1 REG_GR1
+ REG_GR2 = 14,
+#define REG_GR2 REG_GR2
+ REG_GR3 = 15,
+#define REG_GR3 REG_GR3
+ REG_GR4 = 16,
+#define REG_GR4 REG_GR4
+ REG_GR5 = 17,
+#define REG_GR5 REG_GR5
+ REG_GR6 = 18,
+#define REG_GR6 REG_GR6
+ REG_GR7 = 19,
+#define REG_GR7 REG_GR7
+ REG_GR8 = 20,
+#define REG_GR8 REG_GR8
+ REG_GR9 = 21,
+#define REG_GR9 REG_GR9
+ REG_GR10 = 22,
+#define REG_GR10 REG_GR10
+ REG_GR11 = 23,
+#define REG_GR11 REG_GR11
+ REG_GR12 = 24,
+#define REG_GR12 REG_GR12
+ REG_GR13 = 25,
+#define REG_GR13 REG_GR13
+ REG_GR14 = 26,
+#define REG_GR14 REG_GR14
+ REG_GR15 = 27,
+#define REG_GR15 REG_GR15
+ REG_GR16 = 28,
+#define REG_GR16 REG_GR16
+ REG_GR17 = 29,
+#define REG_GR17 REG_GR17
+ REG_GR18 = 30,
+#define REG_GR18 REG_GR18
+ REG_GR19 = 31,
+#define REG_GR19 REG_GR19
+ REG_GR20 = 32,
+#define REG_GR20 REG_GR20
+ REG_GR21 = 33,
+#define REG_GR21 REG_GR21
+ REG_GR22 = 34,
+#define REG_GR22 REG_GR22
+ REG_GR23 = 35,
+#define REG_GR23 REG_GR23
+ REG_GR24 = 36,
+#define REG_GR24 REG_GR24
+ REG_GR25 = 37,
+#define REG_GR25 REG_GR25
+ REG_GR26 = 38,
+#define REG_GR26 REG_GR26
+ REG_GR27 = 39,
+#define REG_GR27 REG_GR27
+ REG_GR28 = 40,
+#define REG_GR28 REG_GR28
+ REG_GR29 = 41,
+#define REG_GR29 REG_GR29
+ REG_GR30 = 42,
+#define REG_GR30 REG_GR30
+ REG_GR31 = 43,
+#define REG_GR31 REG_GR31
+ REG_GR32 = 44,
+#define REG_GR32 REG_GR32
+ REG_GR33 = 45,
+#define REG_GR33 REG_GR33
+ REG_GR34 = 46,
+#define REG_GR34 REG_GR34
+ REG_GR35 = 47,
+#define REG_GR35 REG_GR35
+ REG_GR36 = 48,
+#define REG_GR36 REG_GR36
+ REG_GR37 = 49,
+#define REG_GR37 REG_GR37
+ REG_GR38 = 50,
+#define REG_GR38 REG_GR38
+ REG_GR39 = 51,
+#define REG_GR39 REG_GR39
+ REG_GR40 = 52,
+#define REG_GR40 REG_GR40
+ REG_GR41 = 53,
+#define REG_GR41 REG_GR41
+ REG_GR42 = 54,
+#define REG_GR42 REG_GR42
+ REG_GR43 = 55,
+#define REG_GR43 REG_GR43
+ REG_GR44 = 56,
+#define REG_GR44 REG_GR44
+ REG_GR45 = 57,
+#define REG_GR45 REG_GR45
+ REG_GR46 = 58,
+#define REG_GR46 REG_GR46
+ REG_GR47 = 59,
+#define REG_GR47 REG_GR47
+ REG_GR48 = 60,
+#define REG_GR48 REG_GR48
+ REG_GR49 = 61,
+#define REG_GR49 REG_GR49
+ REG_GR50 = 62,
+#define REG_GR50 REG_GR50
+ REG_GR51 = 63,
+#define REG_GR51 REG_GR51
+ REG_GR52 = 64,
+#define REG_GR52 REG_GR52
+ REG_GR53 = 65,
+#define REG_GR53 REG_GR53
+ REG_GR54 = 66,
+#define REG_GR54 REG_GR54
+ REG_GR55 = 67,
+#define REG_GR55 REG_GR55
+ REG_GR56 = 68,
+#define REG_GR56 REG_GR56
+ REG_GR57 = 69,
+#define REG_GR57 REG_GR57
+ REG_GR58 = 70,
+#define REG_GR58 REG_GR58
+ REG_GR59 = 71,
+#define REG_GR59 REG_GR59
+ REG_GR60 = 72,
+#define REG_GR60 REG_GR60
+ REG_GR61 = 73,
+#define REG_GR61 REG_GR61
+ REG_GR62 = 74,
+#define REG_GR62 REG_GR62
+ REG_GR63 = 75,
+#define REG_GR63 REG_GR63
+};
+#endif
+
+typedef unsigned long freg_t;
+
+/* Number of FPU registers. */
+#define NFPREG (64+2+2+8+2+1)
+
+#ifdef __USE_GNU
+/* Number of each register is the `gregset_t' array. */
+enum
+{
+ REG_FR0 = 0,
+#define REG_FR0 REG_FR0
+ REG_FR1 = 1,
+#define REG_FR1 REG_FR1
+ REG_FR2 = 2,
+#define REG_FR2 REG_FR2
+ REG_FR3 = 3,
+#define REG_FR3 REG_FR3
+ REG_FR4 = 4,
+#define REG_FR4 REG_FR4
+ REG_FR5 = 5,
+#define REG_FR5 REG_FR5
+ REG_FR6 = 6,
+#define REG_FR6 REG_FR6
+ REG_FR7 = 7,
+#define REG_FR7 REG_FR7
+ REG_FR8 = 8,
+#define REG_FR8 REG_FR8
+ REG_FR9 = 9,
+#define REG_FR9 REG_FR9
+ REG_FR10 = 10,
+#define REG_FR10 REG_FR10
+ REG_FR11 = 11,
+#define REG_FR11 REG_FR11
+ REG_FR12 = 12,
+#define REG_FR12 REG_FR12
+ REG_FR13 = 13,
+#define REG_FR13 REG_FR13
+ REG_FR14 = 14,
+#define REG_FR14 REG_FR14
+ REG_FR15 = 15,
+#define REG_FR15 REG_FR15
+ REG_FR16 = 16,
+#define REG_FR16 REG_FR16
+ REG_FR17 = 17,
+#define REG_FR17 REG_FR17
+ REG_FR18 = 18,
+#define REG_FR18 REG_FR18
+ REG_FR19 = 19,
+#define REG_FR19 REG_FR19
+ REG_FR20 = 20,
+#define REG_FR20 REG_FR20
+ REG_FR21 = 21,
+#define REG_FR21 REG_FR21
+ REG_FR22 = 22,
+#define REG_FR22 REG_FR22
+ REG_FR23 = 23,
+#define REG_FR23 REG_FR23
+ REG_FR24 = 24,
+#define REG_FR24 REG_FR24
+ REG_FR25 = 25,
+#define REG_FR25 REG_FR25
+ REG_FR26 = 26,
+#define REG_FR26 REG_FR26
+ REG_FR27 = 27,
+#define REG_FR27 REG_FR27
+ REG_FR28 = 28,
+#define REG_FR28 REG_FR28
+ REG_FR29 = 29,
+#define REG_FR29 REG_FR29
+ REG_FR30 = 30,
+#define REG_FR30 REG_FR30
+ REG_FR31 = 31,
+#define REG_FR31 REG_FR31
+ REG_FR32 = 32,
+#define REG_FR32 REG_FR32
+ REG_FR33 = 33,
+#define REG_FR33 REG_FR33
+ REG_FR34 = 34,
+#define REG_FR34 REG_FR34
+ REG_FR35 = 35,
+#define REG_FR35 REG_FR35
+ REG_FR36 = 36,
+#define REG_FR36 REG_FR36
+ REG_FR37 = 37,
+#define REG_FR37 REG_FR37
+ REG_FR38 = 38,
+#define REG_FR38 REG_FR38
+ REG_FR39 = 39,
+#define REG_FR39 REG_FR39
+ REG_FR40 = 40,
+#define REG_FR40 REG_FR40
+ REG_FR41 = 41,
+#define REG_FR41 REG_FR41
+ REG_FR42 = 42,
+#define REG_FR42 REG_FR42
+ REG_FR43 = 43,
+#define REG_FR43 REG_FR43
+ REG_FR44 = 44,
+#define REG_FR44 REG_FR44
+ REG_FR45 = 45,
+#define REG_FR45 REG_FR45
+ REG_FR46 = 46,
+#define REG_FR46 REG_FR46
+ REG_FR47 = 47,
+#define REG_FR47 REG_FR47
+ REG_FR48 = 48,
+#define REG_FR48 REG_FR48
+ REG_FR49 = 49,
+#define REG_FR49 REG_FR49
+ REG_FR50 = 50,
+#define REG_FR50 REG_FR50
+ REG_FR51 = 51,
+#define REG_FR51 REG_FR51
+ REG_FR52 = 52,
+#define REG_FR52 REG_FR52
+ REG_FR53 = 53,
+#define REG_FR53 REG_FR53
+ REG_FR54 = 54,
+#define REG_FR54 REG_FR54
+ REG_FR55 = 55,
+#define REG_FR55 REG_FR55
+ REG_FR56 = 56,
+#define REG_FR56 REG_FR56
+ REG_FR57 = 57,
+#define REG_FR57 REG_FR57
+ REG_FR58 = 58,
+#define REG_FR58 REG_FR58
+ REG_FR59 = 59,
+#define REG_FR59 REG_FR59
+ REG_FR60 = 60,
+#define REG_FR60 REG_FR60
+ REG_FR61 = 61,
+#define REG_FR61 REG_FR61
+ REG_FR62 = 62,
+#define REG_FR62 REG_FR62
+ REG_FR63 = 63,
+#define REG_FR63 REG_FR63
+ REG_FNER0 = 64,
+#define REG_FNER0 REG_FNER0
+ REG_FNER1 = 65,
+#define REG_FNER1 REG_FNER1
+ REG_MSR0 = 66,
+#define REG_MSR0 REG_MSR0
+ REG_MSR1 = 67,
+#define REG_MSR1 REG_MSR1
+ REG_ACC0 = 68,
+#define REG_ACC0 REG_ACC0
+ REG_ACC1 = 69,
+#define REG_ACC1 REG_ACC1
+ REG_ACC2 = 70,
+#define REG_ACC2 REG_ACC2
+ REG_ACC3 = 71,
+#define REG_ACC3 REG_ACC3
+ REG_ACC4 = 72,
+#define REG_ACC4 REG_ACC4
+ REG_ACC5 = 73,
+#define REG_ACC5 REG_ACC5
+ REG_ACC6 = 74,
+#define REG_ACC6 REG_ACC6
+ REG_ACC7 = 75,
+#define REG_ACC7 REG_ACC7
+ REG_ACCG0123 = 76,
+#define REG_ACCG0123 REG_ACCG0123
+ REG_ACCG4567 = 77,
+#define REG_ACCG4567 REG_ACCG4567
+ REG_FSR0 = 78,
+#define REG_FSR0 REG_FSR0
+};
+#endif
+
+/* Structure to describe FPU registers. */
+typedef freg_t fpregset_t[NFPREG];
+
+/* Context to describe whole processor state. */
+typedef struct
+ {
+ gregset_t gregs;
+ fpregset_t fpregs;
+ void *extension;
+ unsigned long sc_oldmask; /* old sigmask */
+ } __attribute__((aligned(8))) mcontext_t;
+
+#ifdef __USE_GNU
+struct kernel_user_int_regs
+{
+ /* integer registers
+ * - up to gr[31] mirror pt_regs in the kernel
+ */
+ unsigned long psr; /* Processor Status Register */
+ unsigned long isr; /* Integer Status Register */
+ unsigned long ccr; /* Condition Code Register */
+ unsigned long cccr; /* Condition Code for Conditional Insns Register */
+ unsigned long lr; /* Link Register */
+ unsigned long lcr; /* Loop Count Register */
+ unsigned long pc; /* Program Counter Register */
+ unsigned long __status; /* exception status */
+ unsigned long syscallno; /* syscall number or -1 */
+ unsigned long orig_gr8; /* original syscall arg #1 */
+ unsigned long gner[2];
+
+ union {
+ unsigned long tbr;
+ unsigned long gr[64];
+ };
+};
+
+struct kernel_user_fpmedia_regs
+{
+ /* FP/Media registers */
+ unsigned long fr[64];
+ unsigned long fner[2];
+ unsigned long msr[2];
+ unsigned long acc[8];
+ unsigned char accg[8];
+ unsigned long fsr[1];
+};
+
+struct kernel_user_context
+{
+ struct kernel_user_int_regs i;
+ struct kernel_user_fpmedia_regs f;
+
+ /* we provide a context extension so that we can save the regs for CPUs that
+ * implement many more of Fujitsu's lavish register spec
+ */
+ void *extension;
+
+ /* This is not part of the kernel's struct user_context, but
+ rather of the enclosing struct sigcontext, but we add it
+ here to parallel mcontext_t, just for completeness. */
+ unsigned long sc_oldmask; /* old sigmask */
+} __attribute__((aligned(8)));
+
+/* This union enables alias-safe casts from mcontext_t* to the union
+ type, that can then be dereferenced as_aliases. */
+union kmcontext_t
+{
+ mcontext_t as_regsets;
+ /* as_aliases is actually missing sc_oldmask, that is present in
+ mcontext_t. */
+ struct kernel_user_context as_aliases;
+};
+#endif
+
+/* 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/frv/syscall.c b/ap/build/uClibc/libc/sysdeps/linux/frv/syscall.c
new file mode 100644
index 0000000..7b416e8
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/syscall.c
@@ -0,0 +1,41 @@
+/* syscall for frv/uClibc
+ *
+ * Copyright (C) 2004 by Alexandre Oliva <aoliva@redhat.com>
+ *
+ * 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
+ */
+
+#include <features.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/syscall.h>
+
+
+long syscall(long sysnum, long arg1, long arg2, long arg3,
+ long arg4, long arg5, long arg6)
+{
+ register unsigned long __scnum __asm__ ("gr7") = (sysnum);
+ register unsigned long __sc0 __asm__ ("gr8") = (unsigned long) (arg1);
+ register unsigned long __sc1 __asm__ ("gr9") = (unsigned long) (arg2);
+ register unsigned long __sc2 __asm__ ("gr10") = (unsigned long) (arg3);
+ register unsigned long __sc3 __asm__ ("gr11") = (unsigned long) (arg4);
+ register unsigned long __sc4 __asm__ ("gr12") = (unsigned long) (arg5);
+ register unsigned long __sc5 __asm__ ("gr13") = (unsigned long) (arg6);
+ __asm__ __volatile__ ("tra gr0,gr0"
+ : "+r" (__sc0)
+ : "r" (__scnum), "r" (__sc1), "r" (__sc2),
+ "r" (__sc3), "r" (__sc4), "r" (__sc5));
+ __syscall_return(long,__sc0);
+}
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/sysdep.c b/ap/build/uClibc/libc/sysdeps/linux/frv/sysdep.c
new file mode 100644
index 0000000..7387d11
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/sysdep.c
@@ -0,0 +1,27 @@
+/* Copyright (C) 1997, 1998, 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. */
+
+#include <errno.h>
+
+/* This routine is jumped to by all the syscall handlers, to stash
+ an error number into errno. */
+int __syscall_error (int err_no)
+{
+ __set_errno (-err_no);
+ return -1;
+}
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/vfork.S b/ap/build/uClibc/libc/sysdeps/linux/frv/vfork.S
new file mode 100644
index 0000000..8935a12
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/vfork.S
@@ -0,0 +1,47 @@
+/* Copyright (C) 2003, 2004 Free Software Foudnation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David Howells <dhowells@redhat.com>, 2003.
+
+ 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. */
+
+#include <features.h>
+
+#include <asm/unistd.h>
+#define _ERRNO_H 1
+#include <bits/errno.h>
+
+ .text
+ .globl __vfork
+ .hidden __vfork
+ .type __vfork,@function
+/* int vfork(void) */
+__vfork:
+ setlos.p #__NR_vfork, gr7
+ setlos #-4096, gr4
+ tra gr0, gr0
+
+ cmp gr8, gr4, icc0
+ blslr icc0, #2
+
+ sethi.p #gotofffuncdeschi(__syscall_error), gr14
+ setlo #gotofffuncdesclo(__syscall_error), gr14
+ ldd @(gr14, gr15), gr14
+ jmpl @(gr14, gr0)
+
+ .size __vfork,.-__vfork
+
+weak_alias(__vfork,vfork)
+libc_hidden_weak(vfork)
diff --git a/ap/build/uClibc/libc/sysdeps/linux/frv/xstatconv.c b/ap/build/uClibc/libc/sysdeps/linux/frv/xstatconv.c
new file mode 100644
index 0000000..d7948c0
--- /dev/null
+++ b/ap/build/uClibc/libc/sysdeps/linux/frv/xstatconv.c
@@ -0,0 +1 @@
+/* We don't need any of this. */