[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/build/uClibc/libc/string/.indent.pro b/ap/build/uClibc/libc/string/.indent.pro
new file mode 100644
index 0000000..492ecf1
--- /dev/null
+++ b/ap/build/uClibc/libc/string/.indent.pro
@@ -0,0 +1,33 @@
+--blank-lines-after-declarations
+--blank-lines-after-procedures
+--break-before-boolean-operator
+--no-blank-lines-after-commas
+--braces-on-if-line
+--braces-on-struct-decl-line
+--comment-indentation25
+--declaration-comment-column25
+--no-comment-delimiters-on-blank-lines
+--cuddle-else
+--continuation-indentation4
+--case-indentation0
+--else-endif-column33
+--space-after-cast
+--line-comments-indentation0
+--declaration-indentation1
+--dont-format-first-column-comments
+--dont-format-comments
+--honour-newlines
+--indent-level4
+/* changed from 0 to 4 */
+--parameter-indentation4
+--line-length78 /* changed from 75 */
+--continue-at-parentheses
+--no-space-after-function-call-names
+--dont-break-procedure-type
+--dont-star-comments
+--leave-optional-blank-lines
+--dont-space-special-semicolon
+--tab-size4
+/* additions by Mark */
+--case-brace-indentation0
+--leave-preprocessor-space
diff --git a/ap/build/uClibc/libc/string/Makefile b/ap/build/uClibc/libc/string/Makefile
new file mode 100644
index 0000000..11f362a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir=../../
+top_builddir=../../
+all: objs
+include $(top_builddir)Rules.mak
+include Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/Makefile.in b/ap/build/uClibc/libc/string/Makefile.in
new file mode 100644
index 0000000..e7f2ccd
--- /dev/null
+++ b/ap/build/uClibc/libc/string/Makefile.in
@@ -0,0 +1,144 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+subdirs += libc/string/$(TARGET_ARCH) libc/string/generic
+
+#
+# Arch specific fun
+#
+# Collect the subarch specific implementation (asm files)
+ifneq ($(strip $(TARGET_SUBARCH)),)
+STRING_SUBARCH_DIR := $(top_srcdir)libc/string/$(TARGET_ARCH)/$(TARGET_SUBARCH)
+STRING_SUBARCH_OUT := $(top_builddir)libc/string/$(TARGET_ARCH)/$(TARGET_SUBARCH)
+
+STRING_SUBARCH_SSRC := $(wildcard $(STRING_SUBARCH_OUT)/*.S)
+STRING_SUBARCH_SOBJ := $(patsubst $(STRING_SUBARCH_DIR)/%.S,$(STRING_SUBARCH_OUT)/%.o,$(STRING_SUBARCH_SSRC))
+
+STRING_SUBARCH_CSRC := $(wildcard $(STRING_SUBARCH_OUT)/*.c)
+STRING_SUBARCH_COBJ := $(patsubst $(STRING_SUBARCH_DIR)/%.c,$(STRING_SUBARCH_OUT)/%.o,$(STRING_SUBARCH_CSRC))
+
+STRING_SUBARCH_OBJS := $(STRING_SUBARCH_SOBJ) $(STRING_SUBARCH_COBJ)
+endif
+
+# Collect the arch specific implementation (asm, c files)
+STRING_ARCH_DIR := $(top_srcdir)libc/string/$(TARGET_ARCH)
+STRING_ARCH_OUT := $(top_builddir)libc/string/$(TARGET_ARCH)
+
+STRING_ARCH_SRC := $(wildcard $(STRING_ARCH_DIR)/*.c)
+STRING_ARCH_OBJ := $(patsubst $(STRING_ARCH_DIR)/%.c,$(STRING_ARCH_OUT)/%.o,$(STRING_ARCH_SRC))
+
+STRING_ARCH_SSRC := $(wildcard $(STRING_ARCH_DIR)/*.S)
+
+# Exclude the subarch implementation from the arch ones
+ifneq ($(strip $(STRING_SUBARCH_OBJS)),)
+STRING_ARCH_SSRC := $(filter-out $(patsubst %.o,$(STRING_ARCH_DIR)/%.S,$(notdir $(STRING_SUBARCH_OBJS))),$(STRING_ARCH_SSRC))
+endif
+
+STRING_ARCH_SOBJ := $(patsubst $(STRING_ARCH_DIR)/%.S,$(STRING_ARCH_OUT)/%.o,$(STRING_ARCH_SSRC))
+
+STRING_ARCH_OBJS := $(STRING_ARCH_OBJ) $(STRING_ARCH_SOBJ)
+
+libc-$(UCLIBC_HAS_STRING_ARCH_OPT) += $(STRING_ARCH_OBJS) $(STRING_SUBARCH_OBJS)
+
+libc-nomulti-$(UCLIBC_HAS_STRING_ARCH_OPT) += $(STRING_ARCH_SOBJ) $(STRING_SUBARCH_OBJS)
+
+#
+# Generic stuff
+#
+STRING_GENERIC_DIR := $(top_srcdir)libc/string/generic
+STRING_GENERIC_OUT := $(top_builddir)libc/string/generic
+
+STRING_GENERIC_SRC := $(wildcard $(STRING_GENERIC_DIR)/*.c)
+STRING_GENERIC_SRC := $(filter-out $(STRING_GENERIC_DIR)/_memcpy_fwd.c, $(STRING_GENERIC_SRC))
+
+ifeq ($(UCLIBC_HAS_STRING_ARCH_OPT),y)
+ifneq ($(strip $(STRING_ARCH_OBJS)),)
+STRING_GENERIC_SRC := $(filter-out $(patsubst %.o,$(STRING_GENERIC_DIR)/%.c,$(notdir $(STRING_ARCH_OBJS))),$(STRING_GENERIC_SRC))
+endif
+ifneq ($(strip $(STRING_SUBARCH_OBJS)),)
+STRING_GENERIC_SRC := $(filter-out $(patsubst %.o,$(STRING_GENERIC_DIR)/%.c,$(notdir $(STRING_SUBARCH_OBJS))),$(STRING_GENERIC_SRC))
+endif
+endif
+
+STRING_GENERIC_OBJS := $(patsubst $(STRING_GENERIC_DIR)/%.c,$(STRING_GENERIC_OUT)/%.o,$(STRING_GENERIC_SRC))
+
+libc-$(UCLIBC_HAS_STRING_GENERIC_OPT) += $(STRING_GENERIC_OBJS)
+
+#
+# Top level string
+#
+STRING_DIR := $(top_srcdir)libc/string
+STRING_OUT := $(top_builddir)libc/string
+
+STRING_ALL_WXSRC := $(wildcard $(STRING_DIR)/w*_l.c)
+ifeq ($(UCLIBC_HAS_LOCALE),y)
+STRING_WXSRC := $(STRING_ALL_WXSRC)
+else
+# wcscoll_l
+STRING_WXSRC := $(filter-out $(STRING_DIR)/wcsxfrm_l.c,$(STRING_ALL_WXSRC))
+endif
+
+STRING_ALL_XLSRC := $(filter-out $(STRING_ALL_WXSRC),$(wildcard $(STRING_DIR)/*_l.c))
+ifeq ($(UCLIBC_HAS_LOCALE),y)
+STRING_XLSRC := $(STRING_ALL_XLSRC)
+else
+# strcoll_l
+STRING_XLSRC := $(filter-out $(STRING_DIR)/strxfrm_l.c,$(STRING_ALL_XLSRC))
+endif
+
+STRING_ALL_WSRC := $(filter-out $(STRING_ALL_WXSRC),$(wildcard $(STRING_DIR)/w*.c))
+ifeq ($(UCLIBC_HAS_LOCALE),y)
+STRING_WSRC := $(STRING_ALL_WSRC)
+else
+# wcscoll
+STRING_WSRC := $(filter-out $(STRING_DIR)/wcsxfrm.c,$(STRING_ALL_WSRC))
+endif
+
+STRING_ALL_CSRC := $(filter-out $(STRING_ALL_WXSRC) $(STRING_ALL_XLSRC) $(STRING_ALL_WSRC) $(STRING_DIR)/_collate.c,$(wildcard $(STRING_DIR)/*.c))
+ifeq ($(UCLIBC_HAS_LOCALE),y)
+STRING_CSRC := $(STRING_ALL_CSRC)
+else
+# strcoll
+STRING_CSRC := $(filter-out $(STRING_DIR)/strxfrm.c,$(STRING_ALL_CSRC))
+endif
+
+ifeq ($(UCLIBC_HAS_WCHAR),y)
+STRING_CSRC += $(STRING_WSRC)
+endif
+ifeq ($(UCLIBC_HAS_XLOCALE),y)
+STRING_CSRC += $(STRING_XLSRC)
+ifeq ($(UCLIBC_HAS_WCHAR),y)
+STRING_CSRC += $(STRING_WXSRC)
+endif
+endif
+
+ifeq ($(UCLIBC_HAS_STRING_ARCH_OPT),y)
+ifneq ($(strip $(STRING_ARCH_OBJS)),)
+STRING_CSRC := $(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_ARCH_OBJS))),$(STRING_CSRC))
+endif
+ifneq ($(strip $(STRING_SUBARCH_OBJS)),)
+STRING_CSRC := $(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_SUBARCH_OBJS))),$(STRING_CSRC))
+endif
+endif
+
+ifeq ($(UCLIBC_HAS_STRING_GENERIC_OPT),y)
+ifneq ($(strip $(STRING_GENERIC_OBJS)),)
+STRING_CSRC := $(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_GENERIC_OBJS))),$(STRING_CSRC))
+endif
+endif
+
+STRING_COBJ := $(patsubst $(STRING_DIR)/%.c,$(STRING_OUT)/%.o,$(STRING_CSRC))
+
+libc-y += $(STRING_COBJ)
+
+libc-nomulti-$(UCLIBC_HAS_XLOCALE) += $(STRING_OUT)/wcsxfrm_l.o
+libc-nomulti-y += $(STRING_OUT)/__xpg_strerror_r.o
+
+objclean-y += CLEAN_libc/string
+
+CLEAN_libc/string:
+ $(do_rm) $(addprefix $(STRING_OUT)/,$(addprefix *., o os oS) $(addprefix */*., o os oS) $(addprefix */*/*., o os oS))
diff --git a/ap/build/uClibc/libc/string/__glibc_strerror_r.c b/ap/build/uClibc/libc/string/__glibc_strerror_r.c
new file mode 100644
index 0000000..e97e552
--- /dev/null
+++ b/ap/build/uClibc/libc/string/__glibc_strerror_r.c
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+#include <string.h>
+
+
+char *__glibc_strerror_r(int errnum, char *strerrbuf, size_t buflen)
+{
+ __xpg_strerror_r(errnum, strerrbuf, buflen);
+
+ return strerrbuf;
+}
+libc_hidden_def(__glibc_strerror_r)
diff --git a/ap/build/uClibc/libc/string/__xpg_basename.c b/ap/build/uClibc/libc/string/__xpg_basename.c
new file mode 100644
index 0000000..2449d1d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/__xpg_basename.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+#include <libgen.h>
+
+char *__xpg_basename(register char *path)
+{
+ static const char null_or_empty[] = ".";
+ char *first;
+ register char *last;
+
+ first = (char *) null_or_empty;
+
+ if (path && *path) {
+ first = path;
+ last = path - 1;
+
+ do {
+ if ((*path != '/') && (path > ++last)) {
+ last = first = path;
+ }
+ } while (*++path);
+
+ if (*first == '/') {
+ last = first;
+ }
+ last[1] = 0;
+ }
+
+ return first;
+}
diff --git a/ap/build/uClibc/libc/string/__xpg_strerror_r.c b/ap/build/uClibc/libc/string/__xpg_strerror_r.c
new file mode 100644
index 0000000..fb4d440
--- /dev/null
+++ b/ap/build/uClibc/libc/string/__xpg_strerror_r.c
@@ -0,0 +1,276 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/* Make sure we get proper strerror_r() prototype */
+#define strerror_r _hidestrerror_r
+
+#include <features.h>
+#include <errno.h>
+#include <string.h>
+#include "_syserrmsg.h"
+
+#undef strerror_r
+
+
+#ifdef __UCLIBC_HAS_ERRNO_MESSAGES__
+
+extern const char _string_syserrmsgs[] attribute_hidden;
+
+#if defined(__alpha__) || defined(__mips__) || defined(__sparc__)
+
+static const unsigned char estridx[] = {
+ 0, /* success is always 0 */
+ EPERM,
+ ENOENT,
+ ESRCH,
+ EINTR,
+ EIO,
+ ENXIO,
+ E2BIG,
+ ENOEXEC,
+ EBADF,
+ ECHILD,
+ EAGAIN,
+ ENOMEM,
+ EACCES,
+ EFAULT,
+ ENOTBLK,
+ EBUSY,
+ EEXIST,
+ EXDEV,
+ ENODEV,
+ ENOTDIR,
+ EISDIR,
+ EINVAL,
+ ENFILE,
+ EMFILE,
+ ENOTTY,
+ ETXTBSY,
+ EFBIG,
+ ENOSPC,
+ ESPIPE,
+ EROFS,
+ EMLINK,
+ EPIPE,
+ EDOM,
+ ERANGE,
+ EDEADLK,
+ ENAMETOOLONG,
+ ENOLCK,
+ ENOSYS,
+ ENOTEMPTY,
+ ELOOP,
+ 0,
+ ENOMSG,
+ EIDRM,
+ ECHRNG,
+ EL2NSYNC,
+ EL3HLT,
+ EL3RST,
+ ELNRNG,
+ EUNATCH,
+ ENOCSI,
+ EL2HLT,
+ EBADE,
+ EBADR,
+ EXFULL,
+ ENOANO,
+ EBADRQC,
+ EBADSLT,
+ 0,
+ EBFONT,
+ ENOSTR,
+ ENODATA,
+ ETIME,
+ ENOSR,
+ ENONET,
+ ENOPKG,
+ EREMOTE,
+ ENOLINK,
+ EADV,
+ ESRMNT,
+ ECOMM,
+ EPROTO,
+ EMULTIHOP,
+ EDOTDOT,
+ EBADMSG,
+ EOVERFLOW,
+ ENOTUNIQ,
+ EBADFD,
+ EREMCHG,
+ ELIBACC,
+ ELIBBAD,
+ ELIBSCN,
+ ELIBMAX,
+ ELIBEXEC,
+ EILSEQ,
+ ERESTART,
+ ESTRPIPE,
+ EUSERS,
+ ENOTSOCK,
+ EDESTADDRREQ,
+ EMSGSIZE,
+ EPROTOTYPE,
+ ENOPROTOOPT,
+ EPROTONOSUPPORT,
+ ESOCKTNOSUPPORT,
+ EOPNOTSUPP,
+ EPFNOSUPPORT,
+ EAFNOSUPPORT,
+ EADDRINUSE,
+ EADDRNOTAVAIL,
+ ENETDOWN,
+ ENETUNREACH,
+ ENETRESET,
+ ECONNABORTED,
+ ECONNRESET,
+ ENOBUFS,
+ EISCONN,
+ ENOTCONN,
+ ESHUTDOWN,
+ ETOOMANYREFS,
+ ETIMEDOUT,
+ ECONNREFUSED,
+ EHOSTDOWN,
+ EHOSTUNREACH,
+ EALREADY,
+ EINPROGRESS,
+ ESTALE,
+ EUCLEAN,
+ ENOTNAM,
+ ENAVAIL,
+ EISNAM,
+ EREMOTEIO,
+#if EDQUOT > 200 /* mips has an outrageous value for this... */
+ 0,
+#else
+ EDQUOT,
+#endif
+ ENOMEDIUM,
+ EMEDIUMTYPE,
+#if EDEADLOCK != EDEADLK
+ EDEADLOCK,
+#endif
+};
+
+#endif
+
+int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)
+{
+ register char *s;
+ int i, retval;
+ char buf[_STRERROR_BUFSIZE];
+ static const char unknown[] = {
+ 'U', 'n', 'k', 'n', 'o', 'w', 'n', ' ', 'e', 'r', 'r', 'o', 'r', ' '
+ };
+
+ retval = EINVAL;
+
+
+#ifdef __UCLIBC_HAS_ERRNO_MESSAGES__
+
+#if defined(__alpha__) || defined(__mips__) || defined(__sparc__)
+ /* Need to translate errno to string index. */
+ for (i = 0 ; i < sizeof(estridx)/sizeof(estridx[0]) ; i++) {
+ if (estridx[i] == errnum) {
+ goto GOT_ESTRIDX;
+ }
+ }
+ i = INT_MAX; /* Failed, but may need to check mips special case. */
+#if EDQUOT > 200 /* Deal with large EDQUOT value on mips */
+ if (errnum == EDQUOT)
+ i = 122;
+#endif
+ GOT_ESTRIDX:
+#else
+ /* No errno to string index translation needed. */
+ i = errnum;
+#endif
+
+ if (((unsigned int) i) < _SYS_NERR) {
+ /* Trade time for space. This function should rarely be called
+ * so rather than keeping an array of pointers for the different
+ * messages, just run through the buffer until we find the
+ * correct string. */
+ for (s = (char *) _string_syserrmsgs ; i ; ++s) {
+ if (!*s) {
+ --i;
+ }
+ }
+ if (*s) { /* Make sure we have an actual message. */
+ retval = 0;
+ goto GOT_MESG;
+ }
+ }
+
+#endif /* __UCLIBC_HAS_ERRNO_MESSAGES__ */
+
+ s = _int10tostr(buf+sizeof(buf)-1, errnum) - sizeof(unknown);
+ memcpy(s, unknown, sizeof(unknown));
+
+ GOT_MESG:
+ if (!strerrbuf) { /* SUSv3 */
+ buflen = 0;
+ }
+ i = strlen(s) + 1;
+ if (i > buflen) {
+ i = buflen;
+ retval = ERANGE;
+ }
+
+ if (i) {
+ memcpy(strerrbuf, s, i);
+ strerrbuf[i-1] = 0; /* In case buf was too small. */
+ }
+
+ if (retval) {
+ __set_errno(retval);
+ }
+
+ return retval;
+}
+
+#else /* __UCLIBC_HAS_ERRNO_MESSAGES__ */
+
+int __xpg_strerror_r(int errnum, char *strerrbuf, size_t buflen)
+{
+ register char *s;
+ int i, retval;
+ char buf[_STRERROR_BUFSIZE];
+ static const char unknown[] = {
+ 'U', 'n', 'k', 'n', 'o', 'w', 'n', ' ', 'e', 'r', 'r', 'o', 'r', ' '
+ };
+
+ s = _int10tostr(buf+sizeof(buf)-1, errnum) - sizeof(unknown);
+ memcpy(s, unknown, sizeof(unknown));
+
+ if (!strerrbuf) { /* SUSv3 */
+ buflen = 0;
+ }
+
+ retval = EINVAL;
+
+ i = buf + sizeof(buf) - s;
+
+ if (i > buflen) {
+ i = buflen;
+ retval = ERANGE;
+ }
+
+ if (i) {
+ memcpy(strerrbuf, s, i);
+ strerrbuf[i-1] = 0; /* In case buf was too small. */
+ }
+
+ __set_errno(retval);
+
+ return retval;
+}
+
+#endif /* __UCLIBC_HAS_ERRNO_MESSAGES__ */
+libc_hidden_def(__xpg_strerror_r)
+weak_alias(__xpg_strerror_r, strerror_r)
diff --git a/ap/build/uClibc/libc/string/_collate.c b/ap/build/uClibc/libc/string/_collate.c
new file mode 100644
index 0000000..def56d2
--- /dev/null
+++ b/ap/build/uClibc/libc/string/_collate.c
@@ -0,0 +1,670 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/* Dec 20, 2002
+ * Initial test implementation of strcoll, strxfrm, wcscoll, and wcsxfrm.
+ * The code needs to be cleaned up a good bit, but I'd like to see people
+ * test it out.
+ *
+ */
+
+#include "_string.h"
+#include <ctype.h>
+#include <locale.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <assert.h>
+
+#ifdef __UCLIBC_HAS_LOCALE__
+#if defined(L_strxfrm) || defined(L_strxfrm_l) || defined(L_wcsxfrm) || defined(L_wcsxfrm_l)
+
+#ifdef L_strxfrm
+#ifndef WANT_WIDE
+#error WANT_WIDE should be defined for L_strxfrm
+#endif
+#ifdef L_wcsxfrm
+#error L_wcsxfrm already defined for L_strxfrm
+#endif
+#endif /* L_strxfrm */
+
+#if defined(L_strxfrm) || defined(L_strxfrm_l)
+
+#define wcscoll strcoll
+#define wcscoll_l strcoll_l
+#define wcsxfrm strxfrm
+#define wcsxfrm_l strxfrm_l
+
+#undef WANT_WIDE
+#undef Wvoid
+#undef Wchar
+#undef Wuchar
+#undef Wint
+
+#define Wchar char
+
+#endif /* defined(L_strxfrm) || defined(L_strxfrm_l) */
+
+#if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE)
+
+
+int wcscoll (const Wchar *s0, const Wchar *s1)
+{
+ return wcscoll_l(s0, s1, __UCLIBC_CURLOCALE );
+}
+libc_hidden_def(wcscoll)
+
+
+size_t wcsxfrm(Wchar *__restrict ws1, const Wchar *__restrict ws2, size_t n)
+{
+ return wcsxfrm_l(ws1, ws2, n, __UCLIBC_CURLOCALE );
+}
+
+#else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
+
+
+#if 0
+#define CUR_COLLATE (&__UCLIBC_CURLOCALE->collate)
+#else
+#define CUR_COLLATE (& __LOCALE_PTR->collate)
+#endif
+
+#define MAX_PENDING 8
+
+typedef struct {
+ const Wchar *s;
+ const Wchar *eob; /* end of backward */
+
+ __uwchar_t weight;
+ __uwchar_t ui_weight; /* undefined or invalid */
+ int colitem;
+ int weightidx;
+ int rule;
+ size_t position;
+ /* should be wchar_t. if wchar < 0 do EILSEQ? */
+ __uwchar_t *cip;
+ __uwchar_t ci_pending[MAX_PENDING]; /* nul-terminated */
+
+ char *back_buf;
+ char *bbe; /* end of back_buf (actual last... not 1 past end) */
+ char *bp; /* ptr into backbuf, NULL if not in backward mode */
+ char ibb[128];
+ size_t bb_size;
+
+ int ru_pushed;
+} col_state_t;
+
+
+#define WEIGHT_MASK 0x3fffU
+#define RULE_MASK 0xc000U
+
+#define RULE_FORWARD (1 << 14)
+#define RULE_POSITION (1 << 15)
+
+#define UI_IDX (WEIGHT_MASK-6)
+#define POSIT_IDX (WEIGHT_MASK-5)
+#define RANGE_IDX (WEIGHT_MASK-4)
+#define UNDEF_IDX (WEIGHT_MASK-3)
+#define INVAL_IDX (WEIGHT_MASK-2)
+#define DITTO_IDX (WEIGHT_MASK-1)
+
+
+#undef TRACE
+#if 0
+#define TRACE(X) printf X
+#else
+#define TRACE(X) ((void)0)
+#endif
+
+static int lookup(wchar_t wc __LOCALE_PARAM )
+{
+ unsigned int sc, n, i0, i1;
+
+ if (((__uwchar_t) wc) > 0xffffU) {
+ return 0;
+ }
+
+ sc = wc & CUR_COLLATE->ti_mask;
+ wc >>= CUR_COLLATE->ti_shift;
+ n = wc & CUR_COLLATE->ii_mask;
+ wc >>= CUR_COLLATE->ii_shift;
+
+ i0 = CUR_COLLATE->wcs2colidt_tbl[wc];
+ i0 <<= CUR_COLLATE->ii_shift;
+ i1 = CUR_COLLATE->wcs2colidt_tbl[CUR_COLLATE->ii_len + i0 + n];
+ i1 <<= CUR_COLLATE->ti_shift;
+ return CUR_COLLATE->wcs2colidt_tbl[CUR_COLLATE->ii_len + CUR_COLLATE->ti_len + i1 + sc];
+
+}
+
+static void init_col_state(col_state_t *cs, const Wchar *wcs)
+{
+ memset(cs, 0, sizeof(col_state_t));
+ cs->s = wcs;
+ cs->bp = cs->back_buf = cs->ibb;
+ cs->bb_size = 128;
+ cs->bbe = cs->back_buf + (cs->bb_size -1);
+}
+
+static void next_weight(col_state_t *cs, int pass __LOCALE_PARAM )
+{
+ int r, w, ru, ri, popping_backup_stack;
+ ssize_t n;
+ const uint16_t *p;
+#ifdef WANT_WIDE
+#define WC (*cs->s)
+#define N (1)
+#else /* WANT_WIDE */
+ wchar_t WC;
+ size_t n0, nx;
+#define N n0
+
+#endif /* WANT_WIDE */
+
+ do {
+
+ if (cs->ru_pushed) {
+ ru = cs->ru_pushed;
+ TRACE(("ru_pushed = %d\n", ru));
+ cs->ru_pushed = 0;
+ goto POSITION_SKIP;
+ }
+
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning should we walk pendings backwards?
+#endif
+ if (cs->cip) { /* possible pending weight */
+ if ((r = *(cs->cip++)) == 0) {
+ cs->cip = NULL;
+ continue;
+ }
+ cs->weightidx = r & WEIGHT_MASK;
+ assert(cs->weightidx);
+/* assert(cs->weightidx != WEIGHT_MASK); */
+ } else { /* get the next collation item from the string */
+ TRACE(("clearing popping flag\n"));
+ popping_backup_stack = 0;
+
+ IGNORE_LOOP:
+ /* keep first pos as 0 for a sentinal */
+ if (*cs->bp) { /* pending backward chars */
+ POP_BACKUP:
+ popping_backup_stack = 1;
+ TRACE(("setting popping flag\n"));
+ n = 0;
+ if (*cs->bp > 0) { /* singles pending */
+ cs->s -= 1;
+ if ((*cs->bp -= 1) == 0) {
+ cs->bp -= 1;
+ }
+ } else { /* last was a multi */
+ cs->s += *cs->bp;
+ cs->bp -= 1;
+ }
+ } else if (!*cs->s) { /* not in backward mode and end of string */
+ cs->weight = 0;
+ return;
+ } else {
+ cs->position += 1;
+ }
+
+ BACK_LOOP:
+#ifdef WANT_WIDE
+ n = 1;
+ cs->colitem = r = lookup(*cs->s __LOCALE_ARG );
+#else /* WANT_WIDE */
+ n = n0 = __locale_mbrtowc_l(&WC, cs->s, __LOCALE_PTR);
+ if (n < 0) {
+ __set_errno(EILSEQ);
+ cs->weight = 0;
+ return;
+ }
+ cs->colitem = r = lookup(WC __LOCALE_ARG );
+#endif /* WANT_WIDE */
+
+ TRACE((" r=%d WC=%#lx\n", r, (unsigned long)(WC)));
+
+ if (r > CUR_COLLATE->max_col_index) { /* starting char for one or more sequences */
+ p = CUR_COLLATE->multistart_tbl;
+ p += p[r-CUR_COLLATE->max_col_index -1];
+ do {
+ n = N;
+ r = *p++;
+ do {
+ if (!*p) { /* found it */
+ cs->colitem = r;
+ TRACE((" found multi %d\n", n));
+ goto FOUND;
+ }
+#ifdef WANT_WIDE
+ /* the lookup check here is safe since we're assured that *p is a valid colidx */
+ if (!cs->s[n] || (lookup(cs->s[n] __LOCALE_ARG ) != *p)) {
+ do {} while (*p++);
+ break;
+ }
+ ++p;
+ ++n;
+#else /* WANT_WIDE */
+ if (cs->s[n]) {
+ nx = __locale_mbrtowc_l(&WC, cs->s + n, __LOCALE_PTR);
+ if (nx < 0) {
+ __set_errno(EILSEQ);
+ cs->weight = 0;
+ return;
+ }
+ }
+ if (!cs->s[n] || (lookup(WC __LOCALE_ARG ) != *p)) {
+ do {} while (*p++);
+ break;
+ }
+ ++p;
+ n += nx; /* Only gets here if cs->s[n] != 0, so nx is set. */
+#endif /* WANT_WIDE */
+ } while (1);
+ } while (1);
+ } else if (r == 0) { /* illegal, undefined, or part of a range */
+ if ((CUR_COLLATE->range_count)
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning .. need to introduce range as a collating item?
+#endif
+ && (((__uwchar_t)(WC - CUR_COLLATE->range_low)) <= CUR_COLLATE->range_count)
+ ) { /* part of a range */
+ /* Note: cs->colitem = 0 already. */
+ TRACE((" found range\n"));
+ ru = CUR_COLLATE->ruletable[CUR_COLLATE->range_rule_offset*CUR_COLLATE->MAX_WEIGHTS + pass];
+ assert((ru & WEIGHT_MASK) != DITTO_IDX);
+ if ((ru & WEIGHT_MASK) == WEIGHT_MASK) {
+ ru = (ru & RULE_MASK) | RANGE_IDX;
+ cs->weight = CUR_COLLATE->range_base_weight + (WC - CUR_COLLATE->range_low);
+ }
+ goto RANGE_SKIP_TO;
+ } else if (((__uwchar_t)(WC)) <= 0x7fffffffUL) { /* legal but undefined */
+ UNDEFINED:
+ /* Note: cs->colitem = 0 already. */
+ ri = CUR_COLLATE->undefined_idx;
+ assert(ri != 0); /* implicit undefined isn't supported */
+
+ TRACE((" found explicit UNDEFINED\n"));
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning right now single weight locales do not support ..
+#endif
+ if (CUR_COLLATE->num_weights == 1) {
+ TRACE((" single weight UNDEFINED\n"));
+ cs->weightidx = RANGE_IDX;
+ cs->weight = ri;
+ cs->s += n;
+ goto PROCESS_WEIGHT;
+ }
+
+ ri = CUR_COLLATE->index2ruleidx[ri - 1];
+ ru = CUR_COLLATE->ruletable[ri * CUR_COLLATE->MAX_WEIGHTS + pass];
+ assert((ru & WEIGHT_MASK) != WEIGHT_MASK); /* TODO: handle ".." */
+ if ((ru & WEIGHT_MASK) == DITTO_IDX) {
+ cs->colitem = CUR_COLLATE->undefined_idx;
+ }
+ goto RANGE_SKIP_TO;
+ } else { /* illegal */
+ TRACE((" found illegal\n"));
+ __set_errno(EINVAL);
+ /* We put all illegals in the same equiv class with maximal weight,
+ * and ignore them after the first pass. */
+ if (pass > 0) {
+ cs->s += n;
+ goto IGNORE_LOOP;
+ }
+ ru = (RULE_FORWARD | RANGE_IDX);
+ cs->weight = 0xffffU;
+ goto RANGE_SKIP_TO;
+ }
+ } else if (CUR_COLLATE->num_weights == 1) {
+ TRACE((" single weight\n"));
+ cs->weightidx = RANGE_IDX;
+ cs->weight = cs->colitem;
+ cs->s += n;
+ goto PROCESS_WEIGHT;
+ } else {
+ TRACE((" normal\n"));
+ }
+
+ /* if we get here, it is a normal char either singlely weighted, undefined, or in a range */
+ FOUND:
+ ri = CUR_COLLATE->index2ruleidx[cs->colitem - 1];
+ TRACE((" ri=%d ", ri));
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning make sure this is correct
+#endif
+ if (!ri) {
+ TRACE(("NOT IN THIS LOCALE\n"));
+ goto UNDEFINED;
+ }
+ ru = CUR_COLLATE->ruletable[ri * CUR_COLLATE->MAX_WEIGHTS + pass];
+
+ RANGE_SKIP_TO:
+
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning ignoreables probably should not interrupt backwards processing, but this is wrong
+#endif
+/* if (!(ru & WEIGHT_MASK)) { */
+/* TRACE(("IGNORE\n")); */
+/* cs->s += n; */
+/* continue; */
+/* } */
+
+
+ TRACE((" rule = %#x weight = %#x popping = %d s = %p eob = %p\n",
+ ru & RULE_MASK, ru & WEIGHT_MASK, popping_backup_stack,
+ cs->s, cs->eob));
+ /* now we need to check if we're going backwards... */
+
+ if (!popping_backup_stack) {
+ if (!(ru & RULE_MASK)) { /* backward */
+ TRACE(("backwards\n"));
+ assert(cs->bp <= cs->bbe);
+ if (cs->bp == cs->bbe) {
+ if (cs->back_buf == cs->ibb) { /* was using internal buffer */
+ cs->bp = malloc(cs->bb_size + 128);
+ if (!cs->bp) {
+ __set_errno(ENOMEM);
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning what to do here?
+#endif
+ cs->weight = 0;
+ return;
+ }
+ memcpy(cs->bp, cs->back_buf, cs->bb_size);
+
+ } else {
+ cs->bp = realloc(cs->back_buf, cs->bb_size + 128);
+ if (!cs->bp) {
+ __set_errno(ENOMEM);
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning what to do here?
+#endif
+ cs->weight = 0;
+ return;
+ }
+ }
+ cs->bb_size += 128;
+ cs->bbe = cs->bp + (cs->bbe - cs->back_buf);
+ cs->back_buf = cs->bp;
+ cs->bp = cs->bbe;
+
+ }
+ if (n==1) { /* single char */
+ if (*cs->bp && (((unsigned char)(*cs->bp)) < CHAR_MAX)) {
+ *cs->bp += 1; /* increment last single's count */
+ } else { /* last was a multi, or just starting */
+ if (!cs->bp) {
+ cs->bp = cs->back_buf;
+ } else {
+ assert(cs->bp < cs->bbe);
+ ++cs->bp;
+ }
+ *cs->bp = 1;
+ }
+ } else { /* multichar */
+ assert(n>1);
+ assert(cs->bp < cs->bbe);
+ *++cs->bp = -n;
+ }
+ cs->s += n;
+ if (*cs->s) {
+ goto BACK_LOOP;
+ }
+ /* end-of-string so start popping */
+ cs->eob = cs->s;
+ TRACE(("popping\n"));
+ goto POP_BACKUP;
+ } else if (*cs->bp) { /* was going backward but this element isn't */
+ /* discard current and use previous backward element */
+ assert(!cs->cip);
+ cs->eob = cs->s;
+ TRACE(("popping\n"));
+ goto POP_BACKUP;
+ } else { /* was and still going forward */
+ TRACE(("forwards\n"));
+ if ((ru & (RULE_POSITION|WEIGHT_MASK)) > RULE_POSITION) {
+ assert(ru & WEIGHT_MASK);
+ cs->ru_pushed = ru;
+ cs->weight = cs->position;
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning devel code
+#endif
+ cs->position = 0; /* reset to reduce size for strcoll? */
+ cs->s += n;
+ cs->weightidx = RANGE_IDX;
+ goto PROCESS_WEIGHT;
+ }
+ }
+ } else { /* popping backwards stack */
+ TRACE(("popping (continued)\n"));
+ if (!*cs->bp) {
+ cs->s = cs->eob;
+ }
+ cs->s -= n;
+ }
+
+ cs->s += n;
+ POSITION_SKIP:
+ cs->weightidx = ru & WEIGHT_MASK;
+ cs->rule = ru & RULE_MASK;
+ }
+
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning for pending we only want the weight... _not_ the rule
+#endif
+ if (!cs->weightidx) { /* ignore */
+ continue;
+ }
+
+ PROCESS_WEIGHT:
+ assert(cs->weightidx);
+
+
+ if (((unsigned int)(cs->weightidx - UI_IDX)) <= (INVAL_IDX-UI_IDX)) {
+ if (cs->weightidx == UI_IDX) {
+ cs->weight = cs->ui_weight;
+ }
+ return;
+ }
+
+ assert(cs->weightidx != WEIGHT_MASK);
+ if (cs->weightidx == DITTO_IDX) { /* want the weight of the current collating item */
+ TRACE(("doing ditto\n"));
+ w = CUR_COLLATE->index2weight[cs->colitem -1];
+ } else if (cs->weightidx <= CUR_COLLATE->max_col_index) { /* normal */
+ TRACE(("doing normal\n"));
+ w = CUR_COLLATE->index2weight[cs->weightidx -1];
+ } else { /* a string */
+ TRACE(("doing string\n"));
+ assert(!(cs->weightidx & RULE_MASK));
+ /* note: iso14561 allows null string here */
+ p = CUR_COLLATE->weightstr + (cs->weightidx - (CUR_COLLATE->max_col_index + 2));
+ if (*p & WEIGHT_MASK) {
+ r = 0;
+ do {
+ assert(r < MAX_PENDING);
+ cs->ci_pending[r++] = *p++;
+ } while (*p & WEIGHT_MASK);
+ cs->cip = cs->ci_pending;
+ }
+ continue;
+ }
+
+ cs->weight = w;
+ return;
+ } while (1);
+}
+
+int __XL_NPP(wcscoll) (const Wchar *s0, const Wchar *s1 __LOCALE_PARAM )
+{
+ col_state_t ws[2];
+ int pass;
+
+ if (!CUR_COLLATE->num_weights) { /* C locale */
+#ifdef WANT_WIDE
+ return wcscmp(s0, s1);
+#else
+ return strcmp(s0, s1);
+#endif
+ }
+
+ pass = 0;
+ do { /* loop through the weights levels */
+ init_col_state(ws, s0);
+ init_col_state(ws+1, s1);
+ do { /* loop through the strings */
+ /* for each string, get the next weight */
+ next_weight(ws, pass __LOCALE_ARG );
+ next_weight(ws+1, pass __LOCALE_ARG );
+ TRACE(("w0=%lu w1=%lu\n",
+ (unsigned long) ws[0].weight,
+ (unsigned long) ws[1].weight));
+
+ if (ws[0].weight != ws[1].weight) {
+ return ws[0].weight - ws[1].weight;
+ }
+ } while (ws[0].weight);
+ } while (++pass < CUR_COLLATE->num_weights);
+
+ return 0;
+}
+libc_hidden_def(__XL_NPP(wcscoll))
+
+#ifdef WANT_WIDE
+
+size_t __XL_NPP(wcsxfrm)(wchar_t *__restrict ws1, const wchar_t *__restrict ws2,
+ size_t n __LOCALE_PARAM )
+{
+ col_state_t cs;
+ size_t count;
+ int pass;
+
+ if (!CUR_COLLATE->num_weights) { /* C locale */
+ return __wcslcpy(ws1, ws2, n);
+ }
+
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning handle empty string as a special case
+#endif
+
+ count = pass = 0;
+ do { /* loop through the weights levels */
+ init_col_state(&cs, ws2);
+ do { /* loop through the string */
+ next_weight(&cs, pass __LOCALE_ARG );
+ TRACE(("weight=%lu (%#lx)\n", (unsigned long) cs.weight, (unsigned long) cs.weight));
+ if (count < n) {
+ ws1[count] = cs.weight +1;
+ }
+ ++count;
+ TRACE(("--------------------------------------------\n"));
+ } while (cs.weight);
+ if (count <= n) { /* overwrite the trailing 0 end-of-pass marker */
+ ws1[count-1] = 1;
+ }
+ TRACE(("-------------------- pass %d --------------------\n", pass));
+ } while (++pass < CUR_COLLATE->num_weights);
+ if (count <= n) { /* oops... change it back */
+ ws1[count-1] = 0;
+ }
+ return count-1;
+}
+#if defined L_strxfrm_l || defined L_wcsxfrm_l
+libc_hidden_def(__XL_NPP(wcsxfrm))
+#endif
+
+#else /* WANT_WIDE */
+
+static const unsigned long bound[] = {
+ 1UL << 7,
+ 1UL << 11,
+ 1UL << 16,
+ 1UL << 21,
+ 1UL << 26,
+};
+
+static unsigned char first[] = {
+ 0x0, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc
+};
+
+/* Use an extension of UTF-8 to store a 32 bit val in max 6 bytes. */
+
+static size_t store(unsigned char *s, size_t count, size_t n, __uwchar_t weight)
+{
+ int i, r;
+
+ i = 0;
+ do {
+ if (weight < bound[i]) {
+ break;
+ }
+ } while (++i < sizeof(bound)/sizeof(bound[0]));
+
+ r = i+1;
+ if (i + count < n) {
+ s += count;
+ s[0] = first[i];
+ while (i) {
+ s[i] = 0x80 | (weight & 0x3f);
+ weight >>= 6;
+ --i;
+ }
+ s[0] |= weight;
+ }
+
+ return r;
+}
+
+size_t __XL_NPP(strxfrm)(char *__restrict ws1, const char *__restrict ws2, size_t n
+ __LOCALE_PARAM )
+{
+ col_state_t cs;
+ size_t count, inc;
+ int pass;
+
+ if (!CUR_COLLATE->num_weights) { /* C locale */
+ return strlcpy(ws1, ws2, n);
+ }
+
+#ifdef __UCLIBC_MJN3_ONLY__
+#warning handle empty string as a special case
+#endif
+
+ inc = count = pass = 0;
+ do { /* loop through the weights levels */
+ init_col_state(&cs, ws2);
+ do { /* loop through the string */
+ next_weight(&cs, pass __LOCALE_ARG );
+ TRACE(("weight=%lu (%#lx)\n", (unsigned long) cs.weight, (unsigned long) cs.weight));
+ inc = store((unsigned char *)ws1, count, n, cs.weight + 1);
+ count += inc;
+ TRACE(("--------------------------------------------\n"));
+ } while (cs.weight);
+ /* overwrite the trailing 0 end-of-pass marker */
+ assert(inc == 1);
+ if (count <= n) {
+ ws1[count-1] = 1;
+ }
+ TRACE(("-------------------- pass %d --------------------\n", pass));
+ } while (++pass < CUR_COLLATE->num_weights);
+ if (count <= n) { /* oops... change it back */
+ ws1[count-1] = 0;
+ }
+ return count-1;
+}
+#ifdef L_strxfrm_l
+libc_hidden_def(__XL_NPP(strxfrm))
+#endif
+
+#endif /* WANT_WIDE */
+
+#endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
+
+#endif /* defined(L_strxfrm) || defined(L_strxfrm_l) || defined(L_wcsxfrm) || defined(L_wcsxfrm_l) */
+
+#endif /* __UCLIBC_HAS_LOCALE__ */
+/**********************************************************************/
diff --git a/ap/build/uClibc/libc/string/_string.h b/ap/build/uClibc/libc/string/_string.h
new file mode 100644
index 0000000..67f17b1
--- /dev/null
+++ b/ap/build/uClibc/libc/string/_string.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef __STRING_H
+#define __STRING_H
+
+#include <features.h>
+#include <string.h>
+#include <limits.h>
+#include <stdint.h>
+
+#ifdef WANT_WIDE
+# include <wchar.h>
+# include <wctype.h>
+# include <bits/uClibc_uwchar.h>
+# define Wvoid wchar_t
+# define Wchar wchar_t
+# define Wuchar __uwchar_t
+# define Wint wchar_t
+#else
+# define Wvoid void
+# define Wchar char
+typedef unsigned char __string_uchar_t;
+# define Wuchar __string_uchar_t
+# define Wint int
+#endif
+
+#endif /* __STRING_H */
diff --git a/ap/build/uClibc/libc/string/_string_syserrmsgs.c b/ap/build/uClibc/libc/string/_string_syserrmsgs.c
new file mode 100644
index 0000000..893af5c
--- /dev/null
+++ b/ap/build/uClibc/libc/string/_string_syserrmsgs.c
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+
+#ifdef __UCLIBC_HAS_ERRNO_MESSAGES__
+
+attribute_hidden
+const char _string_syserrmsgs[] = {
+ /* 0: 0, 8 */ "Success\0"
+ /* 1: 8, 24 */ "Operation not permitted\0"
+ /* 2: 32, 26 */ "No such file or directory\0"
+ /* 3: 58, 16 */ "No such process\0"
+ /* 4: 74, 24 */ "Interrupted system call\0"
+ /* 5: 98, 19 */ "Input/output error\0"
+ /* 6: 117, 26 */ "No such device or address\0"
+ /* 7: 143, 23 */ "Argument list too long\0"
+ /* 8: 166, 18 */ "Exec format error\0"
+ /* 9: 184, 20 */ "Bad file descriptor\0"
+ /* 10: 204, 19 */ "No child processes\0"
+ /* 11: 223, 33 */ "Resource temporarily unavailable\0"
+ /* 12: 256, 23 */ "Cannot allocate memory\0"
+ /* 13: 279, 18 */ "Permission denied\0"
+ /* 14: 297, 12 */ "Bad address\0"
+ /* 15: 309, 22 */ "Block device required\0"
+ /* 16: 331, 24 */ "Device or resource busy\0"
+ /* 17: 355, 12 */ "File exists\0"
+ /* 18: 367, 26 */ "Invalid cross-device link\0"
+ /* 19: 393, 15 */ "No such device\0"
+ /* 20: 408, 16 */ "Not a directory\0"
+ /* 21: 424, 15 */ "Is a directory\0"
+ /* 22: 439, 17 */ "Invalid argument\0"
+ /* 23: 456, 30 */ "Too many open files in system\0"
+ /* 24: 486, 20 */ "Too many open files\0"
+ /* 25: 506, 31 */ "Inappropriate ioctl for device\0"
+ /* 26: 537, 15 */ "Text file busy\0"
+ /* 27: 552, 15 */ "File too large\0"
+ /* 28: 567, 24 */ "No space left on device\0"
+ /* 29: 591, 13 */ "Illegal seek\0"
+ /* 30: 604, 22 */ "Read-only file system\0"
+ /* 31: 626, 15 */ "Too many links\0"
+ /* 32: 641, 12 */ "Broken pipe\0"
+ /* 33: 653, 33 */ "Numerical argument out of domain\0"
+ /* 34: 686, 30 */ "Numerical result out of range\0"
+ /* 35: 716, 26 */ "Resource deadlock avoided\0"
+ /* 36: 742, 19 */ "File name too long\0"
+ /* 37: 761, 19 */ "No locks available\0"
+ /* 38: 780, 25 */ "Function not implemented\0"
+ /* 39: 805, 20 */ "Directory not empty\0"
+ /* 40: 825, 34 */ "Too many levels of symbolic links\0"
+ /* 41: 859, 1 */ "\0"
+ /* 42: 860, 27 */ "No message of desired type\0"
+ /* 43: 887, 19 */ "Identifier removed\0"
+ /* 44: 906, 28 */ "Channel number out of range\0"
+ /* 45: 934, 25 */ "Level 2 not synchronized\0"
+ /* 46: 959, 15 */ "Level 3 halted\0"
+ /* 47: 974, 14 */ "Level 3 reset\0"
+ /* 48: 988, 25 */ "Link number out of range\0"
+ /* 49: 1013, 29 */ "Protocol driver not attached\0"
+ /* 50: 1042, 27 */ "No CSI structure available\0"
+ /* 51: 1069, 15 */ "Level 2 halted\0"
+ /* 52: 1084, 17 */ "Invalid exchange\0"
+ /* 53: 1101, 27 */ "Invalid request descriptor\0"
+ /* 54: 1128, 14 */ "Exchange full\0"
+ /* 55: 1142, 9 */ "No anode\0"
+ /* 56: 1151, 21 */ "Invalid request code\0"
+ /* 57: 1172, 13 */ "Invalid slot\0"
+ /* 58: 1185, 1 */ "\0"
+ /* 59: 1186, 21 */ "Bad font file format\0"
+ /* 60: 1207, 20 */ "Device not a stream\0"
+ /* 61: 1227, 18 */ "No data available\0"
+ /* 62: 1245, 14 */ "Timer expired\0"
+ /* 63: 1259, 25 */ "Out of streams resources\0"
+ /* 64: 1284, 30 */ "Machine is not on the network\0"
+ /* 65: 1314, 22 */ "Package not installed\0"
+ /* 66: 1336, 17 */ "Object is remote\0"
+ /* 67: 1353, 22 */ "Link has been severed\0"
+ /* 68: 1375, 16 */ "Advertise error\0"
+ /* 69: 1391, 14 */ "Srmount error\0"
+ /* 70: 1405, 28 */ "Communication error on send\0"
+ /* 71: 1433, 15 */ "Protocol error\0"
+ /* 72: 1448, 19 */ "Multihop attempted\0"
+ /* 73: 1467, 19 */ "RFS specific error\0"
+ /* 74: 1486, 12 */ "Bad message\0"
+ /* 75: 1498, 38 */ "Value too large for defined data type\0"
+ /* 76: 1536, 27 */ "Name not unique on network\0"
+ /* 77: 1563, 29 */ "File descriptor in bad state\0"
+ /* 78: 1592, 23 */ "Remote address changed\0"
+ /* 79: 1615, 39 */ "Can not access a needed shared library\0"
+ /* 80: 1654, 37 */ "Accessing a corrupted shared library\0"
+ /* 81: 1691, 32 */ ".lib section in a.out corrupted\0"
+ /* 82: 1723, 48 */ "Attempting to link in too many shared libraries\0"
+ /* 83: 1771, 38 */ "Cannot exec a shared library directly\0"
+ /* 84: 1809, 50 */ "Invalid or incomplete multibyte or wide character\0"
+ /* 85: 1859, 44 */ "Interrupted system call should be restarted\0"
+ /* 86: 1903, 19 */ "Streams pipe error\0"
+ /* 87: 1922, 15 */ "Too many users\0"
+ /* 88: 1937, 31 */ "Socket operation on non-socket\0"
+ /* 89: 1968, 29 */ "Destination address required\0"
+ /* 90: 1997, 17 */ "Message too long\0"
+ /* 91: 2014, 31 */ "Protocol wrong type for socket\0"
+ /* 92: 2045, 23 */ "Protocol not available\0"
+ /* 93: 2068, 23 */ "Protocol not supported\0"
+ /* 94: 2091, 26 */ "Socket type not supported\0"
+ /* 95: 2117, 24 */ "Operation not supported\0"
+ /* 96: 2141, 30 */ "Protocol family not supported\0"
+ /* 97: 2171, 41 */ "Address family not supported by protocol\0"
+ /* 98: 2212, 23 */ "Address already in use\0"
+ /* 99: 2235, 32 */ "Cannot assign requested address\0"
+ /* 100: 2267, 16 */ "Network is down\0"
+ /* 101: 2283, 23 */ "Network is unreachable\0"
+ /* 102: 2306, 36 */ "Network dropped connection on reset\0"
+ /* 103: 2342, 33 */ "Software caused connection abort\0"
+ /* 104: 2375, 25 */ "Connection reset by peer\0"
+ /* 105: 2400, 26 */ "No buffer space available\0"
+ /* 106: 2426, 40 */ "Transport endpoint is already connected\0"
+ /* 107: 2466, 36 */ "Transport endpoint is not connected\0"
+ /* 108: 2502, 46 */ "Cannot send after transport endpoint shutdown\0"
+ /* 109: 2548, 35 */ "Too many references: cannot splice\0"
+ /* 110: 2583, 21 */ "Connection timed out\0"
+ /* 111: 2604, 19 */ "Connection refused\0"
+ /* 112: 2623, 13 */ "Host is down\0"
+ /* 113: 2636, 17 */ "No route to host\0"
+ /* 114: 2653, 30 */ "Operation already in progress\0"
+ /* 115: 2683, 26 */ "Operation now in progress\0"
+ /* 116: 2709, 22 */ "Stale NFS file handle\0"
+ /* 117: 2731, 25 */ "Structure needs cleaning\0"
+ /* 118: 2756, 28 */ "Not a XENIX named type file\0"
+ /* 119: 2784, 30 */ "No XENIX semaphores available\0"
+ /* 120: 2814, 21 */ "Is a named type file\0"
+ /* 121: 2835, 17 */ "Remote I/O error\0"
+ /* 122: 2852, 20 */ "Disk quota exceeded\0"
+ /* 123: 2872, 16 */ "No medium found\0"
+ /* 124: 2888, 18 */ "Wrong medium type"
+#if defined(__mips__) || defined(__sparc__)
+ "\0"
+ /* 125: 2906, 28 */ "File locking deadlock error"
+#endif
+ /* Note: for mips we are ignoring ECANCELED since glibc doesn't have a
+ * corresponsding message.*/
+};
+
+#endif
diff --git a/ap/build/uClibc/libc/string/_string_syssigmsgs.c b/ap/build/uClibc/libc/string/_string_syssigmsgs.c
new file mode 100644
index 0000000..26c0948
--- /dev/null
+++ b/ap/build/uClibc/libc/string/_string_syssigmsgs.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+
+#ifdef __UCLIBC_HAS_SIGNUM_MESSAGES__
+
+attribute_hidden
+const char _string_syssigmsgs[] = {
+ /* 0: 0, 1 */ "\0"
+ /* 1: 1, 7 */ "Hangup\0"
+ /* 2: 8, 10 */ "Interrupt\0"
+ /* 3: 18, 5 */ "Quit\0"
+ /* 4: 23, 20 */ "Illegal instruction\0"
+ /* 5: 43, 22 */ "Trace/breakpoint trap\0"
+ /* 6: 65, 8 */ "Aborted\0"
+ /* 7: 73, 10 */ "Bus error\0"
+ /* 8: 83, 25 */ "Floating point exception\0"
+ /* 9: 108, 7 */ "Killed\0"
+ /* 10: 115, 22 */ "User defined signal 1\0"
+ /* 11: 137, 19 */ "Segmentation fault\0"
+ /* 12: 156, 22 */ "User defined signal 2\0"
+ /* 13: 178, 12 */ "Broken pipe\0"
+ /* 14: 190, 12 */ "Alarm clock\0"
+ /* 15: 202, 11 */ "Terminated\0"
+ /* 16: 213, 12 */ "Stack fault\0"
+ /* 17: 225, 13 */ "Child exited\0"
+ /* 18: 238, 10 */ "Continued\0"
+ /* 19: 248, 17 */ "Stopped (signal)\0"
+ /* 20: 265, 8 */ "Stopped\0"
+ /* 21: 273, 20 */ "Stopped (tty input)\0"
+ /* 22: 293, 21 */ "Stopped (tty output)\0"
+ /* 23: 314, 21 */ "Urgent I/O condition\0"
+ /* 24: 335, 24 */ "CPU time limit exceeded\0"
+ /* 25: 359, 25 */ "File size limit exceeded\0"
+ /* 26: 384, 22 */ "Virtual timer expired\0"
+ /* 27: 406, 24 */ "Profiling timer expired\0"
+ /* 28: 430, 15 */ "Window changed\0"
+ /* 29: 445, 13 */ "I/O possible\0"
+ /* 30: 458, 14 */ "Power failure\0"
+ /* 31: 472, 16 */ "Bad system call"
+#if defined SIGEMT
+ /* 32: 488, 9 */ "\0EMT trap"
+#endif
+};
+
+#endif
diff --git a/ap/build/uClibc/libc/string/_syserrmsg.h b/ap/build/uClibc/libc/string/_syserrmsg.h
new file mode 100644
index 0000000..8bd742e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/_syserrmsg.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef __SYSERRMSG_H
+#define __SYSERRMSG_H 1
+
+#include <bits/uClibc_uintmaxtostr.h>
+
+/**********************************************************************/
+/* NOTE: If we ever do internationalized syserr messages, this will
+ * have to be changed! */
+
+#if defined(__mips__) || defined(__sparc__)
+/* sparce and mips have an extra error entry, as EDEADLK and EDEADLOCK have
+ * different meanings on those platforms. */
+# define _SYS_NERR 126
+#else
+# define _SYS_NERR 125
+#endif
+
+#ifdef __UCLIBC_HAS_ERRNO_MESSAGES__
+# define _SYS_ERRMSG_MAXLEN 50
+#else /* __UCLIBC_HAS_ERRNO_MESSAGES__ */
+# define _SYS_ERRMSG_MAXLEN 0
+#endif /* __UCLIBC_HAS_ERRNO_MESSAGES__ */
+
+#if _SYS_ERRMSG_MAXLEN < __UIM_BUFLEN_INT + 14
+# define _STRERROR_BUFSIZE (__UIM_BUFLEN_INT + 14)
+#else
+# define _STRERROR_BUFSIZE _SYS_ERRMSG_MAXLEN
+#endif
+
+#endif
diff --git a/ap/build/uClibc/libc/string/arm/Makefile b/ap/build/uClibc/libc/string/arm/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/arm/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/arm/_memcpy.S b/ap/build/uClibc/libc/string/arm/_memcpy.S
new file mode 100644
index 0000000..b26080d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/arm/_memcpy.S
@@ -0,0 +1,747 @@
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Neil A. Carson and Mark Brinicombe
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Adapted for uClibc from NetBSD _memcpy.S,v 1.6 2003/10/09
+ * by Erik Andersen <andersen@codepoet.org>
+ */
+
+#include <features.h>
+#include <endian.h>
+#include <bits/arm_asm.h>
+
+#if !defined(THUMB1_ONLY)
+/*
+ * This is one fun bit of code ...
+ * Some easy listening music is suggested while trying to understand this
+ * code e.g. Iron Maiden
+ *
+ * For anyone attempting to understand it :
+ *
+ * The core code is implemented here with simple stubs for memcpy()
+ * memmove() and bcopy().
+ *
+ * All local labels are prefixed with Lmemcpy_
+ * Following the prefix a label starting f is used in the forward copy code
+ * while a label using b is used in the backwards copy code
+ * The source and destination addresses determine whether a forward or
+ * backward copy is performed.
+ * Separate bits of code are used to deal with the following situations
+ * for both the forward and backwards copy.
+ * unaligned source address
+ * unaligned destination address
+ * Separate copy routines are used to produce an optimised result for each
+ * of these cases.
+ * The copy code will use LDM/STM instructions to copy up to 32 bytes at
+ * a time where possible.
+ *
+ * Note: r12 (aka ip) can be trashed during the function along with
+ * r0-r3 although r0-r2 have defined uses i.e. dest, src, len throughout.
+ * Additional registers are preserved prior to use i.e. r4, r5 & lr
+ * The return value in r0 must be the destination address.
+ *
+ * Apologies for the state of the comments ;-)
+ */
+
+.text
+.global _memcpy
+.hidden _memcpy
+.type _memcpy,%function
+.align 4
+
+/* XXX: The Thumb-2 conditionals can be removed if/when we require an
+ assembler that supports unified syntax. */
+.macro copy regs
+#if defined(__thumb2__)
+ ittt ge
+ ldmiage r1!, \regs
+ stmiage r0!, \regs
+#else
+ ldmgeia r1!, \regs
+ stmgeia r0!, \regs
+#endif
+.endm
+
+.macro copydb regs
+#if defined(__thumb2__)
+ ittt ge
+ ldmdbge r1!, \regs
+ stmdbge r0!, \regs
+#else
+ ldmgedb r1!, \regs
+ stmgedb r0!, \regs
+#endif
+.endm
+
+_memcpy:
+ /* Determine copy direction */
+ cmp r1, r0
+ bcc .Lmemcpy_backwards
+
+ IT(t, eq) /* Quick abort for src=dst */
+#if defined(__USE_BX__)
+ bxeq lr
+#else
+ moveq pc, lr
+#endif
+ stmdb sp!, {r0, lr} /* memcpy() returns dest addr */
+ subs r2, r2, #4
+ blt .Lmemcpy_fl4 /* less than 4 bytes */
+ ands r12, r0, #3
+ bne .Lmemcpy_fdestul /* oh unaligned destination addr */
+ ands r12, r1, #3
+ bne .Lmemcpy_fsrcul /* oh unaligned source addr */
+
+.Lmemcpy_ft8:
+ /* We have aligned source and destination */
+ subs r2, r2, #8
+ blt .Lmemcpy_fl12 /* less than 12 bytes (4 from above) */
+ subs r2, r2, #0x14
+ blt .Lmemcpy_fl32 /* less than 32 bytes (12 from above) */
+ str r4, [sp, #-4]! /* borrow r4 */
+
+ /* blat 32 bytes at a time */
+ /* XXX for really big copies perhaps we should use more registers */
+.Lmemcpy_floop32:
+ ldmia r1!, {r3, r4, r12, lr}
+ stmia r0!, {r3, r4, r12, lr}
+ ldmia r1!, {r3, r4, r12, lr}
+ stmia r0!, {r3, r4, r12, lr}
+ subs r2, r2, #0x20
+ bge .Lmemcpy_floop32
+
+ cmn r2, #0x10
+ /* blat a remaining 16 bytes */
+ copy "{r3, r4, r12, lr}"
+ subge r2, r2, #0x10
+ ldr r4, [sp], #4 /* restore r4 */
+
+.Lmemcpy_fl32:
+ adds r2, r2, #0x14
+
+ /* blat 12 bytes at a time */
+.Lmemcpy_floop12:
+ copy "{r3, r12, lr}"
+#if defined(__thumb2__)
+ subsge r2, r2, #0x0c
+#else
+ subges r2, r2, #0x0c
+#endif
+ bge .Lmemcpy_floop12
+
+.Lmemcpy_fl12:
+ adds r2, r2, #8
+ blt .Lmemcpy_fl4
+
+ subs r2, r2, #4
+ IT(tt, lt)
+ ldrlt r3, [r1], #4
+ strlt r3, [r0], #4
+ copy "{r3, r12}"
+ subge r2, r2, #4
+
+.Lmemcpy_fl4:
+ /* less than 4 bytes to go */
+ adds r2, r2, #4
+#if defined(__thumb2__)
+ it eq
+ popeq {r0, pc} /* done */
+#elif defined(__ARM_ARCH_4T__)
+ ldmeqia sp!, {r0, r3} /* done */
+ bxeq r3
+#else
+ ldmeqia sp!, {r0, pc} /* done */
+#endif
+
+ /* copy the crud byte at a time */
+ cmp r2, #2
+ ldrb r3, [r1], #1
+ strb r3, [r0], #1
+#if defined(__thumb2__)
+ itt ge
+ ldrbge r3, [r1], #1
+ strbge r3, [r0], #1
+ itt gt
+ ldrbgt r3, [r1], #1
+ strbgt r3, [r0], #1
+#else
+ ldrgeb r3, [r1], #1
+ strgeb r3, [r0], #1
+ ldrgtb r3, [r1], #1
+ strgtb r3, [r0], #1
+#endif
+#if defined(__ARM_ARCH_4T__)
+ ldmia sp!, {r0, r3}
+ bx r3
+#else
+ ldmia sp!, {r0, pc}
+#endif
+
+ /* erg - unaligned destination */
+.Lmemcpy_fdestul:
+ rsb r12, r12, #4
+ cmp r12, #2
+
+ /* align destination with byte copies */
+ ldrb r3, [r1], #1
+ strb r3, [r0], #1
+#if defined(__thumb2__)
+ itt ge
+ ldrbge r3, [r1], #1
+ strbge r3, [r0], #1
+ itt gt
+ ldrbgt r3, [r1], #1
+ strbgt r3, [r0], #1
+#else
+ ldrgeb r3, [r1], #1
+ strgeb r3, [r0], #1
+ ldrgtb r3, [r1], #1
+ strgtb r3, [r0], #1
+#endif
+ subs r2, r2, r12
+ blt .Lmemcpy_fl4 /* less the 4 bytes */
+
+ ands r12, r1, #3
+ beq .Lmemcpy_ft8 /* we have an aligned source */
+
+ /* erg - unaligned source */
+ /* This is where it gets nasty ... */
+.Lmemcpy_fsrcul:
+ bic r1, r1, #3
+ ldr lr, [r1], #4
+ cmp r12, #2
+ bgt .Lmemcpy_fsrcul3
+ beq .Lmemcpy_fsrcul2
+ cmp r2, #0x0c
+ blt .Lmemcpy_fsrcul1loop4
+ sub r2, r2, #0x0c
+ stmdb sp!, {r4, r5}
+
+.Lmemcpy_fsrcul1loop16:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov r3, lr, lsl #8
+ ldmia r1!, {r4, r5, r12, lr}
+ orr r3, r3, r4, lsr #24
+ mov r4, r4, lsl #8
+ orr r4, r4, r5, lsr #24
+ mov r5, r5, lsl #8
+ orr r5, r5, r12, lsr #24
+ mov r12, r12, lsl #8
+ orr r12, r12, lr, lsr #24
+#else
+ mov r3, lr, lsr #8
+ ldmia r1!, {r4, r5, r12, lr}
+ orr r3, r3, r4, lsl #24
+ mov r4, r4, lsr #8
+ orr r4, r4, r5, lsl #24
+ mov r5, r5, lsr #8
+ orr r5, r5, r12, lsl #24
+ mov r12, r12, lsr #8
+ orr r12, r12, lr, lsl #24
+#endif
+ stmia r0!, {r3-r5, r12}
+ subs r2, r2, #0x10
+ bge .Lmemcpy_fsrcul1loop16
+ ldmia sp!, {r4, r5}
+ adds r2, r2, #0x0c
+ blt .Lmemcpy_fsrcul1l4
+
+.Lmemcpy_fsrcul1loop4:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov r12, lr, lsl #8
+ ldr lr, [r1], #4
+ orr r12, r12, lr, lsr #24
+#else
+ mov r12, lr, lsr #8
+ ldr lr, [r1], #4
+ orr r12, r12, lr, lsl #24
+#endif
+ str r12, [r0], #4
+ subs r2, r2, #4
+ bge .Lmemcpy_fsrcul1loop4
+
+.Lmemcpy_fsrcul1l4:
+ sub r1, r1, #3
+ b .Lmemcpy_fl4
+
+.Lmemcpy_fsrcul2:
+ cmp r2, #0x0c
+ blt .Lmemcpy_fsrcul2loop4
+ sub r2, r2, #0x0c
+ stmdb sp!, {r4, r5}
+
+.Lmemcpy_fsrcul2loop16:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov r3, lr, lsl #16
+ ldmia r1!, {r4, r5, r12, lr}
+ orr r3, r3, r4, lsr #16
+ mov r4, r4, lsl #16
+ orr r4, r4, r5, lsr #16
+ mov r5, r5, lsl #16
+ orr r5, r5, r12, lsr #16
+ mov r12, r12, lsl #16
+ orr r12, r12, lr, lsr #16
+#else
+ mov r3, lr, lsr #16
+ ldmia r1!, {r4, r5, r12, lr}
+ orr r3, r3, r4, lsl #16
+ mov r4, r4, lsr #16
+ orr r4, r4, r5, lsl #16
+ mov r5, r5, lsr #16
+ orr r5, r5, r12, lsl #16
+ mov r12, r12, lsr #16
+ orr r12, r12, lr, lsl #16
+#endif
+ stmia r0!, {r3-r5, r12}
+ subs r2, r2, #0x10
+ bge .Lmemcpy_fsrcul2loop16
+ ldmia sp!, {r4, r5}
+ adds r2, r2, #0x0c
+ blt .Lmemcpy_fsrcul2l4
+
+.Lmemcpy_fsrcul2loop4:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov r12, lr, lsl #16
+ ldr lr, [r1], #4
+ orr r12, r12, lr, lsr #16
+#else
+ mov r12, lr, lsr #16
+ ldr lr, [r1], #4
+ orr r12, r12, lr, lsl #16
+#endif
+ str r12, [r0], #4
+ subs r2, r2, #4
+ bge .Lmemcpy_fsrcul2loop4
+
+.Lmemcpy_fsrcul2l4:
+ sub r1, r1, #2
+ b .Lmemcpy_fl4
+
+.Lmemcpy_fsrcul3:
+ cmp r2, #0x0c
+ blt .Lmemcpy_fsrcul3loop4
+ sub r2, r2, #0x0c
+ stmdb sp!, {r4, r5}
+
+.Lmemcpy_fsrcul3loop16:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov r3, lr, lsl #24
+ ldmia r1!, {r4, r5, r12, lr}
+ orr r3, r3, r4, lsr #8
+ mov r4, r4, lsl #24
+ orr r4, r4, r5, lsr #8
+ mov r5, r5, lsl #24
+ orr r5, r5, r12, lsr #8
+ mov r12, r12, lsl #24
+ orr r12, r12, lr, lsr #8
+#else
+ mov r3, lr, lsr #24
+ ldmia r1!, {r4, r5, r12, lr}
+ orr r3, r3, r4, lsl #8
+ mov r4, r4, lsr #24
+ orr r4, r4, r5, lsl #8
+ mov r5, r5, lsr #24
+ orr r5, r5, r12, lsl #8
+ mov r12, r12, lsr #24
+ orr r12, r12, lr, lsl #8
+#endif
+ stmia r0!, {r3-r5, r12}
+ subs r2, r2, #0x10
+ bge .Lmemcpy_fsrcul3loop16
+ ldmia sp!, {r4, r5}
+ adds r2, r2, #0x0c
+ blt .Lmemcpy_fsrcul3l4
+
+.Lmemcpy_fsrcul3loop4:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov r12, lr, lsl #24
+ ldr lr, [r1], #4
+ orr r12, r12, lr, lsr #8
+#else
+ mov r12, lr, lsr #24
+ ldr lr, [r1], #4
+ orr r12, r12, lr, lsl #8
+#endif
+ str r12, [r0], #4
+ subs r2, r2, #4
+ bge .Lmemcpy_fsrcul3loop4
+
+.Lmemcpy_fsrcul3l4:
+ sub r1, r1, #1
+ b .Lmemcpy_fl4
+
+.Lmemcpy_backwards:
+ add r1, r1, r2
+ add r0, r0, r2
+ subs r2, r2, #4
+ blt .Lmemcpy_bl4 /* less than 4 bytes */
+ ands r12, r0, #3
+ bne .Lmemcpy_bdestul /* oh unaligned destination addr */
+ ands r12, r1, #3
+ bne .Lmemcpy_bsrcul /* oh unaligned source addr */
+
+.Lmemcpy_bt8:
+ /* We have aligned source and destination */
+ subs r2, r2, #8
+ blt .Lmemcpy_bl12 /* less than 12 bytes (4 from above) */
+ stmdb sp!, {r4, lr}
+ subs r2, r2, #0x14 /* less than 32 bytes (12 from above) */
+ blt .Lmemcpy_bl32
+
+ /* blat 32 bytes at a time */
+ /* XXX for really big copies perhaps we should use more registers */
+.Lmemcpy_bloop32:
+ ldmdb r1!, {r3, r4, r12, lr}
+ stmdb r0!, {r3, r4, r12, lr}
+ ldmdb r1!, {r3, r4, r12, lr}
+ stmdb r0!, {r3, r4, r12, lr}
+ subs r2, r2, #0x20
+ bge .Lmemcpy_bloop32
+
+.Lmemcpy_bl32:
+ cmn r2, #0x10
+ /* blat a remaining 16 bytes */
+ copydb "{r3, r4, r12, lr}"
+ subge r2, r2, #0x10
+ adds r2, r2, #0x14
+ /* blat a remaining 12 bytes */
+ copydb "{r3, r12, lr}"
+ subge r2, r2, #0x0c
+ ldmia sp!, {r4, lr}
+
+.Lmemcpy_bl12:
+ adds r2, r2, #8
+ blt .Lmemcpy_bl4
+ subs r2, r2, #4
+ IT(tt, lt)
+ ldrlt r3, [r1, #-4]!
+ strlt r3, [r0, #-4]!
+ copydb "{r3, r12}"
+ subge r2, r2, #4
+
+.Lmemcpy_bl4:
+ /* less than 4 bytes to go */
+ adds r2, r2, #4
+ IT(t, eq)
+#if defined(__USE_BX__)
+ bxeq lr
+#else
+ moveq pc, lr /* done */
+#endif
+ /* copy the crud byte at a time */
+ cmp r2, #2
+ ldrb r3, [r1, #-1]!
+ strb r3, [r0, #-1]!
+#ifdef __thumb2__
+ itt ge
+ ldrbge r3, [r1, #-1]!
+ strbge r3, [r0, #-1]!
+ itt gt
+ ldrbgt r3, [r1, #-1]!
+ strbgt r3, [r0, #-1]!
+#else
+ ldrgeb r3, [r1, #-1]!
+ strgeb r3, [r0, #-1]!
+ ldrgtb r3, [r1, #-1]!
+ strgtb r3, [r0, #-1]!
+#endif
+#if defined(__USE_BX__)
+ bx lr
+#else
+ mov pc, lr
+#endif
+ /* erg - unaligned destination */
+.Lmemcpy_bdestul:
+ cmp r12, #2
+
+ /* align destination with byte copies */
+ ldrb r3, [r1, #-1]!
+ strb r3, [r0, #-1]!
+#ifdef __thumb2__
+ itt ge
+ ldrbge r3, [r1, #-1]!
+ strbge r3, [r0, #-1]!
+ itt gt
+ ldrbgt r3, [r1, #-1]!
+ strbgt r3, [r0, #-1]!
+#else
+ ldrgeb r3, [r1, #-1]!
+ strgeb r3, [r0, #-1]!
+ ldrgtb r3, [r1, #-1]!
+ strgtb r3, [r0, #-1]!
+#endif
+ subs r2, r2, r12
+ blt .Lmemcpy_bl4 /* less than 4 bytes to go */
+ ands r12, r1, #3
+ beq .Lmemcpy_bt8 /* we have an aligned source */
+
+ /* erg - unaligned source */
+ /* This is where it gets nasty ... */
+.Lmemcpy_bsrcul:
+ bic r1, r1, #3
+ ldr r3, [r1, #0]
+ cmp r12, #2
+ blt .Lmemcpy_bsrcul1
+ beq .Lmemcpy_bsrcul2
+ cmp r2, #0x0c
+ blt .Lmemcpy_bsrcul3loop4
+ sub r2, r2, #0x0c
+ stmdb sp!, {r4, r5, lr}
+
+.Lmemcpy_bsrcul3loop16:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov lr, r3, lsr #8
+ ldmdb r1!, {r3-r5, r12}
+ orr lr, lr, r12, lsl #24
+ mov r12, r12, lsr #8
+ orr r12, r12, r5, lsl #24
+ mov r5, r5, lsr #8
+ orr r5, r5, r4, lsl #24
+ mov r4, r4, lsr #8
+ orr r4, r4, r3, lsl #24
+#else
+ mov lr, r3, lsl #8
+ ldmdb r1!, {r3-r5, r12}
+ orr lr, lr, r12, lsr #24
+ mov r12, r12, lsl #8
+ orr r12, r12, r5, lsr #24
+ mov r5, r5, lsl #8
+ orr r5, r5, r4, lsr #24
+ mov r4, r4, lsl #8
+ orr r4, r4, r3, lsr #24
+#endif
+ stmdb r0!, {r4, r5, r12, lr}
+ subs r2, r2, #0x10
+ bge .Lmemcpy_bsrcul3loop16
+ ldmia sp!, {r4, r5, lr}
+ adds r2, r2, #0x0c
+ blt .Lmemcpy_bsrcul3l4
+
+.Lmemcpy_bsrcul3loop4:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov r12, r3, lsr #8
+ ldr r3, [r1, #-4]!
+ orr r12, r12, r3, lsl #24
+#else
+ mov r12, r3, lsl #8
+ ldr r3, [r1, #-4]!
+ orr r12, r12, r3, lsr #24
+#endif
+ str r12, [r0, #-4]!
+ subs r2, r2, #4
+ bge .Lmemcpy_bsrcul3loop4
+
+.Lmemcpy_bsrcul3l4:
+ add r1, r1, #3
+ b .Lmemcpy_bl4
+
+.Lmemcpy_bsrcul2:
+ cmp r2, #0x0c
+ blt .Lmemcpy_bsrcul2loop4
+ sub r2, r2, #0x0c
+ stmdb sp!, {r4, r5, lr}
+
+.Lmemcpy_bsrcul2loop16:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov lr, r3, lsr #16
+ ldmdb r1!, {r3-r5, r12}
+ orr lr, lr, r12, lsl #16
+ mov r12, r12, lsr #16
+ orr r12, r12, r5, lsl #16
+ mov r5, r5, lsr #16
+ orr r5, r5, r4, lsl #16
+ mov r4, r4, lsr #16
+ orr r4, r4, r3, lsl #16
+#else
+ mov lr, r3, lsl #16
+ ldmdb r1!, {r3-r5, r12}
+ orr lr, lr, r12, lsr #16
+ mov r12, r12, lsl #16
+ orr r12, r12, r5, lsr #16
+ mov r5, r5, lsl #16
+ orr r5, r5, r4, lsr #16
+ mov r4, r4, lsl #16
+ orr r4, r4, r3, lsr #16
+#endif
+ stmdb r0!, {r4, r5, r12, lr}
+ subs r2, r2, #0x10
+ bge .Lmemcpy_bsrcul2loop16
+ ldmia sp!, {r4, r5, lr}
+ adds r2, r2, #0x0c
+ blt .Lmemcpy_bsrcul2l4
+
+.Lmemcpy_bsrcul2loop4:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov r12, r3, lsr #16
+ ldr r3, [r1, #-4]!
+ orr r12, r12, r3, lsl #16
+#else
+ mov r12, r3, lsl #16
+ ldr r3, [r1, #-4]!
+ orr r12, r12, r3, lsr #16
+#endif
+ str r12, [r0, #-4]!
+ subs r2, r2, #4
+ bge .Lmemcpy_bsrcul2loop4
+
+.Lmemcpy_bsrcul2l4:
+ add r1, r1, #2
+ b .Lmemcpy_bl4
+
+.Lmemcpy_bsrcul1:
+ cmp r2, #0x0c
+ blt .Lmemcpy_bsrcul1loop4
+ sub r2, r2, #0x0c
+ stmdb sp!, {r4, r5, lr}
+
+.Lmemcpy_bsrcul1loop32:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov lr, r3, lsr #24
+ ldmdb r1!, {r3-r5, r12}
+ orr lr, lr, r12, lsl #8
+ mov r12, r12, lsr #24
+ orr r12, r12, r5, lsl #8
+ mov r5, r5, lsr #24
+ orr r5, r5, r4, lsl #8
+ mov r4, r4, lsr #24
+ orr r4, r4, r3, lsl #8
+#else
+ mov lr, r3, lsl #24
+ ldmdb r1!, {r3-r5, r12}
+ orr lr, lr, r12, lsr #8
+ mov r12, r12, lsl #24
+ orr r12, r12, r5, lsr #8
+ mov r5, r5, lsl #24
+ orr r5, r5, r4, lsr #8
+ mov r4, r4, lsl #24
+ orr r4, r4, r3, lsr #8
+#endif
+ stmdb r0!, {r4, r5, r12, lr}
+ subs r2, r2, #0x10
+ bge .Lmemcpy_bsrcul1loop32
+ ldmia sp!, {r4, r5, lr}
+ adds r2, r2, #0x0c
+ blt .Lmemcpy_bsrcul1l4
+
+.Lmemcpy_bsrcul1loop4:
+#if __BYTE_ORDER == __BIG_ENDIAN
+ mov r12, r3, lsr #24
+ ldr r3, [r1, #-4]!
+ orr r12, r12, r3, lsl #8
+#else
+ mov r12, r3, lsl #24
+ ldr r3, [r1, #-4]!
+ orr r12, r12, r3, lsr #8
+#endif
+ str r12, [r0, #-4]!
+ subs r2, r2, #4
+ bge .Lmemcpy_bsrcul1loop4
+
+.Lmemcpy_bsrcul1l4:
+ add r1, r1, #1
+ b .Lmemcpy_bl4
+
+#else /* THUMB1_ONLY */
+
+/* This is a fairly dumb implementation for when we can't use the 32-bit code
+ above. */
+.text
+.global _memcpy
+.hidden _memcpy
+.type _memcpy,%function
+.align 4
+.thumb
+_memcpy:
+ push {r0, r4}
+ cmp r2, #0
+ beq .Lmemcpy_exit
+ @ See if we have overlapping regions, and need to reverse the
+ @ direction of the copy
+ cmp r0, r1
+ bls .Lmemcpy_forwards
+ add r4, r1, r2
+ cmp r0, r4
+ bcc .Lmemcpy_backwards
+.Lmemcpy_forwards:
+ /* Forwards. */
+ mov r3, r0
+ eor r3, r1
+ mov r4, #3
+ tst r3, r4
+ bne .Lmemcpy_funaligned
+ cmp r2, #8
+ bcc .Lmemcpy_funaligned
+1: @ copy up to the first word boundary.
+ tst r0, r4
+ beq 1f
+ ldrb r3, [r1]
+ add r1, r1, #1
+ strb r3, [r0]
+ add r0, r0, #1
+ sub r2, r2, #1
+ b 1b
+1: @ Copy aligned words
+ ldr r3, [r1]
+ add r1, r1, #4
+ str r3, [r0]
+ add r0, r0, #4
+ sub r2, r2, #4
+ cmp r2, #4
+ bcs 1b
+ cmp r2, #0
+ beq .Lmemcpy_exit
+.Lmemcpy_funaligned:
+1:
+ ldrb r3, [r1]
+ add r1, r1, #1
+ strb r3, [r0]
+ add r0, r0, #1
+ sub r2, r2, #1
+ bne 1b
+.Lmemcpy_exit:
+ pop {r0, r4}
+ bx lr
+
+.Lmemcpy_backwards:
+ add r0, r0, r2
+ add r1, r1, r2
+1:
+ sub r0, r0, #1
+ sub r1, r1, #1
+ ldrb r3, [r1]
+ strb r3, [r0]
+ sub r2, r2, #1
+ bne 1b
+ b .Lmemcpy_exit
+#endif
diff --git a/ap/build/uClibc/libc/string/arm/bcopy.S b/ap/build/uClibc/libc/string/arm/bcopy.S
new file mode 100644
index 0000000..2d6e90d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/arm/bcopy.S
@@ -0,0 +1,72 @@
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Neil A. Carson and Mark Brinicombe
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Adapted for uClibc from NetBSD bcopy.S,v 1.2 1997/10/09
+ * by Erik Andersen <andersen@codepoet.org>
+ */
+
+/* bcopy = memcpy/memmove with arguments reversed. */
+
+#include <features.h>
+#include <bits/arm_asm.h>
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+
+.text
+.global bcopy
+.type bcopy,%function
+.align 4
+
+#if defined(__thumb__) && !defined(__thumb2__)
+.thumb_func
+bcopy:
+ push {r2, lr}
+ mov ip, r0
+ mov r0, r1
+ mov r1, ip
+ bl _memcpy
+ POP_RET
+#else
+bcopy:
+ /* switch the source and destination registers */
+ eor r0, r1, r0
+ eor r1, r0, r1
+ eor r0, r1, r0
+ b _memcpy /* (PLT) */
+#endif
+
+.size bcopy,.-bcopy
+
+#endif
diff --git a/ap/build/uClibc/libc/string/arm/bzero.S b/ap/build/uClibc/libc/string/arm/bzero.S
new file mode 100644
index 0000000..e576a12
--- /dev/null
+++ b/ap/build/uClibc/libc/string/arm/bzero.S
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Neil A. Carson and Mark Brinicombe
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Adapted for uClibc from NetBSD bzero.S,v 1.2 1997/10/09
+ * by Erik Andersen <andersen@codepoet.org>
+ */
+
+#include <features.h>
+#include <bits/arm_asm.h>
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+
+.text
+.global bzero
+.type bzero,%function
+.align 4
+
+#if defined(__thumb__) && !defined(__thumb2__)
+.thumb_func
+bzero:
+ push {r2, lr}
+ mov r2, r1
+ mov r1, #0
+ bl HIDDEN_JUMPTARGET(memset)
+ POP_RET
+#else
+
+bzero:
+ mov r2, r1
+ mov r1, #0
+ b HIDDEN_JUMPTARGET(memset)
+#endif
+
+.size bzero,.-bzero
+
+#endif
diff --git a/ap/build/uClibc/libc/string/arm/memcmp.S b/ap/build/uClibc/libc/string/arm/memcmp.S
new file mode 100644
index 0000000..65409f4
--- /dev/null
+++ b/ap/build/uClibc/libc/string/arm/memcmp.S
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2002 ARM Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the company may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Adapted for uClibc from NetBSD memcmp.S, version 1.2 2003/04/05
+ * by Erik Andersen <andersen@codepoet.org>
+ */
+
+#include <features.h>
+#include <bits/arm_asm.h>
+
+.text
+.global memcmp
+.type memcmp,%function
+.align 4
+
+#if defined(THUMB1_ONLY)
+.thumb_func
+memcmp:
+ cmp r2, #0
+ bne 1f
+ mov r0, #0
+ bx lr
+1:
+ push {r4}
+ add r4, r0, r2
+2:
+ ldrb r2, [r0]
+ add r0, r0, #1
+ ldrb r3, [r1]
+ add r1, r1, #1
+ cmp r4, r0
+ beq 3f
+ cmp r2, r3
+ beq 2b
+3:
+ sub r0, r2, r3
+ pop {r4}
+ bx lr
+#else
+memcmp:
+ /* if ((len - 1) < 0) return 0 */
+ subs r2, r2, #1
+ IT(tt, mi)
+ movmi r0, #0
+#if defined(__USE_BX__)
+ bxmi lr
+#else
+ movmi pc, lr
+#endif
+ /* ip == last src address to compare */
+ add ip, r0, r2
+1:
+ ldrb r2, [r0], #1
+ ldrb r3, [r1], #1
+ cmp ip, r0
+ IT(t, cs)
+ cmpcs r2, r3
+ beq 1b
+ sub r0, r2, r3
+#if defined(__USE_BX__)
+ bx lr
+#else
+ mov pc, lr
+#endif
+#endif
+
+.size memcmp,.-memcmp
+
+libc_hidden_def(memcmp)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(memcmp,bcmp)
+#endif
diff --git a/ap/build/uClibc/libc/string/arm/memcpy.S b/ap/build/uClibc/libc/string/arm/memcpy.S
new file mode 100644
index 0000000..d2013d2
--- /dev/null
+++ b/ap/build/uClibc/libc/string/arm/memcpy.S
@@ -0,0 +1,61 @@
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Neil A. Carson and Mark Brinicombe
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Adapted for uClibc from NetBSD memcpy.S,v 1.3 2003/04/05
+ * by Erik Andersen <andersen@codepoet.org>
+ */
+
+#include <features.h>
+#include <bits/arm_asm.h>
+
+.text
+.global memcpy
+.type memcpy,%function
+.align 4
+
+#if defined(__thumb__) && !defined(__thumb2__)
+.thumb_func
+memcpy:
+ push {r0, lr}
+ bl _memcpy
+ POP_RET
+#else
+memcpy:
+ b _memcpy
+#endif
+
+.size memcpy,.-memcpy
+
+libc_hidden_def(memcpy)
diff --git a/ap/build/uClibc/libc/string/arm/memmove.S b/ap/build/uClibc/libc/string/arm/memmove.S
new file mode 100644
index 0000000..c11b98d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/arm/memmove.S
@@ -0,0 +1,61 @@
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Neil A. Carson and Mark Brinicombe
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Adapted for uClibc from NetBSD memmove.S,v 1.3 2003/04/05
+ * by Erik Andersen <andersen@codepoet.org>
+ */
+
+#include <features.h>
+#include <bits/arm_asm.h>
+
+.text
+.global memmove
+.type memmove,%function
+.align 4
+
+#if defined(__thumb__) && !defined(__thumb2__)
+.thumb_func
+memmove:
+ push {r2, lr}
+ bl _memcpy
+ POP_RET
+#else
+memmove:
+ b _memcpy
+#endif
+
+.size memmove,.-memmove
+
+libc_hidden_def(memmove)
diff --git a/ap/build/uClibc/libc/string/arm/memset.S b/ap/build/uClibc/libc/string/arm/memset.S
new file mode 100644
index 0000000..66aa603
--- /dev/null
+++ b/ap/build/uClibc/libc/string/arm/memset.S
@@ -0,0 +1,144 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Philip Blundell <philb@gnu.org>
+
+ 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 <sys/syscall.h>
+#include <bits/arm_asm.h>
+
+.text
+.global memset
+.type memset,%function
+.align 4
+
+#if defined(THUMB1_ONLY)
+.thumb_func
+memset:
+ mov ip, r0
+ cmp r2, #8 @ at least 8 bytes to do?
+ bcc 2f
+
+ lsl r3, r1, #8
+ orr r1, r3
+ lsl r3, r1, #16
+ orr r1, r3
+
+ mov r3, #3
+1: @ Fill up to the first word boundary
+ tst r0, r3
+ beq 1f
+ strb r1, [r0]
+ add r0, r0, #1
+ sub r2, r2, #1
+ b 1b
+1: @ Fill aligned words
+ str r1, [r0]
+ add r0, r0, #4
+ sub r2, r2, #4
+ cmp r2, #4
+ bcs 1b
+
+2: @ Fill the remaining bytes
+ cmp r2, #0
+ beq 2f
+1:
+ strb r1, [r0]
+ add r0, r0, #1
+ sub r2, r2, #1
+ bne 1b
+2:
+ mov r0, ip
+ bx lr
+#else
+memset:
+ mov a4, a1
+ cmp a3, $8 @ at least 8 bytes to do?
+ blt 2f
+ orr a2, a2, a2, lsl $8
+ orr a2, a2, a2, lsl $16
+1:
+ tst a4, $3 @ aligned yet?
+#if defined(__thumb2__)
+ itt ne
+ strbne a2, [a4], $1
+ subne a3, a3, $1
+#else
+ strneb a2, [a4], $1
+ subne a3, a3, $1
+#endif
+ bne 1b
+ mov ip, a2
+1:
+ cmp a3, $8 @ 8 bytes still to do?
+ blt 2f
+ stmia a4!, {a2, ip}
+ sub a3, a3, $8
+ cmp a3, $8 @ 8 bytes still to do?
+ blt 2f
+ stmia a4!, {a2, ip}
+ sub a3, a3, $8
+ cmp a3, $8 @ 8 bytes still to do?
+ blt 2f
+ stmia a4!, {a2, ip}
+ sub a3, a3, $8
+ cmp a3, $8 @ 8 bytes still to do?
+#if defined(__thumb2__)
+ itt ge
+ stmiage a4!, {a2, ip}
+ subge a3, a3, $8
+#else
+ stmgeia a4!, {a2, ip}
+ subge a3, a3, $8
+#endif
+ bge 1b
+2:
+ movs a3, a3 @ anything left?
+ IT(t, eq)
+#if defined(__USE_BX__)
+ bxeq lr
+#else
+ moveq pc, lr @ nope
+#endif
+#if defined (__thumb2__)
+1:
+ strb a2, [a4], #1
+ subs a3, a3, #1
+ bne 1b
+ bx lr
+#else
+ rsb a3, a3, $7
+ add pc, pc, a3, lsl $2
+ mov r0, r0
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+ strb a2, [a4], $1
+#if defined(__USE_BX__)
+ bx lr
+#else
+ mov pc, lr
+#endif
+#endif
+#endif
+
+.size memset,.-memset
+
+libc_hidden_def(memset)
diff --git a/ap/build/uClibc/libc/string/arm/strcmp.S b/ap/build/uClibc/libc/string/arm/strcmp.S
new file mode 100644
index 0000000..97363c1
--- /dev/null
+++ b/ap/build/uClibc/libc/string/arm/strcmp.S
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2002 ARM Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the company may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Adapted for uClibc from NetBSD strcmp.S, version 1.3 2003/04/05
+ * by Erik Andersen <andersen@codepoet.org>
+ */
+
+#include <features.h>
+#include <bits/arm_asm.h>
+
+.text
+.global strcmp
+.type strcmp,%function
+.align 4
+
+#if defined(__thumb__) && !defined(__thumb2__)
+.thumb_func
+strcmp:
+1:
+ ldrb r2, [r0]
+ add r0, r0, #1
+ ldrb r3, [r1]
+ add r1, r1, #1
+ cmp r2, #0
+ beq 2f
+ cmp r2, r3
+ beq 1b
+2:
+ sub r0, r2, r3
+ bx lr
+#else
+strcmp:
+1:
+ ldrb r2, [r0], #1
+ ldrb r3, [r1], #1
+ cmp r2, #1
+ IT(t, cs)
+ cmpcs r2, r3
+ beq 1b
+ sub r0, r2, r3
+#if defined(__USE_BX__)
+ bx lr
+#else
+ mov pc, lr
+#endif
+#endif
+
+.size strcmp,.-strcmp
+
+libc_hidden_def(strcmp)
+#ifndef __UCLIBC_HAS_LOCALE__
+strong_alias(strcmp,strcoll)
+libc_hidden_def(strcoll)
+#endif
diff --git a/ap/build/uClibc/libc/string/arm/strlen.S b/ap/build/uClibc/libc/string/arm/strlen.S
new file mode 100644
index 0000000..949e918
--- /dev/null
+++ b/ap/build/uClibc/libc/string/arm/strlen.S
@@ -0,0 +1,111 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Code contributed by Matthew Wilcox <willy@odie.barnet.ac.uk>
+
+ 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 <endian.h>
+#include <sys/syscall.h>
+#include <bits/arm_asm.h>
+
+/* size_t strlen(const char *S)
+ * entry: r0 -> string
+ * exit: r0 = len
+ */
+
+.text
+.global strlen
+.type strlen,%function
+.align 4
+
+#if defined(THUMB1_ONLY)
+/* A simple implementation for when the ARM implementation can't be used. */
+.thumb_func
+strlen:
+ mov r2, #0
+1:
+ ldrb r1, [r0, r2]
+ add r2, r2, #1
+ cmp r1, #0
+ bne 1b
+ sub r0, r2, #1
+ bx lr
+#else
+strlen:
+ bic r1, r0, $3 @ addr of word containing first byte
+ ldr r2, [r1], $4 @ get the first word
+ ands r3, r0, $3 @ how many bytes are duff?
+ rsb r0, r3, $0 @ get - that number into counter.
+ beq Laligned @ skip into main check routine if no
+ @ more
+#if __BYTE_ORDER == __BIG_ENDIAN
+ orr r2, r2, $0xff000000 @ set this byte to non-zero
+ subs r3, r3, $1 @ any more to do?
+ IT(t, gt)
+ orrgt r2, r2, $0x00ff0000 @ if so, set this byte
+ subs r3, r3, $1 @ more?
+ IT(t, gt)
+ orrgt r2, r2, $0x0000ff00 @ then set.
+#else
+ orr r2, r2, $0x000000ff @ set this byte to non-zero
+ subs r3, r3, $1 @ any more to do?
+ IT(t, gt)
+ orrgt r2, r2, $0x0000ff00 @ if so, set this byte
+ subs r3, r3, $1 @ more?
+ IT(t, gt)
+ orrgt r2, r2, $0x00ff0000 @ then set.
+#endif
+Laligned: @ here, we have a word in r2. Does it
+ tst r2, $0x000000ff @ contain any zeroes?
+ IT(tttt, ne)
+ tstne r2, $0x0000ff00 @
+ tstne r2, $0x00ff0000 @
+ tstne r2, $0xff000000 @
+ addne r0, r0, $4 @ if not, the string is 4 bytes longer
+ IT(t, ne)
+ ldrne r2, [r1], $4 @ and we continue to the next word
+ bne Laligned @
+Llastword: @ drop through to here once we find a
+#if __BYTE_ORDER == __BIG_ENDIAN
+ tst r2, $0xff000000 @ word that has a zero byte in it
+ IT(tttt, ne)
+ addne r0, r0, $1 @
+ tstne r2, $0x00ff0000 @ and add up to 3 bytes on to it
+ addne r0, r0, $1 @
+ tstne r2, $0x0000ff00 @ (if first three all non-zero, 4th
+ IT(t, ne)
+ addne r0, r0, $1 @ must be zero)
+#else
+ tst r2, $0x000000ff @
+ IT(tttt, ne)
+ addne r0, r0, $1 @
+ tstne r2, $0x0000ff00 @ and add up to 3 bytes on to it
+ addne r0, r0, $1 @
+ tstne r2, $0x00ff0000 @ (if first three all non-zero, 4th
+ IT(t, ne)
+ addne r0, r0, $1 @ must be zero)
+#endif
+#if defined(__USE_BX__)
+ bx lr
+#else
+ mov pc,lr
+#endif
+#endif
+
+.size strlen,.-strlen
+
+libc_hidden_def(strlen)
diff --git a/ap/build/uClibc/libc/string/avr32/Makefile b/ap/build/uClibc/libc/string/avr32/Makefile
new file mode 100644
index 0000000..e19e9d9
--- /dev/null
+++ b/ap/build/uClibc/libc/string/avr32/Makefile
@@ -0,0 +1,26 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+top_srcdir := ../../../
+top_builddir := ../../../
+
+all: objs
+
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/avr32/bcopy.S b/ap/build/uClibc/libc/string/avr32/bcopy.S
new file mode 100644
index 0000000..bdd5218
--- /dev/null
+++ b/ap/build/uClibc/libc/string/avr32/bcopy.S
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+#include <features.h>
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+
+ .text
+ .global bcopy
+ .type bcopy, @function
+ .align 1
+bcopy:
+ /* Swap the first two arguments */
+ eor r11, r12
+ eor r12, r11
+ eor r11, r12
+ rjmp HIDDEN_JUMPTARGET(memmove)
+
+ .size bcopy, . - bcopy
+
+#endif /* __UCLIBC_SUSV3_LEGACY__ */
diff --git a/ap/build/uClibc/libc/string/avr32/bzero.S b/ap/build/uClibc/libc/string/avr32/bzero.S
new file mode 100644
index 0000000..ca1bd2d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/avr32/bzero.S
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+#include <features.h>
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+
+ .text
+ .global bzero
+ .type bzero, @function
+ .align 1
+bzero:
+ mov r10, r11
+ mov r11, 0
+ rjmp HIDDEN_JUMPTARGET(memset)
+
+ .size bzero, . - bzero
+
+#endif /* __UCLIBC_SUSV3_LEGACY__ */
diff --git a/ap/build/uClibc/libc/string/avr32/memcmp.S b/ap/build/uClibc/libc/string/avr32/memcmp.S
new file mode 100644
index 0000000..ae6cc91
--- /dev/null
+++ b/ap/build/uClibc/libc/string/avr32/memcmp.S
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+#include <features.h>
+
+#define s1 r12
+#define s2 r11
+#define len r10
+
+ .text
+ .global memcmp
+ .type memcmp, @function
+ .align 1
+memcmp:
+ sub len, 4
+ brlt .Lless_than_4
+
+1: ld.w r8, s1++
+ ld.w r9, s2++
+ cp.w r8, r9
+ brne .Lfound_word
+ sub len, 4
+ brge 1b
+
+.Lless_than_4:
+ sub len, -4
+ reteq 0
+
+1: ld.ub r8, s1++
+ ld.ub r9, s2++
+ sub r8, r9
+ retne r8
+ sub len, 1
+ brgt 1b
+
+ retal 0
+
+.Lfound_word:
+ mov len, 4
+
+2: bfextu r11, r9, 24, 8
+ bfextu r12, r8, 24, 8
+ sub r12, r11
+ retne r12
+ lsl r8, 8
+ lsl r9, 8
+ sub len, 1
+ brne 2b
+ retal r12
+
+ .size memcmp, . - memcmp
+
+libc_hidden_def(memcmp)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(memcmp,bcmp)
+#endif
diff --git a/ap/build/uClibc/libc/string/avr32/memcpy.S b/ap/build/uClibc/libc/string/avr32/memcpy.S
new file mode 100644
index 0000000..bf091ab
--- /dev/null
+++ b/ap/build/uClibc/libc/string/avr32/memcpy.S
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+/* Don't use r12 as dst since we must return it unmodified */
+#define dst r9
+#define src r11
+#define len r10
+
+ .text
+ .global memcpy
+ .type memcpy, @function
+memcpy:
+ pref src[0]
+ mov dst, r12
+
+ /* If we have less than 32 bytes, don't do anything fancy */
+ cp.w len, 32
+ brge .Lmore_than_31
+
+ sub len, 1
+ retlt r12
+1: ld.ub r8, src++
+ st.b dst++, r8
+ sub len, 1
+ brge 1b
+ retal r12
+
+.Lmore_than_31:
+ pushm r0-r7, lr
+
+ /* Check alignment */
+ mov r8, src
+ andl r8, 31, COH
+ brne .Lunaligned_src
+ mov r8, dst
+ andl r8, 3, COH
+ brne .Lunaligned_dst
+
+.Laligned_copy:
+ sub len, 32
+ brlt .Lless_than_32
+
+1: /* Copy 32 bytes at a time */
+ ldm src, r0-r7
+ sub src, -32
+ stm dst, r0-r7
+ sub dst, -32
+ sub len, 32
+ brge 1b
+
+.Lless_than_32:
+ /* Copy 16 more bytes if possible */
+ sub len, -16
+ brlt .Lless_than_16
+ ldm src, r0-r3
+ sub src, -16
+ sub len, 16
+ stm dst, r0-r3
+ sub dst, -16
+
+.Lless_than_16:
+ /* Do the remaining as byte copies */
+ neg len
+ add pc, pc, len << 2
+ .rept 15
+ ld.ub r0, src++
+ st.b dst++, r0
+ .endr
+
+ popm r0-r7, pc
+
+.Lunaligned_src:
+ /* Make src cacheline-aligned. r8 = (src & 31) */
+ rsub r8, r8, 32
+ sub len, r8
+1: ld.ub r0, src++
+ st.b dst++, r0
+ sub r8, 1
+ brne 1b
+
+ /* If dst is word-aligned, we're ready to go */
+ pref src[0]
+ mov r8, 3
+ tst dst, r8
+ breq .Laligned_copy
+
+.Lunaligned_dst:
+ /* src is aligned, but dst is not. Expect bad performance */
+ sub len, 4
+ brlt 2f
+1: ld.w r0, src++
+ st.w dst++, r0
+ sub len, 4
+ brge 1b
+
+2: neg len
+ add pc, pc, len << 2
+ .rept 3
+ ld.ub r0, src++
+ st.b dst++, r0
+ .endr
+
+ popm r0-r7, pc
+ .size memcpy, . - memcpy
+
+libc_hidden_def(memcpy)
diff --git a/ap/build/uClibc/libc/string/avr32/memmove.S b/ap/build/uClibc/libc/string/avr32/memmove.S
new file mode 100644
index 0000000..535f4a2
--- /dev/null
+++ b/ap/build/uClibc/libc/string/avr32/memmove.S
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+#define dst r12
+#define src r11
+#define len r10
+
+ .text
+ .global memmove
+ .type memmove, @function
+memmove:
+ cp.w src, dst
+ brge HIDDEN_JUMPTARGET(memcpy)
+
+ add dst, len
+ add src, len
+ pref src[-1]
+
+ /*
+ * The rest is basically the same as in memcpy.S except that
+ * the direction is reversed.
+ */
+ cp.w len, 32
+ brge .Lmore_than_31
+
+ sub len, 1
+ retlt r12
+1: ld.ub r8, --src
+ st.b --dst, r8
+ sub len, 1
+ brge 1b
+ retal r12
+
+.Lmore_than_31:
+ pushm r0-r7, lr
+
+ /* Check alignment */
+ mov r8, src
+ andl r8, 31, COH
+ brne .Lunaligned_src
+ mov r8, r12
+ andl r8, 3, COH
+ brne .Lunaligned_dst
+
+.Laligned_copy:
+ sub len, 32
+ brlt .Lless_than_32
+
+1: /* Copy 32 bytes at a time */
+ sub src, 32
+ ldm src, r0-r7
+ sub dst, 32
+ sub len, 32
+ stm dst, r0-r7
+ brge 1b
+
+.Lless_than_32:
+ /* Copy 16 more bytes if possible */
+ sub len, -16
+ brlt .Lless_than_16
+ sub src, 16
+ ldm src, r0-r3
+ sub dst, 16
+ sub len, 16
+ stm dst, r0-r3
+
+.Lless_than_16:
+ /* Do the remaining as byte copies */
+ sub len, -16
+ breq 2f
+1: ld.ub r0, --src
+ st.b --dst, r0
+ sub len, 1
+ brne 1b
+
+2: popm r0-r7, pc
+
+.Lunaligned_src:
+ /* Make src cacheline-aligned. r8 = (src & 31) */
+ sub len, r8
+1: ld.ub r0, --src
+ st.b --dst, r0
+ sub r8, 1
+ brne 1b
+
+ /* If dst is word-aligned, we're ready to go */
+ pref src[-4]
+ mov r8, 3
+ tst dst, r8
+ breq .Laligned_copy
+
+.Lunaligned_dst:
+ /* src is aligned, but dst is not. Expect bad performance */
+ sub len, 4
+ brlt 2f
+1: ld.w r0, --src
+ st.w --dst, r0
+ sub len, 4
+ brge 1b
+
+2: neg len
+ add pc, pc, len << 2
+ .rept 3
+ ld.ub r0, --src
+ st.b --dst, r0
+ .endr
+
+ popm r0-r7, pc
+ .size memmove, . - memmove
+
+libc_hidden_def(memmove)
diff --git a/ap/build/uClibc/libc/string/avr32/memset.S b/ap/build/uClibc/libc/string/avr32/memset.S
new file mode 100644
index 0000000..472b2be
--- /dev/null
+++ b/ap/build/uClibc/libc/string/avr32/memset.S
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+#include <features.h>
+
+#define s r12
+#define c r11
+#define n r10
+
+ .text
+ .global memset
+ .type memset, @function
+
+ .align 1
+memset:
+ cp.w n, 32
+ mov r9, s
+ brge .Llarge_memset
+
+ sub n, 1
+ retlt s
+1: st.b s++, c
+ sub n, 1
+ brge 1b
+
+ retal r9
+
+.Llarge_memset:
+ mov r8, r11
+ mov r11, 3
+ bfins r8, r8, 8, 8
+ bfins r8, r8, 16, 16
+ tst s, r11
+ breq 2f
+
+1: st.b s++, r8
+ sub n, 1
+ tst s, r11
+ brne 1b
+
+2: mov r11, r9
+ mov r9, r8
+ sub n, 8
+
+3: st.d s++, r8
+ sub n, 8
+ brge 3b
+
+ /* If we are done, n == -8 and we'll skip all st.b insns below */
+ neg n
+ lsl n, 1
+ add pc, n
+ .rept 7
+ st.b s++, r8
+ .endr
+ retal r11
+
+ .size memset, . - memset
+
+libc_hidden_def(memset)
diff --git a/ap/build/uClibc/libc/string/avr32/strcmp.S b/ap/build/uClibc/libc/string/avr32/strcmp.S
new file mode 100644
index 0000000..f73bd43
--- /dev/null
+++ b/ap/build/uClibc/libc/string/avr32/strcmp.S
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+#include <features.h>
+
+#define s1 r12
+#define s2 r11
+#define len r10
+
+ .text
+ .global strcmp
+ .type strcmp, @function
+ .align 1
+strcmp:
+ mov r8, 3
+ tst s1, r8
+ brne .Lunaligned_s1
+ tst s2, r8
+ brne .Lunaligned_s2
+
+1: ld.w r8, s1++
+ ld.w r9, s2++
+ cp.w r8, r9
+ brne 2f
+ tnbz r8
+ brne 1b
+ retal 0
+
+2: bfextu r12, r8, 24, 8
+ bfextu r11, r9, 24, 8
+ sub r12, r11
+ retne r12
+ cp.w r11, 0
+ reteq 0
+ bfextu r12, r8, 16, 8
+ bfextu r11, r9, 16, 8
+ sub r12, r11
+ retne r12
+ cp.w r11, 0
+ reteq 0
+ bfextu r12, r8, 8, 8
+ bfextu r11, r9, 8, 8
+ sub r12, r11
+ retne r12
+ cp.w r11, 0
+ reteq 0
+ bfextu r12, r8, 0, 8
+ bfextu r11, r9, 0, 8
+ sub r12, r11
+ retal r12
+
+.Lunaligned_s1:
+3: tst s1, r8
+ breq 4f
+ ld.ub r10, s1++
+ ld.ub r9, s2++
+ sub r10, r9
+ retne r10
+ cp.w r9, 0
+ brne 3b
+ retal r10
+
+4: tst s2, r8
+ breq 1b
+
+.Lunaligned_s2:
+ /*
+ * s1 and s2 can't both be aligned, and unaligned word loads
+ * can trigger spurious exceptions if we cross a page boundary.
+ * Do it the slow way...
+ */
+1: ld.ub r8, s1++
+ ld.ub r9, s2++
+ sub r8, r9
+ retne r8
+ cp.w r9, 0
+ brne 1b
+ retal 0
+
+ .size strcmp, . - strcmp
+
+libc_hidden_def(strcmp)
+#ifndef __UCLIBC_HAS_LOCALE__
+strong_alias(strcmp, strcoll)
+libc_hidden_def(strcoll)
+#endif
diff --git a/ap/build/uClibc/libc/string/avr32/strlen.S b/ap/build/uClibc/libc/string/avr32/strlen.S
new file mode 100644
index 0000000..5223e53
--- /dev/null
+++ b/ap/build/uClibc/libc/string/avr32/strlen.S
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2004-2007 Atmel Corporation
+ *
+ * This file is subject to the terms and conditions of the GNU Lesser General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ */
+
+#include <features.h>
+
+#define str r12
+
+ .text
+ .global strlen
+ .type strlen, @function
+strlen:
+ mov r11, r12
+
+ mov r9, str
+ andl r9, 3, COH
+ brne .Lunaligned_str
+
+1: ld.w r8, str++
+ tnbz r8
+ brne 1b
+
+ sub r12, r11
+ bfextu r9, r8, 24, 8
+ cp.w r9, 0
+ subeq r12, 4
+ reteq r12
+ bfextu r9, r8, 16, 8
+ cp.w r9, 0
+ subeq r12, 3
+ reteq r12
+ bfextu r9, r8, 8, 8
+ cp.w r9, 0
+ subeq r12, 2
+ reteq r12
+ sub r12, 1
+ retal r12
+
+.Lunaligned_str:
+ add pc, pc, r9 << 3
+ sub r0, r0, 0 /* 4-byte nop */
+ ld.ub r8, str++
+ sub r8, r8, 0
+ breq 1f
+ ld.ub r8, str++
+ sub r8, r8, 0
+ breq 1f
+ ld.ub r8, str++
+ sub r8, r8, 0
+ brne 1b
+
+1: sub r12, 1
+ sub r12, r11
+ retal r12
+
+ .size strlen, . - strlen
+
+libc_hidden_def(strlen)
diff --git a/ap/build/uClibc/libc/string/basename.c b/ap/build/uClibc/libc/string/basename.c
new file mode 100644
index 0000000..29e7a2a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/basename.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef __USE_GNU
+
+char *basename(const char *path)
+{
+ register const char *s;
+ register const char *p;
+
+ p = s = path;
+
+ while (*s) {
+ if (*s++ == '/') {
+ p = s;
+ }
+ }
+
+ return (char *) p;
+}
+libc_hidden_def(basename)
+#endif
diff --git a/ap/build/uClibc/libc/string/bcopy.c b/ap/build/uClibc/libc/string/bcopy.c
new file mode 100644
index 0000000..6234fd8
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bcopy.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+
+
+void bcopy(const void *s2, void *s1, size_t n)
+{
+#if 1
+ memmove(s1, s2, n);
+#else
+ register char *s;
+ register const char *p;
+
+ s = s1;
+ p = s2;
+ if (p >= s) {
+ while (n) {
+ *s++ = *p++;
+ --n;
+ }
+ } else {
+ while (n) {
+ --n;
+ s[n] = p[n];
+ }
+ }
+#endif
+}
+#endif
diff --git a/ap/build/uClibc/libc/string/bfin/Makefile b/ap/build/uClibc/libc/string/bfin/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/bfin/memchr.S b/ap/build/uClibc/libc/string/bfin/memchr.S
new file mode 100644
index 0000000..26d419f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/memchr.S
@@ -0,0 +1,55 @@
+/* memchr.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* void *memchr(const void *s, int c, size_t n);
+ * R0 = address (s)
+ * R1 = sought byte (c)
+ * R2 = count (n)
+ *
+ * Returns pointer to located character.
+ */
+
+.text
+
+.align 2
+
+.weak _memchr
+ENTRY(_memchr)
+ P0 = R0; /* P0 = address */
+ P2 = R2; /* P2 = count */
+ R1 = R1.B(Z);
+ CC = R2 == 0;
+ IF CC JUMP .Lfailed;
+
+.Lbytes:
+ LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
+
+.Lbyte_loop_s:
+ R3 = B[P0++](Z);
+ CC = R3 == R1;
+ IF CC JUMP .Lfound;
+.Lbyte_loop_e:
+ NOP;
+
+.Lfailed:
+ R0=0;
+ RTS;
+
+.Lfound:
+ R0 = P0;
+ R0 += -1;
+ RTS;
+
+.size _memchr,.-_memchr
+
+libc_hidden_def (memchr)
diff --git a/ap/build/uClibc/libc/string/bfin/memcmp.S b/ap/build/uClibc/libc/string/bfin/memcmp.S
new file mode 100644
index 0000000..7cc76ad
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/memcmp.S
@@ -0,0 +1,104 @@
+/* memcmp.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* int memcmp(const void *s1, const void *s2, size_t n);
+ * R0 = First Address (s1)
+ * R1 = Second Address (s2)
+ * R2 = count (n)
+ *
+ * Favours word aligned data.
+ */
+
+.text
+
+.align 2
+
+.weak _memcmp
+ENTRY(_memcmp)
+ I1 = P3;
+ P0 = R0; /* P0 = s1 address */
+ P3 = R1; /* P3 = s2 Address */
+ P2 = R2 ; /* P2 = count */
+ CC = R2 <= 7(IU);
+ IF CC JUMP .Ltoo_small;
+ I0 = R1; /* s2 */
+ R1 = R1 | R0; /* OR addresses together */
+ R1 <<= 30; /* check bottom two bits */
+ CC = AZ; /* AZ set if zero. */
+ IF !CC JUMP .Lbytes ; /* Jump if addrs not aligned. */
+
+ P1 = P2 >> 2; /* count = n/4 */
+ R3 = 3;
+ R2 = R2 & R3; /* remainder */
+ P2 = R2; /* set remainder */
+
+ LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
+.Lquad_loop_s:
+#if !defined(__WORKAROUND_AVOID_DAG1)
+ MNOP || R0 = [P0++] || R1 = [I0++];
+#else
+ R0 = [P0++];
+ R1 = [I0++];
+#endif
+ CC = R0 == R1;
+ IF !CC JUMP .Lquad_different;
+.Lquad_loop_e:
+ NOP;
+
+ P3 = I0; /* s2 */
+.Ltoo_small:
+ CC = P2 == 0; /* Check zero count*/
+ IF CC JUMP .Lfinished; /* very unlikely*/
+
+.Lbytes:
+ LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
+.Lbyte_loop_s:
+ R1 = B[P3++](Z); /* *s2 */
+ R0 = B[P0++](Z); /* *s1 */
+ CC = R0 == R1;
+ IF !CC JUMP .Ldifferent;
+.Lbyte_loop_e:
+ NOP;
+
+.Ldifferent:
+ R0 = R0 - R1;
+ P3 = I1;
+ RTS;
+
+.Lquad_different:
+ /* We've read two quads which don't match.
+ * Can't just compare them, because we're
+ * a little-endian machine, so the MSBs of
+ * the regs occur at later addresses in the
+ * string.
+ * Arrange to re-read those two quads again,
+ * byte-by-byte.
+ */
+ P0 += -4; /* back up to the start of the */
+ P3 = I0; /* quads, and increase the*/
+ P2 += 4; /* remainder count*/
+ P3 += -4;
+ JUMP .Lbytes;
+
+.Lfinished:
+ R0 = 0;
+ P3 = I1;
+ RTS;
+
+.size _memcmp,.-_memcmp
+
+libc_hidden_def (memcmp)
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+weak_alias (memcmp,bcmp)
+#endif
diff --git a/ap/build/uClibc/libc/string/bfin/memcpy.S b/ap/build/uClibc/libc/string/bfin/memcpy.S
new file mode 100644
index 0000000..bdd7606
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/memcpy.S
@@ -0,0 +1,77 @@
+/* memcpy.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* void *memcpy(void *dest, const void *src, size_t n);
+ * R0 = To Address (dest) (leave unchanged to form result)
+ * R1 = From Address (src)
+ * R2 = count
+ *
+ * Note: Favours word alignment
+ */
+
+.text
+
+.align 2
+
+.weak _memcpy
+ENTRY(_memcpy)
+ [--SP] = P3;
+ P0 = R0; /* P0 = To address */
+ P3 = R1; /* P3 = From Address */
+ P2 = R2; /* P2 = count */
+ CC = R2 <= 7(IU);
+ IF CC JUMP .Ltoo_small;
+ I0 = R1;
+ R3 = R1 | R0; /* OR addresses together */
+ R3 <<= 30; /* check bottom two bits */
+ CC = AZ; /* AZ set if zero. */
+ IF !CC JUMP .Lbytes; /* Jump if addrs not aligned. */
+ P1 = P2 >> 2; /* count = n/4 */
+ P1 += -1;
+ R3 = 3;
+ R2 = R2 & R3; /* remainder */
+ P2 = R2; /* set remainder */
+ R1 = [I0++];
+#if !defined(__WORKAROUND_AVOID_DAG1)
+ LSETUP (.Lquad_loop, .Lquad_loop) LC0=P1;
+.Lquad_loop: MNOP || [P0++] = R1 || R1 = [I0++];
+#else
+ LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
+.Lquad_loop_s: [P0++] = R1;
+.Lquad_loop_e: R1 = [I0++];
+#endif
+ [P0++] = R1;
+
+ CC = P2 == 0; /* any remaining bytes? */
+ P3 = I0; /* Ammend P3 for remaining copy */
+ IF !CC JUMP .Lbytes;
+ P3 = [SP++];
+ RTS;
+
+.Ltoo_small:
+ CC = P2 == 0; /* Check zero count */
+ IF CC JUMP .Lfinished; /* very unlikely */
+
+.Lbytes:
+ LSETUP (.Lbyte_loop_s, .Lbyte_loop_e) LC0=P2;
+.Lbyte_loop_s: R1 = B[P3++](Z);
+.Lbyte_loop_e: B[P0++] = R1;
+
+.Lfinished:
+ P3 = [SP++];
+
+ RTS;
+
+.size _memcpy,.-_memcpy
+
+libc_hidden_def (memcpy)
diff --git a/ap/build/uClibc/libc/string/bfin/memmove.S b/ap/build/uClibc/libc/string/bfin/memmove.S
new file mode 100644
index 0000000..73e3638
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/memmove.S
@@ -0,0 +1,100 @@
+/* memmove.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* void *memmove(void *dest, const void *src, size_t n);
+ * R0 = To Address (dest) (leave unchanged to form result)
+ * R1 = From Address (src)
+ * R2 = count (n)
+ *
+ * Note: Data may overlap
+ */
+
+.text
+
+.align 2
+
+.weak _memmove
+ENTRY(_memmove)
+ I1 = P3;
+ P0 = R0; /* P0 = To address */
+ P3 = R1; /* P3 = From Address */
+ P2 = R2; /* P2 = count */
+ CC = P2 == 0; /* Check zero count*/
+ IF CC JUMP .Lfinished; /* very unlikely */
+
+ CC = R1 < R0 (IU); /* From < To */
+ IF !CC JUMP .Lno_overlap;
+ R3 = R1 + R2;
+ CC = R0 <= R3 (IU); /* (From+len) >= To */
+ IF CC JUMP .Loverlap;
+.Lno_overlap:
+ R3 = 11;
+ CC = R2 <= R3;
+ IF CC JUMP .Lbytes;
+ R3 = R1 | R0; /* OR addresses together */
+ R3 <<= 30; /* check bottom two bits */
+ CC = AZ; /* AZ set if zero.*/
+ IF !CC JUMP .Lbytes; /* Jump if addrs not aligned.*/
+
+ I0 = P3;
+ P1 = P2 >> 2; /* count = n/4 */
+ P1 += -1;
+ R3 = 3;
+ R2 = R2 & R3; /* remainder */
+ P2 = R2; /* set remainder */
+ R1 = [I0++];
+
+#if !defined(__WORKAROUND_AVOID_DAG1)
+ LSETUP (.Lquad_loop, .Lquad_loop) LC0=P1;
+.Lquad_loop: MNOP || [P0++] = R1 || R1 = [I0++];
+#else
+ LSETUP (.Lquad_loop_s, .Lquad_loop_e) LC0=P1;
+.Lquad_loop_s: [P0++] = R1;
+.Lquad_loop_e: R1 = [I0++];
+#endif
+ [P0++] = R1;
+
+ CC = P2 == 0; /* any remaining bytes? */
+ P3 = I0; /* Ammend P3 to updated ptr. */
+ IF !CC JUMP .Lbytes;
+ P3 = I1;
+ RTS;
+
+.Lbytes: LSETUP (.Lbyte2_s, .Lbyte2_e) LC0=P2;
+.Lbyte2_s: R1 = B[P3++](Z);
+.Lbyte2_e: B[P0++] = R1;
+
+.Lfinished: P3 = I1;
+ RTS;
+
+.Loverlap:
+ P2 += -1;
+ P0 = P0 + P2;
+ P3 = P3 + P2;
+ R1 = B[P3--] (Z);
+ CC = P2 == 0;
+ IF CC JUMP .Lno_loop;
+#if defined(__WORKAROUND_SPECULATIVE_LOADS)
+ NOP;
+ NOP;
+#endif
+ LSETUP (.Lol_s, .Lol_e) LC0 = P2;
+.Lol_s: B[P0--] = R1;
+.Lol_e: R1 = B[P3--] (Z);
+.Lno_loop: B[P0] = R1;
+ P3 = I1;
+ RTS;
+
+.size _memmove,.-_memmove
+
+libc_hidden_def (memmove)
diff --git a/ap/build/uClibc/libc/string/bfin/memset.S b/ap/build/uClibc/libc/string/bfin/memset.S
new file mode 100644
index 0000000..64012f7
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/memset.S
@@ -0,0 +1,90 @@
+/* memset.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* void *memset(void *s, int c, size_t n);
+ * R0 = address (s) (leave unchanged to form result)
+ * R1 = filler byte (c)
+ * R2 = count (n)
+ *
+ * Note: Favours word aligned data.
+ */
+
+.text
+
+.align 2
+
+.weak _memset
+ENTRY(_memset)
+ P0 = R0 ; /* P0 = address */
+ P2 = R2 ; /* P2 = count */
+ R3 = R0 + R2; /* end */
+ CC = R2 <= 7(IU);
+ IF CC JUMP .Ltoo_small;
+ R1 = R1.B (Z); /* R1 = fill char */
+ R2 = 3;
+ R2 = R0 & R2; /* addr bottom two bits */
+ CC = R2 == 0; /* AZ set if zero. */
+ IF !CC JUMP .Lforce_align ; /* Jump if addr not aligned. */
+
+.Laligned:
+ P1 = P2 >> 2; /* count = n/4 */
+ R2 = R1 << 8; /* create quad filler */
+ R2.L = R2.L + R1.L(NS);
+ R2.H = R2.L + R1.H(NS);
+ P2 = R3;
+
+ LSETUP (.Lquad_loop , .Lquad_loop) LC0=P1;
+.Lquad_loop:
+ [P0++] = R2;
+
+ CC = P0 == P2;
+ IF !CC JUMP .Lbytes_left;
+ RTS;
+
+.Lbytes_left:
+ R2 = R3; /* end point */
+ R3 = P0; /* current position */
+ R2 = R2 - R3; /* bytes left */
+ P2 = R2;
+
+.Ltoo_small:
+ CC = P2 == 0; /* Check zero count */
+ IF CC JUMP .Lfinished; /* Unusual */
+
+.Lbytes:
+ LSETUP (.Lbyte_loop , .Lbyte_loop) LC0=P2;
+.Lbyte_loop:
+ B[P0++] = R1;
+
+.Lfinished:
+ RTS;
+
+.Lforce_align:
+ CC = BITTST (R0, 0); /* odd byte */
+ R0 = 4;
+ R0 = R0 - R2;
+ P1 = R0;
+ R0 = P0; /* Recover return address */
+ IF !CC JUMP .Lskip1;
+ B[P0++] = R1;
+.Lskip1:
+ CC = R2 <= 2; /* 2 bytes */
+ P2 -= P1; /* reduce count */
+ IF !CC JUMP .Laligned;
+ B[P0++] = R1;
+ B[P0++] = R1;
+ JUMP .Laligned;
+
+.size _memset,.-_memset
+
+libc_hidden_def (memset)
diff --git a/ap/build/uClibc/libc/string/bfin/strcmp.S b/ap/build/uClibc/libc/string/bfin/strcmp.S
new file mode 100644
index 0000000..ef23aa9
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bfin/strcmp.S
@@ -0,0 +1,122 @@
+/* strcmp.S
+ * Copyright (C) 2003-2007 Analog Devices Inc., All Rights Reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU Library General
+ * Public License. See the file "COPYING.LIB" in the main directory of this
+ * archive for more details.
+ *
+ * Non-LGPL License also available as part of VisualDSP++
+ * http://www.analog.com/processors/resources/crosscore/visualDspDevSoftware.html
+ */
+
+#include <sysdep.h>
+
+/* Fast strcmp() for Blackfin.
+ * When both strings are aligned, this processes four characters at
+ * a time. Uses a hw loop with "very big" count to loop "forever",
+ * until difference or a terminating zero is found.
+ * Once the end-case word has been identified, breaks out of the
+ * loop to check more carefully (same as the unaligned case).
+ */
+
+.text
+
+.align 2
+
+.weak _strcmp
+ENTRY(_strcmp)
+ [--sp] = (R7:4);
+ p1 = r0;
+ p2 = r1;
+
+ p0 = -1; /* (need for loop counter init) */
+
+ /* check if byte aligned */
+ r0 = r0 | r1; /* check both pointers at same time */
+ r0 <<= 30; /* dump all but last 2 bits */
+ cc = az; /* are they zero? */
+ if !cc jump .Lunaligned; /* no; use unaligned code. */
+ /* fall-thru for aligned case.. */
+
+ /* note that r0 is zero from the previous... */
+ /* p0 set to -1 */
+
+ LSETUP (.Lbeginloop, .Lendloop) lc0=p0;
+ /* pick up first words */
+ r1 = [p1++];
+ r2 = [p2++];
+ /* make up mask: 0FF0FF */
+ r7 = 0xFF;
+ r7.h = 0xFF;
+ /* loop : 9 cycles to check 4 characters */
+ cc = r1 == r2;
+.Lbeginloop:
+ if !cc jump .Lnotequal4; /* compare failure, exit loop */
+
+ /* starting with 44332211 */
+ /* see if char 3 or char 1 is 0 */
+ r3 = r1 & r7; /* form 00330011 */
+ /* add to zero, and (r2 is free, reload) */
+ r6 = r3 +|+ r0 || r2 = [p2++] || nop;
+ cc = az; /* true if either is zero */
+ r3 = r1 ^ r3; /* form 44002200 (4321^0301 => 4020) */
+ /* (trick, saves having another mask) */
+ /* add to zero, and (r1 is free, reload) */
+ r6 = r3 +|+ r0 || r1 = [p1++] || nop;
+ cc |= az; /* true if either is zero */
+ if cc jump .Lzero4; /* leave if a zero somewhere */
+.Lendloop:
+ cc = r1 == r2;
+
+ /* loop exits */
+.Lnotequal4: /* compare failure on 4-char compare */
+ /* address pointers are one word ahead; */
+ /* faster to use zero4 exit code */
+ p1 += 4;
+ p2 += 4;
+
+.Lzero4: /* one of the bytes in word 1 is zero */
+ /* but we've already fetched the next word; so */
+ /* backup two to look at failing word again */
+ p1 += -8;
+ p2 += -8;
+
+
+
+ /* here when pointers are unaligned: checks one */
+ /* character at a time. Also use at the end of */
+ /* the word-check algorithm to figure out what happened */
+.Lunaligned:
+ /* R0 is non-zero from before. */
+ /* p0 set to -1 */
+
+ r0 = 0 (Z);
+ r1 = B[p1++] (Z);
+ r2 = B[p2++] (Z);
+ LSETUP (.Lbeginloop1, .Lendloop1) lc0=p0;
+
+.Lbeginloop1:
+ cc = r1; /* first char must be non-zero */
+ /* chars must be the same */
+ r3 = r2 - r1 (NS) || r1 = B[p1++] (Z) || nop;
+ cc &= az;
+ r3 = r0 - r2; /* second char must be non-zero */
+ cc &= an;
+ if !cc jump .Lexitloop1;
+.Lendloop1:
+ r2 = B[p2++] (Z);
+
+.Lexitloop1: /* here means we found a zero or a difference. */
+ /* we have r2(N), p2(N), r1(N+1), p1(N+2) */
+ r1=B[p1+ -2] (Z);
+ r0 = r1 - r2;
+ (r7:4) = [sp++];
+ rts;
+.size _strcmp,.-_strcmp
+
+libc_hidden_def (strcmp)
+
+#ifndef __UCLIBC_HAS_LOCALE__
+weak_alias (strcmp,strcoll)
+libc_hidden_def (strcoll)
+#endif
diff --git a/ap/build/uClibc/libc/string/bzero.c b/ap/build/uClibc/libc/string/bzero.c
new file mode 100644
index 0000000..a541f36
--- /dev/null
+++ b/ap/build/uClibc/libc/string/bzero.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+void bzero(void *s, size_t n)
+{
+#if 1
+ (void)memset(s, 0, n);
+#else
+ register unsigned char *p = s;
+
+ while (n) {
+ *p++ = 0;
+ --n;
+ }
+#endif
+}
+#endif
diff --git a/ap/build/uClibc/libc/string/cris/memcopy.h b/ap/build/uClibc/libc/string/cris/memcopy.h
new file mode 100644
index 0000000..449c756
--- /dev/null
+++ b/ap/build/uClibc/libc/string/cris/memcopy.h
@@ -0,0 +1,62 @@
+/* Copyright (C) 2001 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ Modified for use in uClibc (C) 2007 Axis Communications AB.
+ Minimal modifications: include path name and #undef of WORD_COPY_FWD/BWD
+
+ 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. */
+
+#include "../generic/memcopy.h"
+
+/* We override the word-copying macros, partly because misalignment in one
+ pointer isn't cause for a special function, partly because we want to
+ get rid of all the static functions in generic/memcopy.c; these macros
+ are only used in memmove.c since we have arch-specific mempcpy, memcpy and
+ memset. */
+
+#undef OP_T_THRES
+#define OP_T_THRES OPSIZ
+
+#undef WORD_COPY_FWD
+#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
+ do \
+ { \
+ unsigned long enddst_bp = dst_bp + nbytes - (nbytes % OPSIZ); \
+ nbytes_left = (nbytes % OPSIZ); \
+ while (dst_bp < (unsigned long) enddst_bp) \
+ { \
+ op_t x = *(op_t *) src_bp; \
+ src_bp += sizeof x; \
+ *(op_t *) dst_bp = x; \
+ dst_bp += sizeof x; \
+ } \
+ } while (0)
+
+#undef WORD_COPY_BWD
+#define WORD_COPY_BWD(dst_bp, src_bp, nbytes_left, nbytes) \
+ do \
+ { \
+ unsigned long enddst_bp = dst_bp - nbytes + (nbytes % OPSIZ); \
+ nbytes_left = (nbytes % OPSIZ); \
+ while (dst_bp > enddst_bp) \
+ { \
+ op_t x; \
+ src_bp -= sizeof x; \
+ x = *(op_t *) src_bp; \
+ dst_bp -= sizeof x; \
+ *(op_t *) dst_bp = x; \
+ } \
+ } while (0)
diff --git a/ap/build/uClibc/libc/string/cris/memcpy.c b/ap/build/uClibc/libc/string/cris/memcpy.c
new file mode 100644
index 0000000..94e576f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/cris/memcpy.c
@@ -0,0 +1,242 @@
+/* A memcpy for CRIS.
+ Copyright (C) 1994-2008 Axis Communications.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Neither the name of Axis Communications nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
+ COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE. */
+
+/* FIXME: This file should really only be used for reference, as the
+ result is somewhat depending on gcc generating what we expect rather
+ than what we describe. An assembly file should be used instead. */
+
+#include <string.h>
+
+#ifdef __arch_v32
+/* For CRISv32, movem is very cheap. */
+#define MEMCPY_BY_BLOCK_THRESHOLD (44)
+#else
+/* Break even between movem and move16 is really at 38.7 * 2, but
+ modulo 44, so up to the next multiple of 44, we use ordinary code. */
+#define MEMCPY_BY_BLOCK_THRESHOLD (44 * 2)
+#endif
+
+/* No name ambiguities in this file. */
+__asm__ (".syntax no_register_prefix");
+
+void *
+memcpy(void *pdst, const void *psrc, size_t pn)
+{
+ /* Now we want the parameters put in special registers.
+ Make sure the compiler is able to make something useful of this.
+ As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
+
+ If gcc was allright, it really would need no temporaries, and no
+ stack space to save stuff on. */
+
+ register void *return_dst __asm__ ("r10") = pdst;
+ register unsigned char *dst __asm__ ("r13") = pdst;
+ register unsigned const char *src __asm__ ("r11") = psrc;
+ register int n __asm__ ("r12") = pn;
+
+ /* When src is aligned but not dst, this makes a few extra needless
+ cycles. I believe it would take as many to check that the
+ re-alignment was unnecessary. */
+ if (((unsigned long) dst & 3) != 0
+ /* Don't align if we wouldn't copy more than a few bytes; so we
+ don't have to check further for overflows. */
+ && n >= 3)
+ {
+ if ((unsigned long) dst & 1)
+ {
+ n--;
+ *dst = *src;
+ src++;
+ dst++;
+ }
+
+ if ((unsigned long) dst & 2)
+ {
+ n -= 2;
+ *(short *) dst = *(short *) src;
+ src += 2;
+ dst += 2;
+ }
+ }
+
+ /* Decide which copying method to use. */
+ if (n >= MEMCPY_BY_BLOCK_THRESHOLD)
+ {
+ /* It is not optimal to tell the compiler about clobbering any
+ registers; that will move the saving/restoring of those registers
+ to the function prologue/epilogue, and make non-movem sizes
+ suboptimal. */
+ __asm__ __volatile__
+ ("\
+ ;; GCC does promise correct register allocations, but let's \n\
+ ;; make sure it keeps its promises. \n\
+ .ifnc %0-%1-%2,$r13-$r11-$r12 \n\
+ .error \"GCC reg alloc bug: %0-%1-%4 != $r13-$r12-$r11\" \n\
+ .endif \n\
+ \n\
+ ;; Save the registers we'll use in the movem process \n\
+ ;; on the stack. \n\
+ subq 11*4,sp \n\
+ movem r10,[sp] \n\
+ \n\
+ ;; Now we've got this: \n\
+ ;; r11 - src \n\
+ ;; r13 - dst \n\
+ ;; r12 - n \n\
+ \n\
+ ;; Update n for the first loop. \n\
+ subq 44,r12 \n\
+0: \n\
+"
+#ifdef __arch_common_v10_v32
+ /* Cater to branch offset difference between v32 and v10. We
+ assume the branch below has an 8-bit offset. */
+" setf\n"
+#endif
+" movem [r11+],r10 \n\
+ subq 44,r12 \n\
+ bge 0b \n\
+ movem r10,[r13+] \n\
+ \n\
+ ;; Compensate for last loop underflowing n. \n\
+ addq 44,r12 \n\
+ \n\
+ ;; Restore registers from stack. \n\
+ movem [sp+],r10"
+
+ /* Outputs. */
+ : "=r" (dst), "=r" (src), "=r" (n)
+
+ /* Inputs. */
+ : "0" (dst), "1" (src), "2" (n));
+ }
+
+ while (n >= 16)
+ {
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+
+ n -= 16;
+ }
+
+ switch (n)
+ {
+ case 0:
+ break;
+
+ case 1:
+ *dst = *src;
+ break;
+
+ case 2:
+ *(short *) dst = *(short *) src;
+ break;
+
+ case 3:
+ *(short *) dst = *(short *) src; dst += 2; src += 2;
+ *dst = *src;
+ break;
+
+ case 4:
+ *(long *) dst = *(long *) src;
+ break;
+
+ case 5:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *dst = *src;
+ break;
+
+ case 6:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(short *) dst = *(short *) src;
+ break;
+
+ case 7:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(short *) dst = *(short *) src; dst += 2; src += 2;
+ *dst = *src;
+ break;
+
+ case 8:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src;
+ break;
+
+ case 9:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *dst = *src;
+ break;
+
+ case 10:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(short *) dst = *(short *) src;
+ break;
+
+ case 11:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(short *) dst = *(short *) src; dst += 2; src += 2;
+ *dst = *src;
+ break;
+
+ case 12:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src;
+ break;
+
+ case 13:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *dst = *src;
+ break;
+
+ case 14:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(short *) dst = *(short *) src;
+ break;
+
+ case 15:
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(long *) dst = *(long *) src; dst += 4; src += 4;
+ *(short *) dst = *(short *) src; dst += 2; src += 2;
+ *dst = *src;
+ break;
+ }
+
+ return return_dst;
+}
+libc_hidden_def(memcpy)
diff --git a/ap/build/uClibc/libc/string/cris/memmove.c b/ap/build/uClibc/libc/string/cris/memmove.c
new file mode 100644
index 0000000..4184fc9
--- /dev/null
+++ b/ap/build/uClibc/libc/string/cris/memmove.c
@@ -0,0 +1,100 @@
+/* Taken from generic/memmove.c; trivially modified to work with
+ arch-specific memcopy.h for Cris.
+
+ Copy memory to memory until the specified number of bytes
+ has been copied. Overlap is handled correctly.
+ Copyright (C) 1991, 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ 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 <string.h>
+
+#include "memcopy.h"
+#include "../generic/pagecopy.h"
+
+void *memmove (void *dest, const void *src, size_t len)
+{
+ unsigned long int dstp = (long int) dest;
+ unsigned long int srcp = (long int) src;
+
+ /* This test makes the forward copying code be used whenever possible.
+ Reduces the working set. */
+ if (dstp - srcp >= len) /* *Unsigned* compare! */
+ {
+#if 1
+#warning REMINDER: Cris arch-opt memmove assumes memcpy does forward copying!
+ memcpy(dest, src, len);
+#else
+ /* Copy from the beginning to the end. */
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= (-dstp) % OPSIZ;
+ BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
+
+ /* Copy whole pages from SRCP to DSTP by virtual address
+ manipulation, as much as possible. */
+
+ PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
+
+ /* Copy from SRCP to DSTP taking advantage of the known
+ alignment of DSTP. Number of bytes remaining is put
+ in the third argument, i.e. in LEN. This number may
+ vary from machine to machine. */
+
+ WORD_COPY_FWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_FWD (dstp, srcp, len);
+#endif
+ }
+ else
+ {
+ /* Copy from the end to the beginning. */
+ srcp += len;
+ dstp += len;
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= dstp % OPSIZ;
+ BYTE_COPY_BWD (dstp, srcp, dstp % OPSIZ);
+
+ /* Copy from SRCP to DSTP taking advantage of the known
+ alignment of DSTP. Number of bytes remaining is put
+ in the third argument, i.e. in LEN. This number may
+ vary from machine to machine. */
+
+ WORD_COPY_BWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_BWD (dstp, srcp, len);
+ }
+
+ return (dest);
+}
+libc_hidden_def(memmove)
diff --git a/ap/build/uClibc/libc/string/cris/memset.c b/ap/build/uClibc/libc/string/cris/memset.c
new file mode 100644
index 0000000..fab4e8b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/cris/memset.c
@@ -0,0 +1,262 @@
+/* A memset for CRIS.
+ Copyright (C) 1999-2008 Axis Communications.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Neither the name of Axis Communications nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
+ COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE. */
+
+/* FIXME: This file should really only be used for reference, as the
+ result is somewhat depending on gcc generating what we expect rather
+ than what we describe. An assembly file should be used instead. */
+
+#include <string.h>
+
+/* Note the multiple occurrence of the expression "12*4", including the
+ asm. It is hard to get it into the asm in a good way. Thus better to
+ expose the problem everywhere: no macro. */
+
+/* Assuming one cycle per dword written or read (ok, not really true; the
+ world is not ideal), and one cycle per instruction, then 43+3*(n/48-1)
+ <= 24+24*(n/48-1) so n >= 45.7; n >= 0.9; we win on the first full
+ 48-byte block to set. */
+
+#define MEMSET_BY_BLOCK_THRESHOLD (1 * 48)
+
+/* No name ambiguities in this file. */
+__asm__ (".syntax no_register_prefix");
+
+void *memset(void *pdst, int c, unsigned int plen)
+{
+ /* Now we want the parameters in special registers. Make sure the
+ compiler does something usable with this. */
+
+ register char *return_dst __asm__ ("r10") = pdst;
+ register int n __asm__ ("r12") = plen;
+ register int lc __asm__ ("r11") = c;
+
+ /* Most apps use memset sanely. Memsetting about 3..4 bytes or less get
+ penalized here compared to the generic implementation. */
+
+ /* This is fragile performancewise at best. Check with newer GCC
+ releases, if they compile cascaded "x |= x << 8" to sane code. */
+ __asm__("movu.b %0,r13 \n\
+ lslq 8,r13 \n\
+ move.b %0,r13 \n\
+ move.d r13,%0 \n\
+ lslq 16,r13 \n\
+ or.d r13,%0"
+ : "=r" (lc) /* Inputs. */
+ : "0" (lc) /* Outputs. */
+ : "r13"); /* Trash. */
+
+ {
+ register char *dst __asm__ ("r13") = pdst;
+
+ if (((unsigned long) pdst & 3) != 0
+ /* Oops! n = 0 must be a valid call, regardless of alignment. */
+ && n >= 3)
+ {
+ if ((unsigned long) dst & 1)
+ {
+ *dst = (char) lc;
+ n--;
+ dst++;
+ }
+
+ if ((unsigned long) dst & 2)
+ {
+ *(short *) dst = lc;
+ n -= 2;
+ dst += 2;
+ }
+ }
+
+ /* Decide which setting method to use. */
+ if (n >= MEMSET_BY_BLOCK_THRESHOLD)
+ {
+ /* It is not optimal to tell the compiler about clobbering any
+ registers; that will move the saving/restoring of those registers
+ to the function prologue/epilogue, and make non-block sizes
+ suboptimal. */
+ __asm__ __volatile__
+ ("\
+ ;; GCC does promise correct register allocations, but let's \n\
+ ;; make sure it keeps its promises. \n\
+ .ifnc %0-%1-%4,$r13-$r12-$r11 \n\
+ .error \"GCC reg alloc bug: %0-%1-%4 != $r13-$r12-$r11\" \n\
+ .endif \n\
+ \n\
+ ;; Save the registers we'll clobber in the movem process \n\
+ ;; on the stack. Don't mention them to gcc, it will only be \n\
+ ;; upset. \n\
+ subq 11*4,sp \n\
+ movem r10,[sp] \n\
+ \n\
+ move.d r11,r0 \n\
+ move.d r11,r1 \n\
+ move.d r11,r2 \n\
+ move.d r11,r3 \n\
+ move.d r11,r4 \n\
+ move.d r11,r5 \n\
+ move.d r11,r6 \n\
+ move.d r11,r7 \n\
+ move.d r11,r8 \n\
+ move.d r11,r9 \n\
+ move.d r11,r10 \n\
+ \n\
+ ;; Now we've got this: \n\
+ ;; r13 - dst \n\
+ ;; r12 - n \n\
+ \n\
+ ;; Update n for the first loop \n\
+ subq 12*4,r12 \n\
+0: \n\
+"
+#ifdef __arch_common_v10_v32
+ /* Cater to branch offset difference between v32 and v10. We
+ assume the branch below has an 8-bit offset. */
+" setf\n"
+#endif
+" subq 12*4,r12 \n\
+ bge 0b \n\
+ movem r11,[r13+] \n\
+ \n\
+ ;; Compensate for last loop underflowing n. \n\
+ addq 12*4,r12 \n\
+ \n\
+ ;; Restore registers from stack. \n\
+ movem [sp+],r10"
+
+ /* Outputs. */
+ : "=r" (dst), "=r" (n)
+
+ /* Inputs. */
+ : "0" (dst), "1" (n), "r" (lc));
+ }
+
+ /* An ad-hoc unroll, used for 4*12-1..16 bytes. */
+ while (n >= 16)
+ {
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ n -= 16;
+ }
+
+ switch (n)
+ {
+ case 0:
+ break;
+
+ case 1:
+ *dst = (char) lc;
+ break;
+
+ case 2:
+ *(short *) dst = (short) lc;
+ break;
+
+ case 3:
+ *(short *) dst = (short) lc; dst += 2;
+ *dst = (char) lc;
+ break;
+
+ case 4:
+ *(long *) dst = lc;
+ break;
+
+ case 5:
+ *(long *) dst = lc; dst += 4;
+ *dst = (char) lc;
+ break;
+
+ case 6:
+ *(long *) dst = lc; dst += 4;
+ *(short *) dst = (short) lc;
+ break;
+
+ case 7:
+ *(long *) dst = lc; dst += 4;
+ *(short *) dst = (short) lc; dst += 2;
+ *dst = (char) lc;
+ break;
+
+ case 8:
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc;
+ break;
+
+ case 9:
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *dst = (char) lc;
+ break;
+
+ case 10:
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *(short *) dst = (short) lc;
+ break;
+
+ case 11:
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *(short *) dst = (short) lc; dst += 2;
+ *dst = (char) lc;
+ break;
+
+ case 12:
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc;
+ break;
+
+ case 13:
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *dst = (char) lc;
+ break;
+
+ case 14:
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *(short *) dst = (short) lc;
+ break;
+
+ case 15:
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *(long *) dst = lc; dst += 4;
+ *(short *) dst = (short) lc; dst += 2;
+ *dst = (char) lc;
+ break;
+ }
+ }
+
+ return return_dst;
+}
+libc_hidden_def(memset)
diff --git a/ap/build/uClibc/libc/string/cris/strcpy.c b/ap/build/uClibc/libc/string/cris/strcpy.c
new file mode 100644
index 0000000..40e6389
--- /dev/null
+++ b/ap/build/uClibc/libc/string/cris/strcpy.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2006-2007 Axis Communications AB
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <string.h>
+
+char *strcpy(char *dest, const char *src)
+{
+ char *ret = dest;
+ unsigned long himagic = 0x80808080L;
+ unsigned long lomagic = 0x01010101L;
+
+ while ((unsigned long)src & (sizeof src - 1))
+ {
+ if (!(*dest++ = *src++))
+ {
+ return ret;
+ }
+ }
+
+ while (1)
+ {
+ unsigned long value = *(unsigned long*)src;
+ unsigned long magic;
+
+ src += sizeof (unsigned long);
+
+ if ((magic = (value - lomagic) & himagic))
+ {
+ if (magic & ~value)
+ {
+ break;
+ }
+ }
+
+ *(unsigned long*)dest = value;
+ dest += sizeof (unsigned long);
+ }
+
+ src -= sizeof (unsigned long);
+
+ while ((*dest++ = *src++))
+ {
+ }
+
+ return ret;
+}
+libc_hidden_def(strcpy)
diff --git a/ap/build/uClibc/libc/string/cris/strncpy.c b/ap/build/uClibc/libc/string/cris/strncpy.c
new file mode 100644
index 0000000..8d07407
--- /dev/null
+++ b/ap/build/uClibc/libc/string/cris/strncpy.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2006-2007 Axis Communications AB
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <string.h>
+
+
+char *strncpy(char *dest, const char *src, size_t count)
+{
+ char *ret = dest;
+ unsigned long himagic = 0x80808080L;
+ unsigned long lomagic = 0x01010101L;
+
+ while (count && (unsigned long)src & (sizeof src - 1))
+ {
+ count--;
+ if (!(*dest++ = *src++))
+ {
+ goto finalize;
+ }
+ }
+
+ while (count >= sizeof (unsigned long))
+ {
+ unsigned long value = *(unsigned long*)src;
+ unsigned long magic;
+
+ if ((magic = (value - lomagic) & himagic))
+ {
+ if (magic & ~value)
+ {
+ break;
+ }
+ }
+
+ *(unsigned long*)dest = value;
+ dest += sizeof (unsigned long);
+ src += sizeof (unsigned long);
+ count -= sizeof (unsigned long);
+ }
+
+ while (count)
+ {
+ count--;
+ if (!(*dest++ = *src++))
+ break;
+ }
+
+finalize:
+ if (count)
+ {
+ memset(dest, '\0', count);
+ }
+
+ return ret;
+}
+libc_hidden_def(strncpy)
diff --git a/ap/build/uClibc/libc/string/dirname.c b/ap/build/uClibc/libc/string/dirname.c
new file mode 100644
index 0000000..6265e56
--- /dev/null
+++ b/ap/build/uClibc/libc/string/dirname.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+#include <libgen.h>
+
+char *dirname(char *path)
+{
+ static const char null_or_empty_or_noslash[] = ".";
+ register char *s;
+ register char *last;
+ char *first;
+
+ last = s = path;
+
+ if (s != NULL) {
+
+ LOOP:
+ while (*s && (*s != '/')) ++s;
+ first = s;
+ while (*s == '/') ++s;
+ if (*s) {
+ last = first;
+ goto LOOP;
+ }
+
+ if (last == path) {
+ if (*last != '/') {
+ goto DOT;
+ }
+ if ((*++last == '/') && (last[1] == 0)) {
+ ++last;
+ }
+ }
+ *last = 0;
+ return path;
+ }
+ DOT:
+ return (char *) null_or_empty_or_noslash;
+}
diff --git a/ap/build/uClibc/libc/string/ffs.c b/ap/build/uClibc/libc/string/ffs.c
new file mode 100644
index 0000000..f39d304
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ffs.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <limits.h>
+#include <string.h>
+
+int ffs(int i)
+{
+#if 1
+ /* inlined binary search method */
+ char n = 1;
+#if UINT_MAX == 0xffffU
+ /* nothing to do here -- just trying to avoiding possible problems */
+#elif UINT_MAX == 0xffffffffU
+ if (!(i & 0xffff)) {
+ n += 16;
+ i >>= 16;
+ }
+#else
+#error ffs needs rewriting!
+#endif
+
+ if (!(i & 0xff)) {
+ n += 8;
+ i >>= 8;
+ }
+ if (!(i & 0x0f)) {
+ n += 4;
+ i >>= 4;
+ }
+ if (!(i & 0x03)) {
+ n += 2;
+ i >>= 2;
+ }
+ return (i) ? (n + ((i+1) & 0x01)) : 0;
+
+#else
+ /* linear search -- slow, but small */
+ int n;
+
+ for (n = 0 ; i ; ++n) {
+ i >>= 1;
+ }
+
+ return n;
+#endif
+}
+libc_hidden_def(ffs)
+#if ULONG_MAX == UINT_MAX
+strong_alias_untyped(ffs, ffsl)
+#endif
diff --git a/ap/build/uClibc/libc/string/ffsll.c b/ap/build/uClibc/libc/string/ffsll.c
new file mode 100644
index 0000000..a766290
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ffsll.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1992, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ 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 <limits.h>
+#include <string.h>
+
+/* Find the first bit set in I. */
+int ffsll (long long int i)
+{
+ unsigned long long int x = i & -i;
+
+ if (x <= 0xffffffff)
+ return ffs (i);
+ else
+ return 32 + ffs (i >> 32);
+}
+
+#if ULONG_MAX != UINT_MAX
+strong_alias_untyped(ffsll, ffsl)
+#endif
diff --git a/ap/build/uClibc/libc/string/frv/Makefile b/ap/build/uClibc/libc/string/frv/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/frv/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/frv/memcpy.S b/ap/build/uClibc/libc/string/frv/memcpy.S
new file mode 100644
index 0000000..ae84379
--- /dev/null
+++ b/ap/build/uClibc/libc/string/frv/memcpy.S
@@ -0,0 +1,127 @@
+/* memcpy.S: optimised assembly memcpy
+ *
+ * Copyright (C) 2003, 2004 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * 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.
+ */
+
+#include <features.h>
+
+ .text
+ .p2align 4
+
+###############################################################################
+#
+# void *memcpy(void *to, const char *from, size_t count)
+#
+# - NOTE: must not use any stack. exception detection performs function return
+# to caller's fixup routine, aborting the remainder of the copy
+#
+###############################################################################
+ .globl memcpy
+ .type memcpy,@function
+memcpy:
+ or.p gr8,gr9,gr4
+ orcc gr10,gr0,gr0,icc3
+ or.p gr10,gr4,gr4
+ beqlr icc3,#0
+
+ # optimise based on best common alignment for to, from & count
+ andicc.p gr4,#0x1f,gr0,icc0
+ setlos #8,gr11
+ andicc.p gr4,#0x0f,gr0,icc1
+ beq icc0,#0,memcpy_32
+ andicc.p gr4,#0x07,gr0,icc0
+ beq icc1,#0,memcpy_16
+ andicc.p gr4,#0x03,gr0,icc1
+ beq icc0,#0,memcpy_8
+ andicc.p gr4,#0x01,gr0,icc0
+ beq icc1,#0,memcpy_4
+ setlos.p #1,gr11
+ beq icc0,#0,memcpy_2
+
+ # do byte by byte copy
+ sub.p gr8,gr11,gr3
+ sub gr9,gr11,gr9
+0: ldubu.p @(gr9,gr11),gr4
+ subicc gr10,#1,gr10,icc0
+ stbu.p gr4,@(gr3,gr11)
+ bne icc0,#2,0b
+ bralr
+
+ # do halfword by halfword copy
+memcpy_2:
+ setlos #2,gr11
+ sub.p gr8,gr11,gr3
+ sub gr9,gr11,gr9
+0: lduhu.p @(gr9,gr11),gr4
+ subicc gr10,#2,gr10,icc0
+ sthu.p gr4,@(gr3,gr11)
+ bne icc0,#2,0b
+ bralr
+
+ # do word by word copy
+memcpy_4:
+ setlos #4,gr11
+ sub.p gr8,gr11,gr3
+ sub gr9,gr11,gr9
+0: ldu.p @(gr9,gr11),gr4
+ subicc gr10,#4,gr10,icc0
+ stu.p gr4,@(gr3,gr11)
+ bne icc0,#2,0b
+ bralr
+
+ # do double-word by double-word copy
+memcpy_8:
+ sub.p gr8,gr11,gr3
+ sub gr9,gr11,gr9
+0: lddu.p @(gr9,gr11),gr4
+ subicc gr10,#8,gr10,icc0
+ stdu.p gr4,@(gr3,gr11)
+ bne icc0,#2,0b
+ bralr
+
+ # do quad-word by quad-word copy
+memcpy_16:
+ sub.p gr8,gr11,gr3
+ sub gr9,gr11,gr9
+0: lddu @(gr9,gr11),gr4
+ lddu.p @(gr9,gr11),gr6
+ subicc gr10,#16,gr10,icc0
+ stdu gr4,@(gr3,gr11)
+ stdu.p gr6,@(gr3,gr11)
+ bne icc0,#2,0b
+ bralr
+
+ # do eight-word by eight-word copy
+memcpy_32:
+ sub.p gr8,gr11,gr3
+ sub gr9,gr11,gr9
+0: lddu @(gr9,gr11),gr4
+ lddu @(gr9,gr11),gr6
+ lddu @(gr9,gr11),gr12
+ lddu.p @(gr9,gr11),gr14
+ subicc gr10,#32,gr10,icc0
+ stdu gr4,@(gr3,gr11)
+ stdu gr6,@(gr3,gr11)
+ stdu gr12,@(gr3,gr11)
+ stdu.p gr14,@(gr3,gr11)
+ bne icc0,#2,0b
+ bralr
+
+ .size memcpy, .-memcpy
+
+libc_hidden_def(memcpy)
diff --git a/ap/build/uClibc/libc/string/frv/memset.S b/ap/build/uClibc/libc/string/frv/memset.S
new file mode 100644
index 0000000..bc0f80d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/frv/memset.S
@@ -0,0 +1,158 @@
+/* memset.S: optimised assembly memset
+ *
+ * Copyright (C) 2003, 2004 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * 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.
+ */
+
+#include <features.h>
+
+ .text
+ .p2align 4
+
+###############################################################################
+#
+# void *memset(void *p, char ch, size_t count)
+#
+# - NOTE: must not use any stack. exception detection performs function return
+# to caller's fixup routine, aborting the remainder of the set
+# GR4, GR7, GR8, and GR11 must be managed
+#
+###############################################################################
+ .globl memset
+ .type memset,@function
+memset:
+ orcc.p gr10,gr0,gr5,icc3 ; GR5 = count
+ andi gr9,#0xff,gr9
+ or.p gr8,gr0,gr4 ; GR4 = address
+ beqlr icc3,#0
+
+ # conditionally write a byte to 2b-align the address
+ setlos.p #1,gr6
+ andicc gr4,#1,gr0,icc0
+ ckne icc0,cc7
+ cstb.p gr9,@(gr4,gr0) ,cc7,#1
+ csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3
+ cadd.p gr4,gr6,gr4 ,cc7,#1
+ beqlr icc3,#0
+
+ # conditionally write a word to 4b-align the address
+ andicc.p gr4,#2,gr0,icc0
+ subicc gr5,#2,gr0,icc1
+ setlos.p #2,gr6
+ ckne icc0,cc7
+ slli.p gr9,#8,gr12 ; need to double up the pattern
+ cknc icc1,cc5
+ or.p gr9,gr12,gr12
+ andcr cc7,cc5,cc7
+
+ csth.p gr12,@(gr4,gr0) ,cc7,#1
+ csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3
+ cadd.p gr4,gr6,gr4 ,cc7,#1
+ beqlr icc3,#0
+
+ # conditionally write a dword to 8b-align the address
+ andicc.p gr4,#4,gr0,icc0
+ subicc gr5,#4,gr0,icc1
+ setlos.p #4,gr6
+ ckne icc0,cc7
+ slli.p gr12,#16,gr13 ; need to quadruple-up the pattern
+ cknc icc1,cc5
+ or.p gr13,gr12,gr12
+ andcr cc7,cc5,cc7
+
+ cst.p gr12,@(gr4,gr0) ,cc7,#1
+ csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3
+ cadd.p gr4,gr6,gr4 ,cc7,#1
+ beqlr icc3,#0
+
+ or.p gr12,gr12,gr13 ; need to octuple-up the pattern
+
+ # the address is now 8b-aligned - loop around writing 64b chunks
+ setlos #8,gr7
+ subi.p gr4,#8,gr4 ; store with update index does weird stuff
+ setlos #64,gr6
+
+ subicc gr5,#64,gr0,icc0
+0: cknc icc0,cc7
+ cstdu gr12,@(gr4,gr7) ,cc7,#1
+ cstdu gr12,@(gr4,gr7) ,cc7,#1
+ cstdu gr12,@(gr4,gr7) ,cc7,#1
+ cstdu gr12,@(gr4,gr7) ,cc7,#1
+ cstdu gr12,@(gr4,gr7) ,cc7,#1
+ cstdu.p gr12,@(gr4,gr7) ,cc7,#1
+ csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3
+ cstdu.p gr12,@(gr4,gr7) ,cc7,#1
+ subicc gr5,#64,gr0,icc0
+ cstdu.p gr12,@(gr4,gr7) ,cc7,#1
+ beqlr icc3,#0
+ bnc icc0,#2,0b
+
+ # now do 32-byte remnant
+ subicc.p gr5,#32,gr0,icc0
+ setlos #32,gr6
+ cknc icc0,cc7
+ cstdu.p gr12,@(gr4,gr7) ,cc7,#1
+ csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3
+ cstdu.p gr12,@(gr4,gr7) ,cc7,#1
+ setlos #16,gr6
+ cstdu.p gr12,@(gr4,gr7) ,cc7,#1
+ subicc gr5,#16,gr0,icc0
+ cstdu.p gr12,@(gr4,gr7) ,cc7,#1
+ beqlr icc3,#0
+
+ # now do 16-byte remnant
+ cknc icc0,cc7
+ cstdu.p gr12,@(gr4,gr7) ,cc7,#1
+ csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3
+ cstdu.p gr12,@(gr4,gr7) ,cc7,#1
+ beqlr icc3,#0
+
+ # now do 8-byte remnant
+ subicc gr5,#8,gr0,icc1
+ cknc icc1,cc7
+ cstdu.p gr12,@(gr4,gr7) ,cc7,#1
+ csubcc gr5,gr7,gr5 ,cc7,#1 ; also set ICC3
+ setlos.p #4,gr7
+ beqlr icc3,#0
+
+ # now do 4-byte remnant
+ subicc gr5,#4,gr0,icc0
+ addi.p gr4,#4,gr4
+ cknc icc0,cc7
+ cstu.p gr12,@(gr4,gr7) ,cc7,#1
+ csubcc gr5,gr7,gr5 ,cc7,#1 ; also set ICC3
+ subicc.p gr5,#2,gr0,icc1
+ beqlr icc3,#0
+
+ # now do 2-byte remnant
+ setlos #2,gr7
+ addi.p gr4,#2,gr4
+ cknc icc1,cc7
+ csthu.p gr12,@(gr4,gr7) ,cc7,#1
+ csubcc gr5,gr7,gr5 ,cc7,#1 ; also set ICC3
+ subicc.p gr5,#1,gr0,icc0
+ beqlr icc3,#0
+
+ # now do 1-byte remnant
+ setlos #0,gr7
+ addi.p gr4,#2,gr4
+ cknc icc0,cc7
+ cstb.p gr12,@(gr4,gr0) ,cc7,#1
+ bralr
+ .size memset, .-memset
+
+libc_hidden_def(memset)
diff --git a/ap/build/uClibc/libc/string/generic/Makefile b/ap/build/uClibc/libc/string/generic/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/generic/_memcpy_fwd.c b/ap/build/uClibc/libc/string/generic/_memcpy_fwd.c
new file mode 100644
index 0000000..470165a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/_memcpy_fwd.c
@@ -0,0 +1,185 @@
+/* _wordcopy_fwd_aligned -- Copy block beginning at SRCP to
+ block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
+ Both SRCP and DSTP should be aligned for memory operations on `op_t's. */
+
+static void _wordcopy_fwd_aligned (long int dstp, long int srcp, size_t len)
+{
+ op_t a0, a1;
+
+ switch (len % 8)
+ {
+ case 2:
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 6 * OPSIZ;
+ dstp -= 7 * OPSIZ;
+ len += 6;
+ goto do1;
+ case 3:
+ a1 = ((op_t *) srcp)[0];
+ srcp -= 5 * OPSIZ;
+ dstp -= 6 * OPSIZ;
+ len += 5;
+ goto do2;
+ case 4:
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 4 * OPSIZ;
+ dstp -= 5 * OPSIZ;
+ len += 4;
+ goto do3;
+ case 5:
+ a1 = ((op_t *) srcp)[0];
+ srcp -= 3 * OPSIZ;
+ dstp -= 4 * OPSIZ;
+ len += 3;
+ goto do4;
+ case 6:
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 2 * OPSIZ;
+ dstp -= 3 * OPSIZ;
+ len += 2;
+ goto do5;
+ case 7:
+ a1 = ((op_t *) srcp)[0];
+ srcp -= 1 * OPSIZ;
+ dstp -= 2 * OPSIZ;
+ len += 1;
+ goto do6;
+
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ a0 = ((op_t *) srcp)[0];
+ srcp -= 0 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ goto do7;
+ case 1:
+ a1 = ((op_t *) srcp)[0];
+ srcp -=-1 * OPSIZ;
+ dstp -= 0 * OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do8; /* No-op. */
+ }
+
+ do
+ {
+ do8:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a1;
+ do7:
+ a1 = ((op_t *) srcp)[1];
+ ((op_t *) dstp)[1] = a0;
+ do6:
+ a0 = ((op_t *) srcp)[2];
+ ((op_t *) dstp)[2] = a1;
+ do5:
+ a1 = ((op_t *) srcp)[3];
+ ((op_t *) dstp)[3] = a0;
+ do4:
+ a0 = ((op_t *) srcp)[4];
+ ((op_t *) dstp)[4] = a1;
+ do3:
+ a1 = ((op_t *) srcp)[5];
+ ((op_t *) dstp)[5] = a0;
+ do2:
+ a0 = ((op_t *) srcp)[6];
+ ((op_t *) dstp)[6] = a1;
+ do1:
+ a1 = ((op_t *) srcp)[7];
+ ((op_t *) dstp)[7] = a0;
+
+ srcp += 8 * OPSIZ;
+ dstp += 8 * OPSIZ;
+ len -= 8;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[0] = a1;
+}
+
+/* _wordcopy_fwd_dest_aligned -- Copy block beginning at SRCP to
+ block beginning at DSTP with LEN `op_t' words (not LEN bytes!).
+ DSTP should be aligned for memory operations on `op_t's, but SRCP must
+ *not* be aligned. */
+
+static void _wordcopy_fwd_dest_aligned (long int dstp, long int srcp, size_t len)
+{
+ op_t a0, a1, a2, a3;
+ int sh_1, sh_2;
+
+ /* Calculate how to shift a word read at the memory operation
+ aligned srcp to make it aligned for copy. */
+
+ sh_1 = 8 * (srcp % OPSIZ);
+ sh_2 = 8 * OPSIZ - sh_1;
+
+ /* Make SRCP aligned by rounding it down to the beginning of the `op_t'
+ it points in the middle of. */
+ srcp &= -OPSIZ;
+
+ switch (len % 4)
+ {
+ case 2:
+ a1 = ((op_t *) srcp)[0];
+ a2 = ((op_t *) srcp)[1];
+ srcp -= 1 * OPSIZ;
+ dstp -= 3 * OPSIZ;
+ len += 2;
+ goto do1;
+ case 3:
+ a0 = ((op_t *) srcp)[0];
+ a1 = ((op_t *) srcp)[1];
+ srcp -= 0 * OPSIZ;
+ dstp -= 2 * OPSIZ;
+ len += 1;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ a3 = ((op_t *) srcp)[0];
+ a0 = ((op_t *) srcp)[1];
+ srcp -=-1 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ len += 0;
+ goto do3;
+ case 1:
+ a2 = ((op_t *) srcp)[0];
+ a3 = ((op_t *) srcp)[1];
+ srcp -=-2 * OPSIZ;
+ dstp -= 0 * OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do4; /* No-op. */
+ }
+
+ do
+ {
+ do4:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = MERGE (a2, sh_1, a3, sh_2);
+ do3:
+ a1 = ((op_t *) srcp)[1];
+ ((op_t *) dstp)[1] = MERGE (a3, sh_1, a0, sh_2);
+ do2:
+ a2 = ((op_t *) srcp)[2];
+ ((op_t *) dstp)[2] = MERGE (a0, sh_1, a1, sh_2);
+ do1:
+ a3 = ((op_t *) srcp)[3];
+ ((op_t *) dstp)[3] = MERGE (a1, sh_1, a2, sh_2);
+
+ srcp += 4 * OPSIZ;
+ dstp += 4 * OPSIZ;
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[0] = MERGE (a2, sh_1, a3, sh_2);
+}
diff --git a/ap/build/uClibc/libc/string/generic/memchr.c b/ap/build/uClibc/libc/string/generic/memchr.c
new file mode 100644
index 0000000..d5cd000
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/memchr.c
@@ -0,0 +1,175 @@
+/* Copyright (C) 1991,93,96,97,99,2000,2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ 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 <string.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "memcopy.h"
+
+#define LONG_MAX_32_BITS 2147483647
+
+/* Search no more than N bytes of S for C. */
+#undef memchr
+void *memchr (const void * s, int c_in, size_t n)
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = (const unsigned char *) s;
+ n > 0 && ((unsigned long int) char_ptr
+ & (sizeof (longword) - 1)) != 0;
+ --n, ++char_ptr)
+ if (*char_ptr == c)
+ return (void *) char_ptr;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+
+ if (sizeof (longword) != 4 && sizeof (longword) != 8)
+ abort ();
+
+#if LONG_MAX <= LONG_MAX_32_BITS
+ magic_bits = 0x7efefeff;
+#else
+ magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+#endif
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+#if LONG_MAX > LONG_MAX_32_BITS
+ charmask |= charmask << 32;
+#endif
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ while (n >= sizeof (longword))
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C, not zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *longword_ptr++ ^ charmask;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C? If none of them were, it was
+ a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
+
+ if (cp[0] == c)
+ return (void *) cp;
+ if (cp[1] == c)
+ return (void *) &cp[1];
+ if (cp[2] == c)
+ return (void *) &cp[2];
+ if (cp[3] == c)
+ return (void *) &cp[3];
+#if LONG_MAX > 2147483647
+ if (cp[4] == c)
+ return (void *) &cp[4];
+ if (cp[5] == c)
+ return (void *) &cp[5];
+ if (cp[6] == c)
+ return (void *) &cp[6];
+ if (cp[7] == c)
+ return (void *) &cp[7];
+#endif
+ }
+
+ n -= sizeof (longword);
+ }
+
+ char_ptr = (const unsigned char *) longword_ptr;
+
+ while (n-- > 0)
+ {
+ if (*char_ptr == c)
+ return (void *) char_ptr;
+ else
+ ++char_ptr;
+ }
+
+ return 0;
+}
+libc_hidden_weak(memchr)
diff --git a/ap/build/uClibc/libc/string/generic/memcmp.c b/ap/build/uClibc/libc/string/generic/memcmp.c
new file mode 100644
index 0000000..62600cd
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/memcmp.c
@@ -0,0 +1,315 @@
+/* Copyright (C) 1991,1993,1995,1997,1998,2003,2004
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ 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 <string.h>
+#include "memcopy.h"
+
+
+#include <endian.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define CMP_LT_OR_GT(a, b) ((a) > (b) ? 1 : -1)
+#else
+# define CMP_LT_OR_GT(a, b) memcmp_bytes ((a), (b))
+#endif
+
+/* BE VERY CAREFUL IF YOU CHANGE THIS CODE! */
+
+/* The strategy of this memcmp is:
+
+ 1. Compare bytes until one of the block pointers is aligned.
+
+ 2. Compare using memcmp_common_alignment or
+ memcmp_not_common_alignment, regarding the alignment of the other
+ block after the initial byte operations. The maximum number of
+ full words (of type op_t) are compared in this way.
+
+ 3. Compare the few remaining bytes. */
+
+#if __BYTE_ORDER != __BIG_ENDIAN
+/* memcmp_bytes -- Compare A and B bytewise in the byte order of the machine.
+ A and B are known to be different.
+ This is needed only on little-endian machines. */
+
+static __inline__ int
+memcmp_bytes (op_t a, op_t b)
+{
+ long int srcp1 = (long int) &a;
+ long int srcp2 = (long int) &b;
+ op_t a0, b0;
+
+ do
+ {
+ a0 = ((byte *) srcp1)[0];
+ b0 = ((byte *) srcp2)[0];
+ srcp1 += 1;
+ srcp2 += 1;
+ }
+ while (a0 == b0);
+ return a0 - b0;
+}
+#endif
+
+/* memcmp_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN `op_t'
+ objects (not LEN bytes!). Both SRCP1 and SRCP2 should be aligned for
+ memory operations on `op_t's. */
+static int
+memcmp_common_alignment (long int srcp1, long int srcp2, size_t len)
+{
+ op_t a0, a1;
+ op_t b0, b1;
+
+ switch (len % 4)
+ {
+ default: /* Avoid warning about uninitialized local variables. */
+ case 2:
+ a0 = ((op_t *) srcp1)[0];
+ b0 = ((op_t *) srcp2)[0];
+ srcp1 -= 2 * OPSIZ;
+ srcp2 -= 2 * OPSIZ;
+ len += 2;
+ goto do1;
+ case 3:
+ a1 = ((op_t *) srcp1)[0];
+ b1 = ((op_t *) srcp2)[0];
+ srcp1 -= OPSIZ;
+ srcp2 -= OPSIZ;
+ len += 1;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return 0;
+ a0 = ((op_t *) srcp1)[0];
+ b0 = ((op_t *) srcp2)[0];
+ goto do3;
+ case 1:
+ a1 = ((op_t *) srcp1)[0];
+ b1 = ((op_t *) srcp2)[0];
+ srcp1 += OPSIZ;
+ srcp2 += OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ /* Fall through. */
+ }
+
+ do
+ {
+ a0 = ((op_t *) srcp1)[0];
+ b0 = ((op_t *) srcp2)[0];
+ if (a1 != b1)
+ return CMP_LT_OR_GT (a1, b1);
+
+ do3:
+ a1 = ((op_t *) srcp1)[1];
+ b1 = ((op_t *) srcp2)[1];
+ if (a0 != b0)
+ return CMP_LT_OR_GT (a0, b0);
+
+ do2:
+ a0 = ((op_t *) srcp1)[2];
+ b0 = ((op_t *) srcp2)[2];
+ if (a1 != b1)
+ return CMP_LT_OR_GT (a1, b1);
+
+ do1:
+ a1 = ((op_t *) srcp1)[3];
+ b1 = ((op_t *) srcp2)[3];
+ if (a0 != b0)
+ return CMP_LT_OR_GT (a0, b0);
+
+ srcp1 += 4 * OPSIZ;
+ srcp2 += 4 * OPSIZ;
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ if (a1 != b1)
+ return CMP_LT_OR_GT (a1, b1);
+ return 0;
+}
+
+/* memcmp_not_common_alignment -- Compare blocks at SRCP1 and SRCP2 with LEN
+ `op_t' objects (not LEN bytes!). SRCP2 should be aligned for memory
+ operations on `op_t', but SRCP1 *should be unaligned*. */
+static int
+memcmp_not_common_alignment (long int srcp1, long int srcp2, size_t len)
+{
+ op_t a0, a1, a2, a3;
+ op_t b0, b1, b2, b3;
+ op_t x;
+ int shl, shr;
+
+ /* Calculate how to shift a word read at the memory operation
+ aligned srcp1 to make it aligned for comparison. */
+
+ shl = 8 * (srcp1 % OPSIZ);
+ shr = 8 * OPSIZ - shl;
+
+ /* Make SRCP1 aligned by rounding it down to the beginning of the `op_t'
+ it points in the middle of. */
+ srcp1 &= -OPSIZ;
+
+ switch (len % 4)
+ {
+ default: /* Avoid warning about uninitialized local variables. */
+ case 2:
+ a1 = ((op_t *) srcp1)[0];
+ a2 = ((op_t *) srcp1)[1];
+ b2 = ((op_t *) srcp2)[0];
+ srcp1 -= 1 * OPSIZ;
+ srcp2 -= 2 * OPSIZ;
+ len += 2;
+ goto do1;
+ case 3:
+ a0 = ((op_t *) srcp1)[0];
+ a1 = ((op_t *) srcp1)[1];
+ b1 = ((op_t *) srcp2)[0];
+ srcp2 -= 1 * OPSIZ;
+ len += 1;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return 0;
+ a3 = ((op_t *) srcp1)[0];
+ a0 = ((op_t *) srcp1)[1];
+ b0 = ((op_t *) srcp2)[0];
+ srcp1 += 1 * OPSIZ;
+ goto do3;
+ case 1:
+ a2 = ((op_t *) srcp1)[0];
+ a3 = ((op_t *) srcp1)[1];
+ b3 = ((op_t *) srcp2)[0];
+ srcp1 += 2 * OPSIZ;
+ srcp2 += 1 * OPSIZ;
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ /* Fall through. */
+ }
+
+ do
+ {
+ a0 = ((op_t *) srcp1)[0];
+ b0 = ((op_t *) srcp2)[0];
+ x = MERGE(a2, shl, a3, shr);
+ if (x != b3)
+ return CMP_LT_OR_GT (x, b3);
+
+ do3:
+ a1 = ((op_t *) srcp1)[1];
+ b1 = ((op_t *) srcp2)[1];
+ x = MERGE(a3, shl, a0, shr);
+ if (x != b0)
+ return CMP_LT_OR_GT (x, b0);
+
+ do2:
+ a2 = ((op_t *) srcp1)[2];
+ b2 = ((op_t *) srcp2)[2];
+ x = MERGE(a0, shl, a1, shr);
+ if (x != b1)
+ return CMP_LT_OR_GT (x, b1);
+
+ do1:
+ a3 = ((op_t *) srcp1)[3];
+ b3 = ((op_t *) srcp2)[3];
+ x = MERGE(a1, shl, a2, shr);
+ if (x != b2)
+ return CMP_LT_OR_GT (x, b2);
+
+ srcp1 += 4 * OPSIZ;
+ srcp2 += 4 * OPSIZ;
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ x = MERGE(a2, shl, a3, shr);
+ if (x != b3)
+ return CMP_LT_OR_GT (x, b3);
+ return 0;
+}
+
+int
+memcmp (const __ptr_t s1, const __ptr_t s2, size_t len)
+{
+ op_t a0;
+ op_t b0;
+ long int srcp1 = (long int) s1;
+ long int srcp2 = (long int) s2;
+ op_t res;
+
+ if (len >= OP_T_THRES)
+ {
+ /* There are at least some bytes to compare. No need to test
+ for LEN == 0 in this alignment loop. */
+ while (srcp2 % OPSIZ != 0)
+ {
+ a0 = ((byte *) srcp1)[0];
+ b0 = ((byte *) srcp2)[0];
+ srcp1 += 1;
+ srcp2 += 1;
+ res = a0 - b0;
+ if (res != 0)
+ return res;
+ len -= 1;
+ }
+
+ /* SRCP2 is now aligned for memory operations on `op_t'.
+ SRCP1 alignment determines if we can do a simple,
+ aligned compare or need to shuffle bits. */
+
+ if (srcp1 % OPSIZ == 0)
+ res = memcmp_common_alignment (srcp1, srcp2, len / OPSIZ);
+ else
+ res = memcmp_not_common_alignment (srcp1, srcp2, len / OPSIZ);
+ if (res != 0)
+ return res;
+
+ /* Number of bytes remaining in the interval [0..OPSIZ-1]. */
+ srcp1 += len & -OPSIZ;
+ srcp2 += len & -OPSIZ;
+ len %= OPSIZ;
+ }
+
+ /* There are just a few bytes to compare. Use byte memory operations. */
+ while (len != 0)
+ {
+ a0 = ((byte *) srcp1)[0];
+ b0 = ((byte *) srcp2)[0];
+ srcp1 += 1;
+ srcp2 += 1;
+ res = a0 - b0;
+ if (res != 0)
+ return res;
+ len -= 1;
+ }
+
+ return 0;
+}
+libc_hidden_weak(memcmp)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(memcmp,bcmp)
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/memcopy.h b/ap/build/uClibc/libc/string/generic/memcopy.h
new file mode 100644
index 0000000..df1ba9a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/memcopy.h
@@ -0,0 +1,150 @@
+/* memcopy.h -- definitions for memory copy functions. Generic C version.
+ Copyright (C) 1991, 1992, 1993, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ 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. */
+
+/* The strategy of the memory functions is:
+
+ 1. Copy bytes until the destination pointer is aligned.
+
+ 2. Copy words in unrolled loops. If the source and destination
+ are not aligned in the same way, use word memory operations,
+ but shift and merge two read words before writing.
+
+ 3. Copy the few remaining bytes.
+
+ This is fast on processors that have at least 10 registers for
+ allocation by GCC, and that can access memory at reg+const in one
+ instruction.
+
+ I made an "exhaustive" test of this memmove when I wrote it,
+ exhaustive in the sense that I tried all alignment and length
+ combinations, with and without overlap. */
+
+#include <sys/cdefs.h>
+#include <endian.h>
+
+/* The macros defined in this file are:
+
+ BYTE_COPY_FWD(dst_beg_ptr, src_beg_ptr, nbytes_to_copy)
+
+ BYTE_COPY_BWD(dst_end_ptr, src_end_ptr, nbytes_to_copy)
+
+ WORD_COPY_FWD(dst_beg_ptr, src_beg_ptr, nbytes_remaining, nbytes_to_copy)
+
+ WORD_COPY_BWD(dst_end_ptr, src_end_ptr, nbytes_remaining, nbytes_to_copy)
+
+ MERGE(old_word, sh_1, new_word, sh_2)
+ [I fail to understand. I feel stupid. --roland]
+*/
+
+/* Type to use for aligned memory operations.
+ This should normally be the biggest type supported by a single load
+ and store. */
+#define op_t unsigned long int
+#define OPSIZ (sizeof(op_t))
+
+/* Type to use for unaligned operations. */
+typedef unsigned char byte;
+
+/* Optimal type for storing bytes in registers. */
+#define reg_char char
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
+#endif
+#if __BYTE_ORDER == __BIG_ENDIAN
+#define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
+#endif
+
+/* Copy exactly NBYTES bytes from SRC_BP to DST_BP,
+ without any assumptions about alignment of the pointers. */
+#define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \
+ do \
+ { \
+ size_t __nbytes = (nbytes); \
+ while (__nbytes > 0) \
+ { \
+ byte __x = ((byte *) src_bp)[0]; \
+ src_bp += 1; \
+ __nbytes -= 1; \
+ ((byte *) dst_bp)[0] = __x; \
+ dst_bp += 1; \
+ } \
+ } while (0)
+
+/* Copy exactly NBYTES_TO_COPY bytes from SRC_END_PTR to DST_END_PTR,
+ beginning at the bytes right before the pointers and continuing towards
+ smaller addresses. Don't assume anything about alignment of the
+ pointers. */
+#define BYTE_COPY_BWD(dst_ep, src_ep, nbytes) \
+ do \
+ { \
+ size_t __nbytes = (nbytes); \
+ while (__nbytes > 0) \
+ { \
+ byte __x; \
+ src_ep -= 1; \
+ __x = ((byte *) src_ep)[0]; \
+ dst_ep -= 1; \
+ __nbytes -= 1; \
+ ((byte *) dst_ep)[0] = __x; \
+ } \
+ } while (0)
+
+/* Copy *up to* NBYTES bytes from SRC_BP to DST_BP, with
+ the assumption that DST_BP is aligned on an OPSIZ multiple. If
+ not all bytes could be easily copied, store remaining number of bytes
+ in NBYTES_LEFT, otherwise store 0. */
+/* extern void _wordcopy_fwd_aligned __P ((long int, long int, size_t)); */
+/* extern void _wordcopy_fwd_dest_aligned __P ((long int, long int, size_t)); */
+#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
+ do \
+ { \
+ if (src_bp % OPSIZ == 0) \
+ _wordcopy_fwd_aligned (dst_bp, src_bp, (nbytes) / OPSIZ); \
+ else \
+ _wordcopy_fwd_dest_aligned (dst_bp, src_bp, (nbytes) / OPSIZ); \
+ src_bp += (nbytes) & -OPSIZ; \
+ dst_bp += (nbytes) & -OPSIZ; \
+ (nbytes_left) = (nbytes) % OPSIZ; \
+ } while (0)
+
+/* Copy *up to* NBYTES_TO_COPY bytes from SRC_END_PTR to DST_END_PTR,
+ beginning at the words (of type op_t) right before the pointers and
+ continuing towards smaller addresses. May take advantage of that
+ DST_END_PTR is aligned on an OPSIZ multiple. If not all bytes could be
+ easily copied, store remaining number of bytes in NBYTES_REMAINING,
+ otherwise store 0. */
+/* extern void _wordcopy_bwd_aligned __P ((long int, long int, size_t)); */
+/* extern void _wordcopy_bwd_dest_aligned __P ((long int, long int, size_t)); */
+#define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
+ do \
+ { \
+ if (src_ep % OPSIZ == 0) \
+ _wordcopy_bwd_aligned (dst_ep, src_ep, (nbytes) / OPSIZ); \
+ else \
+ _wordcopy_bwd_dest_aligned (dst_ep, src_ep, (nbytes) / OPSIZ); \
+ src_ep -= (nbytes) & -OPSIZ; \
+ dst_ep -= (nbytes) & -OPSIZ; \
+ (nbytes_left) = (nbytes) % OPSIZ; \
+ } while (0)
+
+
+/* Threshold value for when to enter the unrolled loops. */
+#define OP_T_THRES 16
diff --git a/ap/build/uClibc/libc/string/generic/memcpy.c b/ap/build/uClibc/libc/string/generic/memcpy.c
new file mode 100644
index 0000000..7dd7118
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/memcpy.c
@@ -0,0 +1,61 @@
+/* Copy memory to memory until the specified number of bytes
+ has been copied. Overlap is NOT handled correctly.
+ Copyright (C) 1991, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ 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 <string.h>
+#include "memcopy.h"
+#include "pagecopy.h"
+#include "_memcpy_fwd.c"
+
+
+void *memcpy (void *dstpp, const void *srcpp, size_t len)
+{
+ unsigned long int dstp = (long int) dstpp;
+ unsigned long int srcp = (long int) srcpp;
+
+ /* Copy from the beginning to the end. */
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= (-dstp) % OPSIZ;
+ BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
+
+ /* Copy whole pages from SRCP to DSTP by virtual address manipulation,
+ as much as possible. */
+
+ PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
+
+ /* Copy from SRCP to DSTP taking advantage of the known alignment of
+ DSTP. Number of bytes remaining is put in the third argument,
+ i.e. in LEN. This number may vary from machine to machine. */
+
+ WORD_COPY_FWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_FWD (dstp, srcp, len);
+
+ return dstpp;
+}
+libc_hidden_weak(memcpy)
diff --git a/ap/build/uClibc/libc/string/generic/memmem.c b/ap/build/uClibc/libc/string/generic/memmem.c
new file mode 100644
index 0000000..9738497
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/memmem.c
@@ -0,0 +1,51 @@
+/* Copyright (C) 1991,92,93,94,96,97,98,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. */
+
+#include <string.h>
+#include <stddef.h>
+
+#ifdef __USE_GNU
+
+/* Return the first occurrence of NEEDLE in HAYSTACK. */
+void *memmem (const void *haystack, size_t haystack_len,
+ const void *needle, size_t needle_len)
+{
+ const char *begin;
+ const char *const last_possible
+ = (const char *) haystack + haystack_len - needle_len;
+
+ if (needle_len == 0)
+ /* The first occurrence of the empty string is deemed to occur at
+ the beginning of the string. */
+ return (void *) haystack;
+
+ /* Sanity check, otherwise the loop might search through the whole
+ memory. */
+ if (__builtin_expect (haystack_len < needle_len, 0))
+ return NULL;
+
+ for (begin = (const char *) haystack; begin <= last_possible; ++begin)
+ if (begin[0] == ((const char *) needle)[0] &&
+ !memcmp ((const void *) &begin[1],
+ (const void *) ((const char *) needle + 1),
+ needle_len - 1))
+ return (void *) begin;
+
+ return NULL;
+}
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/memmove.c b/ap/build/uClibc/libc/string/generic/memmove.c
new file mode 100644
index 0000000..b564a7d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/memmove.c
@@ -0,0 +1,289 @@
+/* Copy memory to memory until the specified number of bytes
+ has been copied. Overlap is handled correctly.
+ Copyright (C) 1991, 1995, 1996, 1997, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Torbjorn Granlund (tege@sics.se).
+
+ 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 <string.h>
+
+#include "memcopy.h"
+#include "pagecopy.h"
+
+#ifdef __ARCH_HAS_BWD_MEMCPY__
+/* generic-opt memmove assumes memcpy does forward copying! */
+#include "_memcpy_fwd.c"
+#endif
+
+
+static void _wordcopy_bwd_aligned (long int dstp, long int srcp, size_t len)
+{
+ op_t a0 = 0;
+ op_t a1 = 0;
+
+ switch (len % 8)
+ {
+ case 2:
+ srcp -= 2 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ a0 = ((op_t *) srcp)[1];
+ len += 6;
+ goto do1;
+ case 3:
+ srcp -= 3 * OPSIZ;
+ dstp -= 2 * OPSIZ;
+ a1 = ((op_t *) srcp)[2];
+ len += 5;
+ goto do2;
+ case 4:
+ srcp -= 4 * OPSIZ;
+ dstp -= 3 * OPSIZ;
+ a0 = ((op_t *) srcp)[3];
+ len += 4;
+ goto do3;
+ case 5:
+ srcp -= 5 * OPSIZ;
+ dstp -= 4 * OPSIZ;
+ a1 = ((op_t *) srcp)[4];
+ len += 3;
+ goto do4;
+ case 6:
+ srcp -= 6 * OPSIZ;
+ dstp -= 5 * OPSIZ;
+ a0 = ((op_t *) srcp)[5];
+ len += 2;
+ goto do5;
+ case 7:
+ srcp -= 7 * OPSIZ;
+ dstp -= 6 * OPSIZ;
+ a1 = ((op_t *) srcp)[6];
+ len += 1;
+ goto do6;
+
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ srcp -= 8 * OPSIZ;
+ dstp -= 7 * OPSIZ;
+ a0 = ((op_t *) srcp)[7];
+ goto do7;
+ case 1:
+ srcp -= 9 * OPSIZ;
+ dstp -= 8 * OPSIZ;
+ a1 = ((op_t *) srcp)[8];
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do8; /* No-op. */
+ }
+
+ do
+ {
+ do8:
+ a0 = ((op_t *) srcp)[7];
+ ((op_t *) dstp)[7] = a1;
+ do7:
+ a1 = ((op_t *) srcp)[6];
+ ((op_t *) dstp)[6] = a0;
+ do6:
+ a0 = ((op_t *) srcp)[5];
+ ((op_t *) dstp)[5] = a1;
+ do5:
+ a1 = ((op_t *) srcp)[4];
+ ((op_t *) dstp)[4] = a0;
+ do4:
+ a0 = ((op_t *) srcp)[3];
+ ((op_t *) dstp)[3] = a1;
+ do3:
+ a1 = ((op_t *) srcp)[2];
+ ((op_t *) dstp)[2] = a0;
+ do2:
+ a0 = ((op_t *) srcp)[1];
+ ((op_t *) dstp)[1] = a1;
+ do1:
+ a1 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = a0;
+
+ srcp -= 8 * OPSIZ;
+ dstp -= 8 * OPSIZ;
+ len -= 8;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[7] = a1;
+}
+
+/* _wordcopy_bwd_dest_aligned -- Copy block finishing right
+ before SRCP to block finishing right before DSTP with LEN `op_t'
+ words (not LEN bytes!). DSTP should be aligned for memory
+ operations on `op_t', but SRCP must *not* be aligned. */
+
+static void _wordcopy_bwd_dest_aligned (long int dstp, long int srcp, size_t len)
+{
+ op_t a0 = 0;
+ op_t a1 = 0;
+ op_t a2 = 0;
+ op_t a3 = 0;
+ int sh_1, sh_2;
+
+ /* Calculate how to shift a word read at the memory operation
+ aligned srcp to make it aligned for copy. */
+
+ sh_1 = 8 * (srcp % OPSIZ);
+ sh_2 = 8 * OPSIZ - sh_1;
+
+ /* Make srcp aligned by rounding it down to the beginning of the op_t
+ it points in the middle of. */
+ srcp &= -OPSIZ;
+ srcp += OPSIZ;
+
+ switch (len % 4)
+ {
+ case 2:
+ srcp -= 3 * OPSIZ;
+ dstp -= 1 * OPSIZ;
+ a2 = ((op_t *) srcp)[2];
+ a1 = ((op_t *) srcp)[1];
+ len += 2;
+ goto do1;
+ case 3:
+ srcp -= 4 * OPSIZ;
+ dstp -= 2 * OPSIZ;
+ a3 = ((op_t *) srcp)[3];
+ a2 = ((op_t *) srcp)[2];
+ len += 1;
+ goto do2;
+ case 0:
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ return;
+ srcp -= 5 * OPSIZ;
+ dstp -= 3 * OPSIZ;
+ a0 = ((op_t *) srcp)[4];
+ a3 = ((op_t *) srcp)[3];
+ goto do3;
+ case 1:
+ srcp -= 6 * OPSIZ;
+ dstp -= 4 * OPSIZ;
+ a1 = ((op_t *) srcp)[5];
+ a0 = ((op_t *) srcp)[4];
+ len -= 1;
+ if (OP_T_THRES <= 3 * OPSIZ && len == 0)
+ goto do0;
+ goto do4; /* No-op. */
+ }
+
+ do
+ {
+ do4:
+ a3 = ((op_t *) srcp)[3];
+ ((op_t *) dstp)[3] = MERGE (a0, sh_1, a1, sh_2);
+ do3:
+ a2 = ((op_t *) srcp)[2];
+ ((op_t *) dstp)[2] = MERGE (a3, sh_1, a0, sh_2);
+ do2:
+ a1 = ((op_t *) srcp)[1];
+ ((op_t *) dstp)[1] = MERGE (a2, sh_1, a3, sh_2);
+ do1:
+ a0 = ((op_t *) srcp)[0];
+ ((op_t *) dstp)[0] = MERGE (a1, sh_1, a2, sh_2);
+
+ srcp -= 4 * OPSIZ;
+ dstp -= 4 * OPSIZ;
+ len -= 4;
+ }
+ while (len != 0);
+
+ /* This is the right position for do0. Please don't move
+ it into the loop. */
+ do0:
+ ((op_t *) dstp)[3] = MERGE (a0, sh_1, a1, sh_2);
+}
+
+void *memmove (void *dest, const void *src, size_t len)
+{
+ unsigned long int dstp = (long int) dest;
+ unsigned long int srcp = (long int) src;
+
+ /* This test makes the forward copying code be used whenever possible.
+ Reduces the working set. */
+ if (dstp - srcp >= len) /* *Unsigned* compare! */
+ {
+#ifndef __ARCH_HAS_BWD_MEMCPY__
+ /* Backward memcpy implementation cannot be used */
+ memcpy(dest, src, len);
+#else
+ /* Copy from the beginning to the end. */
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= (-dstp) % OPSIZ;
+ BYTE_COPY_FWD (dstp, srcp, (-dstp) % OPSIZ);
+
+ /* Copy whole pages from SRCP to DSTP by virtual address
+ manipulation, as much as possible. */
+
+ PAGE_COPY_FWD_MAYBE (dstp, srcp, len, len);
+
+ /* Copy from SRCP to DSTP taking advantage of the known
+ alignment of DSTP. Number of bytes remaining is put
+ in the third argument, i.e. in LEN. This number may
+ vary from machine to machine. */
+
+ WORD_COPY_FWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_FWD (dstp, srcp, len);
+#endif
+ }
+ else
+ {
+ /* Copy from the end to the beginning. */
+ srcp += len;
+ dstp += len;
+
+ /* If there not too few bytes to copy, use word copy. */
+ if (len >= OP_T_THRES)
+ {
+ /* Copy just a few bytes to make DSTP aligned. */
+ len -= dstp % OPSIZ;
+ BYTE_COPY_BWD (dstp, srcp, dstp % OPSIZ);
+
+ /* Copy from SRCP to DSTP taking advantage of the known
+ alignment of DSTP. Number of bytes remaining is put
+ in the third argument, i.e. in LEN. This number may
+ vary from machine to machine. */
+
+ WORD_COPY_BWD (dstp, srcp, len, len);
+
+ /* Fall out and copy the tail. */
+ }
+
+ /* There are just a few bytes to copy. Use byte memory operations. */
+ BYTE_COPY_BWD (dstp, srcp, len);
+ }
+
+ return (dest);
+}
+libc_hidden_weak(memmove)
diff --git a/ap/build/uClibc/libc/string/generic/mempcpy.c b/ap/build/uClibc/libc/string/generic/mempcpy.c
new file mode 100644
index 0000000..d7fa79e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/mempcpy.c
@@ -0,0 +1,19 @@
+/* Copy memory to memory until the specified number of bytes
+ has been copied, return pointer to following byte.
+ Overlap is NOT handled correctly.
+*/
+
+/* Ditch the glibc version and just wrap memcpy. */
+
+#include <string.h>
+
+#ifdef __USE_GNU
+
+# undef mempcpy
+void *mempcpy (void *dstpp, const void *srcpp, size_t len)
+{
+ memcpy(dstpp, srcpp, len);
+ return (void *)(((char *)dstpp) + len);
+}
+libc_hidden_weak(mempcpy)
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/memrchr.c b/ap/build/uClibc/libc/string/generic/memrchr.c
new file mode 100644
index 0000000..c03a770
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/memrchr.c
@@ -0,0 +1,176 @@
+/* memrchr -- find the last occurrence of a byte in a memory block
+ Copyright (C) 1991, 93, 96, 97, 99, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ 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 <string.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#ifdef __USE_GNU
+
+#include "memcopy.h"
+
+#define LONG_MAX_32_BITS 2147483647
+
+/* Search no more than N bytes of S for C. */
+void *memrchr (const void * s, int c_in, size_t n)
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the last few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = (const unsigned char *) s + n;
+ n > 0 && ((unsigned long int) char_ptr
+ & (sizeof (longword) - 1)) != 0;
+ --n)
+ if (*--char_ptr == c)
+ return (void *) char_ptr;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (const unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+
+ if (sizeof (longword) != 4 && sizeof (longword) != 8)
+ abort ();
+
+#if LONG_MAX <= LONG_MAX_32_BITS
+ magic_bits = 0x7efefeff;
+#else
+ magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+#endif
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+#if LONG_MAX > LONG_MAX_32_BITS
+ charmask |= charmask << 32;
+#endif
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ while (n >= sizeof (longword))
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C, not zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *--longword_ptr ^ charmask;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C? If none of them were, it was
+ a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) longword_ptr;
+
+#if LONG_MAX > 2147483647
+ if (cp[7] == c)
+ return (void *) &cp[7];
+ if (cp[6] == c)
+ return (void *) &cp[6];
+ if (cp[5] == c)
+ return (void *) &cp[5];
+ if (cp[4] == c)
+ return (void *) &cp[4];
+#endif
+ if (cp[3] == c)
+ return (void *) &cp[3];
+ if (cp[2] == c)
+ return (void *) &cp[2];
+ if (cp[1] == c)
+ return (void *) &cp[1];
+ if (cp[0] == c)
+ return (void *) cp;
+ }
+
+ n -= sizeof (longword);
+ }
+
+ char_ptr = (const unsigned char *) longword_ptr;
+
+ while (n-- > 0)
+ {
+ if (*--char_ptr == c)
+ return (void *) char_ptr;
+ }
+
+ return 0;
+}
+libc_hidden_def(memrchr)
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/memset.c b/ap/build/uClibc/libc/string/generic/memset.c
new file mode 100644
index 0000000..7be5727
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/memset.c
@@ -0,0 +1,85 @@
+/* Copyright (C) 1991, 1997, 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. */
+
+#include <string.h>
+#include "memcopy.h"
+
+void *memset (void *dstpp, int c, size_t len)
+{
+ long int dstp = (long int) dstpp;
+
+ if (len >= 8)
+ {
+ size_t xlen;
+ op_t cccc;
+
+ cccc = (unsigned char) c;
+ cccc |= cccc << 8;
+ cccc |= cccc << 16;
+ if (OPSIZ > 4)
+ /* Do the shift in two steps to avoid warning if long has 32 bits. */
+ cccc |= (cccc << 16) << 16;
+
+ /* There are at least some bytes to set.
+ No need to test for LEN == 0 in this alignment loop. */
+ while (dstp % OPSIZ != 0)
+ {
+ ((byte *) dstp)[0] = c;
+ dstp += 1;
+ len -= 1;
+ }
+
+ /* Write 8 `op_t' per iteration until less than 8 `op_t' remain. */
+ xlen = len / (OPSIZ * 8);
+ while (xlen > 0)
+ {
+ ((op_t *) dstp)[0] = cccc;
+ ((op_t *) dstp)[1] = cccc;
+ ((op_t *) dstp)[2] = cccc;
+ ((op_t *) dstp)[3] = cccc;
+ ((op_t *) dstp)[4] = cccc;
+ ((op_t *) dstp)[5] = cccc;
+ ((op_t *) dstp)[6] = cccc;
+ ((op_t *) dstp)[7] = cccc;
+ dstp += 8 * OPSIZ;
+ xlen -= 1;
+ }
+ len %= OPSIZ * 8;
+
+ /* Write 1 `op_t' per iteration until less than OPSIZ bytes remain. */
+ xlen = len / OPSIZ;
+ while (xlen > 0)
+ {
+ ((op_t *) dstp)[0] = cccc;
+ dstp += OPSIZ;
+ xlen -= 1;
+ }
+ len %= OPSIZ;
+ }
+
+ /* Write the last few bytes. */
+ while (len > 0)
+ {
+ ((byte *) dstp)[0] = c;
+ dstp += 1;
+ len -= 1;
+ }
+
+ return dstpp;
+}
+libc_hidden_weak(memset)
diff --git a/ap/build/uClibc/libc/string/generic/pagecopy.h b/ap/build/uClibc/libc/string/generic/pagecopy.h
new file mode 100644
index 0000000..b00db49
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/pagecopy.h
@@ -0,0 +1,75 @@
+/* Macros for copying by pages; used in memcpy, memmove. Generic macros.
+ Copyright (C) 1995, 1997 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 defines the macro:
+
+ PAGE_COPY_FWD_MAYBE (dstp, srcp, nbytes_left, nbytes)
+
+ which is invoked like WORD_COPY_FWD et al. The pointers should be at
+ least word aligned. This will check if virtual copying by pages can and
+ should be done and do it if so.
+
+ System-specific pagecopy.h files should define these macros and then
+ #include this file:
+
+ PAGE_COPY_THRESHOLD
+ -- Minimum size for which virtual copying by pages is worthwhile.
+
+ PAGE_SIZE
+ -- Size of a page.
+
+ PAGE_COPY_FWD (dstp, srcp, nbytes_left, nbytes)
+ -- Macro to perform the virtual copy operation.
+ The pointers will be aligned to PAGE_SIZE bytes.
+*/
+
+
+#if defined PAGE_COPY_THRESHOLD && PAGE_COPY_THRESHOLD
+
+#include <assert.h>
+
+#define PAGE_COPY_FWD_MAYBE(dstp, srcp, nbytes_left, nbytes) \
+ do \
+ { \
+ if ((nbytes) >= PAGE_COPY_THRESHOLD && \
+ PAGE_OFFSET ((dstp) - (srcp)) == 0) \
+ { \
+ /* The amount to copy is past the threshold for copying \
+ pages virtually with kernel VM operations, and the \
+ source and destination addresses have the same alignment. */ \
+ size_t nbytes_before = PAGE_OFFSET (-(dstp)); \
+ if (nbytes_before != 0) \
+ { \
+ /* First copy the words before the first page boundary. */ \
+ WORD_COPY_FWD (dstp, srcp, nbytes_left, nbytes_before); \
+ assert (nbytes_left == 0); \
+ nbytes -= nbytes_before; \
+ } \
+ PAGE_COPY_FWD (dstp, srcp, nbytes_left, nbytes); \
+ } \
+ } while (0)
+
+/* The page size is always a power of two, so we can avoid modulo division. */
+#define PAGE_OFFSET(n) ((n) & (PAGE_SIZE - 1))
+
+#else
+
+#define PAGE_COPY_FWD_MAYBE(dstp, srcp, nbytes_left, nbytes) /* nada */
+
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/rawmemchr.c b/ap/build/uClibc/libc/string/generic/rawmemchr.c
new file mode 100644
index 0000000..ddefb09
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/rawmemchr.c
@@ -0,0 +1,162 @@
+/* Copyright (C) 1991,93,96,97,99,2000,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ 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 <string.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#ifdef __USE_GNU
+
+#include "memcopy.h"
+
+#define LONG_MAX_32_BITS 2147483647
+
+/* Find the first occurrence of C in S. */
+void *rawmemchr (const void * s, int c_in)
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = (const unsigned char *) s;
+ ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
+ ++char_ptr)
+ if (*char_ptr == c)
+ return (void *) char_ptr;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+
+ if (sizeof (longword) != 4 && sizeof (longword) != 8)
+ abort ();
+
+#if LONG_MAX <= LONG_MAX_32_BITS
+ magic_bits = 0x7efefeff;
+#else
+ magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
+#endif
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+#if LONG_MAX > LONG_MAX_32_BITS
+ charmask |= charmask << 32;
+#endif
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ while (1)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C, not zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *longword_ptr++ ^ charmask;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C? If none of them were, it was
+ a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
+
+ if (cp[0] == c)
+ return (void *) cp;
+ if (cp[1] == c)
+ return (void *) &cp[1];
+ if (cp[2] == c)
+ return (void *) &cp[2];
+ if (cp[3] == c)
+ return (void *) &cp[3];
+#if LONG_MAX > 2147483647
+ if (cp[4] == c)
+ return (void *) &cp[4];
+ if (cp[5] == c)
+ return (void *) &cp[5];
+ if (cp[6] == c)
+ return (void *) &cp[6];
+ if (cp[7] == c)
+ return (void *) &cp[7];
+#endif
+ }
+ }
+}
+libc_hidden_def(rawmemchr)
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/strcat.c b/ap/build/uClibc/libc/string/generic/strcat.c
new file mode 100644
index 0000000..b19a0db
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strcat.c
@@ -0,0 +1,47 @@
+/* Copyright (C) 1991, 1997, 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. */
+
+#include <string.h>
+#include "memcopy.h"
+
+/* Append SRC on the end of DEST. */
+char *strcat (char *dest, const char *src)
+{
+ char *s1 = dest;
+ const char *s2 = src;
+ reg_char c;
+
+ /* Find the end of the string. */
+ do
+ c = *s1++;
+ while (c != '\0');
+
+ /* Make S1 point before the next character, so we can increment
+ it while memory is read (wins on pipelined cpus). */
+ s1 -= 2;
+
+ do
+ {
+ c = *s2++;
+ *++s1 = c;
+ }
+ while (c != '\0');
+
+ return dest;
+}
+libc_hidden_def(strcat)
diff --git a/ap/build/uClibc/libc/string/generic/strchr.c b/ap/build/uClibc/libc/string/generic/strchr.c
new file mode 100644
index 0000000..836ccdd
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strchr.c
@@ -0,0 +1,185 @@
+/* Copyright (C) 1991,93,94,95,96,97,99,2000,03 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ bug fix and commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to strchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ 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 <string.h>
+#include <stdlib.h>
+
+
+#include "memcopy.h"
+
+/* Find the first occurrence of C in S. */
+char *strchr (const char *s, int c_in)
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = (const unsigned char *) s;
+ ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
+ ++char_ptr)
+ if (*char_ptr == c)
+ return (void *) char_ptr;
+ else if (*char_ptr == '\0')
+ return NULL;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+ switch (sizeof (longword))
+ {
+ case 4: magic_bits = 0x7efefeffL; break;
+ case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+ default:
+ abort ();
+ }
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+ if (sizeof (longword) > 4)
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+ charmask |= (charmask << 16) << 16;
+ if (sizeof (longword) > 8)
+ abort ();
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ for (;;)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C as well as zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *longword_ptr++;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0 ||
+
+ /* That caught zeroes. Now test for C. */
+ ((((longword ^ charmask) + magic_bits) ^ ~(longword ^ charmask))
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C or zero?
+ If none of them were, it was a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
+
+ if (*cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (sizeof (longword) > 4)
+ {
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ if (*++cp == c)
+ return (char *) cp;
+ else if (*cp == '\0')
+ return NULL;
+ }
+ }
+ }
+
+ return NULL;
+}
+libc_hidden_weak(strchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+weak_alias(strchr,index)
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/strchrnul.c b/ap/build/uClibc/libc/string/generic/strchrnul.c
new file mode 100644
index 0000000..9984d61
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strchrnul.c
@@ -0,0 +1,167 @@
+/* Copyright (C) 1991,93,94,95,96,97,99,2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ bug fix and commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to strchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ 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 <string.h>
+#include <stdlib.h>
+
+#ifdef __USE_GNU
+
+#include "memcopy.h"
+
+/* Find the first occurrence of C in S or the final NUL byte. */
+char *strchrnul (const char *s, int c_in)
+{
+ const unsigned char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, charmask;
+ unsigned reg_char c;
+
+ c = (unsigned char) c_in;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = (const unsigned char *) s;
+ ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
+ ++char_ptr)
+ if (*char_ptr == c || *char_ptr == '\0')
+ return (void *) char_ptr;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+ switch (sizeof (longword))
+ {
+ case 4: magic_bits = 0x7efefeffL; break;
+ case 8: magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL; break;
+ default:
+ abort ();
+ }
+
+ /* Set up a longword, each of whose bytes is C. */
+ charmask = c | (c << 8);
+ charmask |= charmask << 16;
+ if (sizeof (longword) > 4)
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+ charmask |= (charmask << 16) << 16;
+ if (sizeof (longword) > 8)
+ abort ();
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ for (;;)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly.
+
+ 3) But wait! Aren't we looking for C as well as zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ longword = *longword_ptr++;
+
+ /* Add MAGIC_BITS to LONGWORD. */
+ if ((((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits) != 0 ||
+
+ /* That caught zeroes. Now test for C. */
+ ((((longword ^ charmask) + magic_bits) ^ ~(longword ^ charmask))
+ & ~magic_bits) != 0)
+ {
+ /* Which of the bytes was C or zero?
+ If none of them were, it was a misfire; continue the search. */
+
+ const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
+
+ if (*cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (sizeof (longword) > 4)
+ {
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ if (*++cp == c || *cp == '\0')
+ return (char *) cp;
+ }
+ }
+ }
+
+ /* This should never happen. */
+ return NULL;
+}
+libc_hidden_def(strchrnul)
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/strcmp.c b/ap/build/uClibc/libc/string/generic/strcmp.c
new file mode 100644
index 0000000..502b80f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strcmp.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 1991, 1996, 1997, 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. */
+
+#include <string.h>
+
+#include "memcopy.h"
+
+/* Compare S1 and S2, returning less than, equal to or
+ greater than zero if S1 is lexicographically less than,
+ equal to or greater than S2. */
+int strcmp (const char *p1, const char *p2)
+{
+ register const unsigned char *s1 = (const unsigned char *) p1;
+ register const unsigned char *s2 = (const unsigned char *) p2;
+ unsigned reg_char c1, c2;
+
+ do
+ {
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0')
+ return c1 - c2;
+ }
+ while (c1 == c2);
+
+ return c1 - c2;
+}
+libc_hidden_weak(strcmp)
+
+#ifndef __UCLIBC_HAS_LOCALE__
+strong_alias(strcmp,strcoll)
+libc_hidden_def(strcoll)
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/strcpy.c b/ap/build/uClibc/libc/string/generic/strcpy.c
new file mode 100644
index 0000000..ace6dea
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strcpy.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1997, 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. */
+
+#include <string.h>
+
+/* Copy SRC to DEST. */
+char *strcpy(char *dest, const char *src)
+{
+ char *dst = dest;
+
+ while ((*dst = *src) != '\0') {
+ src++;
+ dst++;
+ }
+
+ return dest;
+}
+libc_hidden_def(strcpy)
diff --git a/ap/build/uClibc/libc/string/generic/strcspn.c b/ap/build/uClibc/libc/string/generic/strcspn.c
new file mode 100644
index 0000000..f1f39df
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strcspn.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991, 1994, 1996, 1997, 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. */
+
+#include <string.h>
+
+
+/* Return the length of the maximum initial segment of S
+ which contains no characters from REJECT. */
+size_t strcspn (const char *s, const char *reject)
+{
+ size_t count = 0;
+
+ while (*s != '\0')
+ if (strchr (reject, *s++) == NULL)
+ ++count;
+ else
+ return count;
+
+ return count;
+}
+libc_hidden_def(strcspn)
diff --git a/ap/build/uClibc/libc/string/generic/strlen.c b/ap/build/uClibc/libc/string/generic/strlen.c
new file mode 100644
index 0000000..9b6d81d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strlen.c
@@ -0,0 +1,150 @@
+/* Copyright (C) 1991, 1993, 1997, 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Written by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se);
+ commentary by Jim Blandy (jimb@ai.mit.edu).
+
+ 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 <string.h>
+#include <stdlib.h>
+
+
+/* Return the length of the null-terminated string STR. Scan for
+ the null terminator quickly by testing four bytes at a time. */
+size_t strlen (const char *str)
+{
+ const char *char_ptr;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, magic_bits, himagic, lomagic;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = str; ((unsigned long int) char_ptr
+ & (sizeof (longword) - 1)) != 0;
+ ++char_ptr)
+ if (*char_ptr == '\0')
+ return char_ptr - str;
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+ magic_bits = 0x7efefeffL;
+ himagic = 0x80808080L;
+ lomagic = 0x01010101L;
+ if (sizeof (longword) > 4)
+ {
+ /* 64-bit version of the magic. */
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+ magic_bits = ((0x7efefefeL << 16) << 16) | 0xfefefeffL;
+ himagic = ((himagic << 16) << 16) | himagic;
+ lomagic = ((lomagic << 16) << 16) | lomagic;
+ }
+ if (sizeof (longword) > 8)
+ abort ();
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ for (;;)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly. */
+
+ longword = *longword_ptr++;
+
+ if (
+#if 0
+ /* Add MAGIC_BITS to LONGWORD. */
+ (((longword + magic_bits)
+
+ /* Set those bits that were unchanged by the addition. */
+ ^ ~longword)
+
+ /* Look at only the hole bits. If any of the hole bits
+ are unchanged, most likely one of the bytes was a
+ zero. */
+ & ~magic_bits)
+#else
+ ((longword - lomagic) & himagic)
+#endif
+ != 0)
+ {
+ /* Which of the bytes was the zero? If none of them were, it was
+ a misfire; continue the search. */
+
+ const char *cp = (const char *) (longword_ptr - 1);
+
+ if (cp[0] == 0)
+ return cp - str;
+ if (cp[1] == 0)
+ return cp - str + 1;
+ if (cp[2] == 0)
+ return cp - str + 2;
+ if (cp[3] == 0)
+ return cp - str + 3;
+ if (sizeof (longword) > 4)
+ {
+ if (cp[4] == 0)
+ return cp - str + 4;
+ if (cp[5] == 0)
+ return cp - str + 5;
+ if (cp[6] == 0)
+ return cp - str + 6;
+ if (cp[7] == 0)
+ return cp - str + 7;
+ }
+ }
+ }
+}
+libc_hidden_weak(strlen)
diff --git a/ap/build/uClibc/libc/string/generic/strncat.c b/ap/build/uClibc/libc/string/generic/strncat.c
new file mode 100644
index 0000000..0863d36
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strncat.c
@@ -0,0 +1,76 @@
+/* Copyright (C) 1991, 1997 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 <string.h>
+
+#include "memcopy.h"
+
+char *strncat (char *s1, const char *s2, size_t n)
+{
+ reg_char c;
+ char *s = s1;
+
+ /* Find the end of S1. */
+ do
+ c = *s1++;
+ while (c != '\0');
+
+ /* Make S1 point before next character, so we can increment
+ it while memory is read (wins on pipelined cpus). */
+ s1 -= 2;
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+ do
+ {
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ } while (--n4 > 0);
+ n &= 3;
+ }
+
+ while (n > 0)
+ {
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ return s;
+ n--;
+ }
+
+ if (c != '\0')
+ *++s1 = '\0';
+
+ return s;
+}
+libc_hidden_def(strncat)
diff --git a/ap/build/uClibc/libc/string/generic/strncmp.c b/ap/build/uClibc/libc/string/generic/strncmp.c
new file mode 100644
index 0000000..04d6cf2
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strncmp.c
@@ -0,0 +1,67 @@
+/* Copyright (C) 1991, 1996, 1997, 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. */
+
+#include <string.h>
+#include "memcopy.h"
+
+/* Compare no more than N characters of S1 and S2,
+ returning less than, equal to or greater than zero
+ if S1 is lexicographically less than, equal to or
+ greater than S2. */
+int strncmp (const char *s1, const char *s2, size_t n)
+{
+ unsigned reg_char c1 = '\0';
+ unsigned reg_char c2 = '\0';
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+ do
+ {
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0' || c1 != c2)
+ return c1 - c2;
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0' || c1 != c2)
+ return c1 - c2;
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0' || c1 != c2)
+ return c1 - c2;
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0' || c1 != c2)
+ return c1 - c2;
+ } while (--n4 > 0);
+ n &= 3;
+ }
+
+ while (n > 0)
+ {
+ c1 = (unsigned char) *s1++;
+ c2 = (unsigned char) *s2++;
+ if (c1 == '\0' || c1 != c2)
+ return c1 - c2;
+ n--;
+ }
+
+ return c1 - c2;
+}
+libc_hidden_weak(strncmp)
diff --git a/ap/build/uClibc/libc/string/generic/strncpy.c b/ap/build/uClibc/libc/string/generic/strncpy.c
new file mode 100644
index 0000000..26b45bb
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strncpy.c
@@ -0,0 +1,81 @@
+/* Copyright (C) 1991, 1997, 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. */
+
+#include <string.h>
+#include "memcopy.h"
+
+char *strncpy (char *s1, const char *s2, size_t n)
+{
+ reg_char c;
+ char *s = s1;
+
+ --s1;
+
+ if (n >= 4)
+ {
+ size_t n4 = n >> 2;
+
+ for (;;)
+ {
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ c = *s2++;
+ *++s1 = c;
+ if (c == '\0')
+ break;
+ if (--n4 == 0)
+ goto last_chars;
+ }
+ n = n - (s1 - s) - 1;
+ if (n == 0)
+ return s;
+ goto zero_fill;
+ }
+
+ last_chars:
+ n &= 3;
+ if (n == 0)
+ return s;
+
+ do
+ {
+ c = *s2++;
+ *++s1 = c;
+ if (--n == 0)
+ return s;
+ }
+ while (c != '\0');
+
+ zero_fill:
+ do
+ *++s1 = '\0';
+ while (--n > 0);
+
+ return s;
+}
+libc_hidden_def(strncpy)
diff --git a/ap/build/uClibc/libc/string/generic/strnlen.c b/ap/build/uClibc/libc/string/generic/strnlen.c
new file mode 100644
index 0000000..b9dc161
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strnlen.c
@@ -0,0 +1,160 @@
+/* Find the length of STRING, but scan at most MAXLEN characters.
+ Copyright (C) 1991, 1993, 1997, 2000, 2001 Free Software Foundation, Inc.
+ Contributed by Jakub Jelinek <jakub@redhat.com>.
+
+ Based on strlen written by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se);
+ commentary by Jim Blandy (jimb@ai.mit.edu).
+
+ 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; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef __USE_GNU
+
+/* Find the length of S, but scan at most MAXLEN characters. If no
+ '\0' terminator is found in that many characters, return MAXLEN. */
+size_t strnlen (const char *str, size_t maxlen)
+{
+ const char *char_ptr, *end_ptr = str + maxlen;
+ const unsigned long int *longword_ptr;
+ unsigned long int longword, himagic, lomagic;
+
+ if (maxlen == 0)
+ return 0;
+
+ if (__builtin_expect (end_ptr < str, 0))
+ end_ptr = (const char *) ~0UL;
+
+ /* Handle the first few characters by reading one character at a time.
+ Do this until CHAR_PTR is aligned on a longword boundary. */
+ for (char_ptr = str; ((unsigned long int) char_ptr
+ & (sizeof (longword) - 1)) != 0;
+ ++char_ptr)
+ if (*char_ptr == '\0')
+ {
+ if (char_ptr > end_ptr)
+ char_ptr = end_ptr;
+ return char_ptr - str;
+ }
+
+ /* All these elucidatory comments refer to 4-byte longwords,
+ but the theory applies equally well to 8-byte longwords. */
+
+ longword_ptr = (unsigned long int *) char_ptr;
+
+ /* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
+ the "holes." Note that there is a hole just to the left of
+ each byte, with an extra at the end:
+
+ bits: 01111110 11111110 11111110 11111111
+ bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
+
+ The 1-bits make sure that carries propagate to the next 0-bit.
+ The 0-bits provide holes for carries to fall into. */
+ himagic = 0x80808080L;
+ lomagic = 0x01010101L;
+ if (sizeof (longword) > 4)
+ {
+ /* 64-bit version of the magic. */
+ /* Do the shift in two steps to avoid a warning if long has 32 bits. */
+ himagic = ((himagic << 16) << 16) | himagic;
+ lomagic = ((lomagic << 16) << 16) | lomagic;
+ }
+ if (sizeof (longword) > 8)
+ abort ();
+
+ /* Instead of the traditional loop which tests each character,
+ we will test a longword at a time. The tricky part is testing
+ if *any of the four* bytes in the longword in question are zero. */
+ while (longword_ptr < (unsigned long int *) end_ptr)
+ {
+ /* We tentatively exit the loop if adding MAGIC_BITS to
+ LONGWORD fails to change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of LONGWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24. If one of bits 24-30 is set, there will be a carry
+ into bit 31, so all of the hole bits will be changed.
+
+ The one misfire occurs when bits 24-30 are clear and bit
+ 31 is set; in this case, the hole at bit 31 is not
+ changed. If we had access to the processor carry flag,
+ we could close this loophole by putting the fourth hole
+ at bit 32!
+
+ So it ignores everything except 128's, when they're aligned
+ properly. */
+
+ longword = *longword_ptr++;
+
+ if ((longword - lomagic) & himagic)
+ {
+ /* Which of the bytes was the zero? If none of them were, it was
+ a misfire; continue the search. */
+
+ const char *cp = (const char *) (longword_ptr - 1);
+
+ char_ptr = cp;
+ if (cp[0] == 0)
+ break;
+ char_ptr = cp + 1;
+ if (cp[1] == 0)
+ break;
+ char_ptr = cp + 2;
+ if (cp[2] == 0)
+ break;
+ char_ptr = cp + 3;
+ if (cp[3] == 0)
+ break;
+ if (sizeof (longword) > 4)
+ {
+ char_ptr = cp + 4;
+ if (cp[4] == 0)
+ break;
+ char_ptr = cp + 5;
+ if (cp[5] == 0)
+ break;
+ char_ptr = cp + 6;
+ if (cp[6] == 0)
+ break;
+ char_ptr = cp + 7;
+ if (cp[7] == 0)
+ break;
+ }
+ }
+ char_ptr = end_ptr;
+ }
+
+ if (char_ptr > end_ptr)
+ char_ptr = end_ptr;
+ return char_ptr - str;
+}
+libc_hidden_def(strnlen)
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/strrchr.c b/ap/build/uClibc/libc/string/generic/strrchr.c
new file mode 100644
index 0000000..7d16926
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strrchr.c
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991, 1995, 1996, 1997, 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. */
+
+#include <string.h>
+
+
+/* Find the last occurrence of C in S. */
+char *strrchr (const char *s, int c)
+{
+ register const char *found, *p;
+
+ c = (unsigned char) c;
+
+ /* Since strchr is fast, we use it rather than the obvious loop. */
+
+ if (c == '\0')
+ return strchr (s, '\0');
+
+ found = NULL;
+ while ((p = strchr (s, c)) != NULL)
+ {
+ found = p;
+ s = p + 1;
+ }
+
+ return (char *) found;
+}
+libc_hidden_weak(strrchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+weak_alias(strrchr,rindex)
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/strsep.c b/ap/build/uClibc/libc/string/generic/strsep.c
new file mode 100644
index 0000000..91dfade
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strsep.c
@@ -0,0 +1,68 @@
+/* Copyright (C) 1992, 93, 96, 97, 98, 99, 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 <string.h>
+
+#ifdef __USE_BSD
+
+
+char *strsep (char **stringp, const char *delim)
+{
+ char *begin, *end;
+
+ begin = *stringp;
+ if (begin == NULL)
+ return NULL;
+
+ /* A frequent case is when the delimiter string contains only one
+ character. Here we don't need to call the expensive `strpbrk'
+ function and instead work using `strchr'. */
+ if (delim[0] == '\0' || delim[1] == '\0')
+ {
+ char ch = delim[0];
+
+ if (ch == '\0')
+ end = NULL;
+ else
+ {
+ if (*begin == ch)
+ end = begin;
+ else if (*begin == '\0')
+ end = NULL;
+ else
+ end = strchr (begin + 1, ch);
+ }
+ }
+ else
+ /* Find the end of the token. */
+ end = strpbrk (begin, delim);
+
+ if (end)
+ {
+ /* Terminate the token and set *STRINGP past NUL character. */
+ *end++ = '\0';
+ *stringp = end;
+ }
+ else
+ /* No more delimiters; this is the last token. */
+ *stringp = NULL;
+
+ return begin;
+}
+libc_hidden_def(strsep)
+#endif
diff --git a/ap/build/uClibc/libc/string/generic/strspn.c b/ap/build/uClibc/libc/string/generic/strspn.c
new file mode 100644
index 0000000..1d9ec40
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strspn.c
@@ -0,0 +1,42 @@
+/* Copyright (C) 1991, 1997, 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. */
+
+#include <string.h>
+
+/* Return the length of the maximum initial segment
+ of S which contains only characters in ACCEPT. */
+size_t strspn (const char *s, const char *accept)
+{
+ const char *p;
+ const char *a;
+ size_t count = 0;
+
+ for (p = s; *p != '\0'; ++p)
+ {
+ for (a = accept; *a != '\0'; ++a)
+ if (*p == *a)
+ break;
+ if (*a == '\0')
+ return count;
+ else
+ ++count;
+ }
+
+ return count;
+}
+libc_hidden_def(strspn)
diff --git a/ap/build/uClibc/libc/string/generic/strstr.c b/ap/build/uClibc/libc/string/generic/strstr.c
new file mode 100644
index 0000000..c3b886a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strstr.c
@@ -0,0 +1,113 @@
+/* Return the offset of one string within another.
+ Copyright (C) 1994,1996,1997,2000,2001,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. */
+
+/*
+ * My personal strstr() implementation that beats most other algorithms.
+ * Until someone tells me otherwise, I assume that this is the
+ * fastest implementation of strstr() in C.
+ * I deliberately chose not to comment it. You should have at least
+ * as much fun trying to understand it, as I had to write it :-).
+ *
+ * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de */
+
+#include <string.h>
+
+
+typedef unsigned chartype;
+
+char *strstr (const char *phaystack, const char *pneedle)
+{
+ const unsigned char *haystack, *needle;
+ chartype b;
+ const unsigned char *rneedle;
+
+ haystack = (const unsigned char *) phaystack;
+
+ if ((b = *(needle = (const unsigned char *) pneedle)))
+ {
+ chartype c;
+ haystack--; /* possible ANSI violation */
+
+ {
+ chartype a;
+ do
+ if (!(a = *++haystack))
+ goto ret0;
+ while (a != b);
+ }
+
+ if (!(c = *++needle))
+ goto foundneedle;
+ ++needle;
+ goto jin;
+
+ for (;;)
+ {
+ {
+ chartype a;
+ if (0)
+ jin:{
+ if ((a = *++haystack) == c)
+ goto crest;
+ }
+ else
+ a = *++haystack;
+ do
+ {
+ for (; a != b; a = *++haystack)
+ {
+ if (!a)
+ goto ret0;
+ if ((a = *++haystack) == b)
+ break;
+ if (!a)
+ goto ret0;
+ }
+ }
+ while ((a = *++haystack) != c);
+ }
+ crest:
+ {
+ chartype a;
+ {
+ const unsigned char *rhaystack;
+ if (*(rhaystack = haystack-- + 1) == (a = *(rneedle = needle)))
+ do
+ {
+ if (!a)
+ goto foundneedle;
+ if (*++rhaystack != (a = *++needle))
+ break;
+ if (!a)
+ goto foundneedle;
+ }
+ while (*++rhaystack == (a = *++needle));
+ needle = rneedle; /* took the register-poor aproach */
+ }
+ if (!a)
+ break;
+ }
+ }
+ }
+foundneedle:
+ return (char *) haystack;
+ret0:
+ return 0;
+}
+libc_hidden_def(strstr)
diff --git a/ap/build/uClibc/libc/string/generic/strtok_r.c b/ap/build/uClibc/libc/string/generic/strtok_r.c
new file mode 100644
index 0000000..75ce5be
--- /dev/null
+++ b/ap/build/uClibc/libc/string/generic/strtok_r.c
@@ -0,0 +1,67 @@
+/* Reentrant string tokenizer. Generic version.
+ Copyright (C) 1991,1996-1999,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. */
+
+#include <string.h>
+
+#ifdef __USE_GNU
+# define __rawmemchr rawmemchr
+#else
+# define __rawmemchr strchr
+#endif
+#if 0
+ Parse S into tokens separated by characters in DELIM.
+ If S is NULL, the saved pointer in SAVE_PTR is used as
+ the next starting point. For example:
+ char s[] = "-abc-=-def";
+ char *sp;
+ x = strtok_r(s, "-", &sp); /* x = "abc", sp = "=-def" */
+ x = strtok_r(NULL, "-=", &sp); /* x = "def", sp = NULL */
+ x = strtok_r(NULL, "=", &sp); /* x = NULL */
+ /* s = "abc\0-def\0" */
+#endif
+char *strtok_r (char *s, const char *delim, char **save_ptr)
+{
+ char *token;
+
+ if (s == NULL)
+ s = *save_ptr;
+
+ /* Scan leading delimiters. */
+ s += strspn (s, delim);
+ if (*s == '\0')
+ {
+ *save_ptr = s;
+ return NULL;
+ }
+
+ /* Find the end of the token. */
+ token = s;
+ s = strpbrk (token, delim);
+ if (s == NULL)
+ /* This token finishes the string. */
+ *save_ptr = __rawmemchr (token, '\0');
+ else
+ {
+ /* Terminate the token and make *SAVE_PTR point past it. */
+ *s = '\0';
+ *save_ptr = s + 1;
+ }
+ return token;
+}
+libc_hidden_def(strtok_r)
diff --git a/ap/build/uClibc/libc/string/i386/Makefile b/ap/build/uClibc/libc/string/i386/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/i386/memchr.c b/ap/build/uClibc/libc/string/i386/memchr.c
new file mode 100644
index 0000000..1960f6b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/memchr.c
@@ -0,0 +1,75 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+#undef memchr
+/*#define memchr TESTING*/
+void *memchr(const void *s, int c, size_t count)
+{
+ void *edi;
+ int ecx;
+ __asm__ __volatile__(
+ " jecxz 1f\n"
+ " repne; scasb\n"
+ " leal -1(%%edi), %%edi\n"
+ " je 2f\n"
+ "1:\n"
+ " xorl %%edi, %%edi\n" /* NULL */
+ "2:\n"
+ : "=&D" (edi), "=&c" (ecx)
+ : "a" (c), "0" (s), "1" (count)
+ /* : no clobbers */
+ );
+ return edi;
+}
+#ifndef memchr
+libc_hidden_def(memchr)
+#else
+/* Uncomment TESTING, gcc -D_GNU_SOURCE -m32 -Os memchr.c -o memchr
+ * and run ./memchr
+ */
+int main()
+{
+ static const char str[] = "abc.def";
+ printf((char*)memchr(str, '.',-2) - str == 3 ? "ok\n" : "BAD!\n");
+ printf((char*)memchr(str, '.',-1) - str == 3 ? "ok\n" : "BAD!\n");
+ printf((char*)memchr(str, '.', 0) == NULL ? "ok\n" : "BAD!\n");
+ printf((char*)memchr(str, '.', 1) == NULL ? "ok\n" : "BAD!\n");
+ printf((char*)memchr(str, '.', 2) == NULL ? "ok\n" : "BAD!\n");
+ printf((char*)memchr(str, '.', 3) == NULL ? "ok\n" : "BAD!\n");
+ printf((char*)memchr(str, '.', 4) - str == 3 ? "ok\n" : "BAD!\n");
+ printf((char*)memchr(str, '.', 5) - str == 3 ? "ok\n" : "BAD!\n");
+ printf((char*)memchr(str+3, '.', 0) == NULL ? "ok\n" : "BAD!\n");
+ printf((char*)memchr(str+3, '.', 5) - str == 3 ? "ok\n" : "BAD!\n");
+}
+#endif
diff --git a/ap/build/uClibc/libc/string/i386/memcpy.c b/ap/build/uClibc/libc/string/i386/memcpy.c
new file mode 100644
index 0000000..697d0bd
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/memcpy.c
@@ -0,0 +1,54 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+#undef memcpy
+void *memcpy(void * to, const void * from, size_t n)
+{
+ int d0, d1, d2;
+ __asm__ __volatile__(
+ " rep; movsl\n"
+ " movl %4, %%ecx\n"
+ " andl $3, %%ecx\n"
+ /* jz is optional. avoids "rep; movsb" with ecx == 0,
+ * but adds a branch, which is currently (2008) faster */
+ " jz 1f\n"
+ " rep; movsb\n"
+ "1:\n"
+ : "=&c" (d0), "=&D" (d1), "=&S" (d2)
+ : "0" (n / 4), "g" (n), "1" ((long)to), "2" ((long)from)
+ : "memory"
+ );
+ return to;
+}
+libc_hidden_def(memcpy)
diff --git a/ap/build/uClibc/libc/string/i386/memmove.c b/ap/build/uClibc/libc/string/i386/memmove.c
new file mode 100644
index 0000000..0ec8016
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/memmove.c
@@ -0,0 +1,71 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+#undef memmove
+/*#define memmove TESTING*/
+void *memmove(void *dest, const void *src, size_t n)
+{
+ int eax, ecx, esi, edi;
+ __asm__ __volatile__(
+ " movl %%eax, %%edi\n"
+ " cmpl %%esi, %%eax\n"
+ " je 2f\n" /* (optional) src == dest -> NOP */
+ " jb 1f\n" /* src > dest -> simple copy */
+ " leal -1(%%esi,%%ecx), %%esi\n"
+ " leal -1(%%eax,%%ecx), %%edi\n"
+ " std\n"
+ "1: rep; movsb\n"
+ " cld\n"
+ "2:\n"
+ : "=&c" (ecx), "=&S" (esi), "=&a" (eax), "=&D" (edi)
+ : "0" (n), "1" (src), "2" (dest)
+ : "memory"
+ );
+ return (void*)eax;
+}
+#ifndef memmove
+libc_hidden_def(memmove)
+#else
+/* Uncomment TESTING, gcc -D_GNU_SOURCE -m32 -Os memmove.c -o memmove
+ * and run ./memmove
+ */
+int main()
+{
+ static char str[] = "abcdef.123";
+ memmove(str + 1, str, 5);
+ printf(strcmp(str, "aabcde.123") == 0 ? "ok\n" : "BAD!\n");
+ memmove(str, str + 1, 5);
+ printf(strcmp(str, "abcdee.123") == 0 ? "ok\n" : "BAD!\n");
+}
+#endif
diff --git a/ap/build/uClibc/libc/string/i386/memset.c b/ap/build/uClibc/libc/string/i386/memset.c
new file mode 100644
index 0000000..9f51f3c
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/memset.c
@@ -0,0 +1,95 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ *
+ * 2009-04: modified by Denys Vlasenko <vda.linux@googlemail.com>
+ * Fill byte-by-byte is a bit too slow. I prefer 46 byte function
+ * which fills x4 faster than 21 bytes one.
+ */
+
+#include <string.h>
+
+#undef memset
+void *memset(void *s, int c, size_t count)
+{
+ int reg, edi;
+ __asm__ __volatile__(
+
+ /* Most of the time, count is divisible by 4 and nonzero */
+ /* It's better to make this case faster */
+ /* " jecxz 9f\n" - (optional) count == 0: goto ret */
+ " mov %%ecx, %1\n"
+ " shr $2, %%ecx\n"
+ " jz 1f\n" /* zero words: goto fill_bytes */
+ /* extend 8-bit fill to 32 bits */
+ " movzx %%al, %%eax\n" /* 3 bytes */
+ /* or: " and $0xff, %%eax\n" - 5 bytes */
+ " imul $0x01010101, %%eax\n" /* 6 bytes */
+ /* fill full words */
+ " rep; stosl\n"
+ /* fill 0-3 bytes */
+ "1: and $3, %1\n"
+ " jz 9f\n" /* (count & 3) == 0: goto end */
+ "2: stosb\n"
+ " dec %1\n"
+ " jnz 2b\n"
+ /* end */
+ "9:\n"
+
+ : "=&D" (edi), "=&r" (reg)
+ : "0" (s), "a" (c), "c" (count)
+ : "memory"
+ );
+ return s;
+}
+libc_hidden_def(memset)
+
+/*
+gcc 4.3.1
+=========
+57 push %edi
+8b 7c 24 08 mov 0x8(%esp),%edi
+8b 4c 24 10 mov 0x10(%esp),%ecx
+8b 44 24 0c mov 0xc(%esp),%eax
+89 ca mov %ecx,%edx
+c1 e9 02 shr $0x2,%ecx
+74 0b je 1f <__GI_memset+0x1f>
+0f b6 c0 movzbl %al,%eax
+69 c0 01 01 01 01 imul $0x1010101,%eax,%eax
+f3 ab rep stos %eax,%es:(%edi)
+83 e2 03 and $0x3,%edx
+74 04 je 28 <__GI_memset+0x28>
+aa stos %al,%es:(%edi)
+4a dec %edx
+75 fc jne 24 <__GI_memset+0x24>
+8b 44 24 08 mov 0x8(%esp),%eax
+5f pop %edi
+c3 ret
+*/
diff --git a/ap/build/uClibc/libc/string/i386/rawmemchr.c b/ap/build/uClibc/libc/string/i386/rawmemchr.c
new file mode 100644
index 0000000..be0b142
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/rawmemchr.c
@@ -0,0 +1,24 @@
+/*
+ * Adapted from strlen.c code
+ *
+ * Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <string.h>
+
+#undef rawmemchr
+void *rawmemchr(const void *s, int c)
+{
+ void *eax;
+ int ecx, edi;
+ __asm__ __volatile__(
+ " repne; scasb\n"
+ " leal -1(%%edi), %%eax\n"
+ : "=&c" (ecx), "=&D" (edi), "=&a" (eax)
+ : "0" (0xffffffff), "1" (s), "2" (c)
+ );
+ return eax;
+}
+libc_hidden_def(rawmemchr)
diff --git a/ap/build/uClibc/libc/string/i386/strcat.c b/ap/build/uClibc/libc/string/i386/strcat.c
new file mode 100644
index 0000000..e71aad4
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strcat.c
@@ -0,0 +1,50 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+char *strcat(char * dest, const char * src)
+{
+ int d0, d1, d2, d3;
+ __asm__ __volatile__(
+ "repne\n\t"
+ "scasb\n\t"
+ "decl %1\n"
+ "1:\tlodsb\n\t"
+ "stosb\n\t"
+ "testb %%al,%%al\n\t"
+ "jne 1b"
+ : "=&S" (d0), "=&D" (d1), "=&a" (d2), "=&c" (d3)
+ : "0" (src), "1" (dest), "2" (0), "3" (0xffffffff):"memory");
+ return dest;
+}
+libc_hidden_def(strcat)
diff --git a/ap/build/uClibc/libc/string/i386/strchr.c b/ap/build/uClibc/libc/string/i386/strchr.c
new file mode 100644
index 0000000..93cc958
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strchr.c
@@ -0,0 +1,58 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+#undef strchr
+char *strchr(const char *s, int c)
+{
+ int esi;
+ register char * eax;
+ __asm__ __volatile__(
+ " movb %%al, %%ah\n"
+ "1: lodsb\n"
+ " cmpb %%ah, %%al\n"
+ " je 2f\n"
+ " testb %%al, %%al\n"
+ " jnz 1b\n"
+ " movl $1, %%esi\n" /* can use shorter xor + inc */
+ "2: leal -1(%%esi), %%eax\n"
+ : "=a" (eax), "=&S" (esi)
+ : "0" (c), "1" (s)
+ /* no clobbers */
+ );
+ return eax;
+}
+libc_hidden_def(strchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(strchr,index)
+#endif
diff --git a/ap/build/uClibc/libc/string/i386/strchrnul.c b/ap/build/uClibc/libc/string/i386/strchrnul.c
new file mode 100644
index 0000000..d484272
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strchrnul.c
@@ -0,0 +1,47 @@
+/*
+ * Adapted from strchr.c code
+ *
+ * Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <string.h>
+
+#undef strchrnul
+/*#define strchrnul TESTING*/
+char *strchrnul(const char *s, int c)
+{
+ int esi;
+ char *eax;
+ __asm__ __volatile__(
+ " movb %%al, %%ah\n"
+ "1: lodsb\n"
+ " cmpb %%ah, %%al\n"
+ " je 2f\n"
+ " testb %%al, %%al\n"
+ " jnz 1b\n"
+ /* with this, we'd get strchr(): */
+ /* " movl $1, %%esi\n" */
+ "2: leal -1(%%esi), %%eax\n"
+ : "=a" (eax), "=&S" (esi)
+ : "0" (c), "1" (s)
+ /* no clobbers */
+ );
+ return eax;
+}
+#ifndef strchrnul
+libc_hidden_def(strchrnul)
+#else
+/* Uncomment TESTING, gcc -D_GNU_SOURCE -m32 -Os strchrnul.c -o strchrnul
+ * and run ./strchrnul
+ */
+int main()
+{
+ static const char str[] = "abc.def";
+ printf((char*)strchrnul(str, '.') - str == 3 ? "ok\n" : "BAD!\n");
+ printf((char*)strchrnul(str, '*') - str == 7 ? "ok\n" : "BAD!\n");
+ printf((char*)strchrnul(str, 0) - str == 7 ? "ok\n" : "BAD!\n");
+ printf((char*)strchrnul(str+3, '.') - str == 3 ? "ok\n" : "BAD!\n");
+}
+#endif
diff --git a/ap/build/uClibc/libc/string/i386/strcmp.c b/ap/build/uClibc/libc/string/i386/strcmp.c
new file mode 100644
index 0000000..9621f66
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strcmp.c
@@ -0,0 +1,59 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+int strcmp(const char *cs, const char *ct)
+{
+ int d0, d1;
+ register int __res;
+ __asm__ __volatile__(
+ "1:\tlodsb\n\t"
+ "scasb\n\t"
+ "jne 2f\n\t"
+ "testb %%al,%%al\n\t"
+ "jne 1b\n\t"
+ "xorl %%eax,%%eax\n\t"
+ "jmp 3f\n"
+ "2:\tsbbl %%eax,%%eax\n\t"
+ "orb $1,%%al\n"
+ "3:"
+ :"=a" (__res), "=&S" (d0), "=&D" (d1)
+ :"1" (cs),"2" (ct));
+ return __res;
+}
+libc_hidden_def(strcmp)
+
+#ifndef __UCLIBC_HAS_LOCALE__
+strong_alias(strcmp,strcoll)
+libc_hidden_def(strcoll)
+#endif
diff --git a/ap/build/uClibc/libc/string/i386/strcpy.c b/ap/build/uClibc/libc/string/i386/strcpy.c
new file mode 100644
index 0000000..fff1bd0
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strcpy.c
@@ -0,0 +1,48 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+#undef strcpy
+char *strcpy(char * dest, const char * src)
+{
+ int d0, d1, d2;
+ __asm__ __volatile__(
+ "1:\tlodsb\n\t"
+ "stosb\n\t"
+ "testb %%al,%%al\n\t"
+ "jne 1b"
+ : "=&S" (d0), "=&D" (d1), "=&a" (d2)
+ :"0" (src),"1" (dest) : "memory");
+ return dest;
+}
+libc_hidden_def(strcpy)
diff --git a/ap/build/uClibc/libc/string/i386/string.h b/ap/build/uClibc/libc/string/i386/string.h
new file mode 100644
index 0000000..cf4333d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/string.h
@@ -0,0 +1,338 @@
+/*
+ * Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball
+ */
+
+#if !defined _STRING_H
+#error "Never use <libc-string_i386.h> directly; include <string.h> instead"
+#endif
+
+#ifndef _LIBC_STRING_i386_H
+#define _LIBC_STRING_i386_H 1
+
+static __always_inline
+void *inlined_memset_const_c_count4(void *s, unsigned eax, unsigned count)
+{
+ int ecx, edi;
+
+ if (count == 0)
+ return s;
+
+ /* Very small (2 stores or less) are best done with direct
+ * mov <const>,<mem> instructions (they do not clobber registers) */
+ if (count == 1) {
+ *(char *)(s + 0) = eax;
+ return s;
+ }
+
+ /* You wonder why & 0xff is needed? Try memset(p, '\xff', size).
+ * If char is signed, '\xff' == -1! */
+ eax = (eax & 0xff) * 0x01010101; /* done at compile time */
+
+ if (count == 2) {
+ *(short *)(s + 0) = eax;
+ return s;
+ }
+ if (count == 3) {
+ *(short *)(s + 0) = eax;
+ *(char *) (s + 2) = eax;
+ return s;
+ }
+ if (count == 1*4 + 0) {
+ *(int *)(s + 0) = eax;
+ return s;
+ }
+ if (count == 1*4 + 1) {
+ *(int *) (s + 0) = eax;
+ *(char *)(s + 4) = eax;
+ return s;
+ }
+ if (count == 1*4 + 2) {
+ *(int *) (s + 0) = eax;
+ *(short *)(s + 4) = eax;
+ return s;
+ }
+
+ /* Small string stores: don't clobber ecx
+ * (clobbers only eax and edi) */
+#define small_store(arg) { \
+ __asm__ __volatile__( \
+ arg \
+ : "=&D" (edi) \
+ : "a" (eax), "0" (s) \
+ : "memory" \
+ ); \
+ return s; \
+}
+ if (count == 1*4 + 3) small_store("stosl; stosw; stosb");
+ if (count == 2*4 + 0) {
+ ((int *)s)[0] = eax;
+ ((int *)s)[1] = eax;
+ return s;
+ }
+ if (count == 2*4 + 1) small_store("stosl; stosl; stosb");
+ if (count == 2*4 + 2) small_store("stosl; stosl; stosw");
+ if (count == 2*4 + 3) small_store("stosl; stosl; stosw; stosb");
+ if (count == 3*4 + 0) small_store("stosl; stosl; stosl");
+ if (count == 3*4 + 1) small_store("stosl; stosl; stosl; stosb");
+ if (count == 3*4 + 2) small_store("stosl; stosl; stosl; stosw");
+ if (count == 3*4 + 3) small_store("stosl; stosl; stosl; stosw; stosb");
+ if (count == 4*4 + 0) small_store("stosl; stosl; stosl; stosl");
+ if (count == 4*4 + 1) small_store("stosl; stosl; stosl; stosl; stosb");
+ /* going over 7 bytes is suboptimal */
+ /* stosw is 2-byte insn, so this one takes 6 bytes: */
+ if (count == 4*4 + 2) small_store("stosl; stosl; stosl; stosl; stosw");
+ /* 7 bytes */
+ if (count == 4*4 + 3) small_store("stosl; stosl; stosl; stosl; stosw; stosb");
+ /* 5 bytes */
+ if (count == 5*4 + 0) small_store("stosl; stosl; stosl; stosl; stosl");
+ /* 6 bytes */
+ if (count == 5*4 + 1) small_store("stosl; stosl; stosl; stosl; stosl; stosb");
+ /* 7 bytes */
+ if (count == 5*4 + 2) small_store("stosl; stosl; stosl; stosl; stosl; stosw");
+ /* 8 bytes, but oh well... */
+ if (count == 5*4 + 3) small_store("stosl; stosl; stosl; stosl; stosl; stosw; stosb");
+ /* 6 bytes */
+ if (count == 6*4 + 0) small_store("stosl; stosl; stosl; stosl; stosl; stosl");
+ /* the rest would be 7+ bytes and is handled below instead */
+#undef small_store
+
+ /* Not small, but multiple-of-4 store.
+ * "mov <const>,%ecx; rep; stosl" sequence is 7 bytes */
+ __asm__ __volatile__(
+ " rep; stosl\n"
+ : "=&c" (ecx), "=&D" (edi)
+ : "a" (eax), "0" (count / 4), "1" (s)
+ : "memory"
+ );
+ return s;
+}
+#if 1 /* -51 bytes on shared i386 build with gcc 4.3.0 */
+#define memset(s, c, count) ( \
+ ( !(__builtin_constant_p(c) && __builtin_constant_p(count)) \
+ || ((count) > (6*4 + 0) && ((count) % 4) != 0) \
+ ) \
+ ? memset((s), (c), (count)) \
+ : inlined_memset_const_c_count4((s), (c), (count)) \
+ )
+#endif
+
+
+static __always_inline
+void *inlined_mempcpy_const_count4(void *d, const void *s, unsigned count)
+{
+ int ecx;
+ char *esi, *edi;
+
+ if (count == 0)
+ return d;
+
+ if (count == 1) {
+ *(char *)d = *(char *)s;
+ return d + 1;
+ }
+ if (count == 2) {
+ *(short *)d = *(short *)s;
+ return d + 2;
+ }
+ /* Small string moves: don't clobber ecx
+ * (clobbers only esi and edi) */
+#define small_move(arg) { \
+ __asm__ __volatile__( \
+ arg \
+ : "=&S" (esi), "=&D" (edi) \
+ : "0" (s), "1" (d) \
+ : "memory" \
+ ); \
+ return edi; \
+}
+ if (count == 3) small_move("movsw; movsb");
+ if (count == 1*4 + 0) {
+ *(int *)d = *(int *)s;
+ return d + 4;
+ }
+ if (count == 1*4 + 1) small_move("movsl; movsb");
+ if (count == 1*4 + 2) small_move("movsl; movsw");
+ if (count == 1*4 + 3) small_move("movsl; movsw; movsb");
+ if (count == 2*4 + 0) small_move("movsl; movsl");
+ if (count == 2*4 + 1) small_move("movsl; movsl; movsb");
+ if (count == 2*4 + 2) small_move("movsl; movsl; movsw");
+ if (count == 2*4 + 3) small_move("movsl; movsl; movsw; movsb");
+ if (count == 3*4 + 0) small_move("movsl; movsl; movsl");
+ if (count == 3*4 + 1) small_move("movsl; movsl; movsl; movsb");
+ if (count == 3*4 + 2) small_move("movsl; movsl; movsl; movsw");
+ if (count == 3*4 + 3) small_move("movsl; movsl; movsl; movsw; movsb");
+ if (count == 4*4 + 0) small_move("movsl; movsl; movsl; movsl");
+ if (count == 4*4 + 1) small_move("movsl; movsl; movsl; movsl; movsb");
+ /* going over 7 bytes is suboptimal */
+ /* movsw is 2-byte insn, so this one takes 6 bytes: */
+ if (count == 4*4 + 2) small_move("movsl; movsl; movsl; movsl; movsw");
+ /* 7 bytes */
+ if (count == 4*4 + 3) small_move("movsl; movsl; movsl; movsl; movsw; movsb");
+ /* 5 bytes */
+ if (count == 5*4 + 0) small_move("movsl; movsl; movsl; movsl; movsl");
+ /* 6 bytes */
+ if (count == 5*4 + 1) small_move("movsl; movsl; movsl; movsl; movsl; movsb");
+ /* 7 bytes */
+ if (count == 5*4 + 2) small_move("movsl; movsl; movsl; movsl; movsl; movsw");
+ /* 8 bytes, but oh well... */
+ if (count == 5*4 + 3) small_move("movsl; movsl; movsl; movsl; movsl; movsw; movsb");
+ /* 6 bytes */
+ if (count == 6*4 + 0) small_move("movsl; movsl; movsl; movsl; movsl; movsl");
+ /* the rest would be 7+ bytes and is handled below instead */
+#undef small_move
+
+ /* Not small, but multiple-of-4 move.
+ * "mov <const>,%ecx; rep; movsl" sequence is 7 bytes */
+ __asm__ __volatile__(
+ " rep; movsl\n"
+ : "=&c" (ecx), "=&S" (esi), "=&D" (edi)
+ : "0" (count / 4), "1" (s), "2" (d)
+ : "memory"
+ );
+ return edi;
+}
+static __always_inline
+void *inlined_memcpy_const_count4(void *d, const void *s, unsigned count)
+{
+ inlined_mempcpy_const_count4(d, s, count);
+ return d;
+}
+#if 1 /* +34 bytes on shared i386 build with gcc 4.3.0 */
+#define mempcpy(d, s, count) ( \
+ ( !(__builtin_constant_p(count)) \
+ || ((count) > (6*4 + 0) && ((count) % 4) != 0) \
+ ) \
+ ? mempcpy((d), (s), (count)) \
+ : inlined_mempcpy_const_count4((d), (s), (count)) \
+ )
+#define memcpy(d, s, count) ( \
+ ( !(__builtin_constant_p(count)) \
+ || ((count) > (6*4 + 0) && ((count) % 4) != 0) \
+ ) \
+ ? memcpy((d), (s), (count)) \
+ : inlined_memcpy_const_count4((d), (s), (count)) \
+ )
+#endif
+
+
+static __always_inline
+size_t inlined_strlen(const char *s)
+{
+ int edi;
+ int ecx;
+ __asm__ __volatile__(
+ " repne; scasb\n"
+ /* " notl %0\n" */
+ /* " decl %0\n" */
+ : "=c" (ecx), "=&D" (edi)
+ : "1" (s), "a" (0), "0" (0xffffffffu)
+ /* : no clobbers */
+ );
+ return -ecx - 1;
+}
+#if 0 /* +1108 bytes on shared i386 build with gcc 4.3.0 */
+#define strlen(s) inlined_strlen(s)
+#endif
+
+
+static __always_inline
+char *inlined_stpcpy(char *dest, const char *src)
+{
+ char *esi, *edi;
+ int eax;
+ __asm__ __volatile__(
+ "1: lodsb\n"
+ " stosb\n"
+ " testb %%al, %%al\n"
+ " jnz 1b\n"
+ : "=&S" (esi), "=&D" (edi), "=&a" (eax)
+ : "0" (src), "1" (dest)
+ : "memory"
+ );
+ return edi - 1;
+}
+static __always_inline
+char *inlined_strcpy(char *dest, const char *src)
+{
+ inlined_stpcpy(dest, src);
+ return dest;
+}
+#if 0 /* +562 bytes on shared i386 build with gcc 4.3.0 */
+#define stpcpy(dest, src) inlined_stpcpy(dest, src)
+#define strcpy(dest, src) inlined_strcpy(dest, src)
+#endif
+
+
+static __always_inline
+void *inlined_memchr(const void *s, int c, size_t count)
+{
+ void *edi;
+ int ecx;
+ /* Unfortunately, c gets loaded to %eax (wide insn), not %al */
+ __asm__ __volatile__(
+ " jecxz 1f\n"
+ " repne; scasb\n"
+ " leal -1(%%edi), %%edi\n"
+ " je 2f\n"
+ "1:\n"
+ " xorl %%edi, %%edi\n"
+ "2:\n"
+ : "=&D" (edi), "=&c" (ecx)
+ : "a" (c), "0" (s), "1" (count)
+ /* : no clobbers */
+ );
+ return edi;
+}
+static __always_inline
+void *inlined_memchr_const_c(const void *s, int c, size_t count)
+{
+#if defined __OPTIMIZE__
+ void *edi;
+ int ecx, eax;
+ __asm__ __volatile__(
+ " jecxz 1f\n"
+ " movb %4, %%al\n" /* const c to %%al */
+ " repne; scasb\n"
+ " leal -1(%%edi), %%edi\n"
+ " je 2f\n"
+ "1:\n"
+ " xorl %%edi, %%edi\n"
+ "2:\n"
+ : "=&D" (edi), "=&c" (ecx), "=&a" (eax)
+ : "0" (s), "i" (c), "1" (count)
+ /* : no clobbers */
+ );
+ return edi;
+#else
+ /* With -O0, gcc can't figure out how to encode CONST c
+ * as an immediate operand. Generating slightly bigger code
+ * (usually "movl CONST,%eax", 3 bytes bigger than needed):
+ */
+ void *edi;
+ int ecx, eax;
+ __asm__ __volatile__(
+ " jecxz 1f\n"
+ " repne; scasb\n"
+ " leal -1(%%edi), %%edi\n"
+ " je 2f\n"
+ "1:\n"
+ " xorl %%edi, %%edi\n"
+ "2:\n"
+ : "=&D" (edi), "=&c" (ecx), "=&a" (eax)
+ : "0" (s), "2" (c), "1" (count)
+ /* : no clobbers */
+ );
+ return edi;
+#endif
+}
+#if 1 /* +2 bytes on shared i386 build with gcc 4.3.0 */
+#define memchr(s, c, count) ( \
+ __builtin_constant_p(c) \
+ ? inlined_memchr_const_c(s, (c) & 0xff, count) \
+ : inlined_memchr(s, c, count) \
+ )
+#endif
+
+#endif /* _LIBC_STRING_i386_H */
diff --git a/ap/build/uClibc/libc/string/i386/strlen.c b/ap/build/uClibc/libc/string/i386/strlen.c
new file mode 100644
index 0000000..ff2baeb
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strlen.c
@@ -0,0 +1,48 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+#undef strlen
+size_t strlen(const char *s)
+{
+ int eax, ecx, edi;
+ __asm__ __volatile__(
+ " repne; scasb\n"
+ " notl %%ecx\n"
+ " leal -1(%%ecx), %%eax\n"
+ : "=&c" (ecx), "=&D" (edi), "=&a" (eax)
+ : "0" (0xffffffff), "1" (s), "2" (0)
+ );
+ return eax;
+}
+libc_hidden_def(strlen)
diff --git a/ap/build/uClibc/libc/string/i386/strncat.c b/ap/build/uClibc/libc/string/i386/strncat.c
new file mode 100644
index 0000000..12f0a30
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strncat.c
@@ -0,0 +1,86 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+#undef strncat
+/*#define strncat TESTING*/
+char *strncat(char * dest, const char * src, size_t count)
+{
+ int esi, edi, eax, ecx, edx;
+ __asm__ __volatile__(
+ " xorl %%eax, %%eax\n"
+ " incl %%edx\n"
+ " pushl %%edi\n" /* save dest */
+ " repne; scasb\n"
+ " decl %%edi\n" /* edi => NUL in dest */
+ /* count-- */
+ "1: decl %%edx\n"
+ /* if count reached 0, store NUL and bail out */
+ " movl %%edx, %%eax\n"
+ " jz 2f\n"
+ /* else copy a char */
+ " lodsb\n"
+ "2: stosb\n"
+ " testb %%al, %%al\n"
+ " jnz 1b\n"
+ /* end of loop */
+ " popl %%eax\n" /* restore dest into eax */
+ : "=&S" (esi), "=&D" (edi), "=&a" (eax), "=&c" (ecx), "=&d" (edx)
+ : "0" (src), "1" (dest), "3" (0xffffffff), "4" (count)
+ : "memory"
+ );
+ return (char *)eax;
+}
+#ifndef strncat
+libc_hidden_def(strncat)
+#else
+/* Uncomment TESTING, gcc -m32 -Os strncat.c -o strncat
+ * and run ./strncat
+ */
+int main()
+{
+ char buf[99];
+
+ strcpy(buf, "abc"); buf[4] = '*'; strncat(buf, "def", 0);
+ printf(strcmp(buf, "abc") == 0 && buf[4] == '*' ? "ok\n" : "BAD!\n");
+
+ strcpy(buf, "abc"); buf[6] = 1; buf[7] = '*'; strncat(buf, "def", 50);
+ printf(strcmp(buf, "abcdef") == 0 && buf[7] == '*' ? "ok\n" : "BAD!\n");
+
+ strcpy(buf, "abc"); buf[6] = 1; buf[7] = '*'; strncat(buf, "def", -1);
+ printf(strcmp(buf, "abcdef") == 0 && buf[7] == '*' ? "ok\n" : "BAD!\n");
+
+ strcpy(buf, "abc"); buf[6] = 1; buf[7] = '*'; strncat(buf, "def123", 3);
+ printf(strcmp(buf, "abcdef") == 0 && buf[7] == '*' ? "ok\n" : "BAD!\n");
+}
+#endif
diff --git a/ap/build/uClibc/libc/string/i386/strncmp.c b/ap/build/uClibc/libc/string/i386/strncmp.c
new file mode 100644
index 0000000..bfb20c3
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strncmp.c
@@ -0,0 +1,59 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+#undef strncmp
+int strncmp(const char *cs, const char *ct, size_t count)
+{
+ int eax;
+ int esi, edi, ecx;
+ __asm__ __volatile__(
+ " incl %%ecx\n"
+ "1: decl %%ecx\n"
+ " jz 2f\n"
+ " lodsb\n"
+ " scasb\n"
+ " jne 3f\n"
+ " testb %%al, %%al\n"
+ " jnz 1b\n"
+ "2: xorl %%eax, %%eax\n"
+ " jmp 4f\n"
+ "3: sbbl %%eax, %%eax\n"
+ " orb $1, %%al\n"
+ "4:\n"
+ : "=a" (eax), "=&S" (esi), "=&D" (edi), "=&c" (ecx)
+ : "1" (cs), "2" (ct), "3" (count)
+ );
+ return eax;
+}
+libc_hidden_weak(strncmp)
diff --git a/ap/build/uClibc/libc/string/i386/strncpy.c b/ap/build/uClibc/libc/string/i386/strncpy.c
new file mode 100644
index 0000000..99d104b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strncpy.c
@@ -0,0 +1,75 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+#undef strncpy
+/*#define strncpy TESTING*/
+char *strncpy(char * dest, const char * src, size_t count)
+{
+ int esi, edi, ecx, eax;
+ __asm__ __volatile__(
+ "1: subl $1, %%ecx\n" /* not dec! it doesnt set CF */
+ " jc 2f\n"
+ " lodsb\n"
+ " stosb\n"
+ " testb %%al, %%al\n"
+ " jnz 1b\n"
+ " rep; stosb\n"
+ "2:\n"
+ : "=&S" (esi), "=&D" (edi), "=&c" (ecx), "=&a" (eax)
+ : "0" (src), "1" (dest), "2" (count)
+ : "memory"
+ );
+ return dest;
+}
+#ifndef strncpy
+libc_hidden_def(strncpy)
+#else
+/* Uncomment TESTING, gcc -D_GNU_SOURCE -m32 -Os strncpy.c -o strncpy
+ * and run ./strncpy
+ */
+int main()
+{
+ static char str[99];
+
+ str[3] = '*'; str[4] = 0; strncpy(str, "abc", 3);
+ printf(strcmp(str, "abc*") == 0 ? "ok\n" : "BAD!\n");
+
+ str[4] = '*'; str[5] = '+'; strncpy(str, "abc", 5);
+ printf(strcmp(str, "abc") == 0 && str[4] == 0 && str[5] == '+' ?
+ "ok\n" : "BAD!\n");
+ strncpy(str, "def", 0); /* should do nothing */
+ printf(strcmp(str, "abc") == 0 && str[4] == 0 && str[5] == '+' ?
+ "ok\n" : "BAD!\n");
+}
+#endif
diff --git a/ap/build/uClibc/libc/string/i386/strnlen.c b/ap/build/uClibc/libc/string/i386/strnlen.c
new file mode 100644
index 0000000..f58f698
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strnlen.c
@@ -0,0 +1,75 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+#ifdef __USE_GNU
+
+#undef strnlen
+/*#define strnlen TESTING*/
+size_t strnlen(const char *s, size_t count)
+{
+ int edx;
+ int eax;
+ __asm__ __volatile__(
+ " leal -1(%%ecx), %%eax\n"
+ "1: incl %%eax\n"
+ " decl %%edx\n"
+ " jz 3f\n"
+ " cmpb $0, (%%eax)\n"
+ " jnz 1b\n"
+ "3: subl %%ecx, %%eax"
+ : "=a" (eax), "=&d" (edx)
+ : "c" (s), "1" (count + 1)
+ );
+ return eax;
+}
+#ifndef strnlen
+libc_hidden_def(strnlen)
+#else
+/* Uncomment TESTING, gcc -D_GNU_SOURCE -m32 -Os strnlen.c -o strnlen
+ * and run ./strnlen
+ */
+int main()
+{
+ printf(strnlen("abc\0def", -2) == 3 ? "ok\n" : "BAD!\n");
+ printf(strnlen("abc\0def", -1) == 3 ? "ok\n" : "BAD!\n");
+ printf(strnlen("abc\0def", 0) == 0 ? "ok\n" : "BAD!\n");
+ printf(strnlen("abc\0def", 1) == 1 ? "ok\n" : "BAD!\n");
+ printf(strnlen("abc\0def", 2) == 2 ? "ok\n" : "BAD!\n");
+ printf(strnlen("abc\0def", 3) == 3 ? "ok\n" : "BAD!\n");
+ printf(strnlen("abc\0def", 4) == 3 ? "ok\n" : "BAD!\n");
+ printf(strnlen("abc\0def", 5) == 3 ? "ok\n" : "BAD!\n");
+}
+#endif
+
+#endif
diff --git a/ap/build/uClibc/libc/string/i386/strrchr.c b/ap/build/uClibc/libc/string/i386/strrchr.c
new file mode 100644
index 0000000..5c349f6
--- /dev/null
+++ b/ap/build/uClibc/libc/string/i386/strrchr.c
@@ -0,0 +1,58 @@
+/*
+ * This string-include defines all string functions as inline
+ * functions. Use gcc. It also assumes ds=es=data space, this should be
+ * normal. Most of the string-functions are rather heavily hand-optimized,
+ * see especially strtok,strstr,str[c]spn. They should work, but are not
+ * very easy to understand. Everything is done entirely within the register
+ * set, making the functions fast and clean. String instructions have been
+ * used through-out, making for "slightly" unclear code :-)
+ *
+ * NO Copyright (C) 1991, 1992 Linus Torvalds,
+ * consider these trivial functions to be PD.
+ */
+
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ * These make no attempt to use nifty things like mmx/3dnow/etc.
+ * These are not inline, and will therefore not be as fast as
+ * modifying the headers to use inlines (and cannot therefore
+ * do tricky things when dealing with const memory). But they
+ * should (I hope!) be faster than their generic equivalents....
+ *
+ * More importantly, these should provide a good example for
+ * others to follow when adding arch specific optimizations.
+ * -Erik
+ */
+
+#include <string.h>
+
+char *strrchr(const char *s, int c)
+{
+ char *eax;
+
+ __asm__ __volatile__(
+ " movb %%cl, %%ch\n"
+ "1: movb (%1), %%cl\n" /* load char */
+ " cmpb %%cl, %%ch\n" /* char == c? */
+ " jne 2f\n"
+ " movl %1, %%eax\n"
+ "2: incl %1\n"
+ " testb %%cl, %%cl\n" /* char == NUL? */
+ " jnz 1b\n"
+ /* "=c": use ecx, not ebx (-fpic uses it). */
+ : "=a" (eax), "=r" (s), "=c" (c)
+ : "0" (0), "1" (s), "2" (c)
+ /* : no clobbers */
+ );
+ return eax;
+}
+libc_hidden_def(strrchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(strrchr,rindex)
+#endif
diff --git a/ap/build/uClibc/libc/string/ia64/Makefile b/ap/build/uClibc/libc/string/ia64/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/ia64/bcopy.S b/ap/build/uClibc/libc/string/ia64/bcopy.S
new file mode 100644
index 0000000..c5637c3
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/bcopy.S
@@ -0,0 +1,14 @@
+#include "sysdep.h"
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+
+ENTRY(bcopy)
+ .regstk 3, 0, 0, 0
+ mov r8 = in0
+ mov in0 = in1
+ ;;
+ mov in1 = r8
+ br.cond.sptk.many HIDDEN_JUMPTARGET(memmove)
+END(bcopy)
+
+#endif
diff --git a/ap/build/uClibc/libc/string/ia64/bzero.S b/ap/build/uClibc/libc/string/ia64/bzero.S
new file mode 100644
index 0000000..1f0f8b7
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/bzero.S
@@ -0,0 +1,320 @@
+/* Optimized version of the standard bzero() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Contributed by Dan Pop for Itanium <Dan.Pop@cern.ch>.
+ Rewritten for McKinley by Sverre Jarp, HP Labs/CERN <Sverre.Jarp@cern.ch>
+
+ 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. */
+
+/* Return: dest
+
+ Inputs:
+ in0: dest
+ in1: count
+
+ The algorithm is fairly straightforward: set byte by byte until we
+ we get to a 16B-aligned address, then loop on 128 B chunks using an
+ early store as prefetching, then loop on 32B chucks, then clear remaining
+ words, finally clear remaining bytes.
+ Since a stf.spill f0 can store 16B in one go, we use this instruction
+ to get peak speed. */
+
+#include "sysdep.h"
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+
+#undef ret
+
+#define dest in0
+#define cnt in1
+
+#define tmp r31
+#define save_lc r30
+#define ptr0 r29
+#define ptr1 r28
+#define ptr2 r27
+#define ptr3 r26
+#define ptr9 r24
+#define loopcnt r23
+#define linecnt r22
+#define bytecnt r21
+
+/* This routine uses only scratch predicate registers (p6 - p15) */
+#define p_scr p6 /* default register for same-cycle branches */
+#define p_unalgn p9
+#define p_y p11
+#define p_n p12
+#define p_yy p13
+#define p_nn p14
+
+#define movi0 mov
+
+#define MIN1 15
+#define MIN1P1HALF 8
+#define LINE_SIZE 128
+#define LSIZE_SH 7 /* shift amount */
+#define PREF_AHEAD 8
+
+#define USE_FLP
+#if defined(USE_INT)
+#define store st8
+#define myval r0
+#elif defined(USE_FLP)
+#define store stf8
+#define myval f0
+#endif
+
+.align 64
+ENTRY(bzero)
+{ .mmi
+ .prologue
+ alloc tmp = ar.pfs, 2, 0, 0, 0
+ lfetch.nt1 [dest]
+ .save ar.lc, save_lc
+ movi0 save_lc = ar.lc
+} { .mmi
+ .body
+ mov ret0 = dest /* return value */
+ nop.m 0
+ cmp.eq p_scr, p0 = cnt, r0
+;; }
+{ .mmi
+ and ptr2 = -(MIN1+1), dest /* aligned address */
+ and tmp = MIN1, dest /* prepare to check for alignment */
+ tbit.nz p_y, p_n = dest, 0 /* Do we have an odd address? (M_B_U) */
+} { .mib
+ mov ptr1 = dest
+ nop.i 0
+(p_scr) br.ret.dpnt.many rp /* return immediately if count = 0 */
+;; }
+{ .mib
+ cmp.ne p_unalgn, p0 = tmp, r0
+} { .mib /* NB: # of bytes to move is 1 */
+ sub bytecnt = (MIN1+1), tmp /* higher than loopcnt */
+ cmp.gt p_scr, p0 = 16, cnt /* is it a minimalistic task? */
+(p_scr) br.cond.dptk.many .move_bytes_unaligned /* go move just a few (M_B_U) */
+;; }
+{ .mmi
+(p_unalgn) add ptr1 = (MIN1+1), ptr2 /* after alignment */
+(p_unalgn) add ptr2 = MIN1P1HALF, ptr2 /* after alignment */
+(p_unalgn) tbit.nz.unc p_y, p_n = bytecnt, 3 /* should we do a st8 ? */
+;; }
+{ .mib
+(p_y) add cnt = -8, cnt
+(p_unalgn) tbit.nz.unc p_yy, p_nn = bytecnt, 2 /* should we do a st4 ? */
+} { .mib
+(p_y) st8 [ptr2] = r0,-4
+(p_n) add ptr2 = 4, ptr2
+;; }
+{ .mib
+(p_yy) add cnt = -4, cnt
+(p_unalgn) tbit.nz.unc p_y, p_n = bytecnt, 1 /* should we do a st2 ? */
+} { .mib
+(p_yy) st4 [ptr2] = r0,-2
+(p_nn) add ptr2 = 2, ptr2
+;; }
+{ .mmi
+ mov tmp = LINE_SIZE+1 /* for compare */
+(p_y) add cnt = -2, cnt
+(p_unalgn) tbit.nz.unc p_yy, p_nn = bytecnt, 0 /* should we do a st1 ? */
+} { .mmi
+ nop.m 0
+(p_y) st2 [ptr2] = r0,-1
+(p_n) add ptr2 = 1, ptr2
+;; }
+
+{ .mmi
+(p_yy) st1 [ptr2] = r0
+ cmp.gt p_scr, p0 = tmp, cnt /* is it a minimalistic task? */
+} { .mbb
+(p_yy) add cnt = -1, cnt
+(p_scr) br.cond.dpnt.many .fraction_of_line /* go move just a few */
+;; }
+{ .mib
+ nop.m 0
+ shr.u linecnt = cnt, LSIZE_SH
+ nop.b 0
+;; }
+
+ .align 32
+.l1b: /* ------------------ L1B: store ahead into cache lines; fill later */
+{ .mmi
+ and tmp = -(LINE_SIZE), cnt /* compute end of range */
+ mov ptr9 = ptr1 /* used for prefetching */
+ and cnt = (LINE_SIZE-1), cnt /* remainder */
+} { .mmi
+ mov loopcnt = PREF_AHEAD-1 /* default prefetch loop */
+ cmp.gt p_scr, p0 = PREF_AHEAD, linecnt /* check against actual value */
+;; }
+{ .mmi
+(p_scr) add loopcnt = -1, linecnt
+ add ptr2 = 16, ptr1 /* start of stores (beyond prefetch stores) */
+ add ptr1 = tmp, ptr1 /* first address beyond total range */
+;; }
+{ .mmi
+ add tmp = -1, linecnt /* next loop count */
+ movi0 ar.lc = loopcnt
+;; }
+.pref_l1b:
+{ .mib
+ stf.spill [ptr9] = f0, 128 /* Do stores one cache line apart */
+ nop.i 0
+ br.cloop.dptk.few .pref_l1b
+;; }
+{ .mmi
+ add ptr0 = 16, ptr2 /* Two stores in parallel */
+ movi0 ar.lc = tmp
+;; }
+.l1bx:
+ { .mmi
+ stf.spill [ptr2] = f0, 32
+ stf.spill [ptr0] = f0, 32
+ ;; }
+ { .mmi
+ stf.spill [ptr2] = f0, 32
+ stf.spill [ptr0] = f0, 32
+ ;; }
+ { .mmi
+ stf.spill [ptr2] = f0, 32
+ stf.spill [ptr0] = f0, 64
+ cmp.lt p_scr, p0 = ptr9, ptr1 /* do we need more prefetching? */
+ ;; }
+{ .mmb
+ stf.spill [ptr2] = f0, 32
+(p_scr) stf.spill [ptr9] = f0, 128
+ br.cloop.dptk.few .l1bx
+;; }
+{ .mib
+ cmp.gt p_scr, p0 = 8, cnt /* just a few bytes left ? */
+(p_scr) br.cond.dpnt.many .move_bytes_from_alignment
+;; }
+
+.fraction_of_line:
+{ .mib
+ add ptr2 = 16, ptr1
+ shr.u loopcnt = cnt, 5 /* loopcnt = cnt / 32 */
+;; }
+{ .mib
+ cmp.eq p_scr, p0 = loopcnt, r0
+ add loopcnt = -1, loopcnt
+(p_scr) br.cond.dpnt.many .store_words
+;; }
+{ .mib
+ and cnt = 0x1f, cnt /* compute the remaining cnt */
+ movi0 ar.lc = loopcnt
+;; }
+ .align 32
+.l2: /* ----------------------------- L2A: store 32B in 2 cycles */
+{ .mmb
+ store [ptr1] = myval, 8
+ store [ptr2] = myval, 8
+;; } { .mmb
+ store [ptr1] = myval, 24
+ store [ptr2] = myval, 24
+ br.cloop.dptk.many .l2
+;; }
+.store_words:
+{ .mib
+ cmp.gt p_scr, p0 = 8, cnt /* just a few bytes left ? */
+(p_scr) br.cond.dpnt.many .move_bytes_from_alignment /* Branch */
+;; }
+
+{ .mmi
+ store [ptr1] = myval, 8 /* store */
+ cmp.le p_y, p_n = 16, cnt /* */
+ add cnt = -8, cnt /* subtract */
+;; }
+{ .mmi
+(p_y) store [ptr1] = myval, 8 /* store */
+(p_y) cmp.le.unc p_yy, p_nn = 16, cnt
+(p_y) add cnt = -8, cnt /* subtract */
+;; }
+{ .mmi /* store */
+(p_yy) store [ptr1] = myval, 8
+(p_yy) add cnt = -8, cnt /* subtract */
+;; }
+
+.move_bytes_from_alignment:
+{ .mib
+ cmp.eq p_scr, p0 = cnt, r0
+ tbit.nz.unc p_y, p0 = cnt, 2 /* should we terminate with a st4 ? */
+(p_scr) br.cond.dpnt.few .restore_and_exit
+;; }
+{ .mib
+(p_y) st4 [ptr1] = r0,4
+ tbit.nz.unc p_yy, p0 = cnt, 1 /* should we terminate with a st2 ? */
+;; }
+{ .mib
+(p_yy) st2 [ptr1] = r0,2
+ tbit.nz.unc p_y, p0 = cnt, 0 /* should we terminate with a st1 ? */
+;; }
+
+{ .mib
+(p_y) st1 [ptr1] = r0
+;; }
+.restore_and_exit:
+{ .mib
+ nop.m 0
+ movi0 ar.lc = save_lc
+ br.ret.sptk.many rp
+;; }
+
+.move_bytes_unaligned:
+{ .mmi
+ .pred.rel "mutex",p_y, p_n
+ .pred.rel "mutex",p_yy, p_nn
+(p_n) cmp.le p_yy, p_nn = 4, cnt
+(p_y) cmp.le p_yy, p_nn = 5, cnt
+(p_n) add ptr2 = 2, ptr1
+} { .mmi
+(p_y) add ptr2 = 3, ptr1
+(p_y) st1 [ptr1] = r0, 1 /* fill 1 (odd-aligned) byte */
+(p_y) add cnt = -1, cnt /* [15, 14 (or less) left] */
+;; }
+{ .mmi
+(p_yy) cmp.le.unc p_y, p0 = 8, cnt
+ add ptr3 = ptr1, cnt /* prepare last store */
+ movi0 ar.lc = save_lc
+} { .mmi
+(p_yy) st2 [ptr1] = r0, 4 /* fill 2 (aligned) bytes */
+(p_yy) st2 [ptr2] = r0, 4 /* fill 2 (aligned) bytes */
+(p_yy) add cnt = -4, cnt /* [11, 10 (o less) left] */
+;; }
+{ .mmi
+(p_y) cmp.le.unc p_yy, p0 = 8, cnt
+ add ptr3 = -1, ptr3 /* last store */
+ tbit.nz p_scr, p0 = cnt, 1 /* will there be a st2 at the end ? */
+} { .mmi
+(p_y) st2 [ptr1] = r0, 4 /* fill 2 (aligned) bytes */
+(p_y) st2 [ptr2] = r0, 4 /* fill 2 (aligned) bytes */
+(p_y) add cnt = -4, cnt /* [7, 6 (or less) left] */
+;; }
+{ .mmi
+(p_yy) st2 [ptr1] = r0, 4 /* fill 2 (aligned) bytes */
+(p_yy) st2 [ptr2] = r0, 4 /* fill 2 (aligned) bytes */
+ /* [3, 2 (or less) left] */
+ tbit.nz p_y, p0 = cnt, 0 /* will there be a st1 at the end ? */
+} { .mmi
+(p_yy) add cnt = -4, cnt
+;; }
+{ .mmb
+(p_scr) st2 [ptr1] = r0 /* fill 2 (aligned) bytes */
+(p_y) st1 [ptr3] = r0 /* fill last byte (using ptr3) */
+ br.ret.sptk.many rp
+;; }
+END(bzero)
+
+#endif
diff --git a/ap/build/uClibc/libc/string/ia64/memccpy.S b/ap/build/uClibc/libc/string/ia64/memccpy.S
new file mode 100644
index 0000000..259d680
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/memccpy.S
@@ -0,0 +1,213 @@
+/* Optimized version of the memccpy() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+ Contributed by Dan Pop <Dan.Pop@cern.ch>.
+
+ 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. */
+
+/* Return: a pointer to the next byte after char in dest or NULL
+
+ Inputs:
+ in0: dest
+ in1: src
+ in2: char
+ in3: byte count
+
+ This implementation assumes little endian mode (UM.be = 0).
+
+ This implementation assumes that it is safe to do read ahead
+ in the src block, without getting beyond its limit. */
+
+#include "sysdep.h"
+#undef ret
+
+#define OP_T_THRES 16
+#define OPSIZ 8
+
+#define saved_pr r17
+#define saved_lc r18
+#define dest r19
+#define src r20
+#define len r21
+#define asrc r22
+#define tmp r23
+#define char r24
+#define charx8 r25
+#define saved_ec r26
+#define sh2 r28
+#define sh1 r29
+#define loopcnt r30
+#define value r31
+
+#ifdef GAS_ALIGN_BREAKS_UNWIND_INFO
+/* Manually force proper loop-alignment. Note: be sure to
+ double-check the code-layout after making any changes to
+ this routine! */
+# define ALIGN(n) { nop 0 }
+#else
+# define ALIGN(n) .align n
+#endif
+
+ENTRY(memccpy)
+ .prologue
+ alloc r2 = ar.pfs, 4, 40 - 4, 0, 40
+
+#include "softpipe.h"
+ .rotr r[MEMLAT + 7], tmp1[4], tmp2[4], val[4], tmp3[2], pos0[2]
+ .rotp p[MEMLAT + 6 + 1]
+
+ mov ret0 = r0 /* return NULL if no match */
+ .save pr, saved_pr
+ mov saved_pr = pr /* save the predicate registers */
+ mov dest = in0 /* dest */
+ .save ar.lc, saved_lc
+ mov saved_lc = ar.lc /* save the loop counter */
+ mov saved_ec = ar.ec /* save the loop counter */
+ .body
+ mov src = in1 /* src */
+ extr.u char = in2, 0, 8 /* char */
+ mov len = in3 /* len */
+ sub tmp = r0, in0 /* tmp = -dest */
+ cmp.ne p7, p0 = r0, r0 /* clear p7 */
+ ;;
+ and loopcnt = 7, tmp /* loopcnt = -dest % 8 */
+ cmp.ge p6, p0 = OP_T_THRES, len /* is len <= OP_T_THRES */
+ mov ar.ec = 0 /* ec not guaranteed zero on entry */
+(p6) br.cond.spnt .cpyfew /* copy byte by byte */
+ ;;
+ cmp.eq p6, p0 = loopcnt, r0
+ mux1 charx8 = char, @brcst
+(p6) br.cond.sptk .dest_aligned
+ sub len = len, loopcnt /* len -= -dest % 8 */
+ adds loopcnt = -1, loopcnt /* --loopcnt */
+ ;;
+ mov ar.lc = loopcnt
+.l1: /* copy -dest % 8 bytes */
+ ld1 value = [src], 1 /* value = *src++ */
+ ;;
+ st1 [dest] = value, 1 /* *dest++ = value */
+ cmp.eq p6, p0 = value, char
+(p6) br.cond.spnt .foundit
+ br.cloop.dptk .l1
+.dest_aligned:
+ and sh1 = 7, src /* sh1 = src % 8 */
+ and tmp = -8, len /* tmp = len & -OPSIZ */
+ and asrc = -8, src /* asrc = src & -OPSIZ -- align src */
+ shr.u loopcnt = len, 3 /* loopcnt = len / 8 */
+ and len = 7, len ;; /* len = len % 8 */
+ shl sh1 = sh1, 3 /* sh1 = 8 * (src % 8) */
+ adds loopcnt = -1, loopcnt /* --loopcnt */
+ mov pr.rot = 1 << 16 ;; /* set rotating predicates */
+ sub sh2 = 64, sh1 /* sh2 = 64 - sh1 */
+ mov ar.lc = loopcnt /* set LC */
+ cmp.eq p6, p0 = sh1, r0 /* is the src aligned? */
+(p6) br.cond.sptk .src_aligned ;;
+ add src = src, tmp /* src += len & -OPSIZ */
+ mov ar.ec = MEMLAT + 6 + 1 /* six more passes needed */
+ ld8 r[1] = [asrc], 8 /* r[1] = w0 */
+ cmp.ne p6, p0 = r0, r0 ;; /* clear p6 */
+ ALIGN(32)
+.l2:
+(p[0]) ld8.s r[0] = [asrc], 8 /* r[0] = w1 */
+(p[MEMLAT]) shr.u tmp1[0] = r[1 + MEMLAT], sh1 /* tmp1 = w0 >> sh1 */
+(p[MEMLAT]) shl tmp2[0] = r[0 + MEMLAT], sh2 /* tmp2 = w1 << sh2 */
+(p[MEMLAT+4]) xor tmp3[0] = val[1], charx8
+(p[MEMLAT+5]) czx1.r pos0[0] = tmp3[1]
+(p[MEMLAT+6]) chk.s r[6 + MEMLAT], .recovery1 /* our data isn't */
+ /* valid - rollback! */
+(p[MEMLAT+6]) cmp.ne p6, p0 = 8, pos0[1]
+(p6) br.cond.spnt .gotit
+(p[MEMLAT+6]) st8 [dest] = val[3], 8 /* store val to dest */
+(p[MEMLAT+3]) or val[0] = tmp1[3], tmp2[3] /* val = tmp1 | tmp2 */
+ br.ctop.sptk .l2
+ br.cond.sptk .cpyfew
+
+.src_aligned:
+ cmp.ne p6, p0 = r0, r0 /* clear p6 */
+ mov ar.ec = MEMLAT + 2 + 1 ;; /* set EC */
+.l3:
+(p[0]) ld8.s r[0] = [src], 8
+(p[MEMLAT]) xor tmp3[0] = r[MEMLAT], charx8
+(p[MEMLAT+1]) czx1.r pos0[0] = tmp3[1]
+(p[MEMLAT+2]) cmp.ne p7, p0 = 8, pos0[1]
+(p[MEMLAT+2]) chk.s r[MEMLAT+2], .recovery2
+(p7) br.cond.spnt .gotit
+.back2:
+(p[MEMLAT+2]) st8 [dest] = r[MEMLAT+2], 8
+ br.ctop.dptk .l3
+.cpyfew:
+ cmp.eq p6, p0 = len, r0 /* is len == 0 ? */
+ adds len = -1, len /* --len; */
+(p6) br.cond.spnt .restore_and_exit ;;
+ mov ar.lc = len
+.l4:
+ ld1 value = [src], 1
+ ;;
+ st1 [dest] = value, 1
+ cmp.eq p6, p0 = value, char
+(p6) br.cond.spnt .foundit
+ br.cloop.dptk .l4 ;;
+.foundit:
+(p6) mov ret0 = dest
+.restore_and_exit:
+ mov pr = saved_pr, -1 /* restore the predicate registers */
+ mov ar.lc = saved_lc /* restore the loop counter */
+ mov ar.ec = saved_ec ;; /* restore the epilog counter */
+ br.ret.sptk.many b0
+.gotit:
+ .pred.rel "mutex" p6, p7
+(p6) mov value = val[3] /* if coming from l2 */
+(p7) mov value = r[MEMLAT+2] /* if coming from l3 */
+ mov ar.lc = pos0[1] ;;
+.l5:
+ extr.u tmp = value, 0, 8 ;;
+ st1 [dest] = tmp, 1
+ shr.u value = value, 8
+ br.cloop.sptk .l5 ;;
+ mov ret0 = dest
+ mov pr = saved_pr, -1
+ mov ar.lc = saved_lc
+ br.ret.sptk.many b0
+
+.recovery1:
+ adds src = -(MEMLAT + 6 + 1) * 8, asrc
+ mov loopcnt = ar.lc
+ mov tmp = ar.ec ;;
+ sub sh1 = (MEMLAT + 6 + 1), tmp
+ shr.u sh2 = sh2, 3
+ ;;
+ shl loopcnt = loopcnt, 3
+ sub src = src, sh2
+ shl sh1 = sh1, 3
+ shl tmp = tmp, 3
+ ;;
+ add len = len, loopcnt
+ add src = sh1, src ;;
+ add len = tmp, len
+.back1:
+ br.cond.sptk .cpyfew
+
+.recovery2:
+ add tmp = -(MEMLAT + 3) * 8, src
+(p7) br.cond.spnt .gotit
+ ;;
+ ld8 r[MEMLAT+2] = [tmp] ;;
+ xor pos0[1] = r[MEMLAT+2], charx8 ;;
+ czx1.r pos0[1] = pos0[1] ;;
+ cmp.ne p7, p6 = 8, pos0[1]
+(p7) br.cond.spnt .gotit
+ br.cond.sptk .back2
+END(memccpy)
diff --git a/ap/build/uClibc/libc/string/ia64/memchr.S b/ap/build/uClibc/libc/string/ia64/memchr.S
new file mode 100644
index 0000000..f25e803
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/memchr.S
@@ -0,0 +1,131 @@
+/* Optimized version of the standard memchr() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+ Contributed by Dan Pop <Dan.Pop@cern.ch>.
+
+ 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. */
+
+/* Return: the address of the first occurence of chr in str or NULL
+
+ Inputs:
+ in0: str
+ in1: chr
+ in2: byte count
+
+ This implementation assumes little endian mode. For big endian mode,
+ the instruction czx1.r should be replaced by czx1.l.
+
+ The algorithm is fairly straightforward: search byte by byte until we
+ we get to a word aligned address, then search word by word as much as
+ possible; the remaining few bytes are searched one at a time.
+
+ The word by word search is performed by xor-ing the word with a word
+ containing chr in every byte. If there is a hit, the result will
+ contain a zero byte in the corresponding position. The presence and
+ position of that zero byte is detected with a czx instruction.
+
+ All the loops in this function could have had the internal branch removed
+ if br.ctop and br.cloop could be predicated :-(. */
+
+#include "sysdep.h"
+#undef ret
+
+#define saved_pr r15
+#define saved_lc r16
+#define chr r17
+#define len r18
+#define pos0 r20
+#define val r21
+#define tmp r24
+#define chrx8 r25
+#define loopcnt r30
+
+#define str in0
+
+ENTRY(__memchr)
+ .prologue
+ alloc r2 = ar.pfs, 3, 0, 29, 32
+#include "softpipe.h"
+ .rotr value[MEMLAT+1], addr[MEMLAT+3], aux[2], poschr[2]
+ .rotp p[MEMLAT+3]
+ .save ar.lc, saved_lc
+ mov saved_lc = ar.lc /* save the loop counter */
+ .save pr, saved_pr
+ mov saved_pr = pr /* save the predicates */
+ .body
+ mov ret0 = str
+ and tmp = 7, str /* tmp = str % 8 */
+ cmp.ne p7, p0 = r0, r0 /* clear p7 */
+ extr.u chr = in1, 0, 8 /* chr = (unsigned char) in1 */
+ mov len = in2
+ cmp.gtu p6, p0 = 16, in2 /* use a simple loop for short */
+(p6) br.cond.spnt .srchfew ;; /* searches */
+ sub loopcnt = 8, tmp /* loopcnt = 8 - tmp */
+ cmp.eq p6, p0 = tmp, r0
+(p6) br.cond.sptk .str_aligned;;
+ sub len = len, loopcnt
+ adds loopcnt = -1, loopcnt;;
+ mov ar.lc = loopcnt
+.l1:
+ ld1 val = [ret0], 1
+ ;;
+ cmp.eq p6, p0 = val, chr
+(p6) br.cond.spnt .foundit
+ br.cloop.sptk .l1 ;;
+.str_aligned:
+ cmp.ne p6, p0 = r0, r0 /* clear p6 */
+ shr.u loopcnt = len, 3 /* loopcnt = len / 8 */
+ and len = 7, len ;; /* remaining len = len & 7 */
+ adds loopcnt = -1, loopcnt
+ mov ar.ec = MEMLAT + 3
+ mux1 chrx8 = chr, @brcst ;; /* get a word full of chr */
+ mov ar.lc = loopcnt
+ mov pr.rot = 1 << 16 ;;
+.l2:
+(p[0]) mov addr[0] = ret0
+(p[0]) ld8 value[0] = [ret0], 8
+(p[MEMLAT]) xor aux[0] = value[MEMLAT], chrx8
+(p[MEMLAT+1]) czx1.r poschr[0] = aux[1]
+(p[MEMLAT+2]) cmp.ne p7, p0 = 8, poschr[1]
+(p7) br.cond.dpnt .foundit
+ br.ctop.dptk .l2
+.srchfew:
+ adds loopcnt = -1, len
+ cmp.eq p6, p0 = len, r0
+(p6) br.cond.spnt .notfound ;;
+ mov ar.lc = loopcnt
+.l3:
+ ld1 val = [ret0], 1
+ ;;
+ cmp.eq p6, p0 = val, chr
+(p6) br.cond.dpnt .foundit
+ br.cloop.sptk .l3 ;;
+.notfound:
+ cmp.ne p6, p0 = r0, r0 /* clear p6 (p7 was already 0 when we got here) */
+ mov ret0 = r0 ;; /* return NULL */
+.foundit:
+ .pred.rel "mutex" p6, p7
+(p6) adds ret0 = -1, ret0 /* if we got here from l1 or l3 */
+(p7) add ret0 = addr[MEMLAT+2], poschr[1] /* if we got here from l2 */
+ mov pr = saved_pr, -1
+ mov ar.lc = saved_lc
+ br.ret.sptk.many b0
+
+END(__memchr)
+
+weak_alias(__memchr, memchr)
+weak_alias(__memchr, __ubp_memchr)
+libc_hidden_def(memchr)
diff --git a/ap/build/uClibc/libc/string/ia64/memcmp.S b/ap/build/uClibc/libc/string/ia64/memcmp.S
new file mode 100644
index 0000000..adb1a20
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/memcmp.S
@@ -0,0 +1,166 @@
+/* Optimized version of the standard memcmp() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+ Contributed by Dan Pop <Dan.Pop@cern.ch>.
+
+ 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. */
+
+/* Return: the result of the comparison
+
+ Inputs:
+ in0: dest (aka s1)
+ in1: src (aka s2)
+ in2: byte count
+
+ In this form, it assumes little endian mode. For big endian mode, the
+ the two shifts in .l2 must be inverted:
+
+ shl tmp1[0] = r[1 + MEMLAT], sh1 // tmp1 = w0 << sh1
+ shr.u tmp2[0] = r[0 + MEMLAT], sh2 // tmp2 = w1 >> sh2
+
+ and all the mux1 instructions should be replaced by plain mov's. */
+
+#include "sysdep.h"
+#undef ret
+
+#define OP_T_THRES 16
+#define OPSIZ 8
+#define MEMLAT 2
+
+#define start r15
+#define saved_pr r17
+#define saved_lc r18
+#define dest r19
+#define src r20
+#define len r21
+#define asrc r22
+#define tmp r23
+#define value1 r24
+#define value2 r25
+#define sh2 r28
+#define sh1 r29
+#define loopcnt r30
+
+ENTRY(memcmp)
+ .prologue
+ alloc r2 = ar.pfs, 3, 37, 0, 40
+
+ .rotr r[MEMLAT + 2], q[MEMLAT + 5], tmp1[4], tmp2[4], val[2]
+ .rotp p[MEMLAT + 4 + 1]
+
+ mov ret0 = r0 /* by default return value = 0 */
+ .save pr, saved_pr
+ mov saved_pr = pr /* save the predicate registers */
+ .save ar.lc, saved_lc
+ mov saved_lc = ar.lc /* save the loop counter */
+ .body
+ mov dest = in0 /* dest */
+ mov src = in1 /* src */
+ mov len = in2 /* len */
+ sub tmp = r0, in0 /* tmp = -dest */
+ ;;
+ and loopcnt = 7, tmp /* loopcnt = -dest % 8 */
+ cmp.ge p6, p0 = OP_T_THRES, len /* is len <= OP_T_THRES */
+(p6) br.cond.spnt .cmpfew /* compare byte by byte */
+ ;;
+ cmp.eq p6, p0 = loopcnt, r0
+(p6) br.cond.sptk .dest_aligned
+ sub len = len, loopcnt /* len -= -dest % 8 */
+ adds loopcnt = -1, loopcnt /* --loopcnt */
+ ;;
+ mov ar.lc = loopcnt
+.l1: /* copy -dest % 8 bytes */
+ ld1 value1 = [src], 1 /* value = *src++ */
+ ld1 value2 = [dest], 1
+ ;;
+ cmp.ne p6, p0 = value1, value2
+(p6) br.cond.spnt .done
+ br.cloop.dptk .l1
+.dest_aligned:
+ and sh1 = 7, src /* sh1 = src % 8 */
+ and tmp = -8, len /* tmp = len & -OPSIZ */
+ and asrc = -8, src /* asrc = src & -OPSIZ -- align src */
+ shr.u loopcnt = len, 3 /* loopcnt = len / 8 */
+ and len = 7, len ;; /* len = len % 8 */
+ shl sh1 = sh1, 3 /* sh1 = 8 * (src % 8) */
+ adds loopcnt = -1, loopcnt /* --loopcnt */
+ mov pr.rot = 1 << 16 ;; /* set rotating predicates */
+ sub sh2 = 64, sh1 /* sh2 = 64 - sh1 */
+ mov ar.lc = loopcnt /* set LC */
+ cmp.eq p6, p0 = sh1, r0 /* is the src aligned? */
+(p6) br.cond.sptk .src_aligned
+ add src = src, tmp /* src += len & -OPSIZ */
+ mov ar.ec = MEMLAT + 4 + 1 /* four more passes needed */
+ ld8 r[1] = [asrc], 8 ;; /* r[1] = w0 */
+ .align 32
+
+/* We enter this loop with p6 cleared by the above comparison */
+
+.l2:
+(p[0]) ld8 r[0] = [asrc], 8 /* r[0] = w1 */
+(p[0]) ld8 q[0] = [dest], 8
+(p[MEMLAT]) shr.u tmp1[0] = r[1 + MEMLAT], sh1 /* tmp1 = w0 >> sh1 */
+(p[MEMLAT]) shl tmp2[0] = r[0 + MEMLAT], sh2 /* tmp2 = w1 << sh2 */
+(p[MEMLAT+4]) cmp.ne p6, p0 = q[MEMLAT + 4], val[1]
+(p[MEMLAT+3]) or val[0] = tmp1[3], tmp2[3] /* val = tmp1 | tmp2 */
+(p6) br.cond.spnt .l2exit
+ br.ctop.sptk .l2
+ br.cond.sptk .cmpfew
+.l3exit:
+ mux1 value1 = r[MEMLAT], @rev
+ mux1 value2 = q[MEMLAT], @rev
+ cmp.ne p6, p0 = r0, r0 ;; /* clear p6 */
+.l2exit:
+(p6) mux1 value1 = val[1], @rev
+(p6) mux1 value2 = q[MEMLAT + 4], @rev ;;
+ cmp.ltu p6, p7 = value2, value1 ;;
+(p6) mov ret0 = -1
+(p7) mov ret0 = 1
+ mov pr = saved_pr, -1 /* restore the predicate registers */
+ mov ar.lc = saved_lc /* restore the loop counter */
+ br.ret.sptk.many b0
+.src_aligned:
+ cmp.ne p6, p0 = r0, r0 /* clear p6 */
+ mov ar.ec = MEMLAT + 1 ;; /* set EC */
+.l3:
+(p[0]) ld8 r[0] = [src], 8
+(p[0]) ld8 q[0] = [dest], 8
+(p[MEMLAT]) cmp.ne p6, p0 = r[MEMLAT], q[MEMLAT]
+(p6) br.cond.spnt .l3exit
+ br.ctop.dptk .l3 ;;
+.cmpfew:
+ cmp.eq p6, p0 = len, r0 /* is len == 0 ? */
+ adds len = -1, len /* --len; */
+(p6) br.cond.spnt .restore_and_exit ;;
+ mov ar.lc = len
+.l4:
+ ld1 value1 = [src], 1
+ ld1 value2 = [dest], 1
+ ;;
+ cmp.ne p6, p0 = value1, value2
+(p6) br.cond.spnt .done
+ br.cloop.dptk .l4 ;;
+.done:
+(p6) sub ret0 = value2, value1 /* don't execute it if falling thru */
+.restore_and_exit:
+ mov pr = saved_pr, -1 /* restore the predicate registers */
+ mov ar.lc = saved_lc /* restore the loop counter */
+ br.ret.sptk.many b0
+END(memcmp)
+libc_hidden_def (memcmp)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias (memcmp, bcmp)
+#endif
diff --git a/ap/build/uClibc/libc/string/ia64/memcpy.S b/ap/build/uClibc/libc/string/ia64/memcpy.S
new file mode 100644
index 0000000..6c48a72
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/memcpy.S
@@ -0,0 +1,436 @@
+/* Optimized version of the standard memcpy() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+ Contributed by Dan Pop for Itanium <Dan.Pop@cern.ch>.
+ Rewritten for McKinley by Sverre Jarp, HP Labs/CERN <Sverre.Jarp@cern.ch>
+
+ 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. */
+
+/* Return: dest
+
+ Inputs:
+ in0: dest
+ in1: src
+ in2: byte count
+
+ An assembly implementation of the algorithm used by the generic C
+ version from glibc. The case when source and sest are aligned is
+ treated separately, for extra performance.
+
+ In this form, memcpy assumes little endian mode. For big endian mode,
+ sh1 must be computed using an extra instruction: sub sh1 = 64, sh1
+ and the order of r[MEMLAT] and r[MEMLAT+1] must be reverted in the
+ shrp instruction. */
+
+#define USE_LFETCH
+#define USE_FLP
+#include "sysdep.h"
+#undef ret
+
+#define LFETCH_DIST 500
+
+#define ALIGN_UNROLL_no 4 /* no. of elements */
+#define ALIGN_UNROLL_sh 2 /* (shift amount) */
+
+#define MEMLAT 8
+#define Nrot ((4*(MEMLAT+2) + 7) & ~7)
+
+#define OP_T_THRES 16
+#define OPSIZ 8
+
+#define loopcnt r14
+#define elemcnt r15
+#define saved_pr r16
+#define saved_lc r17
+#define adest r18
+#define dest r19
+#define asrc r20
+#define src r21
+#define len r22
+#define tmp2 r23
+#define tmp3 r24
+#define tmp4 r25
+#define ptable r26
+#define ploop56 r27
+#define loopaddr r28
+#define sh1 r29
+#define ptr1 r30
+#define ptr2 r31
+
+#define movi0 mov
+
+#define p_scr p6
+#define p_xtr p7
+#define p_nxtr p8
+#define p_few p9
+
+#if defined(USE_FLP)
+#define load ldf8
+#define store stf8
+#define tempreg f6
+#define the_r fr
+#define the_s fs
+#define the_t ft
+#define the_q fq
+#define the_w fw
+#define the_x fx
+#define the_y fy
+#define the_z fz
+#elif defined(USE_INT)
+#define load ld8
+#define store st8
+#define tempreg tmp2
+#define the_r r
+#define the_s s
+#define the_t t
+#define the_q q
+#define the_w w
+#define the_x x
+#define the_y y
+#define the_z z
+#endif
+
+#ifdef GAS_ALIGN_BREAKS_UNWIND_INFO
+/* Manually force proper loop-alignment. Note: be sure to
+ double-check the code-layout after making any changes to
+ this routine! */
+# define ALIGN(n) { nop 0 }
+#else
+# define ALIGN(n) .align n
+#endif
+
+#if defined(USE_LFETCH)
+#define LOOP(shift) \
+ ALIGN(32); \
+.loop##shift : \
+{ .mmb \
+(p[0]) ld8.nt1 r[0] = [asrc], 8 ; \
+(p[0]) lfetch.nt1 [ptr1], 16 ; \
+ nop.b 0 ; \
+} { .mib \
+(p[MEMLAT+1]) st8 [dest] = tmp3, 8 ; \
+(p[MEMLAT]) shrp tmp3 = r[MEMLAT], s[MEMLAT+1], shift ; \
+ nop.b 0 ;; \
+ } { .mmb \
+(p[0]) ld8.nt1 s[0] = [asrc], 8 ; \
+(p[0]) lfetch.nt1 [ptr2], 16 ; \
+ nop.b 0 ; \
+} { .mib \
+(p[MEMLAT+1]) st8 [dest] = tmp4, 8 ; \
+(p[MEMLAT]) shrp tmp4 = s[MEMLAT], r[MEMLAT], shift ; \
+ br.ctop.sptk.many .loop##shift \
+;; } \
+{ .mib \
+ br.cond.sptk.many .copy_bytes ; /* deal with the remaining bytes */ \
+}
+#else
+#define LOOP(shift) \
+ ALIGN(32); \
+.loop##shift : \
+{ .mmb \
+(p[0]) ld8.nt1 r[0] = [asrc], 8 ; \
+ nop.b 0 ; \
+} { .mib \
+(p[MEMLAT+1]) st8 [dest] = tmp3, 8 ; \
+(p[MEMLAT]) shrp tmp3 = r[MEMLAT], s[MEMLAT+1], shift ; \
+ nop.b 0 ;; \
+ } { .mmb \
+(p[0]) ld8.nt1 s[0] = [asrc], 8 ; \
+ nop.b 0 ; \
+} { .mib \
+(p[MEMLAT+1]) st8 [dest] = tmp4, 8 ; \
+(p[MEMLAT]) shrp tmp4 = s[MEMLAT], r[MEMLAT], shift ; \
+ br.ctop.sptk.many .loop##shift \
+;; } \
+{ .mib \
+ br.cond.sptk.many .copy_bytes ; /* deal with the remaining bytes */ \
+}
+#endif
+
+
+ENTRY(memcpy)
+{ .mmi
+ .prologue
+ alloc r2 = ar.pfs, 3, Nrot - 3, 0, Nrot
+ .rotr r[MEMLAT+1], s[MEMLAT+2], q[MEMLAT+1], t[MEMLAT+1]
+ .rotp p[MEMLAT+2]
+ .rotf fr[MEMLAT+1], fq[MEMLAT+1], fs[MEMLAT+1], ft[MEMLAT+1]
+ mov ret0 = in0 /* return tmp2 = dest */
+ .save pr, saved_pr
+ movi0 saved_pr = pr /* save the predicate registers */
+} { .mmi
+ and tmp4 = 7, in0 /* check if destination is aligned */
+ mov dest = in0 /* dest */
+ mov src = in1 /* src */
+;; }
+{ .mii
+ cmp.eq p_scr, p0 = in2, r0 /* if (len == 0) */
+ .save ar.lc, saved_lc
+ movi0 saved_lc = ar.lc /* save the loop counter */
+ .body
+ cmp.ge p_few, p0 = OP_T_THRES, in2 /* is len <= OP_T_THRESH */
+} { .mbb
+ mov len = in2 /* len */
+(p_scr) br.cond.dpnt.few .restore_and_exit /* Branch no. 1: return dest */
+(p_few) br.cond.dpnt.many .copy_bytes /* Branch no. 2: copy byte by byte */
+;; }
+{ .mmi
+#if defined(USE_LFETCH)
+ lfetch.nt1 [dest] /* */
+ lfetch.nt1 [src] /* */
+#endif
+ shr.u elemcnt = len, 3 /* elemcnt = len / 8 */
+} { .mib
+ cmp.eq p_scr, p0 = tmp4, r0 /* is destination aligned? */
+ sub loopcnt = 7, tmp4 /* */
+(p_scr) br.cond.dptk.many .dest_aligned
+;; }
+{ .mmi
+ ld1 tmp2 = [src], 1 /* */
+ sub len = len, loopcnt, 1 /* reduce len */
+ movi0 ar.lc = loopcnt /* */
+} { .mib
+ cmp.ne p_scr, p0 = 0, loopcnt /* avoid loading beyond end-point */
+;; }
+
+.l0: /* ---------------------------- L0: Align src on 8-byte boundary */
+{ .mmi
+ st1 [dest] = tmp2, 1 /* */
+(p_scr) ld1 tmp2 = [src], 1 /* */
+} { .mib
+ cmp.lt p_scr, p0 = 1, loopcnt /* avoid load beyond end-point */
+ add loopcnt = -1, loopcnt
+ br.cloop.dptk.few .l0 /* */
+;; }
+
+.dest_aligned:
+{ .mmi
+ and tmp4 = 7, src /* ready for alignment check */
+ shr.u elemcnt = len, 3 /* elemcnt = len / 8 */
+;; }
+{ .mib
+ cmp.ne p_scr, p0 = tmp4, r0 /* is source also aligned */
+ tbit.nz p_xtr, p_nxtr = src, 3 /* prepare a separate move if src */
+} { .mib /* is not 16B aligned */
+ add ptr2 = LFETCH_DIST, dest /* prefetch address */
+ add ptr1 = LFETCH_DIST, src
+(p_scr) br.cond.dptk.many .src_not_aligned
+;; }
+
+/* The optimal case, when dest, and src are aligned */
+
+.both_aligned:
+{ .mmi
+ .pred.rel "mutex",p_xtr,p_nxtr
+(p_xtr) cmp.gt p_scr, p0 = ALIGN_UNROLL_no+1, elemcnt /* Need N + 1 to qualify */
+(p_nxtr) cmp.gt p_scr, p0 = ALIGN_UNROLL_no, elemcnt /* Need only N to qualify */
+ movi0 pr.rot = 1 << 16 /* set rotating predicates */
+} { .mib
+(p_scr) br.cond.dpnt.many .copy_full_words
+;; }
+
+{ .mmi
+(p_xtr) load tempreg = [src], 8
+(p_xtr) add elemcnt = -1, elemcnt
+ movi0 ar.ec = MEMLAT + 1 /* set the epilog counter */
+;; }
+{ .mmi
+(p_xtr) add len = -8, len /* */
+ add asrc = 16, src /* one bank apart (for USE_INT) */
+ shr.u loopcnt = elemcnt, ALIGN_UNROLL_sh /* cater for unrolling */
+;;}
+{ .mmi
+ add loopcnt = -1, loopcnt
+(p_xtr) store [dest] = tempreg, 8 /* copy the "extra" word */
+ nop.i 0
+;; }
+{ .mib
+ add adest = 16, dest
+ movi0 ar.lc = loopcnt /* set the loop counter */
+;; }
+
+#ifdef GAS_ALIGN_BREAKS_UNWIND_INFO
+ { nop 0 }
+#else
+ .align 32
+#endif
+#if defined(USE_FLP)
+.l1: /* ------------------------------- L1: Everything a multiple of 8 */
+{ .mmi
+#if defined(USE_LFETCH)
+(p[0]) lfetch.nt1 [ptr2],32
+#endif
+(p[0]) ldfp8 the_r[0],the_q[0] = [src], 16
+(p[0]) add len = -32, len
+} {.mmb
+(p[MEMLAT]) store [dest] = the_r[MEMLAT], 8
+(p[MEMLAT]) store [adest] = the_s[MEMLAT], 8
+;; }
+{ .mmi
+#if defined(USE_LFETCH)
+(p[0]) lfetch.nt1 [ptr1],32
+#endif
+(p[0]) ldfp8 the_s[0], the_t[0] = [src], 16
+} {.mmb
+(p[MEMLAT]) store [dest] = the_q[MEMLAT], 24
+(p[MEMLAT]) store [adest] = the_t[MEMLAT], 24
+ br.ctop.dptk.many .l1
+;; }
+#elif defined(USE_INT)
+.l1: /* ------------------------------- L1: Everything a multiple of 8 */
+{ .mmi
+(p[0]) load the_r[0] = [src], 8
+(p[0]) load the_q[0] = [asrc], 8
+(p[0]) add len = -32, len
+} {.mmb
+(p[MEMLAT]) store [dest] = the_r[MEMLAT], 8
+(p[MEMLAT]) store [adest] = the_q[MEMLAT], 8
+;; }
+{ .mmi
+(p[0]) load the_s[0] = [src], 24
+(p[0]) load the_t[0] = [asrc], 24
+} {.mmb
+(p[MEMLAT]) store [dest] = the_s[MEMLAT], 24
+(p[MEMLAT]) store [adest] = the_t[MEMLAT], 24
+#if defined(USE_LFETCH)
+;; }
+{ .mmb
+(p[0]) lfetch.nt1 [ptr2],32
+(p[0]) lfetch.nt1 [ptr1],32
+#endif
+ br.ctop.dptk.many .l1
+;; }
+#endif
+
+.copy_full_words:
+{ .mib
+ cmp.gt p_scr, p0 = 8, len /* */
+ shr.u elemcnt = len, 3 /* */
+(p_scr) br.cond.dpnt.many .copy_bytes
+;; }
+{ .mii
+ load tempreg = [src], 8
+ add loopcnt = -1, elemcnt /* */
+;; }
+{ .mii
+ cmp.ne p_scr, p0 = 0, loopcnt /* */
+ mov ar.lc = loopcnt /* */
+;; }
+
+.l2: /* ------------------------------- L2: Max 4 words copied separately */
+{ .mmi
+ store [dest] = tempreg, 8
+(p_scr) load tempreg = [src], 8 /* */
+ add len = -8, len
+} { .mib
+ cmp.lt p_scr, p0 = 1, loopcnt /* avoid load beyond end-point */
+ add loopcnt = -1, loopcnt
+ br.cloop.dptk.few .l2
+;; }
+
+.copy_bytes:
+{ .mib
+ cmp.eq p_scr, p0 = len, r0 /* is len == 0 ? */
+ add loopcnt = -1, len /* len--; */
+(p_scr) br.cond.spnt .restore_and_exit
+;; }
+{ .mii
+ ld1 tmp2 = [src], 1
+ movi0 ar.lc = loopcnt
+ cmp.ne p_scr, p0 = 0, loopcnt /* avoid load beyond end-point */
+;; }
+
+.l3: /* ------------------------------- L3: Final byte move */
+{ .mmi
+ st1 [dest] = tmp2, 1
+(p_scr) ld1 tmp2 = [src], 1
+} { .mib
+ cmp.lt p_scr, p0 = 1, loopcnt /* avoid load beyond end-point */
+ add loopcnt = -1, loopcnt
+ br.cloop.dptk.few .l3
+;; }
+
+.restore_and_exit:
+{ .mmi
+ movi0 pr = saved_pr, -1 /* restore the predicate registers */
+;; }
+{ .mib
+ movi0 ar.lc = saved_lc /* restore the loop counter */
+ br.ret.sptk.many b0
+;; }
+
+
+.src_not_aligned:
+{ .mmi
+ cmp.gt p_scr, p0 = 16, len
+ and sh1 = 7, src /* sh1 = src % 8 */
+ shr.u loopcnt = len, 4 /* element-cnt = len / 16 */
+} { .mib
+ add tmp4 = @ltoff(.table), gp
+ add tmp3 = @ltoff(.loop56), gp
+(p_scr) br.cond.dpnt.many .copy_bytes /* do byte by byte if too few */
+;; }
+{ .mmi
+ and asrc = -8, src /* asrc = (-8) -- align src for loop */
+ add loopcnt = -1, loopcnt /* loopcnt-- */
+ shl sh1 = sh1, 3 /* sh1 = 8 * (src % 8) */
+} { .mmi
+ ld8 ptable = [tmp4] /* ptable = &table */
+ ld8 ploop56 = [tmp3] /* ploop56 = &loop56 */
+ and tmp2 = -16, len /* tmp2 = len & -OPSIZ */
+;; }
+{ .mmi
+ add tmp3 = ptable, sh1 /* tmp3 = &table + sh1 */
+ add src = src, tmp2 /* src += len & (-16) */
+ movi0 ar.lc = loopcnt /* set LC */
+;; }
+{ .mmi
+ ld8 tmp4 = [tmp3] /* tmp4 = loop offset */
+ sub len = len, tmp2 /* len -= len & (-16) */
+ movi0 ar.ec = MEMLAT + 2 /* one more pass needed */
+;; }
+{ .mmi
+ ld8 s[1] = [asrc], 8 /* preload */
+ sub loopaddr = ploop56,tmp4 /* loopadd = &loop56 - loop offset */
+ movi0 pr.rot = 1 << 16 /* set rotating predicates */
+;; }
+{ .mib
+ nop.m 0
+ movi0 b6 = loopaddr
+ br b6 /* jump to the appropriate loop */
+;; }
+
+ LOOP(8)
+ LOOP(16)
+ LOOP(24)
+ LOOP(32)
+ LOOP(40)
+ LOOP(48)
+ LOOP(56)
+END(memcpy)
+libc_hidden_def (memcpy)
+
+ .rodata
+ .align 8
+.table:
+ data8 0 /* dummy entry */
+ data8 .loop56 - .loop8
+ data8 .loop56 - .loop16
+ data8 .loop56 - .loop24
+ data8 .loop56 - .loop32
+ data8 .loop56 - .loop40
+ data8 .loop56 - .loop48
+ data8 .loop56 - .loop56
diff --git a/ap/build/uClibc/libc/string/ia64/memmove.S b/ap/build/uClibc/libc/string/ia64/memmove.S
new file mode 100644
index 0000000..beaada6
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/memmove.S
@@ -0,0 +1,251 @@
+/* Optimized version of the standard memmove() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+ Contributed by Dan Pop <Dan.Pop@cern.ch>.
+
+ 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. */
+
+/* Return: dest
+
+ Inputs:
+ in0: dest
+ in1: src
+ in2: byte count
+
+ The core of the function is the memcpy implementation used in memcpy.S.
+ When bytes have to be copied backwards, only the easy case, when
+ all arguments are multiples of 8, is optimised.
+
+ In this form, it assumes little endian mode. For big endian mode,
+ sh1 must be computed using an extra instruction: sub sh1 = 64, sh1
+ or the UM.be bit should be cleared at the beginning and set at the end. */
+
+#include "sysdep.h"
+#undef ret
+
+#define OP_T_THRES 16
+#define OPSIZ 8
+
+#define adest r15
+#define saved_pr r17
+#define saved_lc r18
+#define dest r19
+#define src r20
+#define len r21
+#define asrc r22
+#define tmp2 r23
+#define tmp3 r24
+#define tmp4 r25
+#define ptable r26
+#define ploop56 r27
+#define loopaddr r28
+#define sh1 r29
+#define loopcnt r30
+#define value r31
+
+#ifdef GAS_ALIGN_BREAKS_UNWIND_INFO
+# define ALIGN(n) { nop 0 }
+#else
+# define ALIGN(n) .align n
+#endif
+
+#define LOOP(shift) \
+ ALIGN(32); \
+.loop##shift : \
+(p[0]) ld8 r[0] = [asrc], 8 ; /* w1 */ \
+(p[MEMLAT+1]) st8 [dest] = value, 8 ; \
+(p[MEMLAT]) shrp value = r[MEMLAT], r[MEMLAT+1], shift ; \
+ nop.b 0 ; \
+ nop.b 0 ; \
+ br.ctop.sptk .loop##shift ; \
+ br.cond.sptk .cpyfew ; /* deal with the remaining bytes */
+
+#define MEMLAT 21
+#define Nrot (((2*MEMLAT+3) + 7) & ~7)
+
+ENTRY(memmove)
+ .prologue
+ alloc r2 = ar.pfs, 3, Nrot - 3, 0, Nrot
+ .rotr r[MEMLAT + 2], q[MEMLAT + 1]
+ .rotp p[MEMLAT + 2]
+ mov ret0 = in0 /* return value = dest */
+ .save pr, saved_pr
+ mov saved_pr = pr /* save the predicate registers */
+ .save ar.lc, saved_lc
+ mov saved_lc = ar.lc /* save the loop counter */
+ .body
+ or tmp3 = in0, in1 ;; /* tmp3 = dest | src */
+ or tmp3 = tmp3, in2 /* tmp3 = dest | src | len */
+ mov dest = in0 /* dest */
+ mov src = in1 /* src */
+ mov len = in2 /* len */
+ sub tmp2 = r0, in0 /* tmp2 = -dest */
+ cmp.eq p6, p0 = in2, r0 /* if (len == 0) */
+(p6) br.cond.spnt .restore_and_exit;;/* return dest; */
+ and tmp4 = 7, tmp3 /* tmp4 = (dest | src | len) & 7 */
+ cmp.le p6, p0 = dest, src /* if dest <= src it's always safe */
+(p6) br.cond.spnt .forward /* to copy forward */
+ add tmp3 = src, len;;
+ cmp.lt p6, p0 = dest, tmp3 /* if dest > src && dest < src + len */
+(p6) br.cond.spnt .backward /* we have to copy backward */
+
+.forward:
+ shr.u loopcnt = len, 4 ;; /* loopcnt = len / 16 */
+ cmp.ne p6, p0 = tmp4, r0 /* if ((dest | src | len) & 7 != 0) */
+(p6) br.cond.sptk .next /* goto next; */
+
+/* The optimal case, when dest, src and len are all multiples of 8 */
+
+ and tmp3 = 0xf, len
+ mov pr.rot = 1 << 16 /* set rotating predicates */
+ mov ar.ec = MEMLAT + 1 ;; /* set the epilog counter */
+ cmp.ne p6, p0 = tmp3, r0 /* do we have to copy an extra word? */
+ adds loopcnt = -1, loopcnt;; /* --loopcnt */
+(p6) ld8 value = [src], 8;;
+(p6) st8 [dest] = value, 8 /* copy the "odd" word */
+ mov ar.lc = loopcnt /* set the loop counter */
+ cmp.eq p6, p0 = 8, len
+(p6) br.cond.spnt .restore_and_exit;;/* the one-word special case */
+ adds adest = 8, dest /* set adest one word ahead of dest */
+ adds asrc = 8, src ;; /* set asrc one word ahead of src */
+ nop.b 0 /* get the "golden" alignment for */
+ nop.b 0 /* the next loop */
+.l0:
+(p[0]) ld8 r[0] = [src], 16
+(p[0]) ld8 q[0] = [asrc], 16
+(p[MEMLAT]) st8 [dest] = r[MEMLAT], 16
+(p[MEMLAT]) st8 [adest] = q[MEMLAT], 16
+ br.ctop.dptk .l0 ;;
+
+ mov pr = saved_pr, -1 /* restore the predicate registers */
+ mov ar.lc = saved_lc /* restore the loop counter */
+ br.ret.sptk.many b0
+.next:
+ cmp.ge p6, p0 = OP_T_THRES, len /* is len <= OP_T_THRES */
+ and loopcnt = 7, tmp2 /* loopcnt = -dest % 8 */
+(p6) br.cond.spnt .cpyfew /* copy byte by byte */
+ ;;
+ cmp.eq p6, p0 = loopcnt, r0
+(p6) br.cond.sptk .dest_aligned
+ sub len = len, loopcnt /* len -= -dest % 8 */
+ adds loopcnt = -1, loopcnt /* --loopcnt */
+ ;;
+ mov ar.lc = loopcnt
+.l1: /* copy -dest % 8 bytes */
+ ld1 value = [src], 1 /* value = *src++ */
+ ;;
+ st1 [dest] = value, 1 /* *dest++ = value */
+ br.cloop.dptk .l1
+.dest_aligned:
+ and sh1 = 7, src /* sh1 = src % 8 */
+ and tmp2 = -8, len /* tmp2 = len & -OPSIZ */
+ and asrc = -8, src /* asrc = src & -OPSIZ -- align src */
+ shr.u loopcnt = len, 3 /* loopcnt = len / 8 */
+ and len = 7, len;; /* len = len % 8 */
+ adds loopcnt = -1, loopcnt /* --loopcnt */
+ addl tmp4 = @ltoff(.table), gp
+ addl tmp3 = @ltoff(.loop56), gp
+ mov ar.ec = MEMLAT + 1 /* set EC */
+ mov pr.rot = 1 << 16;; /* set rotating predicates */
+ mov ar.lc = loopcnt /* set LC */
+ cmp.eq p6, p0 = sh1, r0 /* is the src aligned? */
+(p6) br.cond.sptk .src_aligned
+ add src = src, tmp2 /* src += len & -OPSIZ */
+ shl sh1 = sh1, 3 /* sh1 = 8 * (src % 8) */
+ ld8 ploop56 = [tmp3] /* ploop56 = &loop56 */
+ ld8 ptable = [tmp4];; /* ptable = &table */
+ add tmp3 = ptable, sh1;; /* tmp3 = &table + sh1 */
+ mov ar.ec = MEMLAT + 1 + 1 /* one more pass needed */
+ ld8 tmp4 = [tmp3];; /* tmp4 = loop offset */
+ sub loopaddr = ploop56,tmp4 /* loopadd = &loop56 - loop offset */
+ ld8 r[1] = [asrc], 8;; /* w0 */
+ mov b6 = loopaddr;;
+ br b6 /* jump to the appropriate loop */
+
+ LOOP(8)
+ LOOP(16)
+ LOOP(24)
+ LOOP(32)
+ LOOP(40)
+ LOOP(48)
+ LOOP(56)
+
+.src_aligned:
+.l3:
+(p[0]) ld8 r[0] = [src], 8
+(p[MEMLAT]) st8 [dest] = r[MEMLAT], 8
+ br.ctop.dptk .l3
+.cpyfew:
+ cmp.eq p6, p0 = len, r0 /* is len == 0 ? */
+ adds len = -1, len /* --len; */
+(p6) br.cond.spnt .restore_and_exit ;;
+ mov ar.lc = len
+.l4:
+ ld1 value = [src], 1
+ ;;
+ st1 [dest] = value, 1
+ br.cloop.dptk .l4 ;;
+.restore_and_exit:
+ mov pr = saved_pr, -1 /* restore the predicate registers */
+ mov ar.lc = saved_lc /* restore the loop counter */
+ br.ret.sptk.many b0
+
+/* In the case of a backward copy, optimise only the case when everything
+ is a multiple of 8, otherwise copy byte by byte. The backward copy is
+ used only when the blocks are overlapping and dest > src.
+*/
+.backward:
+ shr.u loopcnt = len, 3 /* loopcnt = len / 8 */
+ add src = src, len /* src points one byte past the end */
+ add dest = dest, len ;; /* dest points one byte past the end */
+ mov ar.ec = MEMLAT + 1 /* set the epilog counter */
+ mov pr.rot = 1 << 16 /* set rotating predicates */
+ adds loopcnt = -1, loopcnt /* --loopcnt */
+ cmp.ne p6, p0 = tmp4, r0 /* if ((dest | src | len) & 7 != 0) */
+(p6) br.cond.sptk .bytecopy ;; /* copy byte by byte backward */
+ adds src = -8, src /* src points to the last word */
+ adds dest = -8, dest /* dest points to the last word */
+ mov ar.lc = loopcnt;; /* set the loop counter */
+.l5:
+(p[0]) ld8 r[0] = [src], -8
+(p[MEMLAT]) st8 [dest] = r[MEMLAT], -8
+ br.ctop.dptk .l5
+ br.cond.sptk .restore_and_exit
+.bytecopy:
+ adds src = -1, src /* src points to the last byte */
+ adds dest = -1, dest /* dest points to the last byte */
+ adds loopcnt = -1, len;; /* loopcnt = len - 1 */
+ mov ar.lc = loopcnt;; /* set the loop counter */
+.l6:
+(p[0]) ld1 r[0] = [src], -1
+(p[MEMLAT]) st1 [dest] = r[MEMLAT], -1
+ br.ctop.dptk .l6
+ br.cond.sptk .restore_and_exit
+END(memmove)
+
+ .rodata
+ .align 8
+.table:
+ data8 0 /* dummy entry */
+ data8 .loop56 - .loop8
+ data8 .loop56 - .loop16
+ data8 .loop56 - .loop24
+ data8 .loop56 - .loop32
+ data8 .loop56 - .loop40
+ data8 .loop56 - .loop48
+ data8 .loop56 - .loop56
+
+libc_hidden_def (memmove)
diff --git a/ap/build/uClibc/libc/string/ia64/memset.S b/ap/build/uClibc/libc/string/ia64/memset.S
new file mode 100644
index 0000000..45df583
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/memset.S
@@ -0,0 +1,400 @@
+/* Optimized version of the standard memset() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Contributed by Dan Pop for Itanium <Dan.Pop@cern.ch>.
+ Rewritten for McKinley by Sverre Jarp, HP Labs/CERN <Sverre.Jarp@cern.ch>
+
+ 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. */
+
+/* Return: dest
+
+ Inputs:
+ in0: dest
+ in1: value
+ in2: count
+
+ The algorithm is fairly straightforward: set byte by byte until we
+ we get to a 16B-aligned address, then loop on 128 B chunks using an
+ early store as prefetching, then loop on 32B chucks, then clear remaining
+ words, finally clear remaining bytes.
+ Since a stf.spill f0 can store 16B in one go, we use this instruction
+ to get peak speed when value = 0. */
+
+#include "sysdep.h"
+#undef ret
+
+#define dest in0
+#define value in1
+#define cnt in2
+
+#define tmp r31
+#define save_lc r30
+#define ptr0 r29
+#define ptr1 r28
+#define ptr2 r27
+#define ptr3 r26
+#define ptr9 r24
+#define loopcnt r23
+#define linecnt r22
+#define bytecnt r21
+
+#define fvalue f6
+
+/* This routine uses only scratch predicate registers (p6 - p15) */
+#define p_scr p6 /* default register for same-cycle branches */
+#define p_nz p7
+#define p_zr p8
+#define p_unalgn p9
+#define p_y p11
+#define p_n p12
+#define p_yy p13
+#define p_nn p14
+
+#define movi0 mov
+
+#define MIN1 15
+#define MIN1P1HALF 8
+#define LINE_SIZE 128
+#define LSIZE_SH 7 /* shift amount */
+#define PREF_AHEAD 8
+
+#define USE_FLP
+#if defined(USE_INT)
+#define store st8
+#define myval value
+#elif defined(USE_FLP)
+#define store stf8
+#define myval fvalue
+#endif
+
+.align 64
+ENTRY(memset)
+{ .mmi
+ .prologue
+ alloc tmp = ar.pfs, 3, 0, 0, 0
+ lfetch.nt1 [dest]
+ .save ar.lc, save_lc
+ movi0 save_lc = ar.lc
+} { .mmi
+ .body
+ mov ret0 = dest /* return value */
+ cmp.ne p_nz, p_zr = value, r0 /* use stf.spill if value is zero */
+ cmp.eq p_scr, p0 = cnt, r0
+;; }
+{ .mmi
+ and ptr2 = -(MIN1+1), dest /* aligned address */
+ and tmp = MIN1, dest /* prepare to check for alignment */
+ tbit.nz p_y, p_n = dest, 0 /* Do we have an odd address? (M_B_U) */
+} { .mib
+ mov ptr1 = dest
+ mux1 value = value, @brcst /* create 8 identical bytes in word */
+(p_scr) br.ret.dpnt.many rp /* return immediately if count = 0 */
+;; }
+{ .mib
+ cmp.ne p_unalgn, p0 = tmp, r0
+} { .mib /* NB: # of bytes to move is 1 higher */
+ sub bytecnt = (MIN1+1), tmp /* than loopcnt */
+ cmp.gt p_scr, p0 = 16, cnt /* is it a minimalistic task? */
+(p_scr) br.cond.dptk.many .move_bytes_unaligned /* go move just a few (M_B_U) */
+;; }
+{ .mmi
+(p_unalgn) add ptr1 = (MIN1+1), ptr2 /* after alignment */
+(p_unalgn) add ptr2 = MIN1P1HALF, ptr2 /* after alignment */
+(p_unalgn) tbit.nz.unc p_y, p_n = bytecnt, 3 /* should we do a st8 ? */
+;; }
+{ .mib
+(p_y) add cnt = -8, cnt
+(p_unalgn) tbit.nz.unc p_yy, p_nn = bytecnt, 2 /* should we do a st4 ? */
+} { .mib
+(p_y) st8 [ptr2] = value, -4
+(p_n) add ptr2 = 4, ptr2
+;; }
+{ .mib
+(p_yy) add cnt = -4, cnt
+(p_unalgn) tbit.nz.unc p_y, p_n = bytecnt, 1 /* should we do a st2 ? */
+} { .mib
+(p_yy) st4 [ptr2] = value, -2
+(p_nn) add ptr2 = 2, ptr2
+;; }
+{ .mmi
+ mov tmp = LINE_SIZE+1 /* for compare */
+(p_y) add cnt = -2, cnt
+(p_unalgn) tbit.nz.unc p_yy, p_nn = bytecnt, 0 /* should we do a st1 ? */
+} { .mmi
+ setf.sig fvalue=value /* transfer value to FLP side */
+(p_y) st2 [ptr2] = value, -1
+(p_n) add ptr2 = 1, ptr2
+;; }
+
+{ .mmi
+(p_yy) st1 [ptr2] = value
+ cmp.gt p_scr, p0 = tmp, cnt /* is it a minimalistic task? */
+} { .mbb
+(p_yy) add cnt = -1, cnt
+(p_scr) br.cond.dpnt.many .fraction_of_line /* go move just a few */
+;; }
+
+{ .mib
+ nop.m 0
+ shr.u linecnt = cnt, LSIZE_SH
+(p_zr) br.cond.dptk.many .l1b /* Jump to use stf.spill */
+;; }
+
+#ifndef GAS_ALIGN_BREAKS_UNWIND_INFO
+ .align 32 /* -------- L1A: store ahead into cache lines; fill later */
+#endif
+{ .mmi
+ and tmp = -(LINE_SIZE), cnt /* compute end of range */
+ mov ptr9 = ptr1 /* used for prefetching */
+ and cnt = (LINE_SIZE-1), cnt /* remainder */
+} { .mmi
+ mov loopcnt = PREF_AHEAD-1 /* default prefetch loop */
+ cmp.gt p_scr, p0 = PREF_AHEAD, linecnt /* check against actual value */
+;; }
+{ .mmi
+(p_scr) add loopcnt = -1, linecnt /* start of stores */
+ add ptr2 = 8, ptr1 /* (beyond prefetch stores) */
+ add ptr1 = tmp, ptr1 /* first address beyond total */
+;; } /* range */
+{ .mmi
+ add tmp = -1, linecnt /* next loop count */
+ movi0 ar.lc = loopcnt
+;; }
+.pref_l1a:
+{ .mib
+ store [ptr9] = myval, 128 /* Do stores one cache line apart */
+ nop.i 0
+ br.cloop.dptk.few .pref_l1a
+;; }
+{ .mmi
+ add ptr0 = 16, ptr2 /* Two stores in parallel */
+ movi0 ar.lc = tmp
+;; }
+.l1ax:
+ { .mmi
+ store [ptr2] = myval, 8
+ store [ptr0] = myval, 8
+ ;; }
+ { .mmi
+ store [ptr2] = myval, 24
+ store [ptr0] = myval, 24
+ ;; }
+ { .mmi
+ store [ptr2] = myval, 8
+ store [ptr0] = myval, 8
+ ;; }
+ { .mmi
+ store [ptr2] = myval, 24
+ store [ptr0] = myval, 24
+ ;; }
+ { .mmi
+ store [ptr2] = myval, 8
+ store [ptr0] = myval, 8
+ ;; }
+ { .mmi
+ store [ptr2] = myval, 24
+ store [ptr0] = myval, 24
+ ;; }
+ { .mmi
+ store [ptr2] = myval, 8
+ store [ptr0] = myval, 32
+ cmp.lt p_scr, p0 = ptr9, ptr1 /* do we need more prefetching? */
+ ;; }
+{ .mmb
+ store [ptr2] = myval, 24
+(p_scr) store [ptr9] = myval, 128
+ br.cloop.dptk.few .l1ax
+;; }
+{ .mbb
+ cmp.le p_scr, p0 = 8, cnt /* just a few bytes left ? */
+(p_scr) br.cond.dpnt.many .fraction_of_line /* Branch no. 2 */
+ br.cond.dpnt.many .move_bytes_from_alignment /* Branch no. 3 */
+;; }
+
+#ifdef GAS_ALIGN_BREAKS_UNWIND_INFO
+ { nop 0 }
+#else
+ .align 32
+#endif
+.l1b: /* ------------------ L1B: store ahead into cache lines; fill later */
+{ .mmi
+ and tmp = -(LINE_SIZE), cnt /* compute end of range */
+ mov ptr9 = ptr1 /* used for prefetching */
+ and cnt = (LINE_SIZE-1), cnt /* remainder */
+} { .mmi
+ mov loopcnt = PREF_AHEAD-1 /* default prefetch loop */
+ cmp.gt p_scr, p0 = PREF_AHEAD, linecnt /* check against actual value */
+;; }
+{ .mmi
+(p_scr) add loopcnt = -1, linecnt
+ add ptr2 = 16, ptr1 /* start of stores (beyond prefetch stores) */
+ add ptr1 = tmp, ptr1 /* first address beyond total range */
+;; }
+{ .mmi
+ add tmp = -1, linecnt /* next loop count */
+ movi0 ar.lc = loopcnt
+;; }
+.pref_l1b:
+{ .mib
+ stf.spill [ptr9] = f0, 128 /* Do stores one cache line apart */
+ nop.i 0
+ br.cloop.dptk.few .pref_l1b
+;; }
+{ .mmi
+ add ptr0 = 16, ptr2 /* Two stores in parallel */
+ movi0 ar.lc = tmp
+;; }
+.l1bx:
+ { .mmi
+ stf.spill [ptr2] = f0, 32
+ stf.spill [ptr0] = f0, 32
+ ;; }
+ { .mmi
+ stf.spill [ptr2] = f0, 32
+ stf.spill [ptr0] = f0, 32
+ ;; }
+ { .mmi
+ stf.spill [ptr2] = f0, 32
+ stf.spill [ptr0] = f0, 64
+ cmp.lt p_scr, p0 = ptr9, ptr1 /* do we need more prefetching? */
+ ;; }
+{ .mmb
+ stf.spill [ptr2] = f0, 32
+(p_scr) stf.spill [ptr9] = f0, 128
+ br.cloop.dptk.few .l1bx
+;; }
+{ .mib
+ cmp.gt p_scr, p0 = 8, cnt /* just a few bytes left ? */
+(p_scr) br.cond.dpnt.many .move_bytes_from_alignment
+;; }
+
+.fraction_of_line:
+{ .mib
+ add ptr2 = 16, ptr1
+ shr.u loopcnt = cnt, 5 /* loopcnt = cnt / 32 */
+;; }
+{ .mib
+ cmp.eq p_scr, p0 = loopcnt, r0
+ add loopcnt = -1, loopcnt
+(p_scr) br.cond.dpnt.many store_words
+;; }
+{ .mib
+ and cnt = 0x1f, cnt /* compute the remaining cnt */
+ movi0 ar.lc = loopcnt
+;; }
+#ifndef GAS_ALIGN_BREAKS_UNWIND_INFO
+ .align 32
+#endif
+.l2: /* ---------------------------- L2A: store 32B in 2 cycles */
+{ .mmb
+ store [ptr1] = myval, 8
+ store [ptr2] = myval, 8
+;; } { .mmb
+ store [ptr1] = myval, 24
+ store [ptr2] = myval, 24
+ br.cloop.dptk.many .l2
+;; }
+store_words:
+{ .mib
+ cmp.gt p_scr, p0 = 8, cnt /* just a few bytes left ? */
+(p_scr) br.cond.dpnt.many .move_bytes_from_alignment /* Branch */
+;; }
+
+{ .mmi
+ store [ptr1] = myval, 8 /* store */
+ cmp.le p_y, p_n = 16, cnt /* */
+ add cnt = -8, cnt /* subtract */
+;; }
+{ .mmi
+(p_y) store [ptr1] = myval, 8 /* store */
+(p_y) cmp.le.unc p_yy, p_nn = 16, cnt /* */
+(p_y) add cnt = -8, cnt /* subtract */
+;; }
+{ .mmi /* store */
+(p_yy) store [ptr1] = myval, 8 /* */
+(p_yy) add cnt = -8, cnt /* subtract */
+;; }
+
+.move_bytes_from_alignment:
+{ .mib
+ cmp.eq p_scr, p0 = cnt, r0
+ tbit.nz.unc p_y, p0 = cnt, 2 /* should we terminate with a st4 ? */
+(p_scr) br.cond.dpnt.few .restore_and_exit
+;; }
+{ .mib
+(p_y) st4 [ptr1] = value, 4
+ tbit.nz.unc p_yy, p0 = cnt, 1 /* should we terminate with a st2 ? */
+;; }
+{ .mib
+(p_yy) st2 [ptr1] = value, 2
+ tbit.nz.unc p_y, p0 = cnt, 0
+;; }
+
+{ .mib
+(p_y) st1 [ptr1] = value
+;; }
+.restore_and_exit:
+{ .mib
+ nop.m 0
+ movi0 ar.lc = save_lc
+ br.ret.sptk.many rp
+;; }
+
+.move_bytes_unaligned:
+{ .mmi
+ .pred.rel "mutex",p_y, p_n
+ .pred.rel "mutex",p_yy, p_nn
+(p_n) cmp.le p_yy, p_nn = 4, cnt
+(p_y) cmp.le p_yy, p_nn = 5, cnt
+(p_n) add ptr2 = 2, ptr1
+} { .mmi
+(p_y) add ptr2 = 3, ptr1
+(p_y) st1 [ptr1] = value, 1 /* fill 1 (odd-aligned) byte */
+(p_y) add cnt = -1, cnt /* [15, 14 (or less) left] */
+;; }
+{ .mmi
+(p_yy) cmp.le.unc p_y, p0 = 8, cnt
+ add ptr3 = ptr1, cnt /* prepare last store */
+ movi0 ar.lc = save_lc
+} { .mmi
+(p_yy) st2 [ptr1] = value, 4 /* fill 2 (aligned) bytes */
+(p_yy) st2 [ptr2] = value, 4 /* fill 2 (aligned) bytes */
+(p_yy) add cnt = -4, cnt /* [11, 10 (o less) left] */
+;; }
+{ .mmi
+(p_y) cmp.le.unc p_yy, p0 = 8, cnt
+ add ptr3 = -1, ptr3 /* last store */
+ tbit.nz p_scr, p0 = cnt, 1 /* will there be a st2 at the end ? */
+} { .mmi
+(p_y) st2 [ptr1] = value, 4 /* fill 2 (aligned) bytes */
+(p_y) st2 [ptr2] = value, 4 /* fill 2 (aligned) bytes */
+(p_y) add cnt = -4, cnt /* [7, 6 (or less) left] */
+;; }
+{ .mmi
+(p_yy) st2 [ptr1] = value, 4 /* fill 2 (aligned) bytes */
+(p_yy) st2 [ptr2] = value, 4 /* fill 2 (aligned) bytes */
+ /* [3, 2 (or less) left] */
+ tbit.nz p_y, p0 = cnt, 0 /* will there be a st1 at the end ? */
+} { .mmi
+(p_yy) add cnt = -4, cnt
+;; }
+{ .mmb
+(p_scr) st2 [ptr1] = value /* fill 2 (aligned) bytes */
+(p_y) st1 [ptr3] = value /* fill last byte (using ptr3) */
+ br.ret.sptk.many rp
+;; }
+END(memset)
+libc_hidden_def (memset)
diff --git a/ap/build/uClibc/libc/string/ia64/softpipe.h b/ap/build/uClibc/libc/string/ia64/softpipe.h
new file mode 100644
index 0000000..d71af73
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/softpipe.h
@@ -0,0 +1,29 @@
+/* This file is part of the GNU C Library.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+
+ 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. */
+
+/* The latency of a memory load assumed by the assembly implementation
+ of the mem and str functions. Since we don't have any clue about
+ where the data might be, let's assume it's in the L2 cache.
+ Assuming L3 would be too pessimistic :-)
+
+ Some functions define MEMLAT as 2, because they expect their data
+ to be in the L1D cache. */
+
+#ifndef MEMLAT
+# define MEMLAT 6
+#endif
diff --git a/ap/build/uClibc/libc/string/ia64/strchr.S b/ap/build/uClibc/libc/string/ia64/strchr.S
new file mode 100644
index 0000000..66703f2
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/strchr.S
@@ -0,0 +1,113 @@
+/* Optimized version of the standard strchr() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+ Contributed by Dan Pop <Dan.Pop@cern.ch>.
+
+ 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. */
+
+/* Return: the address of the first occurence of chr in str or NULL
+
+ Inputs:
+ in0: str
+ in1: chr
+
+ A modified version of memchr.S, the search ends when the character is
+ found or the terminating null character is encountered.
+
+ This implementation assumes little endian mode. For big endian mode,
+ the instruction czx1.r should be replaced by czx1.l. */
+
+#include "sysdep.h"
+#undef ret
+
+#define saved_lc r18
+#define poschr r19
+#define pos0 r20
+#define val1 r21
+#define val2 r22
+#define tmp r24
+#define chrx8 r25
+#define loopcnt r30
+
+#define str in0
+#define chr in1
+
+ENTRY(strchr)
+ .prologue
+ alloc r2 = ar.pfs, 2, 0, 0, 0
+ .save ar.lc, saved_lc
+ mov saved_lc = ar.lc /* save the loop counter */
+ .body
+ mov ret0 = str
+ and tmp = 7, str /* tmp = str % 8 */
+ mux1 chrx8 = chr, @brcst
+ extr.u chr = chr, 0, 8 /* retain only the last byte */
+ cmp.ne p8, p0 = r0, r0 /* clear p8 */
+ ;;
+ sub loopcnt = 8, tmp /* loopcnt = 8 - tmp */
+ cmp.eq p6, p0 = tmp, r0
+(p6) br.cond.sptk .str_aligned;;
+ adds loopcnt = -1, loopcnt;;
+ mov ar.lc = loopcnt
+.l1:
+ ld1 val2 = [ret0], 1
+ ;;
+ cmp.eq p6, p0 = val2, chr
+ cmp.eq p7, p0 = val2, r0
+(p6) br.cond.spnt .restore_and_exit
+(p7) br.cond.spnt .notfound
+ br.cloop.sptk .l1
+.str_aligned:
+ ld8 val1 = [ret0], 8;;
+ nop.b 0
+ nop.b 0
+.l2:
+ ld8.s val2 = [ret0], 8 /* don't bomb out here */
+ czx1.r pos0 = val1
+ xor tmp = val1, chrx8 /* if val1 contains chr, tmp will */
+ ;; /* contain a zero in its position */
+ czx1.r poschr = tmp
+ cmp.ne p6, p0 = 8, pos0
+ ;;
+ cmp.ne p7, p0 = 8, poschr
+(p7) br.cond.spnt .foundit
+(p6) br.cond.spnt .notfound
+ chk.s val2, .recovery
+.back:
+ mov val1 = val2
+ br.cond.dptk .l2
+.foundit:
+(p6) cmp.lt p8, p0 = pos0, poschr /* we found chr and null in the word */
+(p8) br.cond.spnt .notfound /* null was found before chr */
+ add ret0 = ret0, poschr ;;
+ adds ret0 = -15, ret0 ;; /* should be -16, but we decrement */
+.restore_and_exit: /* ret0 in the next instruction */
+ adds ret0 = -1, ret0 /* ret0 was pointing 1 char too far */
+ mov ar.lc = saved_lc /* restore the loop counter */
+ br.ret.sptk.many b0
+.notfound:
+ mov ret0 = r0 /* return NULL if null was found */
+ mov ar.lc = saved_lc
+ br.ret.sptk.many b0
+.recovery:
+ adds ret0 = -8, ret0;;
+ ld8 val2 = [ret0], 8 /* bomb out here */
+ br.cond.sptk .back
+END(strchr)
+libc_hidden_def (strchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias (strchr, index)
+#endif
diff --git a/ap/build/uClibc/libc/string/ia64/strcmp.S b/ap/build/uClibc/libc/string/ia64/strcmp.S
new file mode 100644
index 0000000..4da72fa
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/strcmp.S
@@ -0,0 +1,59 @@
+/* Optimized version of the standard strcmp() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+ Contributed by Dan Pop <Dan.Pop@cern.ch>.
+
+ 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. */
+
+/* Return: the result of the comparison
+
+ Inputs:
+ in0: s1
+ in1: s2
+
+ Unlike memcmp(), this function is optimized for mismatches within the
+ first few characters. */
+
+#include "sysdep.h"
+#undef ret
+
+#define s1 in0
+#define s2 in1
+
+#define val1 r15
+#define val2 r16
+
+
+ENTRY(strcmp)
+ alloc r2 = ar.pfs, 2, 0, 0, 0
+.loop:
+ ld1 val1 = [s1], 1
+ ld1 val2 = [s2], 1
+ cmp.eq p6, p0 = r0, r0 /* set p6 */
+ ;;
+ cmp.ne.and p6, p0 = val1, r0
+ cmp.ne.and p6, p0 = val2, r0
+ cmp.eq.and p6, p0 = val1, val2
+(p6) br.cond.sptk .loop
+ sub ret0 = val1, val2
+ br.ret.sptk.many b0
+END(strcmp)
+libc_hidden_def (strcmp)
+
+#ifndef __UCLIBC_HAS_LOCALE__
+strong_alias(strcmp,strcoll)
+libc_hidden_def(strcoll)
+#endif
diff --git a/ap/build/uClibc/libc/string/ia64/strcpy.S b/ap/build/uClibc/libc/string/ia64/strcpy.S
new file mode 100644
index 0000000..7b002f6
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/strcpy.S
@@ -0,0 +1,145 @@
+/* Optimized version of the standard strcpy() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+ Contributed by Dan Pop <Dan.Pop@cern.ch>.
+
+ 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. */
+
+/* Return: dest
+
+ Inputs:
+ in0: dest
+ in1: src
+
+ In this form, it assumes little endian mode. For big endian mode, the
+ the two shifts in .l2 must be inverted:
+
+ shl value = r[1], sh1 // value = w0 << sh1
+ shr.u tmp = r[0], sh2 // tmp = w1 >> sh2
+ */
+
+#include "sysdep.h"
+#undef ret
+
+#define saved_lc r15
+#define saved_pr r16
+#define thresh r17
+#define dest r19
+#define src r20
+#define len r21
+#define asrc r22
+#define tmp r23
+#define pos r24
+#define w0 r25
+#define w1 r26
+#define c r27
+#define sh2 r28
+#define sh1 r29
+#define loopcnt r30
+#define value r31
+
+ENTRY(strcpy)
+ .prologue
+ alloc r2 = ar.pfs, 2, 0, 30, 32
+
+#define MEMLAT 2
+ .rotr r[MEMLAT + 2]
+ .rotp p[MEMLAT + 1]
+
+ mov ret0 = in0 /* return value = dest */
+ .save pr, saved_pr
+ mov saved_pr = pr /* save the predicate registers */
+ .save ar.lc, saved_lc
+ mov saved_lc = ar.lc /* save the loop counter */
+ .body
+ sub tmp = r0, in0 ;; /* tmp = -dest */
+ mov dest = in0 /* dest */
+ mov src = in1 /* src */
+ and loopcnt = 7, tmp ;; /* loopcnt = -dest % 8 */
+ cmp.eq p6, p0 = loopcnt, r0
+ adds loopcnt = -1, loopcnt /* --loopcnt */
+(p6) br.cond.sptk .dest_aligned ;;
+ mov ar.lc = loopcnt
+.l1: /* copy -dest % 8 bytes */
+ ld1 c = [src], 1 /* c = *src++ */
+ ;;
+ st1 [dest] = c, 1 /* *dest++ = c */
+ cmp.eq p6, p0 = c, r0
+(p6) br.cond.dpnt .restore_and_exit
+ br.cloop.dptk .l1 ;;
+.dest_aligned:
+ and sh1 = 7, src /* sh1 = src % 8 */
+ mov ar.lc = -1 /* "infinite" loop */
+ and asrc = -8, src ;; /* asrc = src & -OPSIZ -- align src */
+ sub thresh = 8, sh1
+ mov pr.rot = 1 << 16 /* set rotating predicates */
+ cmp.ne p7, p0 = r0, r0 /* clear p7 */
+ shl sh1 = sh1, 3 ;; /* sh1 = 8 * (src % 8) */
+ sub sh2 = 64, sh1 /* sh2 = 64 - sh1 */
+ cmp.eq p6, p0 = sh1, r0 /* is the src aligned? */
+(p6) br.cond.sptk .src_aligned ;;
+ ld8 r[1] = [asrc],8 ;;
+
+ .align 32
+.l2:
+ ld8.s r[0] = [asrc], 8
+ shr.u value = r[1], sh1 ;; /* value = w0 >> sh1 */
+ czx1.r pos = value ;; /* do we have an "early" zero */
+ cmp.lt p7, p0 = pos, thresh /* in w0 >> sh1? */
+(p7) br.cond.dpnt .found0
+ chk.s r[0], .recovery2 /* it is safe to do that only */
+.back2: /* after the previous test */
+ shl tmp = r[0], sh2 /* tmp = w1 << sh2 */
+ ;;
+ or value = value, tmp ;; /* value |= tmp */
+ czx1.r pos = value ;;
+ cmp.ne p7, p0 = 8, pos
+(p7) br.cond.dpnt .found0
+ st8 [dest] = value, 8 /* store val to dest */
+ br.ctop.dptk .l2 ;;
+.src_aligned:
+.l3:
+(p[0]) ld8.s r[0] = [src], 8
+(p[MEMLAT]) chk.s r[MEMLAT], .recovery3
+.back3:
+(p[MEMLAT]) mov value = r[MEMLAT]
+(p[MEMLAT]) czx1.r pos = r[MEMLAT] ;;
+(p[MEMLAT]) cmp.ne p7, p0 = 8, pos
+(p7) br.cond.dpnt .found0
+(p[MEMLAT]) st8 [dest] = r[MEMLAT], 8
+ br.ctop.dptk .l3 ;;
+.found0:
+ mov ar.lc = pos
+.l4:
+ extr.u c = value, 0, 8 /* c = value & 0xff */
+ shr.u value = value, 8
+ ;;
+ st1 [dest] = c, 1
+ br.cloop.dptk .l4 ;;
+.restore_and_exit:
+ mov ar.lc = saved_lc /* restore the loop counter */
+ mov pr = saved_pr, -1 /* restore the predicate registers */
+ br.ret.sptk.many b0
+.recovery2:
+ add tmp = -8, asrc ;;
+ ld8 r[0] = [tmp]
+ br.cond.sptk .back2
+.recovery3:
+ add tmp = -(MEMLAT + 1) * 8, src ;;
+ ld8 r[MEMLAT] = [tmp]
+ br.cond.sptk .back3
+END(strcpy)
+libc_hidden_def (strcpy)
diff --git a/ap/build/uClibc/libc/string/ia64/strlen.S b/ap/build/uClibc/libc/string/ia64/strlen.S
new file mode 100644
index 0000000..edbe843
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/strlen.S
@@ -0,0 +1,98 @@
+/* Optimized version of the standard strlen() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
+ Contributed by Dan Pop <Dan.Pop@cern.ch>.
+
+ 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. */
+
+/* Return: the length of the input string
+
+ Input:
+ in0: str
+
+ Look for the null character byte by byte, until we reach a word aligned
+ address, then search word by word, using the czx instruction. We're
+ also doing one word of read ahead, which could cause problems if the
+ null character is on the last word of a page and the next page is not
+ mapped in the process address space. Hence the use of the speculative
+ load.
+
+ This implementation assumes little endian mode. For big endian mode,
+ the instruction czx1.r should be replaced by czx1.l. */
+
+#include "sysdep.h"
+#undef ret
+
+#define saved_lc r18
+#define str r19
+#define pos0 r20
+#define val1 r21
+#define val2 r22
+#define origadd r23
+#define tmp r24
+#define loopcnt r30
+#define len ret0
+
+ENTRY(strlen)
+ .prologue
+ alloc r2 = ar.pfs, 1, 0, 0, 0
+ .save ar.lc, saved_lc
+ mov saved_lc = ar.lc /* save the loop counter */
+ .body
+ mov str = in0
+ mov len = r0 /* len = 0 */
+ and tmp = 7, in0 /* tmp = str % 8 */
+ ;;
+ sub loopcnt = 8, tmp /* loopcnt = 8 - tmp */
+ cmp.eq p6, p0 = tmp, r0
+(p6) br.cond.sptk .str_aligned;;
+ adds loopcnt = -1, loopcnt;;
+ mov ar.lc = loopcnt
+.l1:
+ ld1 val2 = [str], 1
+ ;;
+ cmp.eq p6, p0 = val2, r0
+(p6) br.cond.spnt .restore_and_exit
+ adds len = 1, len
+ br.cloop.dptk .l1
+.str_aligned:
+ mov origadd = str /* origadd = orig */
+ ld8 val1 = [str], 8;;
+ nop.b 0
+ nop.b 0
+.l2: ld8.s val2 = [str], 8 /* don't bomb out here */
+ czx1.r pos0 = val1
+ ;;
+ cmp.ne p6, p0 = 8, pos0
+(p6) br.cond.spnt .foundit
+ chk.s val2, .recovery
+.back:
+ mov val1 = val2
+ br.cond.dptk .l2
+.foundit:
+ sub tmp = str, origadd /* tmp = crt address - orig */
+ add len = len, pos0;;
+ add len = len, tmp;;
+ adds len = -16, len
+.restore_and_exit:
+ mov ar.lc = saved_lc /* restore the loop counter */
+ br.ret.sptk.many b0
+.recovery:
+ adds str = -8, str;;
+ ld8 val2 = [str], 8 /* bomb out here */
+ br.cond.sptk .back
+END(strlen)
+libc_hidden_def (strlen)
diff --git a/ap/build/uClibc/libc/string/ia64/strncmp.S b/ap/build/uClibc/libc/string/ia64/strncmp.S
new file mode 100644
index 0000000..e31f8fb
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/strncmp.S
@@ -0,0 +1,62 @@
+/* Optimized version of the standard strncmp() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
+ Contributed by Dan Pop <Dan.Pop@cern.ch>.
+
+ 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. */
+
+/* Return: the result of the comparison
+
+ Inputs:
+ in0: s1
+ in1: s2
+ in2: n
+
+ Unlike memcmp(), this function is optimized for mismatches within the
+ first few characters. */
+
+#include "sysdep.h"
+#undef ret
+
+#define s1 in0
+#define s2 in1
+#define n in2
+
+#define val1 r15
+#define val2 r16
+
+
+ENTRY(strncmp)
+ alloc r2 = ar.pfs, 3, 0, 0, 0
+ mov ret0 = r0
+ cmp.eq p6, p0 = r0, r0 /* set p6 */
+ cmp.eq p7, p0 = n, r0 /* return immediately if n == 0 */
+(p7) br.cond.spnt .restore_and_exit ;;
+.loop:
+ ld1 val1 = [s1], 1
+ ld1 val2 = [s2], 1
+ adds n = -1, n /* n-- */
+ ;;
+ cmp.ne.and p6, p0 = val1, r0
+ cmp.ne.and p6, p0 = val2, r0
+ cmp.ne.and p6, p0 = n, r0
+ cmp.eq.and p6, p0 = val1, val2
+(p6) br.cond.sptk .loop
+ sub ret0 = val1, val2
+.restore_and_exit:
+ br.ret.sptk.many b0
+END(strncmp)
+libc_hidden_weak (strncmp)
diff --git a/ap/build/uClibc/libc/string/ia64/strncpy.S b/ap/build/uClibc/libc/string/ia64/strncpy.S
new file mode 100644
index 0000000..3f29bbd
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/strncpy.S
@@ -0,0 +1,232 @@
+/* Optimized version of the standard strncpy() function.
+ This file is part of the GNU C Library.
+ Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Contributed by Dan Pop <Dan.Pop@cern.ch>
+ and Jakub Jelinek <jakub@redhat.com>.
+
+ 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. */
+
+/* Return: dest
+
+ Inputs:
+ in0: dest
+ in1: src
+ in2: len
+
+ In this form, it assumes little endian mode.
+ */
+
+#include "sysdep.h"
+#undef ret
+
+#define saved_lc r15
+#define saved_pr r16
+#define thresh r17
+#define dest r18
+#define dest2 r19
+#define src r20
+#define len r21
+#define asrc r22
+#define tmp r23
+#define pos r24
+#define w0 r25
+#define w1 r26
+#define c r27
+#define sh2 r28
+#define sh1 r29
+#define loopcnt r30
+#define value r31
+
+ENTRY(strncpy)
+ .prologue
+ alloc r2 = ar.pfs, 3, 0, 29, 32
+
+#define MEMLAT 2
+ .rotr r[MEMLAT + 2]
+ .rotp p[MEMLAT + 1]
+
+ mov ret0 = in0 /* return value = dest */
+ .save pr, saved_pr
+ mov saved_pr = pr /* save the predicate registers */
+ .save ar.lc, saved_lc
+ mov saved_lc = ar.lc /* save the loop counter */
+ mov ar.ec = 0 /* ec is not guaranteed to */
+ /* be zero upon function entry */
+ .body
+ cmp.geu p6, p5 = 24, in2
+(p6) br.cond.spnt .short_len
+ sub tmp = r0, in0 ;; /* tmp = -dest */
+ mov len = in2 /* len */
+ mov dest = in0 /* dest */
+ mov src = in1 /* src */
+ and tmp = 7, tmp ;; /* loopcnt = -dest % 8 */
+ cmp.eq p6, p7 = tmp, r0
+ adds loopcnt = -1, tmp /* --loopcnt */
+(p6) br.cond.sptk .dest_aligned ;;
+ sub len = len, tmp /* len -= -dest % 8 */
+ mov ar.lc = loopcnt
+.l1: /* copy -dest % 8 bytes */
+(p5) ld1 c = [src], 1 /* c = *src++ */
+ ;;
+ st1 [dest] = c, 1 /* *dest++ = c */
+ cmp.ne p5, p7 = c, r0
+ br.cloop.dptk .l1 ;;
+(p7) br.cond.dpnt .found0_align
+
+.dest_aligned: /* p7 should be cleared here */
+ shr.u c = len, 3 /* c = len / 8 */
+ and sh1 = 7, src /* sh1 = src % 8 */
+ and asrc = -8, src ;; /* asrc = src & -OPSIZ -- align src */
+ adds c = (MEMLAT-1), c /* c = (len / 8) + MEMLAT - 1 */
+ sub thresh = 8, sh1
+ mov pr.rot = 1 << 16 /* set rotating predicates */
+ shl sh1 = sh1, 3 ;; /* sh1 = 8 * (src % 8) */
+ mov ar.lc = c /* "infinite" loop */
+ sub sh2 = 64, sh1 /* sh2 = 64 - sh1 */
+ cmp.eq p6, p0 = sh1, r0 /* is the src aligned? */
+(p6) br.cond.sptk .src_aligned
+ adds c = -(MEMLAT-1), c ;; /* c = (len / 8) */
+ ld8 r[1] = [asrc],8
+ mov ar.lc = c ;;
+
+ .align 32
+.l2:
+(p6) st8 [dest] = value, 8 /* store val to dest */
+ ld8.s r[0] = [asrc], 8
+ shr.u value = r[1], sh1 ;; /* value = w0 >> sh1 */
+ czx1.r pos = value ;; /* do we have an "early" zero */
+ cmp.lt p7, p0 = pos, thresh /* in w0 >> sh1? */
+ adds len = -8, len /* len -= 8 */
+(p7) br.cond.dpnt .nonalign_found0
+ chk.s r[0], .recovery2 /* it is safe to do that only */
+.back2: /* after the previous test */
+ shl tmp = r[0], sh2 /* tmp = w1 << sh2 */
+ ;;
+ or value = value, tmp ;; /* value |= tmp */
+ czx1.r pos = value ;;
+ cmp.ne p7, p6 = 8, pos
+(p7) br.cond.dpnt .nonalign_found0
+ br.ctop.dptk .l2 ;;
+ adds len = 8, len
+ br.cond.sptk .not_found0 ;;
+.nonalign_found0:
+ cmp.gtu p6, p0 = -8, len
+(p6) br.cond.dptk .found0
+ adds len = 8, len
+ br.cond.sptk .not_found0 ;;
+
+ .align 32
+.src_aligned:
+.l3:
+(p[0]) ld8.s r[0] = [src], 8
+(p[MEMLAT]) chk.s r[MEMLAT], .recovery3
+.back3:
+(p[MEMLAT]) mov value = r[MEMLAT]
+(p[MEMLAT]) czx1.r pos = r[MEMLAT] ;;
+(p[MEMLAT]) cmp.ne p7, p0 = 8, pos
+(p[MEMLAT]) adds len = -8, len /* len -= 8 */
+(p7) br.cond.dpnt .found0
+(p[MEMLAT]) st8 [dest] = r[MEMLAT], 8
+ br.ctop.dptk .l3 ;;
+
+ chk.s r[MEMLAT-1], .recovery4
+.back4:
+ mov value = r[MEMLAT-1]
+
+.not_found0:
+ cmp.eq p5, p6 = len, r0
+ adds len = -1, len
+(p5) br.cond.dptk .restore_and_exit ;;
+ mov ar.lc = len
+.l4:
+(p6) extr.u c = value, 0, 8 /* c = value & 0xff */
+(p6) shr.u value = value, 8 ;;
+ st1 [dest] = c, 1
+ cmp.ne p6, p0 = c, r0
+ br.cloop.dptk .l4
+ br.cond.sptk .restore_and_exit
+
+.found0_align:
+ mov pos = 0
+ adds len = -8, len
+ mov value = 0 ;;
+.found0:
+ shl tmp = pos, 3
+ shr.u loopcnt = len, 4 /* loopcnt = len / 16 */
+ mov c = -1 ;;
+ cmp.eq p6, p0 = loopcnt, r0
+ adds loopcnt = -1, loopcnt
+ shl c = c, tmp ;;
+ and len = 0xf, len
+ andcm value = value, c
+ mov ar.lc = loopcnt ;;
+ cmp.le p7, p0 = 8, len
+ adds dest2 = 16, dest
+ st8 [dest] = value, 8
+ and len = 0x7, len
+(p6) br.cond.dpnt .l6 ;;
+.l5:
+ st8 [dest] = r0, 16
+ st8 [dest2] = r0, 16
+ br.cloop.dptk .l5 ;;
+.l6:
+(p7) st8 [dest] = r0, 8
+ cmp.eq p5, p0 = len, r0
+ adds len = -1, len
+(p5) br.cond.dptk .restore_and_exit ;;
+ mov ar.lc = len ;;
+.l7:
+ st1 [dest] = r0, 1
+ br.cloop.dptk .l7 ;;
+.restore_and_exit:
+ mov ar.lc = saved_lc /* restore the loop counter */
+ mov pr = saved_pr, -1 /* restore the predicate registers */
+ br.ret.sptk.many b0
+
+.short_len:
+ cmp.eq p5, p0 = in2, r0
+ adds loopcnt = -1, in2
+(p5) br.cond.spnt .restore_and_exit ;;
+ mov ar.lc = loopcnt /* p6 should be set when we get here */
+.l8:
+(p6) ld1 c = [in1], 1 /* c = *src++ */
+ ;;
+ st1 [in0] = c, 1 /* *dest++ = c */
+(p6) cmp.ne p6, p0 = c, r0
+ br.cloop.dptk .l8
+ ;;
+ mov ar.lc = saved_lc /* restore the loop counter */
+ mov pr = saved_pr, -1 /* restore the predicate registers */
+ br.ret.sptk.many b0
+.recovery2:
+ add c = 8, len
+ add tmp = -8, asrc ;;
+ cmp.gtu p8, p5 = c, thresh ;;
+(p8) ld8 r[0] = [tmp]
+(p5) mov r[0] = r0
+ br.cond.sptk .back2
+.recovery3:
+ add tmp = -(MEMLAT + 1) * 8, src ;;
+ ld8 r[MEMLAT] = [tmp]
+ br.cond.sptk .back3
+.recovery4:
+ cmp.eq p5, p6 = len, r0
+ add tmp = -MEMLAT * 8, src ;;
+(p6) ld8 r[MEMLAT - 1] = [tmp]
+(p5) mov r[MEMLAT - 1] = r0
+ br.cond.sptk .back4
+END(strncpy)
+libc_hidden_def (strncpy)
diff --git a/ap/build/uClibc/libc/string/ia64/sysdep.h b/ap/build/uClibc/libc/string/ia64/sysdep.h
new file mode 100644
index 0000000..d10020a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/ia64/sysdep.h
@@ -0,0 +1,168 @@
+/* Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Written by Jes Sorensen, <Jes.Sorensen@cern.ch>, April 1999.
+ Based on code originally written by David Mosberger-Tang
+
+ 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 _LINUX_IA64_SYSDEP_H
+#define _LINUX_IA64_SYSDEP_H 1
+
+#include <features.h>
+#include <asm/unistd.h>
+
+#ifdef __ASSEMBLER__
+
+/* Macros to help writing .prologue directives in assembly code. */
+#define ASM_UNW_PRLG_RP 0x8
+#define ASM_UNW_PRLG_PFS 0x4
+#define ASM_UNW_PRLG_PSP 0x2
+#define ASM_UNW_PRLG_PR 0x1
+#define ASM_UNW_PRLG_GRSAVE(ninputs) (32+(ninputs))
+
+#ifdef __STDC__
+#define C_LABEL(name) name :
+#else
+#define C_LABEL(name) name/**/:
+#endif
+
+#define CALL_MCOUNT
+
+#define ENTRY(name) \
+ .text; \
+ .align 32; \
+ .proc C_SYMBOL_NAME(name); \
+ .global C_SYMBOL_NAME(name); \
+ C_LABEL(name) \
+ CALL_MCOUNT
+
+#define LEAF(name) \
+ .text; \
+ .align 32; \
+ .proc C_SYMBOL_NAME(name); \
+ .global name; \
+ C_LABEL(name)
+
+/* Mark the end of function SYM. */
+#undef END
+#define END(sym) .endp C_SYMBOL_NAME(sym)
+
+/* For Linux we can use the system call table in the header file
+ /usr/include/asm/unistd.h
+ of the kernel. But these symbols do not follow the SYS_* syntax
+ so we have to redefine the `SYS_ify' macro here. */
+#undef SYS_ify
+#ifdef __STDC__
+# define SYS_ify(syscall_name) __NR_##syscall_name
+#else
+# define SYS_ify(syscall_name) __NR_/**/syscall_name
+#endif
+
+/* Linux uses a negative return value to indicate syscall errors, unlike
+ most Unices, which use the condition codes' carry flag.
+
+ Since version 2.1 the return value of a system call might be negative
+ even if the call succeeded. E.g., the `lseek' system call might return
+ a large offset. Therefore we must not anymore test for < 0, but test
+ for a real error by making sure the value in %d0 is a real error
+ number. Linus said he will make sure the no syscall returns a value
+ in -1 .. -4095 as a valid result so we can savely test with -4095. */
+
+/* We don't want the label for the error handler to be visible in the symbol
+ table when we define it here. */
+#define SYSCALL_ERROR_LABEL __syscall_error
+
+#undef PSEUDO
+#define PSEUDO(name, syscall_name, args) \
+ ENTRY(name) \
+ DO_CALL (SYS_ify(syscall_name)); \
+ cmp.eq p6,p0=-1,r10; \
+(p6) br.cond.spnt.few __syscall_error;
+
+#define DO_CALL_VIA_BREAK(num) \
+ mov r15=num; \
+ break __BREAK_SYSCALL
+
+#ifdef IA64_USE_NEW_STUB
+# ifdef SHARED
+# define DO_CALL(num) \
+ .prologue; \
+ adds r2 = SYSINFO_OFFSET, r13;; \
+ ld8 r2 = [r2]; \
+ .save ar.pfs, r11; \
+ mov r11 = ar.pfs;; \
+ .body; \
+ mov r15 = num; \
+ mov b7 = r2; \
+ br.call.sptk.many b6 = b7;; \
+ .restore sp; \
+ mov ar.pfs = r11; \
+ .prologue; \
+ .body
+# else /* !SHARED */
+# define DO_CALL(num) \
+ .prologue; \
+ mov r15 = num; \
+ movl r2 = _dl_sysinfo;; \
+ ld8 r2 = [r2]; \
+ .save ar.pfs, r11; \
+ mov r11 = ar.pfs;; \
+ .body; \
+ mov b7 = r2; \
+ br.call.sptk.many b6 = b7;; \
+ .restore sp; \
+ mov ar.pfs = r11; \
+ .prologue; \
+ .body
+# endif
+#else
+# define DO_CALL(num) DO_CALL_VIA_BREAK(num)
+#endif
+
+#undef PSEUDO_END
+#define PSEUDO_END(name) .endp C_SYMBOL_NAME(name);
+
+#undef PSEUDO_NOERRNO
+#define PSEUDO_NOERRNO(name, syscall_name, args) \
+ ENTRY(name) \
+ DO_CALL (SYS_ify(syscall_name));
+
+#undef PSEUDO_END_NOERRNO
+#define PSEUDO_END_NOERRNO(name) .endp C_SYMBOL_NAME(name);
+
+#undef PSEUDO_ERRVAL
+#define PSEUDO_ERRVAL(name, syscall_name, args) \
+ ENTRY(name) \
+ DO_CALL (SYS_ify(syscall_name)); \
+ cmp.eq p6,p0=-1,r10; \
+(p6) mov r10=r8;
+
+
+#undef PSEUDO_END_ERRVAL
+#define PSEUDO_END_ERRVAL(name) .endp C_SYMBOL_NAME(name);
+
+#undef END
+#define END(name) \
+ .size C_SYMBOL_NAME(name), . - C_SYMBOL_NAME(name) ; \
+ .endp C_SYMBOL_NAME(name)
+
+#define ret br.ret.sptk.few b0
+#define ret_NOERRNO ret
+#define ret_ERRVAL ret
+
+#endif /* not __ASSEMBLER__ */
+
+#endif /* linux/ia64/sysdep.h */
diff --git a/ap/build/uClibc/libc/string/memccpy.c b/ap/build/uClibc/libc/string/memccpy.c
new file mode 100644
index 0000000..076bdac
--- /dev/null
+++ b/ap/build/uClibc/libc/string/memccpy.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/* No wide analog. */
+
+#include "_string.h"
+
+void *memccpy(void * __restrict s1, const void * __restrict s2, int c, size_t n)
+{
+ register char *r1 = s1;
+ register const char *r2 = s2;
+
+ while (n-- && (((unsigned char)(*r1++ = *r2++)) != ((unsigned char) c)));
+
+ return (n == (size_t) -1) ? NULL : r1;
+}
+libc_hidden_def(memccpy)
diff --git a/ap/build/uClibc/libc/string/memchr.c b/ap/build/uClibc/libc/string/memchr.c
new file mode 100644
index 0000000..99e13a2
--- /dev/null
+++ b/ap/build/uClibc/libc/string/memchr.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wmemchr wmemchr
+#else
+# undef memchr
+# define Wmemchr memchr
+#endif
+
+Wvoid *Wmemchr(const Wvoid *s, Wint c, size_t n)
+{
+ register const Wuchar *r = (const Wuchar *) s;
+
+ while (n) {
+ if (*r == ((Wuchar)c)) {
+ return (Wvoid *) r; /* silence the warning */
+ }
+ ++r;
+ --n;
+ }
+
+ return NULL;
+}
+
+libc_hidden_def(Wmemchr)
diff --git a/ap/build/uClibc/libc/string/memcmp.c b/ap/build/uClibc/libc/string/memcmp.c
new file mode 100644
index 0000000..6cb37f4
--- /dev/null
+++ b/ap/build/uClibc/libc/string/memcmp.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wmemcmp wmemcmp
+#else
+# define Wmemcmp memcmp
+#endif
+
+int Wmemcmp(const Wvoid *s1, const Wvoid *s2, size_t n)
+{
+ register const Wuchar *r1 = (const Wuchar *) s1;
+ register const Wuchar *r2 = (const Wuchar *) s2;
+
+#ifdef WANT_WIDE
+ while (n && (*r1 == *r2)) {
+ ++r1;
+ ++r2;
+ --n;
+ }
+
+ return (n == 0) ? 0 : ((*r1 < *r2) ? -1 : 1);
+#else
+ int r = 0;
+
+ while (n-- && ((r = ((int)(*r1++)) - *r2++) == 0));
+
+ return r;
+#endif
+}
+
+#ifndef WANT_WIDE
+libc_hidden_def(memcmp)
+# ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(memcmp,bcmp)
+# endif
+#endif
diff --git a/ap/build/uClibc/libc/string/memcpy.c b/ap/build/uClibc/libc/string/memcpy.c
new file mode 100644
index 0000000..42436e0
--- /dev/null
+++ b/ap/build/uClibc/libc/string/memcpy.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wmemcpy wmemcpy
+#else
+# undef memcpy
+# define Wmemcpy memcpy
+#endif
+
+Wvoid *Wmemcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
+{
+ register Wchar *r1 = s1;
+ register const Wchar *r2 = s2;
+
+ while (n) {
+ *r1++ = *r2++;
+ --n;
+ }
+
+ return s1;
+}
+libc_hidden_def(Wmemcpy)
diff --git a/ap/build/uClibc/libc/string/memmem.c b/ap/build/uClibc/libc/string/memmem.c
new file mode 100644
index 0000000..1b3a0ba
--- /dev/null
+++ b/ap/build/uClibc/libc/string/memmem.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef __USE_GNU
+void *memmem(const void *haystack, size_t haystacklen,
+ const void *needle, size_t needlelen)
+{
+ register const char *ph;
+ register const char *pn;
+ const char *plast;
+ size_t n;
+
+ if (needlelen == 0) {
+ return (void *) haystack;
+ }
+
+ if (haystacklen >= needlelen) {
+ ph = (const char *) haystack;
+ pn = (const char *) needle;
+ plast = ph + (haystacklen - needlelen);
+
+ do {
+ n = 0;
+ while (ph[n] == pn[n]) {
+ if (++n == needlelen) {
+ return (void *) ph;
+ }
+ }
+ } while (++ph <= plast);
+ }
+
+ return NULL;
+}
+#endif
diff --git a/ap/build/uClibc/libc/string/memmove.c b/ap/build/uClibc/libc/string/memmove.c
new file mode 100644
index 0000000..9fb0efe
--- /dev/null
+++ b/ap/build/uClibc/libc/string/memmove.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wmemmove wmemmove
+#else
+# define Wmemmove memmove
+#endif
+
+Wvoid *Wmemmove(Wvoid *s1, const Wvoid *s2, size_t n)
+{
+ register Wchar *s = (Wchar *) s1;
+ register const Wchar *p = (const Wchar *) s2;
+
+ if (p >= s) {
+ while (n) {
+ *s++ = *p++;
+ --n;
+ }
+ } else {
+ while (n) {
+ --n;
+ s[n] = p[n];
+ }
+ }
+
+ return s1;
+}
+
+#ifndef WANT_WIDE
+libc_hidden_def(Wmemmove)
+#endif
diff --git a/ap/build/uClibc/libc/string/mempcpy.c b/ap/build/uClibc/libc/string/mempcpy.c
new file mode 100644
index 0000000..d1d752b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/mempcpy.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef __USE_GNU
+
+#ifdef WANT_WIDE
+# define Wmempcpy wmempcpy
+#else
+# undef mempcpy
+# define Wmempcpy mempcpy
+#endif
+
+Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
+{
+ register Wchar *r1 = s1;
+ register const Wchar *r2 = s2;
+
+ while (n) {
+ *r1++ = *r2++;
+ --n;
+ }
+
+ return r1;
+}
+
+libc_hidden_weak(Wmempcpy)
+#endif
diff --git a/ap/build/uClibc/libc/string/memrchr.c b/ap/build/uClibc/libc/string/memrchr.c
new file mode 100644
index 0000000..60211f8
--- /dev/null
+++ b/ap/build/uClibc/libc/string/memrchr.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef __USE_GNU
+void *memrchr(const void *s, int c, size_t n)
+{
+ register const unsigned char *r;
+
+ r = ((unsigned char *)s) + ((size_t) n);
+
+ while (n) {
+ if (*--r == ((unsigned char)c)) {
+ return (void *) r; /* silence the warning */
+ }
+ --n;
+ }
+
+ return NULL;
+}
+
+libc_hidden_def(memrchr)
+#endif
diff --git a/ap/build/uClibc/libc/string/memset.c b/ap/build/uClibc/libc/string/memset.c
new file mode 100644
index 0000000..2a7c19d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/memset.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wmemset wmemset
+#else
+# undef memset
+# define Wmemset memset
+#endif
+
+Wvoid *Wmemset(Wvoid *s, Wint c, size_t n)
+{
+ register Wuchar *p = (Wuchar *) s;
+
+ while (n) {
+ *p++ = (Wuchar) c;
+ --n;
+ }
+
+ return s;
+}
+
+#ifndef WANT_WIDE
+libc_hidden_def(memset)
+#endif
diff --git a/ap/build/uClibc/libc/string/microblaze/Makefile b/ap/build/uClibc/libc/string/microblaze/Makefile
new file mode 100644
index 0000000..5bdfef2
--- /dev/null
+++ b/ap/build/uClibc/libc/string/microblaze/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir := ../../../
+top_builddir := ../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/microblaze/memcpy.S b/ap/build/uClibc/libc/string/microblaze/memcpy.S
new file mode 100644
index 0000000..7cf081e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/microblaze/memcpy.S
@@ -0,0 +1,326 @@
+/*
+ * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2008-2009 PetaLogix
+ * Copyright (C) 2008 Jim Law - Iris LP All rights reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * Written by Jim Law <jlaw@irispower.com>
+ *
+ * intended to replace:
+ * memcpy in memcpy.c and
+ * memmove in memmove.c
+ * ... in arch/microblaze/lib
+ *
+ *
+ * assly_fastcopy.S
+ *
+ * Attempt at quicker memcpy and memmove for MicroBlaze
+ * Input : Operand1 in Reg r5 - destination address
+ * Operand2 in Reg r6 - source address
+ * Operand3 in Reg r7 - number of bytes to transfer
+ * Output: Result in Reg r3 - starting destinaition address
+ *
+ *
+ * Explanation:
+ * Perform (possibly unaligned) copy of a block of memory
+ * between mem locations with size of xfer spec'd in bytes
+ */
+
+ .text
+ .globl memcpy
+ .type memcpy, @function
+ .ent memcpy
+
+memcpy:
+fast_memcpy_ascending:
+ /* move d to return register as value of function */
+ addi r3, r5, 0
+
+ addi r4, r0, 4 /* n = 4 */
+ cmpu r4, r4, r7 /* n = c - n (unsigned) */
+ blti r4, a_xfer_end /* if n < 0, less than one word to transfer */
+
+ /* transfer first 0~3 bytes to get aligned dest address */
+ andi r4, r5, 3 /* n = d & 3 */
+ /* if zero, destination already aligned */
+ beqi r4, a_dalign_done
+ /* n = 4 - n (yields 3, 2, 1 transfers for 1, 2, 3 addr offset) */
+ rsubi r4, r4, 4
+ rsub r7, r4, r7 /* c = c - n adjust c */
+
+a_xfer_first_loop:
+ /* if no bytes left to transfer, transfer the bulk */
+ beqi r4, a_dalign_done
+ lbui r11, r6, 0 /* h = *s */
+ sbi r11, r5, 0 /* *d = h */
+ addi r6, r6, 1 /* s++ */
+ addi r5, r5, 1 /* d++ */
+ brid a_xfer_first_loop /* loop */
+ addi r4, r4, -1 /* n-- (IN DELAY SLOT) */
+
+a_dalign_done:
+ addi r4, r0, 32 /* n = 32 */
+ cmpu r4, r4, r7 /* n = c - n (unsigned) */
+ /* if n < 0, less than one block to transfer */
+ blti r4, a_block_done
+
+a_block_xfer:
+ andi r9, r6, 3 /* t1 = s & 3 */
+ /* if temp == 0, everything is word-aligned */
+ beqi r9, a_word_xfer
+
+a_block_unaligned:
+ andi r4, r7, 0xffffffe0 /* n = c & ~31 */
+ rsub r7, r4, r7 /* c = c - n */
+ andi r8, r6, 0xfffffffc /* as = s & ~3 */
+ add r6, r6, r4 /* s = s + n */
+ lwi r11, r8, 0 /* h = *(as + 0) */
+
+ addi r9, r9, -1
+ beqi r9, a_block_u1 /* t1 was 1 => 1 byte offset */
+ addi r9, r9, -1
+ beqi r9, a_block_u2 /* t1 was 2 => 2 byte offset */
+
+a_block_u3:
+ bslli r11, r11, 24 /* h = h << 24 */
+a_bu3_loop:
+ lwi r12, r8, 4 /* v = *(as + 4) */
+ bsrli r9, r12, 8 /* t1 = v >> 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 0 /* *(d + 0) = t1 */
+ bslli r11, r12, 24 /* h = v << 24 */
+ lwi r12, r8, 8 /* v = *(as + 8) */
+ bsrli r9, r12, 8 /* t1 = v >> 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 4 /* *(d + 4) = t1 */
+ bslli r11, r12, 24 /* h = v << 24 */
+ lwi r12, r8, 12 /* v = *(as + 12) */
+ bsrli r9, r12, 8 /* t1 = v >> 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 8 /* *(d + 8) = t1 */
+ bslli r11, r12, 24 /* h = v << 24 */
+ lwi r12, r8, 16 /* v = *(as + 16) */
+ bsrli r9, r12, 8 /* t1 = v >> 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 12 /* *(d + 12) = t1 */
+ bslli r11, r12, 24 /* h = v << 24 */
+ lwi r12, r8, 20 /* v = *(as + 20) */
+ bsrli r9, r12, 8 /* t1 = v >> 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 16 /* *(d + 16) = t1 */
+ bslli r11, r12, 24 /* h = v << 24 */
+ lwi r12, r8, 24 /* v = *(as + 24) */
+ bsrli r9, r12, 8 /* t1 = v >> 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 20 /* *(d + 20) = t1 */
+ bslli r11, r12, 24 /* h = v << 24 */
+ lwi r12, r8, 28 /* v = *(as + 28) */
+ bsrli r9, r12, 8 /* t1 = v >> 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 24 /* *(d + 24) = t1 */
+ bslli r11, r12, 24 /* h = v << 24 */
+ lwi r12, r8, 32 /* v = *(as + 32) */
+ bsrli r9, r12, 8 /* t1 = v >> 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 28 /* *(d + 28) = t1 */
+ bslli r11, r12, 24 /* h = v << 24 */
+ addi r8, r8, 32 /* as = as + 32 */
+ addi r4, r4, -32 /* n = n - 32 */
+ bneid r4, a_bu3_loop /* while (n) loop */
+ addi r5, r5, 32 /* d = d + 32 (IN DELAY SLOT) */
+ bri a_block_done
+
+a_block_u1:
+ bslli r11, r11, 8 /* h = h << 8 */
+a_bu1_loop:
+ lwi r12, r8, 4 /* v = *(as + 4) */
+ bsrli r9, r12, 24 /* t1 = v >> 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 0 /* *(d + 0) = t1 */
+ bslli r11, r12, 8 /* h = v << 8 */
+ lwi r12, r8, 8 /* v = *(as + 8) */
+ bsrli r9, r12, 24 /* t1 = v >> 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 4 /* *(d + 4) = t1 */
+ bslli r11, r12, 8 /* h = v << 8 */
+ lwi r12, r8, 12 /* v = *(as + 12) */
+ bsrli r9, r12, 24 /* t1 = v >> 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 8 /* *(d + 8) = t1 */
+ bslli r11, r12, 8 /* h = v << 8 */
+ lwi r12, r8, 16 /* v = *(as + 16) */
+ bsrli r9, r12, 24 /* t1 = v >> 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 12 /* *(d + 12) = t1 */
+ bslli r11, r12, 8 /* h = v << 8 */
+ lwi r12, r8, 20 /* v = *(as + 20) */
+ bsrli r9, r12, 24 /* t1 = v >> 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 16 /* *(d + 16) = t1 */
+ bslli r11, r12, 8 /* h = v << 8 */
+ lwi r12, r8, 24 /* v = *(as + 24) */
+ bsrli r9, r12, 24 /* t1 = v >> 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 20 /* *(d + 20) = t1 */
+ bslli r11, r12, 8 /* h = v << 8 */
+ lwi r12, r8, 28 /* v = *(as + 28) */
+ bsrli r9, r12, 24 /* t1 = v >> 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 24 /* *(d + 24) = t1 */
+ bslli r11, r12, 8 /* h = v << 8 */
+ lwi r12, r8, 32 /* v = *(as + 32) */
+ bsrli r9, r12, 24 /* t1 = v >> 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 28 /* *(d + 28) = t1 */
+ bslli r11, r12, 8 /* h = v << 8 */
+ addi r8, r8, 32 /* as = as + 32 */
+ addi r4, r4, -32 /* n = n - 32 */
+ bneid r4, a_bu1_loop /* while (n) loop */
+ addi r5, r5, 32 /* d = d + 32 (IN DELAY SLOT) */
+ bri a_block_done
+
+a_block_u2:
+ bslli r11, r11, 16 /* h = h << 16 */
+a_bu2_loop:
+ lwi r12, r8, 4 /* v = *(as + 4) */
+ bsrli r9, r12, 16 /* t1 = v >> 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 0 /* *(d + 0) = t1 */
+ bslli r11, r12, 16 /* h = v << 16 */
+ lwi r12, r8, 8 /* v = *(as + 8) */
+ bsrli r9, r12, 16 /* t1 = v >> 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 4 /* *(d + 4) = t1 */
+ bslli r11, r12, 16 /* h = v << 16 */
+ lwi r12, r8, 12 /* v = *(as + 12) */
+ bsrli r9, r12, 16 /* t1 = v >> 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 8 /* *(d + 8) = t1 */
+ bslli r11, r12, 16 /* h = v << 16 */
+ lwi r12, r8, 16 /* v = *(as + 16) */
+ bsrli r9, r12, 16 /* t1 = v >> 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 12 /* *(d + 12) = t1 */
+ bslli r11, r12, 16 /* h = v << 16 */
+ lwi r12, r8, 20 /* v = *(as + 20) */
+ bsrli r9, r12, 16 /* t1 = v >> 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 16 /* *(d + 16) = t1 */
+ bslli r11, r12, 16 /* h = v << 16 */
+ lwi r12, r8, 24 /* v = *(as + 24) */
+ bsrli r9, r12, 16 /* t1 = v >> 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 20 /* *(d + 20) = t1 */
+ bslli r11, r12, 16 /* h = v << 16 */
+ lwi r12, r8, 28 /* v = *(as + 28) */
+ bsrli r9, r12, 16 /* t1 = v >> 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 24 /* *(d + 24) = t1 */
+ bslli r11, r12, 16 /* h = v << 16 */
+ lwi r12, r8, 32 /* v = *(as + 32) */
+ bsrli r9, r12, 16 /* t1 = v >> 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 28 /* *(d + 28) = t1 */
+ bslli r11, r12, 16 /* h = v << 16 */
+ addi r8, r8, 32 /* as = as + 32 */
+ addi r4, r4, -32 /* n = n - 32 */
+ bneid r4, a_bu2_loop /* while (n) loop */
+ addi r5, r5, 32 /* d = d + 32 (IN DELAY SLOT) */
+
+a_block_done:
+ addi r4, r0, 4 /* n = 4 */
+ cmpu r4, r4, r7 /* n = c - n (unsigned) */
+ blti r4, a_xfer_end /* if n < 0, less than one word to transfer */
+
+a_word_xfer:
+ andi r4, r7, 0xfffffffc /* n = c & ~3 */
+ addi r10, r0, 0 /* offset = 0 */
+
+ andi r9, r6, 3 /* t1 = s & 3 */
+ /* if temp != 0, unaligned transfers needed */
+ bnei r9, a_word_unaligned
+
+a_word_aligned:
+ lw r9, r6, r10 /* t1 = *(s+offset) */
+ sw r9, r5, r10 /* *(d+offset) = t1 */
+ addi r4, r4,-4 /* n-- */
+ bneid r4, a_word_aligned /* loop */
+ addi r10, r10, 4 /* offset++ (IN DELAY SLOT) */
+
+ bri a_word_done
+
+a_word_unaligned:
+ andi r8, r6, 0xfffffffc /* as = s & ~3 */
+ lwi r11, r8, 0 /* h = *(as + 0) */
+ addi r8, r8, 4 /* as = as + 4 */
+
+ addi r9, r9, -1
+ beqi r9, a_word_u1 /* t1 was 1 => 1 byte offset */
+ addi r9, r9, -1
+ beqi r9, a_word_u2 /* t1 was 2 => 2 byte offset */
+
+a_word_u3:
+ bslli r11, r11, 24 /* h = h << 24 */
+a_wu3_loop:
+ lw r12, r8, r10 /* v = *(as + offset) */
+ bsrli r9, r12, 8 /* t1 = v >> 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ sw r9, r5, r10 /* *(d + offset) = t1 */
+ bslli r11, r12, 24 /* h = v << 24 */
+ addi r4, r4,-4 /* n = n - 4 */
+ bneid r4, a_wu3_loop /* while (n) loop */
+ addi r10, r10, 4 /* offset = ofset + 4 (IN DELAY SLOT) */
+
+ bri a_word_done
+
+a_word_u1:
+ bslli r11, r11, 8 /* h = h << 8 */
+a_wu1_loop:
+ lw r12, r8, r10 /* v = *(as + offset) */
+ bsrli r9, r12, 24 /* t1 = v >> 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ sw r9, r5, r10 /* *(d + offset) = t1 */
+ bslli r11, r12, 8 /* h = v << 8 */
+ addi r4, r4,-4 /* n = n - 4 */
+ bneid r4, a_wu1_loop /* while (n) loop */
+ addi r10, r10, 4 /* offset = ofset + 4 (IN DELAY SLOT) */
+
+ bri a_word_done
+
+a_word_u2:
+ bslli r11, r11, 16 /* h = h << 16 */
+a_wu2_loop:
+ lw r12, r8, r10 /* v = *(as + offset) */
+ bsrli r9, r12, 16 /* t1 = v >> 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ sw r9, r5, r10 /* *(d + offset) = t1 */
+ bslli r11, r12, 16 /* h = v << 16 */
+ addi r4, r4,-4 /* n = n - 4 */
+ bneid r4, a_wu2_loop /* while (n) loop */
+ addi r10, r10, 4 /* offset = ofset + 4 (IN DELAY SLOT) */
+
+a_word_done:
+ add r5, r5, r10 /* d = d + offset */
+ add r6, r6, r10 /* s = s + offset */
+ rsub r7, r10, r7 /* c = c - offset */
+
+a_xfer_end:
+a_xfer_end_loop:
+ beqi r7, a_done /* while (c) */
+ lbui r9, r6, 0 /* t1 = *s */
+ addi r6, r6, 1 /* s++ */
+ sbi r9, r5, 0 /* *d = t1 */
+ addi r7, r7, -1 /* c-- */
+ brid a_xfer_end_loop /* loop */
+ addi r5, r5, 1 /* d++ (IN DELAY SLOT) */
+
+a_done:
+ rtsd r15, 8
+ nop
+
+.size memcpy, . - memcpy
+.end memcpy
+libc_hidden_def(memcpy)
diff --git a/ap/build/uClibc/libc/string/microblaze/memmove.S b/ap/build/uClibc/libc/string/microblaze/memmove.S
new file mode 100644
index 0000000..29233f5
--- /dev/null
+++ b/ap/build/uClibc/libc/string/microblaze/memmove.S
@@ -0,0 +1,348 @@
+/*
+ * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu>
+ * Copyright (C) 2008-2009 PetaLogix
+ * Copyright (C) 2008 Jim Law - Iris LP All rights reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU General
+ * Public License. See the file COPYING in the main directory of this
+ * archive for more details.
+ *
+ * Written by Jim Law <jlaw@irispower.com>
+ *
+ * intended to replace:
+ * memcpy in memcpy.c and
+ * memmove in memmove.c
+ * ... in arch/microblaze/lib
+ *
+ *
+ * assly_fastcopy.S
+ *
+ * Attempt at quicker memcpy and memmove for MicroBlaze
+ * Input : Operand1 in Reg r5 - destination address
+ * Operand2 in Reg r6 - source address
+ * Operand3 in Reg r7 - number of bytes to transfer
+ * Output: Result in Reg r3 - starting destinaition address
+ *
+ *
+ * Explanation:
+ * Perform (possibly unaligned) copy of a block of memory
+ * between mem locations with size of xfer spec'd in bytes
+ */
+
+ .globl memmove
+ .type memmove, @function
+ .ent memmove
+
+memmove:
+ cmpu r4, r5, r6 /* n = s - d */
+ bgei r4, HIDDEN_JUMPTARGET(memcpy)
+
+fast_memcpy_descending:
+ /* move d to return register as value of function */
+ addi r3, r5, 0
+
+ add r5, r5, r7 /* d = d + c */
+ add r6, r6, r7 /* s = s + c */
+
+ addi r4, r0, 4 /* n = 4 */
+ cmpu r4, r4, r7 /* n = c - n (unsigned) */
+ blti r4,d_xfer_end /* if n < 0, less than one word to transfer */
+
+ /* transfer first 0~3 bytes to get aligned dest address */
+ andi r4, r5, 3 /* n = d & 3 */
+ /* if zero, destination already aligned */
+ beqi r4,d_dalign_done
+ rsub r7, r4, r7 /* c = c - n adjust c */
+
+d_xfer_first_loop:
+ /* if no bytes left to transfer, transfer the bulk */
+ beqi r4,d_dalign_done
+ addi r6, r6, -1 /* s-- */
+ addi r5, r5, -1 /* d-- */
+ lbui r11, r6, 0 /* h = *s */
+ sbi r11, r5, 0 /* *d = h */
+ brid d_xfer_first_loop /* loop */
+ addi r4, r4, -1 /* n-- (IN DELAY SLOT) */
+
+d_dalign_done:
+ addi r4, r0, 32 /* n = 32 */
+ cmpu r4, r4, r7 /* n = c - n (unsigned) */
+ /* if n < 0, less than one block to transfer */
+ blti r4, d_block_done
+
+d_block_xfer:
+ andi r4, r7, 0xffffffe0 /* n = c & ~31 */
+ rsub r7, r4, r7 /* c = c - n */
+
+ andi r9, r6, 3 /* t1 = s & 3 */
+ /* if temp != 0, unaligned transfers needed */
+ bnei r9, d_block_unaligned
+
+d_block_aligned:
+ addi r6, r6, -32 /* s = s - 32 */
+ addi r5, r5, -32 /* d = d - 32 */
+ lwi r9, r6, 28 /* t1 = *(s + 28) */
+ lwi r10, r6, 24 /* t2 = *(s + 24) */
+ lwi r11, r6, 20 /* t3 = *(s + 20) */
+ lwi r12, r6, 16 /* t4 = *(s + 16) */
+ swi r9, r5, 28 /* *(d + 28) = t1 */
+ swi r10, r5, 24 /* *(d + 24) = t2 */
+ swi r11, r5, 20 /* *(d + 20) = t3 */
+ swi r12, r5, 16 /* *(d + 16) = t4 */
+ lwi r9, r6, 12 /* t1 = *(s + 12) */
+ lwi r10, r6, 8 /* t2 = *(s + 8) */
+ lwi r11, r6, 4 /* t3 = *(s + 4) */
+ lwi r12, r6, 0 /* t4 = *(s + 0) */
+ swi r9, r5, 12 /* *(d + 12) = t1 */
+ swi r10, r5, 8 /* *(d + 8) = t2 */
+ swi r11, r5, 4 /* *(d + 4) = t3 */
+ addi r4, r4, -32 /* n = n - 32 */
+ bneid r4, d_block_aligned /* while (n) loop */
+ swi r12, r5, 0 /* *(d + 0) = t4 (IN DELAY SLOT) */
+ bri d_block_done
+
+d_block_unaligned:
+ andi r8, r6, 0xfffffffc /* as = s & ~3 */
+ rsub r6, r4, r6 /* s = s - n */
+ lwi r11, r8, 0 /* h = *(as + 0) */
+
+ addi r9, r9, -1
+ beqi r9,d_block_u1 /* t1 was 1 => 1 byte offset */
+ addi r9, r9, -1
+ beqi r9,d_block_u2 /* t1 was 2 => 2 byte offset */
+
+d_block_u3:
+ bsrli r11, r11, 8 /* h = h >> 8 */
+d_bu3_loop:
+ addi r8, r8, -32 /* as = as - 32 */
+ addi r5, r5, -32 /* d = d - 32 */
+ lwi r12, r8, 28 /* v = *(as + 28) */
+ bslli r9, r12, 24 /* t1 = v << 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 28 /* *(d + 28) = t1 */
+ bsrli r11, r12, 8 /* h = v >> 8 */
+ lwi r12, r8, 24 /* v = *(as + 24) */
+ bslli r9, r12, 24 /* t1 = v << 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 24 /* *(d + 24) = t1 */
+ bsrli r11, r12, 8 /* h = v >> 8 */
+ lwi r12, r8, 20 /* v = *(as + 20) */
+ bslli r9, r12, 24 /* t1 = v << 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 20 /* *(d + 20) = t1 */
+ bsrli r11, r12, 8 /* h = v >> 8 */
+ lwi r12, r8, 16 /* v = *(as + 16) */
+ bslli r9, r12, 24 /* t1 = v << 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 16 /* *(d + 16) = t1 */
+ bsrli r11, r12, 8 /* h = v >> 8 */
+ lwi r12, r8, 12 /* v = *(as + 12) */
+ bslli r9, r12, 24 /* t1 = v << 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 12 /* *(d + 112) = t1 */
+ bsrli r11, r12, 8 /* h = v >> 8 */
+ lwi r12, r8, 8 /* v = *(as + 8) */
+ bslli r9, r12, 24 /* t1 = v << 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 8 /* *(d + 8) = t1 */
+ bsrli r11, r12, 8 /* h = v >> 8 */
+ lwi r12, r8, 4 /* v = *(as + 4) */
+ bslli r9, r12, 24 /* t1 = v << 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 4 /* *(d + 4) = t1 */
+ bsrli r11, r12, 8 /* h = v >> 8 */
+ lwi r12, r8, 0 /* v = *(as + 0) */
+ bslli r9, r12, 24 /* t1 = v << 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 0 /* *(d + 0) = t1 */
+ addi r4, r4, -32 /* n = n - 32 */
+ bneid r4, d_bu3_loop /* while (n) loop */
+ bsrli r11, r12, 8 /* h = v >> 8 (IN DELAY SLOT) */
+ bri d_block_done
+
+d_block_u1:
+ bsrli r11, r11, 24 /* h = h >> 24 */
+d_bu1_loop:
+ addi r8, r8, -32 /* as = as - 32 */
+ addi r5, r5, -32 /* d = d - 32 */
+ lwi r12, r8, 28 /* v = *(as + 28) */
+ bslli r9, r12, 8 /* t1 = v << 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 28 /* *(d + 28) = t1 */
+ bsrli r11, r12, 24 /* h = v >> 24 */
+ lwi r12, r8, 24 /* v = *(as + 24) */
+ bslli r9, r12, 8 /* t1 = v << 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 24 /* *(d + 24) = t1 */
+ bsrli r11, r12, 24 /* h = v >> 24 */
+ lwi r12, r8, 20 /* v = *(as + 20) */
+ bslli r9, r12, 8 /* t1 = v << 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 20 /* *(d + 20) = t1 */
+ bsrli r11, r12, 24 /* h = v >> 24 */
+ lwi r12, r8, 16 /* v = *(as + 16) */
+ bslli r9, r12, 8 /* t1 = v << 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 16 /* *(d + 16) = t1 */
+ bsrli r11, r12, 24 /* h = v >> 24 */
+ lwi r12, r8, 12 /* v = *(as + 12) */
+ bslli r9, r12, 8 /* t1 = v << 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 12 /* *(d + 112) = t1 */
+ bsrli r11, r12, 24 /* h = v >> 24 */
+ lwi r12, r8, 8 /* v = *(as + 8) */
+ bslli r9, r12, 8 /* t1 = v << 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 8 /* *(d + 8) = t1 */
+ bsrli r11, r12, 24 /* h = v >> 24 */
+ lwi r12, r8, 4 /* v = *(as + 4) */
+ bslli r9, r12, 8 /* t1 = v << 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 4 /* *(d + 4) = t1 */
+ bsrli r11, r12, 24 /* h = v >> 24 */
+ lwi r12, r8, 0 /* v = *(as + 0) */
+ bslli r9, r12, 8 /* t1 = v << 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 0 /* *(d + 0) = t1 */
+ addi r4, r4, -32 /* n = n - 32 */
+ bneid r4, d_bu1_loop /* while (n) loop */
+ bsrli r11, r12, 24 /* h = v >> 24 (IN DELAY SLOT) */
+ bri d_block_done
+
+d_block_u2:
+ bsrli r11, r11, 16 /* h = h >> 16 */
+d_bu2_loop:
+ addi r8, r8, -32 /* as = as - 32 */
+ addi r5, r5, -32 /* d = d - 32 */
+ lwi r12, r8, 28 /* v = *(as + 28) */
+ bslli r9, r12, 16 /* t1 = v << 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 28 /* *(d + 28) = t1 */
+ bsrli r11, r12, 16 /* h = v >> 16 */
+ lwi r12, r8, 24 /* v = *(as + 24) */
+ bslli r9, r12, 16 /* t1 = v << 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 24 /* *(d + 24) = t1 */
+ bsrli r11, r12, 16 /* h = v >> 16 */
+ lwi r12, r8, 20 /* v = *(as + 20) */
+ bslli r9, r12, 16 /* t1 = v << 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 20 /* *(d + 20) = t1 */
+ bsrli r11, r12, 16 /* h = v >> 16 */
+ lwi r12, r8, 16 /* v = *(as + 16) */
+ bslli r9, r12, 16 /* t1 = v << 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 16 /* *(d + 16) = t1 */
+ bsrli r11, r12, 16 /* h = v >> 16 */
+ lwi r12, r8, 12 /* v = *(as + 12) */
+ bslli r9, r12, 16 /* t1 = v << 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 12 /* *(d + 112) = t1 */
+ bsrli r11, r12, 16 /* h = v >> 16 */
+ lwi r12, r8, 8 /* v = *(as + 8) */
+ bslli r9, r12, 16 /* t1 = v << 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 8 /* *(d + 8) = t1 */
+ bsrli r11, r12, 16 /* h = v >> 16 */
+ lwi r12, r8, 4 /* v = *(as + 4) */
+ bslli r9, r12, 16 /* t1 = v << 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 4 /* *(d + 4) = t1 */
+ bsrli r11, r12, 16 /* h = v >> 16 */
+ lwi r12, r8, 0 /* v = *(as + 0) */
+ bslli r9, r12, 16 /* t1 = v << 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ swi r9, r5, 0 /* *(d + 0) = t1 */
+ addi r4, r4, -32 /* n = n - 32 */
+ bneid r4, d_bu2_loop /* while (n) loop */
+ bsrli r11, r12, 16 /* h = v >> 16 (IN DELAY SLOT) */
+
+d_block_done:
+ addi r4, r0, 4 /* n = 4 */
+ cmpu r4, r4, r7 /* n = c - n (unsigned) */
+ blti r4,d_xfer_end /* if n < 0, less than one word to transfer */
+
+d_word_xfer:
+ andi r4, r7, 0xfffffffc /* n = c & ~3 */
+ rsub r5, r4, r5 /* d = d - n */
+ rsub r6, r4, r6 /* s = s - n */
+ rsub r7, r4, r7 /* c = c - n */
+
+ andi r9, r6, 3 /* t1 = s & 3 */
+ /* if temp != 0, unaligned transfers needed */
+ bnei r9, d_word_unaligned
+
+d_word_aligned:
+ addi r4, r4,-4 /* n-- */
+ lw r9, r6, r4 /* t1 = *(s+n) */
+ bneid r4, d_word_aligned /* loop */
+ sw r9, r5, r4 /* *(d+n) = t1 (IN DELAY SLOT) */
+
+ bri d_word_done
+
+d_word_unaligned:
+ andi r8, r6, 0xfffffffc /* as = s & ~3 */
+ lw r11, r8, r4 /* h = *(as + n) */
+
+ addi r9, r9, -1
+ beqi r9,d_word_u1 /* t1 was 1 => 1 byte offset */
+ addi r9, r9, -1
+ beqi r9,d_word_u2 /* t1 was 2 => 2 byte offset */
+
+d_word_u3:
+ bsrli r11, r11, 8 /* h = h >> 8 */
+d_wu3_loop:
+ addi r4, r4,-4 /* n = n - 4 */
+ lw r12, r8, r4 /* v = *(as + n) */
+ bslli r9, r12, 24 /* t1 = v << 24 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ sw r9, r5, r4 /* *(d + n) = t1 */
+ bneid r4, d_wu3_loop /* while (n) loop */
+ bsrli r11, r12, 8 /* h = v >> 8 (IN DELAY SLOT) */
+
+ bri d_word_done
+
+d_word_u1:
+ bsrli r11, r11, 24 /* h = h >> 24 */
+d_wu1_loop:
+ addi r4, r4,-4 /* n = n - 4 */
+ lw r12, r8, r4 /* v = *(as + n) */
+ bslli r9, r12, 8 /* t1 = v << 8 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ sw r9, r5, r4 /* *(d + n) = t1 */
+ bneid r4, d_wu1_loop /* while (n) loop */
+ bsrli r11, r12, 24 /* h = v >> 24 (IN DELAY SLOT) */
+
+ bri d_word_done
+
+d_word_u2:
+ bsrli r11, r11, 16 /* h = h >> 16 */
+d_wu2_loop:
+ addi r4, r4,-4 /* n = n - 4 */
+ lw r12, r8, r4 /* v = *(as + n) */
+ bslli r9, r12, 16 /* t1 = v << 16 */
+ or r9, r11, r9 /* t1 = h | t1 */
+ sw r9, r5, r4 /* *(d + n) = t1 */
+ bneid r4, d_wu2_loop /* while (n) loop */
+ bsrli r11, r12, 16 /* h = v >> 16 (IN DELAY SLOT) */
+
+d_word_done:
+
+d_xfer_end:
+d_xfer_end_loop:
+ beqi r7, a_done /* while (c) */
+ addi r6, r6, -1 /* s-- */
+ lbui r9, r6, 0 /* t1 = *s */
+ addi r5, r5, -1 /* d-- */
+ sbi r9, r5, 0 /* *d = t1 */
+ brid d_xfer_end_loop /* loop */
+ addi r7, r7, -1 /* c-- (IN DELAY SLOT) */
+
+a_done:
+d_done:
+ rtsd r15, 8
+ nop
+
+.size memmove, . - memmove
+.end memmove
+libc_hidden_def(memmove)
diff --git a/ap/build/uClibc/libc/string/mips/Makefile b/ap/build/uClibc/libc/string/mips/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/mips/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/mips/memcpy.S b/ap/build/uClibc/libc/string/mips/memcpy.S
new file mode 100644
index 0000000..9b05ee6
--- /dev/null
+++ b/ap/build/uClibc/libc/string/mips/memcpy.S
@@ -0,0 +1,257 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
+
+ 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 <sysdep.h>*/
+#include <endian.h>
+#include "sysdep.h"
+
+/* void *memcpy(void *s1, const void *s2, size_t n); */
+
+#ifdef __mips64
+
+#include <sys/asm.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define LDHI ldl /* high part is left in big-endian */
+# define SDHI sdl /* high part is left in big-endian */
+# define LDLO ldr /* low part is right in big-endian */
+# define SDLO sdr /* low part is right in big-endian */
+#else
+# define LDHI ldr /* high part is right in little-endian */
+# define SDHI sdr /* high part is right in little-endian */
+# define LDLO ldl /* low part is left in little-endian */
+# define SDLO sdl /* low part is left in little-endian */
+#endif
+
+ENTRY (memcpy)
+ .set noreorder
+
+ slti t0, a2, 16 # Less than 16?
+ bne t0, zero, L(last16)
+ move v0, a0 # Setup exit value before too late
+
+ xor t0, a1, a0 # Find a0/a1 displacement
+ andi t0, 0x7
+ bne t0, zero, L(shift) # Go handle the unaligned case
+ PTR_SUBU t1, zero, a1
+ andi t1, 0x7 # a0/a1 are aligned, but are we
+ beq t1, zero, L(chk8w) # starting in the middle of a word?
+ PTR_SUBU a2, t1
+ LDHI t0, 0(a1) # Yes we are... take care of that
+ PTR_ADDU a1, t1
+ SDHI t0, 0(a0)
+ PTR_ADDU a0, t1
+
+L(chk8w):
+ andi t0, a2, 0x3f # 64 or more bytes left?
+ beq t0, a2, L(chk1w)
+ PTR_SUBU a3, a2, t0 # Yes
+ PTR_ADDU a3, a1 # a3 = end address of loop
+ move a2, t0 # a2 = what will be left after loop
+L(lop8w):
+ ld t0, 0(a1) # Loop taking 8 words at a time
+ ld t1, 8(a1)
+ ld t2, 16(a1)
+ ld t3, 24(a1)
+ ld ta0, 32(a1)
+ ld ta1, 40(a1)
+ ld ta2, 48(a1)
+ ld ta3, 56(a1)
+ PTR_ADDIU a0, 64
+ PTR_ADDIU a1, 64
+ sd t0, -64(a0)
+ sd t1, -56(a0)
+ sd t2, -48(a0)
+ sd t3, -40(a0)
+ sd ta0, -32(a0)
+ sd ta1, -24(a0)
+ sd ta2, -16(a0)
+ bne a1, a3, L(lop8w)
+ sd ta3, -8(a0)
+
+L(chk1w):
+ andi t0, a2, 0x7 # 8 or more bytes left?
+ beq t0, a2, L(last16)
+ PTR_SUBU a3, a2, t0 # Yes, handle them one dword at a time
+ PTR_ADDU a3, a1 # a3 again end address
+ move a2, t0
+L(lop1w):
+ ld t0, 0(a1)
+ PTR_ADDIU a0, 8
+ PTR_ADDIU a1, 8
+ bne a1, a3, L(lop1w)
+ sd t0, -8(a0)
+
+L(last16):
+ blez a2, L(lst16e) # Handle last 16 bytes, one at a time
+ PTR_ADDU a3, a2, a1
+L(lst16l):
+ lb t0, 0(a1)
+ PTR_ADDIU a0, 1
+ PTR_ADDIU a1, 1
+ bne a1, a3, L(lst16l)
+ sb t0, -1(a0)
+L(lst16e):
+ jr ra # Bye, bye
+ nop
+
+L(shift):
+ PTR_SUBU a3, zero, a0 # Src and Dest unaligned
+ andi a3, 0x7 # (unoptimized case...)
+ beq a3, zero, L(shft1)
+ PTR_SUBU a2, a3 # a2 = bytes left
+ LDHI t0, 0(a1) # Take care of first odd part
+ LDLO t0, 7(a1)
+ PTR_ADDU a1, a3
+ SDHI t0, 0(a0)
+ PTR_ADDU a0, a3
+L(shft1):
+ andi t0, a2, 0x7
+ PTR_SUBU a3, a2, t0
+ PTR_ADDU a3, a1
+L(shfth):
+ LDHI t1, 0(a1) # Limp through, dword by dword
+ LDLO t1, 7(a1)
+ PTR_ADDIU a0, 8
+ PTR_ADDIU a1, 8
+ bne a1, a3, L(shfth)
+ sd t1, -8(a0)
+ b L(last16) # Handle anything which may be left
+ move a2, t0
+
+ .set reorder
+END (memcpy)
+
+#else /* !__mips64 */
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define LWHI lwl /* high part is left in big-endian */
+# define SWHI swl /* high part is left in big-endian */
+# define LWLO lwr /* low part is right in big-endian */
+# define SWLO swr /* low part is right in big-endian */
+#else
+# define LWHI lwr /* high part is right in little-endian */
+# define SWHI swr /* high part is right in little-endian */
+# define LWLO lwl /* low part is left in little-endian */
+# define SWLO swl /* low part is left in little-endian */
+#endif
+
+ENTRY (memcpy)
+ .set noreorder
+
+ slti t0, a2, 8 # Less than 8?
+ bne t0, zero, L(last8)
+ move v0, a0 # Setup exit value before too late
+
+ xor t0, a1, a0 # Find a0/a1 displacement
+ andi t0, 0x3
+ bne t0, zero, L(shift) # Go handle the unaligned case
+ subu t1, zero, a1
+ andi t1, 0x3 # a0/a1 are aligned, but are we
+ beq t1, zero, L(chk8w) # starting in the middle of a word?
+ subu a2, t1
+ LWHI t0, 0(a1) # Yes we are... take care of that
+ addu a1, t1
+ SWHI t0, 0(a0)
+ addu a0, t1
+
+L(chk8w):
+ andi t0, a2, 0x1f # 32 or more bytes left?
+ beq t0, a2, L(chk1w)
+ subu a3, a2, t0 # Yes
+ addu a3, a1 # a3 = end address of loop
+ move a2, t0 # a2 = what will be left after loop
+L(lop8w):
+ lw t0, 0(a1) # Loop taking 8 words at a time
+ lw t1, 4(a1)
+ lw t2, 8(a1)
+ lw t3, 12(a1)
+ lw t4, 16(a1)
+ lw t5, 20(a1)
+ lw t6, 24(a1)
+ lw t7, 28(a1)
+ addiu a0, 32
+ addiu a1, 32
+ sw t0, -32(a0)
+ sw t1, -28(a0)
+ sw t2, -24(a0)
+ sw t3, -20(a0)
+ sw t4, -16(a0)
+ sw t5, -12(a0)
+ sw t6, -8(a0)
+ bne a1, a3, L(lop8w)
+ sw t7, -4(a0)
+
+L(chk1w):
+ andi t0, a2, 0x3 # 4 or more bytes left?
+ beq t0, a2, L(last8)
+ subu a3, a2, t0 # Yes, handle them one word at a time
+ addu a3, a1 # a3 again end address
+ move a2, t0
+L(lop1w):
+ lw t0, 0(a1)
+ addiu a0, 4
+ addiu a1, 4
+ bne a1, a3, L(lop1w)
+ sw t0, -4(a0)
+
+L(last8):
+ blez a2, L(lst8e) # Handle last 8 bytes, one at a time
+ addu a3, a2, a1
+L(lst8l):
+ lb t0, 0(a1)
+ addiu a0, 1
+ addiu a1, 1
+ bne a1, a3, L(lst8l)
+ sb t0, -1(a0)
+L(lst8e):
+ jr ra # Bye, bye
+ nop
+
+L(shift):
+ subu a3, zero, a0 # Src and Dest unaligned
+ andi a3, 0x3 # (unoptimized case...)
+ beq a3, zero, L(shft1)
+ subu a2, a3 # a2 = bytes left
+ LWHI t0, 0(a1) # Take care of first odd part
+ LWLO t0, 3(a1)
+ addu a1, a3
+ SWHI t0, 0(a0)
+ addu a0, a3
+L(shft1):
+ andi t0, a2, 0x3
+ subu a3, a2, t0
+ addu a3, a1
+L(shfth):
+ LWHI t1, 0(a1) # Limp through, word by word
+ LWLO t1, 3(a1)
+ addiu a0, 4
+ addiu a1, 4
+ bne a1, a3, L(shfth)
+ sw t1, -4(a0)
+ b L(last8) # Handle anything which may be left
+ move a2, t0
+
+ .set reorder
+END (memcpy)
+
+#endif /* !__mips64 */
+
+libc_hidden_def(memcpy)
diff --git a/ap/build/uClibc/libc/string/mips/memset.S b/ap/build/uClibc/libc/string/mips/memset.S
new file mode 100644
index 0000000..ff0554f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/mips/memset.S
@@ -0,0 +1,159 @@
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
+
+ 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 <sysdep.h>*/
+#include <endian.h>
+#include "sysdep.h"
+
+/* void *memset(void *s, int c, size_t n). */
+
+#ifdef __mips64
+
+#include <sys/asm.h>
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define SDHI sdl /* high part is left in big-endian */
+#else
+# define SDHI sdr /* high part is right in little-endian */
+#endif
+
+ENTRY (memset)
+ .set noreorder
+
+ slti ta1, a2, 16 # Less than 16?
+ bne ta1, zero, L(last16)
+ move v0, a0 # Setup exit value before too late
+
+ beq a1, zero, L(ueven) # If zero pattern, no need to extend
+ andi a1, 0xff # Avoid problems with bogus arguments
+ dsll ta0, a1, 8
+ or a1, ta0
+ dsll ta0, a1, 16
+ or a1, ta0 # a1 is now pattern in full word
+ dsll ta0, a1, 32
+ or a1, ta0 # a1 is now pattern in double word
+
+L(ueven):
+ PTR_SUBU ta0, zero, a0 # Unaligned address?
+ andi ta0, 0x7
+ beq ta0, zero, L(chkw)
+ PTR_SUBU a2, ta0
+ SDHI a1, 0(a0) # Yes, handle first unaligned part
+ PTR_ADDU a0, ta0 # Now both a0 and a2 are updated
+
+L(chkw):
+ andi ta0, a2, 0xf # Enough left for one loop iteration?
+ beq ta0, a2, L(chkl)
+ PTR_SUBU a3, a2, ta0
+ PTR_ADDU a3, a0 # a3 is last loop address +1
+ move a2, ta0 # a2 is now # of bytes left after loop
+L(loopw):
+ PTR_ADDIU a0, 16 # Handle 2 dwords pr. iteration
+ sd a1, -16(a0)
+ bne a0, a3, L(loopw)
+ sd a1, -8(a0)
+
+L(chkl):
+ andi ta0, a2, 0x8 # Check if there is at least a double
+ beq ta0, zero, L(last16) # word remaining after the loop
+ PTR_SUBU a2, ta0
+ sd a1, 0(a0) # Yes...
+ PTR_ADDIU a0, 8
+
+L(last16):
+ blez a2, L(exit) # Handle last 16 bytes (if cnt>0)
+ PTR_ADDU a3, a2, a0 # a3 is last address +1
+L(lst16l):
+ PTR_ADDIU a0, 1
+ bne a0, a3, L(lst16l)
+ sb a1, -1(a0)
+L(exit):
+ j ra # Bye, bye
+ nop
+
+ .set reorder
+END (memset)
+
+#else /* !__mips64 */
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define SWHI swl /* high part is left in big-endian */
+#else
+# define SWHI swr /* high part is right in little-endian */
+#endif
+
+ENTRY (memset)
+ .set noreorder
+
+ slti t1, a2, 8 # Less than 8?
+ bne t1, zero, L(last8)
+ move v0, a0 # Setup exit value before too late
+
+ beq a1, zero, L(ueven) # If zero pattern, no need to extend
+ andi a1, 0xff # Avoid problems with bogus arguments
+ sll t0, a1, 8
+ or a1, t0
+ sll t0, a1, 16
+ or a1, t0 # a1 is now pattern in full word
+
+L(ueven):
+ subu t0, zero, a0 # Unaligned address?
+ andi t0, 0x3
+ beq t0, zero, L(chkw)
+ subu a2, t0
+ SWHI a1, 0(a0) # Yes, handle first unaligned part
+ addu a0, t0 # Now both a0 and a2 are updated
+
+L(chkw):
+ andi t0, a2, 0x7 # Enough left for one loop iteration?
+ beq t0, a2, L(chkl)
+ subu a3, a2, t0
+ addu a3, a0 # a3 is last loop address +1
+ move a2, t0 # a2 is now # of bytes left after loop
+L(loopw):
+ addiu a0, 8 # Handle 2 words pr. iteration
+ sw a1, -8(a0)
+ bne a0, a3, L(loopw)
+ sw a1, -4(a0)
+
+L(chkl):
+ andi t0, a2, 0x4 # Check if there is at least a full
+ beq t0, zero, L(last8) # word remaining after the loop
+ subu a2, t0
+ sw a1, 0(a0) # Yes...
+ addiu a0, 4
+
+L(last8):
+ blez a2, L(exit) # Handle last 8 bytes (if cnt>0)
+ addu a3, a2, a0 # a3 is last address +1
+L(lst8l):
+ addiu a0, 1
+ bne a0, a3, L(lst8l)
+ sb a1, -1(a0)
+L(exit):
+ j ra # Bye, bye
+ nop
+
+ .set reorder
+END (memset)
+
+#endif /* !__mips64 */
+
+libc_hidden_def(memset)
diff --git a/ap/build/uClibc/libc/string/mips/sysdep.h b/ap/build/uClibc/libc/string/mips/sysdep.h
new file mode 100644
index 0000000..5dad834
--- /dev/null
+++ b/ap/build/uClibc/libc/string/mips/sysdep.h
@@ -0,0 +1,45 @@
+/* Adapted from glibc's sysdeps/unix/mips/sysdep.h */
+
+/* Copyright (C) 1992, 1995, 1997, 1999, 2000, 2002, 2003
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Brendan Kehoe (brendan@zen.org).
+
+ 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. */
+
+#ifdef __ASSEMBLER__
+
+#include <sgidefs.h>
+#include <sys/regdef.h>
+
+#define ENTRY(name) \
+ .globl name; \
+ .align 2; \
+ .ent name,0; \
+ name/* use a comment rather than ## to workaround bug in gcc-3.4.x */:
+
+#undef END
+#define END(function) \
+ .end function; \
+ .size function,.-function
+
+#if _MIPS_SIM == _MIPS_SIM_ABI32 || _MIPS_SIM == _MIPS_SIM_ABIO64
+# define L(label) $L ## label
+#else
+# define L(label) .L ## label
+#endif
+
+#endif
diff --git a/ap/build/uClibc/libc/string/powerpc/Makefile b/ap/build/uClibc/libc/string/powerpc/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/powerpc/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/powerpc/memcpy.c b/ap/build/uClibc/libc/string/powerpc/memcpy.c
new file mode 100644
index 0000000..22794ec
--- /dev/null
+++ b/ap/build/uClibc/libc/string/powerpc/memcpy.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2004 Joakim Tjernlund
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/* These are carefully optimized mem*() functions for PPC written in C.
+ * Don't muck around with these function without checking the generated
+ * assembler code.
+ * It is possible to optimize these significantly more by using specific
+ * data cache instructions(mainly dcbz). However that requires knownledge
+ * about the CPU's cache line size.
+ *
+ * BUG ALERT!
+ * The cache instructions on MPC8xx CPU's are buggy(they don't update
+ * the DAR register when causing a DTLB Miss/Error) and cannot be
+ * used on 8xx CPU's without a kernel patch to work around this
+ * problem.
+ */
+
+#include <string.h>
+
+/* PPC can do pre increment and load/store, but not post increment and
+ load/store. Therefore use *++ptr instead of *ptr++. */
+void *memcpy(void *to, const void *from, size_t len)
+{
+ unsigned long rem, chunks, tmp1, tmp2;
+ unsigned char *tmp_to;
+ unsigned char *tmp_from = (unsigned char *)from;
+
+ chunks = len / 8;
+ tmp_from -= 4;
+ tmp_to = to - 4;
+ if (!chunks)
+ goto lessthan8;
+ rem = (unsigned long )tmp_to % 4;
+ if (rem)
+ goto align;
+ copy_chunks:
+ do {
+ /* make gcc to load all data, then store it */
+ tmp1 = *(unsigned long *)(tmp_from+4);
+ tmp_from += 8;
+ tmp2 = *(unsigned long *)tmp_from;
+ *(unsigned long *)(tmp_to+4) = tmp1;
+ tmp_to += 8;
+ *(unsigned long *)tmp_to = tmp2;
+ } while (--chunks);
+ lessthan8:
+ len = len % 8;
+ if (len >= 4) {
+ tmp_from += 4;
+ tmp_to += 4;
+ *(unsigned long *)(tmp_to) = *(unsigned long *)(tmp_from);
+ len -= 4;
+ }
+ if (!len)
+ return to;
+ tmp_from += 3;
+ tmp_to += 3;
+ do {
+ *++tmp_to = *++tmp_from;
+ } while (--len);
+
+ return to;
+ align:
+ /* ???: Do we really need to generate the carry flag here? If not, then:
+ rem -= 4; */
+ rem = 4 - rem;
+ len -= rem;
+ do {
+ *(tmp_to+4) = *(tmp_from+4);
+ ++tmp_from;
+ ++tmp_to;
+ } while (--rem);
+ chunks = len / 8;
+ if (chunks)
+ goto copy_chunks;
+ goto lessthan8;
+}
+libc_hidden_def(memcpy)
diff --git a/ap/build/uClibc/libc/string/powerpc/memmove.c b/ap/build/uClibc/libc/string/powerpc/memmove.c
new file mode 100644
index 0000000..6bd7991
--- /dev/null
+++ b/ap/build/uClibc/libc/string/powerpc/memmove.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2004 Joakim Tjernlund
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/* These are carefully optimized mem*() functions for PPC written in C.
+ * Don't muck around with these function without checking the generated
+ * assembler code.
+ * It is possible to optimize these significantly more by using specific
+ * data cache instructions(mainly dcbz). However that requires knownledge
+ * about the CPU's cache line size.
+ *
+ * BUG ALERT!
+ * The cache instructions on MPC8xx CPU's are buggy(they don't update
+ * the DAR register when causing a DTLB Miss/Error) and cannot be
+ * used on 8xx CPU's without a kernel patch to work around this
+ * problem.
+ */
+
+#include <string.h>
+
+
+void *memmove(void *to, const void *from, size_t n)
+{
+ unsigned long rem, chunks, tmp1, tmp2;
+ unsigned char *tmp_to;
+ unsigned char *tmp_from = (unsigned char *)from;
+
+ if (tmp_from >= (unsigned char *)to)
+ return memcpy(to, from, n);
+ chunks = n / 8;
+ tmp_from += n;
+ tmp_to = to + n;
+ if (!chunks)
+ goto lessthan8;
+ rem = (unsigned long )tmp_to % 4;
+ if (rem)
+ goto align;
+ copy_chunks:
+ do {
+ /* make gcc to load all data, then store it */
+ tmp1 = *(unsigned long *)(tmp_from-4);
+ tmp_from -= 8;
+ tmp2 = *(unsigned long *)tmp_from;
+ *(unsigned long *)(tmp_to-4) = tmp1;
+ tmp_to -= 8;
+ *(unsigned long *)tmp_to = tmp2;
+ } while (--chunks);
+ lessthan8:
+ n = n % 8;
+ if (n >= 4) {
+ *(unsigned long *)(tmp_to-4) = *(unsigned long *)(tmp_from-4);
+ tmp_from -= 4;
+ tmp_to -= 4;
+ n = n-4;
+ }
+ if (!n ) return to;
+ do {
+ *--tmp_to = *--tmp_from;
+ } while (--n);
+
+ return to;
+ align:
+ rem = 4 - rem;
+ n = n - rem;
+ do {
+ *--tmp_to = *--tmp_from;
+ } while (--rem);
+ chunks = n / 8;
+ if (chunks)
+ goto copy_chunks;
+ goto lessthan8;
+}
+libc_hidden_def(memmove)
diff --git a/ap/build/uClibc/libc/string/powerpc/memset.c b/ap/build/uClibc/libc/string/powerpc/memset.c
new file mode 100644
index 0000000..a900b92
--- /dev/null
+++ b/ap/build/uClibc/libc/string/powerpc/memset.c
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2004 Joakim Tjernlund
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/* These are carefully optimized mem*() functions for PPC written in C.
+ * Don't muck around with these function without checking the generated
+ * assembler code.
+ * It is possible to optimize these significantly more by using specific
+ * data cache instructions(mainly dcbz). However that requires knownledge
+ * about the CPU's cache line size.
+ *
+ * BUG ALERT!
+ * The cache instructions on MPC8xx CPU's are buggy(they don't update
+ * the DAR register when causing a DTLB Miss/Error) and cannot be
+ * used on 8xx CPU's without a kernel patch to work around this
+ * problem.
+ */
+
+#include <string.h>
+
+
+static __inline__ int expand_byte_word(int c){
+ /* this does:
+ c = c << 8 | c;
+ c = c << 16 | c ;
+ */
+ __asm__("rlwimi %0,%0,8,16,23\n"
+ "\trlwimi %0,%0,16,0,15\n"
+ : "=r" (c) : "0" (c));
+ return c;
+}
+
+void *memset(void *to, int c, size_t n)
+{
+ unsigned long rem, chunks;
+ unsigned char *tmp_to;
+
+ chunks = n / 8;
+ tmp_to = to - 4;
+ c = expand_byte_word(c);
+ if (!chunks)
+ goto lessthan8;
+ rem = (unsigned long )tmp_to % 4;
+ if (rem)
+ goto align;
+ copy_chunks:
+ do {
+ *(unsigned long *)(tmp_to+4) = c;
+ tmp_to += 4;
+ *(unsigned long *)(tmp_to+4) = c;
+ tmp_to += 4;
+ } while (--chunks);
+ lessthan8:
+ n = n % 8;
+ if (n >= 4) {
+ *(unsigned long *)(tmp_to+4) = c;
+ tmp_to += 4;
+ n = n-4;
+ }
+ if (!n ) return to;
+ tmp_to += 3;
+ do {
+ *++tmp_to = c;
+ } while (--n);
+
+ return to;
+ align:
+ rem = 4 - rem;
+ n = n-rem;
+ do {
+ *(tmp_to+4) = c;
+ ++tmp_to;
+ } while (--rem);
+ chunks = n / 8;
+ if (chunks)
+ goto copy_chunks;
+ goto lessthan8;
+}
+libc_hidden_def(memset)
diff --git a/ap/build/uClibc/libc/string/psignal.c b/ap/build/uClibc/libc/string/psignal.c
new file mode 100644
index 0000000..3e1f68b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/psignal.c
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+
+
+/* TODO: make this threadsafe with a reentrant version of strsignal? */
+
+void psignal(int signum, register const char *message)
+{
+ /* If the program is calling psignal, it's a safe bet that printf and
+ * friends are used as well. It is also possible that the calling
+ * program could buffer stderr, or reassign it. */
+
+ register const char *sep;
+
+ sep = ": ";
+ if (!(message && *message)) { /* Caller did not supply a prefix message */
+ message = (sep += 2); /* or passed an empty string. */
+ }
+
+ fprintf(stderr, "%s%s%s\n", message, sep, strsignal(signum));
+}
diff --git a/ap/build/uClibc/libc/string/rawmemchr.c b/ap/build/uClibc/libc/string/rawmemchr.c
new file mode 100644
index 0000000..f0cb7ee
--- /dev/null
+++ b/ap/build/uClibc/libc/string/rawmemchr.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef __USE_GNU
+void *rawmemchr(const void *s, int c)
+{
+ register const unsigned char *r = s;
+
+ while (*r != ((unsigned char)c)) ++r;
+
+ return (void *) r; /* silence the warning */
+}
+libc_hidden_def(rawmemchr)
+#endif
diff --git a/ap/build/uClibc/libc/string/sh/memchr.S b/ap/build/uClibc/libc/string/sh/memchr.S
new file mode 100644
index 0000000..6b7142f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh/memchr.S
@@ -0,0 +1,30 @@
+/* $Id: memchr.S,v 1.1 2000/04/14 16:49:01 mjd Exp $
+ *
+ * "memchr" implementation of SuperH
+ *
+ * Copyright (C) 1999 Niibe Yutaka
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * void *memchr(const void *s, int c, size_t n);
+ */
+
+#include <sysdep.h>
+
+ENTRY(memchr)
+ tst r6,r6
+ bt/s 2f
+ exts.b r5,r5
+1: mov.b @r4,r1
+ cmp/eq r1,r5
+ bt/s 3f
+ dt r6
+ bf/s 1b
+ add #1,r4
+2: mov #0,r4
+3: rts
+ mov r4,r0
+END(memchr)
+libc_hidden_def (memchr)
diff --git a/ap/build/uClibc/libc/string/sh/sh4/memcpy.S b/ap/build/uClibc/libc/string/sh/sh4/memcpy.S
new file mode 100644
index 0000000..6a229a0
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh/sh4/memcpy.S
@@ -0,0 +1,1006 @@
+/*
+ * "memcpy" implementation of SuperH
+ *
+ * Copyright (C) 1999 Niibe Yutaka
+ * Copyright (c) 2002 STMicroelectronics Ltd
+ * Modified from memcpy.S and micro-optimised for SH4
+ * Stuart Menefy (stuart.menefy@st.com)
+ *
+ * Copyright (c) 2009 STMicroelectronics Ltd
+ * Optimised using prefetching and 64bit data transfer via FPU
+ * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+ */
+
+/*
+ * void *memcpy(void *dst, const void *src, size_t n);
+ *
+ * It is assumed that there is no overlap between src and dst.
+ * If there is an overlap, then the results are undefined.
+ */
+
+#include <sysdep.h>
+#include <endian.h>
+
+#if defined (__LITTLE_ENDIAN__) && defined (__SH_FPU_ANY__)
+#define MEMCPY_USES_FPU
+/* Use paired single precision load or store mode for 64-bit tranfering.
+ * FPSCR.SZ=1,FPSCR.SZ=0 is well defined on both SH4-200 and SH4-300.
+ * Currenlty it has been only implemented and tested for little endian mode. */
+.macro FPU_SET_PAIRED_PREC
+ sts fpscr, r7
+ mov #0x10, r0 ! PR=0 SZ=1
+ shll16 r0
+ lds r0, fpscr
+.endm
+.macro RESTORE_FPSCR
+ lds r7, fpscr
+.endm
+.macro DALLOC
+ ! Cache allocate + store on dst-32.
+ add #-32, r1
+ movca.l r0, @r1
+ add #32, r1
+.endm
+
+#endif
+
+ !
+ ! GHIJ KLMN OPQR --> ...G HIJK LMNO PQR.
+ !
+
+ ! Size is 16 or greater, and may have trailing bytes
+
+ .balign 32
+.Lcase1:
+ ! Read a long word and write a long word at once
+ ! At the start of each iteration, r7 contains last long load
+ add #-1,r5 ! 79 EX
+ mov r4,r2 ! 5 MT (0 cycles latency)
+
+ mov.l @(r0,r5),r7 ! 21 LS (2 cycles latency)
+ add #-4,r5 ! 50 EX
+
+ add #7,r2 ! 79 EX
+ !
+#ifdef __LITTLE_ENDIAN__
+ ! 6 cycles, 4 bytes per iteration
+3: mov.l @(r0,r5),r1 ! 21 LS (latency=2) ! NMLK
+ mov r7, r3 ! 5 MT (latency=0) ! RQPO
+
+ cmp/hi r2,r0 ! 57 MT
+ shll16 r3 ! 103 EX
+
+ mov r1,r6 ! 5 MT (latency=0)
+ shll8 r3 ! 102 EX ! Oxxx
+
+ shlr8 r6 ! 106 EX ! xNML
+ mov r1, r7 ! 5 MT (latency=0)
+
+ or r6,r3 ! 82 EX ! ONML
+ bt/s 3b ! 109 BR
+
+ mov.l r3,@-r0 ! 30 LS
+#else
+3: mov.l @(r0,r5),r1 ! 21 LS (latency=2) ! KLMN
+ mov r7,r3 ! 5 MT (latency=0) ! OPQR
+
+ cmp/hi r2,r0 ! 57 MT
+ shlr16 r3 ! 107 EX
+
+ shlr8 r3 ! 106 EX ! xxxO
+ mov r1,r6 ! 5 MT (latency=0)
+
+ shll8 r6 ! 102 EX ! LMNx
+ mov r1,r7 ! 5 MT (latency=0)
+
+ or r6,r3 ! 82 EX ! LMNO
+ bt/s 3b ! 109 BR
+
+ mov.l r3,@-r0 ! 30 LS
+#endif
+ ! Finally, copy a byte at once, if necessary
+
+ add #4,r5 ! 50 EX
+ cmp/eq r4,r0 ! 54 MT
+
+ add #-6,r2 ! 50 EX
+ bt 9f ! 109 BR
+
+8: cmp/hi r2,r0 ! 57 MT
+ mov.b @(r0,r5),r1 ! 20 LS (latency=2)
+
+ bt/s 8b ! 109 BR
+
+ mov.b r1,@-r0 ! 29 LS
+
+9: rts
+ nop
+
+
+ !
+ ! GHIJ KLMN OPQR --> .GHI JKLM NOPQ R...
+ !
+
+ ! Size is 16 or greater, and may have trailing bytes
+
+ .balign 32
+.Lcase3:
+ ! Read a long word and write a long word at once
+ ! At the start of each iteration, r7 contains last long load
+ add #-3,r5 ! 79 EX
+ mov r4,r2 ! 5 MT (0 cycles latency)
+
+ mov.l @(r0,r5),r7 ! 21 LS (2 cycles latency)
+ add #-4,r5 ! 50 EX
+
+ add #7,r2 ! 79 EX
+ !
+#ifdef __LITTLE_ENDIAN__
+ ! 6 cycles, 4 bytes per iteration
+3: mov.l @(r0,r5),r1 ! 21 LS (latency=2) ! NMLK
+ mov r7, r3 ! 5 MT (latency=0) ! RQPO
+
+ cmp/hi r2,r0 ! 57 MT
+ shll8 r3 ! 102 EX ! QPOx
+
+ mov r1,r6 ! 5 MT (latency=0)
+ shlr16 r6 ! 107 EX
+
+ shlr8 r6 ! 106 EX ! xxxN
+ mov r1, r7 ! 5 MT (latency=0)
+
+ or r6,r3 ! 82 EX ! QPON
+ bt/s 3b ! 109 BR
+
+ mov.l r3,@-r0 ! 30 LS
+#else
+3: mov r7,r3 ! OPQR
+ shlr8 r3 ! xOPQ
+ mov.l @(r0,r5),r7 ! KLMN
+ mov r7,r6
+ shll16 r6
+ shll8 r6 ! Nxxx
+ or r6,r3 ! NOPQ
+ cmp/hi r2,r0
+ bt/s 3b
+ mov.l r3,@-r0
+#endif
+
+ ! Finally, copy a byte at once, if necessary
+
+ add #6,r5 ! 50 EX
+ cmp/eq r4,r0 ! 54 MT
+
+ add #-6,r2 ! 50 EX
+ bt 9f ! 109 BR
+
+8: cmp/hi r2,r0 ! 57 MT
+ mov.b @(r0,r5),r1 ! 20 LS (latency=2)
+
+ bt/s 8b ! 109 BR
+
+ mov.b r1,@-r0 ! 29 LS
+
+9: rts
+ nop
+
+ENTRY(memcpy)
+
+ ! Calculate the invariants which will be used in the remainder
+ ! of the code:
+ !
+ ! r4 --> [ ... ] DST [ ... ] SRC
+ ! [ ... ] [ ... ]
+ ! : :
+ ! r0 --> [ ... ] r0+r5 --> [ ... ]
+ !
+ !
+
+ ! Short circuit the common case of src, dst and len being 32 bit aligned
+ ! and test for zero length move
+
+ mov r6, r0 ! 5 MT (0 cycle latency)
+ or r4, r0 ! 82 EX
+
+ or r5, r0 ! 82 EX
+ tst r6, r6 ! 86 MT
+
+ bt/s 99f ! 111 BR (zero len)
+ tst #3, r0 ! 87 MT
+
+ mov r4, r0 ! 5 MT (0 cycle latency)
+ add r6, r0 ! 49 EX
+
+ bt/s .Lcase00 ! 111 BR (aligned)
+ sub r4, r5 ! 75 EX
+
+ ! Arguments are not nicely long word aligned or zero len.
+ ! Check for small copies, and if so do a simple byte at a time copy.
+ !
+ ! Deciding on an exact value of 'small' is not easy, as the point at which
+ ! using the optimised routines become worthwhile varies (these are the
+ ! cycle counts for differnet sizes using byte-at-a-time vs. optimised):
+ ! size byte-at-time long word byte
+ ! 16 42 39-40 46-50 50-55
+ ! 24 58 43-44 54-58 62-67
+ ! 36 82 49-50 66-70 80-85
+ ! However the penalty for getting it 'wrong' is much higher for long word
+ ! aligned data (and this is more common), so use a value of 16.
+
+ mov #16, r1 ! 6 EX
+ cmp/gt r6,r1 ! 56 MT
+
+ add #-1,r5 ! 50 EX
+ bf/s 6f ! 108 BR (not small)
+
+ mov r5, r3 ! 5 MT (latency=0)
+ shlr r6 ! 104 EX
+
+ mov.b @(r0,r5),r1 ! 20 LS (latency=2)
+ bf/s 4f ! 111 BR
+
+ add #-1,r3 ! 50 EX
+ tst r6, r6 ! 86 MT
+
+ bt/s 98f ! 110 BR
+ mov.b r1,@-r0 ! 29 LS
+
+ ! 4 cycles, 2 bytes per iteration
+3: mov.b @(r0,r5),r1 ! 20 LS (latency=2)
+
+4: mov.b @(r0,r3),r2 ! 20 LS (latency=2)
+ dt r6 ! 67 EX
+
+ mov.b r1,@-r0 ! 29 LS
+ bf/s 3b ! 111 BR
+
+ mov.b r2,@-r0 ! 29 LS
+98:
+ rts
+ nop
+
+99: rts
+ mov r4, r0
+
+ ! Size is not small, so its worthwhile looking for optimisations.
+ ! First align destination to a long word boundary.
+ !
+ ! r5 = normal value -1
+
+6: tst #3, r0 ! 87 MT
+ mov #3, r3 ! 6 EX
+
+ bt/s 2f ! 111 BR
+ and r0,r3 ! 78 EX
+
+ ! 3 cycles, 1 byte per iteration
+1: dt r3 ! 67 EX
+ mov.b @(r0,r5),r1 ! 19 LS (latency=2)
+
+ add #-1, r6 ! 79 EX
+ bf/s 1b ! 109 BR
+
+ mov.b r1,@-r0 ! 28 LS
+
+2: add #1, r5 ! 79 EX
+
+ ! Now select the appropriate bulk transfer code based on relative
+ ! alignment of src and dst.
+
+ mov r0, r3 ! 5 MT (latency=0)
+
+ mov r5, r0 ! 5 MT (latency=0)
+ tst #1, r0 ! 87 MT
+
+ bf/s 1f ! 111 BR
+ mov #64, r7 ! 6 EX
+
+ ! bit 0 clear
+
+ cmp/ge r7, r6 ! 55 MT
+
+ bt/s 2f ! 111 BR
+ tst #2, r0 ! 87 MT
+
+ ! small
+ bt/s .Lcase0
+ mov r3, r0
+
+ bra .Lcase2
+ nop
+
+ ! big
+2: bt/s .Lcase0b
+ mov r3, r0
+
+ bra .Lcase2b
+ nop
+
+ ! bit 0 set
+1: tst #2, r0 ! 87 MT
+
+ bt/s .Lcase1
+ mov r3, r0
+
+ bra .Lcase3
+ nop
+
+
+ !
+ ! GHIJ KLMN OPQR --> GHIJ KLMN OPQR
+ !
+
+ ! src, dst and size are all long word aligned
+ ! size is non-zero
+
+ .balign 32
+.Lcase00:
+ mov #64, r1 ! 6 EX
+ mov r5, r3 ! 5 MT (latency=0)
+
+ cmp/gt r6, r1 ! 56 MT
+ add #-4, r5 ! 50 EX
+
+ bf .Lcase00b ! 108 BR (big loop)
+ shlr2 r6 ! 105 EX
+
+ shlr r6 ! 104 EX
+ mov.l @(r0, r5), r1 ! 21 LS (latency=2)
+
+ bf/s 4f ! 111 BR
+ add #-8, r3 ! 50 EX
+
+ tst r6, r6 ! 86 MT
+ bt/s 5f ! 110 BR
+
+ mov.l r1,@-r0 ! 30 LS
+
+ ! 4 cycles, 2 long words per iteration
+3: mov.l @(r0, r5), r1 ! 21 LS (latency=2)
+
+4: mov.l @(r0, r3), r2 ! 21 LS (latency=2)
+ dt r6 ! 67 EX
+
+ mov.l r1, @-r0 ! 30 LS
+ bf/s 3b ! 109 BR
+
+ mov.l r2, @-r0 ! 30 LS
+
+5: rts
+ nop
+
+
+ ! Size is 16 or greater and less than 64, but may have trailing bytes
+
+ .balign 32
+.Lcase0:
+ add #-4, r5 ! 50 EX
+ mov r4, r7 ! 5 MT (latency=0)
+
+ mov.l @(r0, r5), r1 ! 21 LS (latency=2)
+ mov #4, r2 ! 6 EX
+
+ add #11, r7 ! 50 EX
+ tst r2, r6 ! 86 MT
+
+ mov r5, r3 ! 5 MT (latency=0)
+ bt/s 4f ! 111 BR
+
+ add #-4, r3 ! 50 EX
+ mov.l r1,@-r0 ! 30 LS
+
+ ! 4 cycles, 2 long words per iteration
+3: mov.l @(r0, r5), r1 ! 21 LS (latency=2)
+
+4: mov.l @(r0, r3), r2 ! 21 LS (latency=2)
+ cmp/hi r7, r0
+
+ mov.l r1, @-r0 ! 30 LS
+ bt/s 3b ! 109 BR
+
+ mov.l r2, @-r0 ! 30 LS
+
+ ! Copy the final 0-3 bytes
+
+ add #3,r5 ! 50 EX
+
+ cmp/eq r0, r4 ! 54 MT
+ add #-10, r7 ! 50 EX
+
+ bt 9f ! 110 BR
+
+ ! 3 cycles, 1 byte per iteration
+1: mov.b @(r0,r5),r1 ! 19 LS
+ cmp/hi r7,r0 ! 57 MT
+
+ bt/s 1b ! 111 BR
+ mov.b r1,@-r0 ! 28 LS
+
+9: rts
+ nop
+
+ ! Size is at least 64 bytes, so will be going round the big loop at least once.
+ !
+ ! r2 = rounded up r4
+ ! r3 = rounded down r0
+
+ .balign 32
+.Lcase0b:
+ add #-4, r5 ! 50 EX
+
+.Lcase00b:
+ mov r0, r3 ! 5 MT (latency=0)
+ mov #(~0x1f), r1 ! 6 EX
+
+ and r1, r3 ! 78 EX
+ mov r4, r2 ! 5 MT (latency=0)
+
+ cmp/eq r3, r0 ! 54 MT
+ add #0x1f, r2 ! 50 EX
+
+ bt/s 1f ! 110 BR
+ and r1, r2 ! 78 EX
+
+ ! copy initial words until cache line aligned
+
+ mov.l @(r0, r5), r1 ! 21 LS (latency=2)
+ tst #4, r0 ! 87 MT
+
+ mov r5, r6 ! 5 MT (latency=0)
+ add #-4, r6 ! 50 EX
+
+ bt/s 4f ! 111 BR
+ add #8, r3 ! 50 EX
+
+ tst #0x18, r0 ! 87 MT
+
+ bt/s 1f ! 109 BR
+ mov.l r1,@-r0 ! 30 LS
+
+ ! 4 cycles, 2 long words per iteration
+3: mov.l @(r0, r5), r1 ! 21 LS (latency=2)
+
+4: mov.l @(r0, r6), r7 ! 21 LS (latency=2)
+ cmp/eq r3, r0 ! 54 MT
+
+ mov.l r1, @-r0 ! 30 LS
+ bf/s 3b ! 109 BR
+
+ mov.l r7, @-r0 ! 30 LS
+
+#ifdef MEMCPY_USES_FPU
+ ! Copy the cache line aligned blocks by using the FPU registers.
+ ! If src and dst are well aligned adopt 64-bit data transfer.
+ ! We also need r0 as a temporary (for movca), so 'undo' the invariant:
+ ! r5: src (was r0+r5)
+ ! r1: dest (was r0)
+1:
+ add r0, r5
+ mov r0, r1
+
+ mov r1, r3 ! MT
+ sub r2, r3 ! EX (r3 - r2 -> r3)
+ mov #-5, r0
+ shld r0, r3 ! number of the cache lines
+
+ mov #8, r0
+ cmp/ge r0, r3 ! Check if there are many cache lines to copy.
+ bf 45f ! Copy cache line aligned blocks without pref.
+ mov r5, r0
+ add #-0x7c, r0
+ tst #7, r0 ! src is 8byte aligned
+ bf 45f
+
+ ! Many cache lines have to be copied and the buffers are well aligned.
+ ! Aggressive prefetching and FPU in single paired precision.
+ mov r0, r5
+ mov r5, r6
+ add #-0x80, r6 ! prefetch head
+
+ ! store FPU (in single precision mode, do not check R15 align).
+ fmov fr12, @-r15
+ fmov fr13, @-r15
+ fmov fr14, @-r15
+ fmov fr15, @-r15
+
+ FPU_SET_PAIRED_PREC
+
+ mov #4, r0
+67:
+ add #-0x20, r6
+ pref @r6
+ add #-0x20, r6
+ pref @r6
+
+ fmov @r5+, dr0
+ fmov @r5+, dr2
+ fmov @r5+, dr4
+ fmov @r5+, dr6
+ fmov @r5+, dr8
+ fmov @r5+, dr10
+ fmov @r5+, dr12
+ fmov @r5+, dr14
+ fmov @r5+, xd0
+ fmov @r5+, xd2
+ fmov @r5+, xd4
+ fmov @r5+, xd6
+ fmov @r5+, xd8
+ fmov @r5+, xd10
+ fmov @r5+, xd12
+ fmov @r5+, xd14
+
+ DALLOC
+ fmov xd14, @-r1
+ fmov xd12, @-r1
+ fmov xd10, @-r1
+ fmov xd8, @-r1
+ DALLOC
+ fmov xd6, @-r1
+ fmov xd4, @-r1
+ fmov xd2, @-r1
+ fmov xd0, @-r1
+ DALLOC
+ fmov dr14, @-r1
+ fmov dr12, @-r1
+ fmov dr10, @-r1
+ fmov dr8, @-r1
+ DALLOC
+ fmov dr6, @-r1
+ add #-0x80, r5
+ fmov dr4, @-r1
+ add #-0x80, r5
+ fmov dr2, @-r1
+ add #-0x20, r6
+ fmov dr0, @-r1
+ add #-4, r3
+ pref @r6
+ add #-0x20, r6
+ cmp/ge r0, r3
+ bt/s 67b
+ pref @r6
+
+ RESTORE_FPSCR
+
+ ! Restore FPU callee save registers
+ fmov @r15+, fr15
+ fmov @r15+, fr14
+ fmov @r15+, fr13
+ fmov @r15+, fr12
+
+ ! Other cache lines could be copied: so use the FPU in single paired
+ ! precision without prefetching. No check for alignment is necessary.
+
+ mov #1, r0
+ cmp/ge r0, r3
+ bt/s 3f
+ add #0x60, r5
+
+ bra 5f
+ nop
+
+ ! No prefetch and FPU in single precision.
+45:
+ add #-0x1c, r5
+ mov r5, r0
+ tst #7, r0
+ bt 3f
+
+2: fmov.s @r5+, fr0
+ fmov.s @r5+, fr1
+ fmov.s @r5+, fr2
+ fmov.s @r5+, fr3
+ fmov.s @r5+, fr4
+ fmov.s @r5+, fr5
+ fmov.s @r5+, fr6
+ fmov.s @r5+, fr7
+
+ DALLOC
+
+ fmov.s fr7, @-r1
+ fmov.s fr6, @-r1
+ fmov.s fr5, @-r1
+ fmov.s fr4, @-r1
+ fmov.s fr3, @-r1
+ fmov.s fr2, @-r1
+ fmov.s fr1, @-r1
+ fmov.s fr0, @-r1
+
+ cmp/eq r2,r1
+
+ bf/s 2b
+ add #-0x40, r5
+
+ bra 5f
+ nop
+
+ ! No prefetch and FPU in single paired precision.
+
+3: FPU_SET_PAIRED_PREC
+
+4: fmov @r5+, dr0
+ fmov @r5+, dr2
+ fmov @r5+, dr4
+ fmov @r5+, dr6
+
+ DALLOC
+
+ fmov dr6, @-r1
+ fmov dr4, @-r1
+ fmov dr2, @-r1
+ fmov dr0, @-r1
+ cmp/eq r2,r1
+
+ bf/s 4b
+ add #-0x40, r5
+
+ RESTORE_FPSCR
+
+5: mov r1, r0
+
+ cmp/eq r4, r0 ! 54 MT
+ bf/s 1f ! 109 BR
+ sub r1, r5 ! 75 EX
+
+ rts
+ nop
+1:
+#else
+ ! Copy the cache line aligned blocks
+ !
+ ! In use: r0, r2, r4, r5
+ ! Scratch: r1, r3, r6, r7
+ !
+ ! We could do this with the four scratch registers, but if src
+ ! and dest hit the same cache line, this will thrash, so make
+ ! use of additional registers.
+ !
+ ! We also need r0 as a temporary (for movca), so 'undo' the invariant:
+ ! r5: src (was r0+r5)
+ ! r1: dest (was r0)
+ ! this can be reversed at the end, so we don't need to save any extra
+ ! state.
+ !
+1: mov.l r8, @-r15 ! 30 LS
+ add r0, r5 ! 49 EX
+
+ mov.l r9, @-r15 ! 30 LS
+ mov r0, r1 ! 5 MT (latency=0)
+
+ mov.l r10, @-r15 ! 30 LS
+ add #-0x1c, r5 ! 50 EX
+
+ mov.l r11, @-r15 ! 30 LS
+
+ ! 16 cycles, 32 bytes per iteration
+2: mov.l @(0x00,r5),r0 ! 18 LS (latency=2)
+ add #-0x20, r1 ! 50 EX
+ mov.l @(0x04,r5),r3 ! 18 LS (latency=2)
+ mov.l @(0x08,r5),r6 ! 18 LS (latency=2)
+ mov.l @(0x0c,r5),r7 ! 18 LS (latency=2)
+ mov.l @(0x10,r5),r8 ! 18 LS (latency=2)
+ mov.l @(0x14,r5),r9 ! 18 LS (latency=2)
+ mov.l @(0x18,r5),r10 ! 18 LS (latency=2)
+ mov.l @(0x1c,r5),r11 ! 18 LS (latency=2)
+ movca.l r0,@r1 ! 40 LS (latency=3-7)
+ mov.l r3,@(0x04,r1) ! 33 LS
+ mov.l r6,@(0x08,r1) ! 33 LS
+ mov.l r7,@(0x0c,r1) ! 33 LS
+
+ mov.l r8,@(0x10,r1) ! 33 LS
+ add #-0x20, r5 ! 50 EX
+
+ mov.l r9,@(0x14,r1) ! 33 LS
+ cmp/eq r2,r1 ! 54 MT
+
+ mov.l r10,@(0x18,r1) ! 33 LS
+ bf/s 2b ! 109 BR
+
+ mov.l r11,@(0x1c,r1) ! 33 LS
+
+ mov r1, r0 ! 5 MT (latency=0)
+
+ mov.l @r15+, r11 ! 15 LS
+ sub r1, r5 ! 75 EX
+
+ mov.l @r15+, r10 ! 15 LS
+ cmp/eq r4, r0 ! 54 MT
+
+ bf/s 1f ! 109 BR
+ mov.l @r15+, r9 ! 15 LS
+
+ rts
+1: mov.l @r15+, r8 ! 15 LS
+#endif
+ sub r4, r1 ! 75 EX (len remaining)
+
+ ! number of trailing bytes is non-zero
+ !
+ ! invariants restored (r5 already decremented by 4)
+ ! also r1=num bytes remaining
+
+ mov #4, r2 ! 6 EX
+ mov r4, r7 ! 5 MT (latency=0)
+
+ add #0x1c, r5 ! 50 EX (back to -4)
+ cmp/hs r2, r1 ! 58 MT
+
+ bf/s 5f ! 108 BR
+ add #11, r7 ! 50 EX
+
+ mov.l @(r0, r5), r6 ! 21 LS (latency=2)
+ tst r2, r1 ! 86 MT
+
+ mov r5, r3 ! 5 MT (latency=0)
+ bt/s 4f ! 111 BR
+
+ add #-4, r3 ! 50 EX
+ cmp/hs r2, r1 ! 58 MT
+
+ bt/s 5f ! 111 BR
+ mov.l r6,@-r0 ! 30 LS
+
+ ! 4 cycles, 2 long words per iteration
+3: mov.l @(r0, r5), r6 ! 21 LS (latency=2)
+
+4: mov.l @(r0, r3), r2 ! 21 LS (latency=2)
+ cmp/hi r7, r0
+
+ mov.l r6, @-r0 ! 30 LS
+ bt/s 3b ! 109 BR
+
+ mov.l r2, @-r0 ! 30 LS
+
+ ! Copy the final 0-3 bytes
+
+5: cmp/eq r0, r4 ! 54 MT
+ add #-10, r7 ! 50 EX
+
+ bt 9f ! 110 BR
+ add #3,r5 ! 50 EX
+
+ ! 3 cycles, 1 byte per iteration
+1: mov.b @(r0,r5),r1 ! 19 LS
+ cmp/hi r7,r0 ! 57 MT
+
+ bt/s 1b ! 111 BR
+ mov.b r1,@-r0 ! 28 LS
+
+9: rts
+ nop
+
+ !
+ ! GHIJ KLMN OPQR --> ..GH IJKL MNOP QR..
+ !
+
+ .balign 32
+.Lcase2:
+ ! Size is 16 or greater and less then 64, but may have trailing bytes
+
+2: mov r5, r6 ! 5 MT (latency=0)
+ add #-2,r5 ! 50 EX
+
+ mov r4,r2 ! 5 MT (latency=0)
+ add #-4,r6 ! 50 EX
+
+ add #7,r2 ! 50 EX
+3: mov.w @(r0,r5),r1 ! 20 LS (latency=2)
+
+ mov.w @(r0,r6),r3 ! 20 LS (latency=2)
+ cmp/hi r2,r0 ! 57 MT
+
+ mov.w r1,@-r0 ! 29 LS
+ bt/s 3b ! 111 BR
+
+ mov.w r3,@-r0 ! 29 LS
+
+ bra 10f
+ nop
+
+
+ .balign 32
+.Lcase2b:
+ ! Size is at least 64 bytes, so will be going round the big loop at least once.
+ !
+ ! r2 = rounded up r4
+ ! r3 = rounded down r0
+
+ mov r0, r3 ! 5 MT (latency=0)
+ mov #(~0x1f), r1 ! 6 EX
+
+ and r1, r3 ! 78 EX
+ mov r4, r2 ! 5 MT (latency=0)
+
+ cmp/eq r3, r0 ! 54 MT
+ add #0x1f, r2 ! 50 EX
+
+ add #-2, r5 ! 50 EX
+ bt/s 1f ! 110 BR
+ and r1, r2 ! 78 EX
+
+ ! Copy a short word one at a time until we are cache line aligned
+ ! Normal values: r0, r2, r3, r4
+ ! Unused: r1, r6, r7
+ ! Mod: r5 (=r5-2)
+ !
+ add #2, r3 ! 50 EX
+
+2: mov.w @(r0,r5),r1 ! 20 LS (latency=2)
+ cmp/eq r3,r0 ! 54 MT
+
+ bf/s 2b ! 111 BR
+
+ mov.w r1,@-r0 ! 29 LS
+
+ ! Copy the cache line aligned blocks
+ !
+ ! In use: r0, r2, r4, r5 (=r5-2)
+ ! Scratch: r1, r3, r6, r7
+ !
+ ! We could do this with the four scratch registers, but if src
+ ! and dest hit the same cache line, this will thrash, so make
+ ! use of additional registers.
+ !
+ ! We also need r0 as a temporary (for movca), so 'undo' the invariant:
+ ! r5: src (was r0+r5)
+ ! r1: dest (was r0)
+ ! this can be reversed at the end, so we don't need to save any extra
+ ! state.
+ !
+1: mov.l r8, @-r15 ! 30 LS
+ add r0, r5 ! 49 EX
+
+ mov.l r9, @-r15 ! 30 LS
+ mov r0, r1 ! 5 MT (latency=0)
+
+ mov.l r10, @-r15 ! 30 LS
+ add #-0x1e, r5 ! 50 EX
+
+ mov.l r11, @-r15 ! 30 LS
+
+ mov.l r12, @-r15 ! 30 LS
+
+ ! 17 cycles, 32 bytes per iteration
+#ifdef __LITTLE_ENDIAN__
+2: mov.w @r5+, r0 ! 14 LS (latency=2) ..JI
+ add #-0x20, r1 ! 50 EX
+
+ mov.l @r5+, r3 ! 15 LS (latency=2) NMLK
+
+ mov.l @r5+, r6 ! 15 LS (latency=2) RQPO
+ shll16 r0 ! 103 EX JI..
+
+ mov.l @r5+, r7 ! 15 LS (latency=2)
+ xtrct r3, r0 ! 48 EX LKJI
+
+ mov.l @r5+, r8 ! 15 LS (latency=2)
+ xtrct r6, r3 ! 48 EX PONM
+
+ mov.l @r5+, r9 ! 15 LS (latency=2)
+ xtrct r7, r6 ! 48 EX
+
+ mov.l @r5+, r10 ! 15 LS (latency=2)
+ xtrct r8, r7 ! 48 EX
+
+ mov.l @r5+, r11 ! 15 LS (latency=2)
+ xtrct r9, r8 ! 48 EX
+
+ mov.w @r5+, r12 ! 15 LS (latency=2)
+ xtrct r10, r9 ! 48 EX
+
+ movca.l r0,@r1 ! 40 LS (latency=3-7)
+ xtrct r11, r10 ! 48 EX
+
+ mov.l r3, @(0x04,r1) ! 33 LS
+ xtrct r12, r11 ! 48 EX
+
+ mov.l r6, @(0x08,r1) ! 33 LS
+
+ mov.l r7, @(0x0c,r1) ! 33 LS
+
+ mov.l r8, @(0x10,r1) ! 33 LS
+ add #-0x40, r5 ! 50 EX
+
+ mov.l r9, @(0x14,r1) ! 33 LS
+ cmp/eq r2,r1 ! 54 MT
+
+ mov.l r10, @(0x18,r1) ! 33 LS
+ bf/s 2b ! 109 BR
+
+ mov.l r11, @(0x1c,r1) ! 33 LS
+#else
+2: mov.w @(0x1e,r5), r0 ! 17 LS (latency=2)
+ add #-2, r5 ! 50 EX
+
+ mov.l @(0x1c,r5), r3 ! 18 LS (latency=2)
+ add #-4, r1 ! 50 EX
+
+ mov.l @(0x18,r5), r6 ! 18 LS (latency=2)
+ shll16 r0 ! 103 EX
+
+ mov.l @(0x14,r5), r7 ! 18 LS (latency=2)
+ xtrct r3, r0 ! 48 EX
+
+ mov.l @(0x10,r5), r8 ! 18 LS (latency=2)
+ xtrct r6, r3 ! 48 EX
+
+ mov.l @(0x0c,r5), r9 ! 18 LS (latency=2)
+ xtrct r7, r6 ! 48 EX
+
+ mov.l @(0x08,r5), r10 ! 18 LS (latency=2)
+ xtrct r8, r7 ! 48 EX
+
+ mov.l @(0x04,r5), r11 ! 18 LS (latency=2)
+ xtrct r9, r8 ! 48 EX
+
+ mov.l @(0x00,r5), r12 ! 18 LS (latency=2)
+ xtrct r10, r9 ! 48 EX
+
+ movca.l r0,@r1 ! 40 LS (latency=3-7)
+ add #-0x1c, r1 ! 50 EX
+
+ mov.l r3, @(0x18,r1) ! 33 LS
+ xtrct r11, r10 ! 48 EX
+
+ mov.l r6, @(0x14,r1) ! 33 LS
+ xtrct r12, r11 ! 48 EX
+
+ mov.l r7, @(0x10,r1) ! 33 LS
+
+ mov.l r8, @(0x0c,r1) ! 33 LS
+ add #-0x1e, r5 ! 50 EX
+
+ mov.l r9, @(0x08,r1) ! 33 LS
+ cmp/eq r2,r1 ! 54 MT
+
+ mov.l r10, @(0x04,r1) ! 33 LS
+ bf/s 2b ! 109 BR
+
+ mov.l r11, @(0x00,r1) ! 33 LS
+#endif
+
+ mov.l @r15+, r12
+ mov r1, r0 ! 5 MT (latency=0)
+
+ mov.l @r15+, r11 ! 15 LS
+ sub r1, r5 ! 75 EX
+
+ mov.l @r15+, r10 ! 15 LS
+ cmp/eq r4, r0 ! 54 MT
+
+ bf/s 1f ! 109 BR
+ mov.l @r15+, r9 ! 15 LS
+
+ rts
+1: mov.l @r15+, r8 ! 15 LS
+
+ add #0x1e, r5 ! 50 EX
+
+ ! Finish off a short word at a time
+ ! r5 must be invariant - 2
+10: mov r4,r2 ! 5 MT (latency=0)
+ add #1,r2 ! 50 EX
+
+ cmp/hi r2, r0 ! 57 MT
+ bf/s 1f ! 109 BR
+
+ add #2, r2 ! 50 EX
+
+3: mov.w @(r0,r5),r1 ! 20 LS
+ cmp/hi r2,r0 ! 57 MT
+
+ bt/s 3b ! 109 BR
+
+ mov.w r1,@-r0 ! 29 LS
+1:
+
+ !
+ ! Finally, copy the last byte if necessary
+ cmp/eq r4,r0 ! 54 MT
+ bt/s 9b
+ add #1,r5
+ mov.b @(r0,r5),r1
+ rts
+ mov.b r1,@-r0
+
+END(memcpy)
+libc_hidden_def (memcpy)
diff --git a/ap/build/uClibc/libc/string/sh/sh4/memmove.c b/ap/build/uClibc/libc/string/sh/sh4/memmove.c
new file mode 100644
index 0000000..8059bd4
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh/sh4/memmove.c
@@ -0,0 +1,121 @@
+/* memmove implementation for SH4
+ *
+ * Copyright (C) 2009 STMicroelectronics Ltd.
+ *
+ * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#ifndef __SH_FPU_ANY__
+#include "../../generic/memmove.c"
+#else
+
+#include <string.h>
+
+#define FPSCR_SR (1 << 20)
+#define STORE_FPSCR(x) __asm__ __volatile__("sts fpscr, %0" : "=r"(x))
+#define LOAD_FPSCR(x) __asm__ __volatile__("lds %0, fpscr" : : "r"(x))
+
+static void fpu_optimised_copy_fwd(void *dest, const void *src, size_t len)
+{
+ char *d = (char *)dest;
+ char *s = (char *)src;
+
+ if (len >= 64) {
+ unsigned long fpscr;
+ int *s1;
+ int *d1;
+
+ /* Align the dest to 4 byte boundary. */
+ while ((unsigned)d & 0x7) {
+ *d++ = *s++;
+ len--;
+ }
+
+ s1 = (int *)s;
+ d1 = (int *)d;
+
+ /* check if s is well aligned to use FPU */
+ if (!((unsigned)s1 & 0x7)) {
+
+ /* Align the dest to cache-line boundary */
+ while ((unsigned)d1 & 0x1c) {
+ *d1++ = *s1++;
+ len -= 4;
+ }
+
+ /* Use paired single precision load or store mode for
+ * 64-bit tranfering.*/
+ STORE_FPSCR(fpscr);
+ LOAD_FPSCR(FPSCR_SR);
+
+ while (len >= 32) {
+ __asm__ __volatile__ ("fmov @%0+,dr0":"+r" (s1));
+ __asm__ __volatile__ ("fmov @%0+,dr2":"+r" (s1));
+ __asm__ __volatile__ ("fmov @%0+,dr4":"+r" (s1));
+ __asm__ __volatile__ ("fmov @%0+,dr6":"+r" (s1));
+ __asm__
+ __volatile__ ("fmov dr0,@%0"::"r"
+ (d1):"memory");
+ d1 += 2;
+ __asm__
+ __volatile__ ("fmov dr2,@%0"::"r"
+ (d1):"memory");
+ d1 += 2;
+ __asm__
+ __volatile__ ("fmov dr4,@%0"::"r"
+ (d1):"memory");
+ d1 += 2;
+ __asm__
+ __volatile__ ("fmov dr6,@%0"::"r"
+ (d1):"memory");
+ d1 += 2;
+ len -= 32;
+ }
+ LOAD_FPSCR(fpscr);
+ }
+ s = (char *)s1;
+ d = (char *)d1;
+ /*TODO: other subcases could be covered here?!?*/
+ }
+ /* Go to per-byte copy */
+ while (len > 0) {
+ *d++ = *s++;
+ len--;
+ }
+ return;
+}
+
+void *memmove(void *dest, const void *src, size_t len)
+{
+ unsigned long int d = (long int)dest;
+ unsigned long int s = (long int)src;
+ unsigned long int res;
+
+ if (d >= s)
+ res = d - s;
+ else
+ res = s - d;
+ /*
+ * 1) dest and src are not overlap ==> memcpy (BWD/FDW)
+ * 2) dest and src are 100% overlap ==> memcpy (BWD/FDW)
+ * 3) left-to-right overlap ==> Copy from the beginning to the end
+ * 4) right-to-left overlap ==> Copy from the end to the beginning
+ */
+
+ if (res == 0) /* 100% overlap */
+ memcpy(dest, src, len); /* No overlap */
+ else if (res >= len)
+ memcpy(dest, src, len);
+ else {
+ if (d > s) /* right-to-left overlap */
+ memcpy(dest, src, len); /* memcpy is BWD */
+ else /* cannot use SH4 memcpy for this case */
+ fpu_optimised_copy_fwd(dest, src, len);
+ }
+ return (dest);
+}
+
+libc_hidden_def(memmove)
+#endif /*__SH_FPU_ANY__ */
diff --git a/ap/build/uClibc/libc/string/sh/sh4/memset.S b/ap/build/uClibc/libc/string/sh/sh4/memset.S
new file mode 100644
index 0000000..eb83355
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh/sh4/memset.S
@@ -0,0 +1,152 @@
+/* $Id: memset.S,v 1.1 2000/04/14 16:49:01 mjd Exp $
+ *
+ * "memset" implementation of SuperH
+ *
+ * Copyright (C) 1999 Niibe Yutaka
+ *
+ * Copyright (c) 2009 STMicroelectronics Ltd
+ * Optimised using 64bit data transfer (via FPU) and the movca.l inst.
+ * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * void *memset(void *s, int c, size_t n);
+ */
+
+#include <sysdep.h>
+
+#if defined (__LITTLE_ENDIAN__) && defined (__SH_FPU_ANY__)
+#define MEMSET_USES_FPU
+/* Use paired single precision load or store mode for 64-bit tranfering.
+ * FPSCR.SZ=1,FPSCR.SZ=0 is well defined on both SH4-200 and SH4-300.
+ * Currenlty it has been only implemented and tested for little endian mode. */
+.macro FPU_SET_PAIRED_PREC
+ sts fpscr, r3
+ mov #0x10, r1 ! PR=0 SZ=1
+ shll16 r1
+ lds r1, fpscr
+.endm
+.macro RESTORE_FPSCR
+ lds r3, fpscr
+.endm
+#endif
+
+ENTRY(memset)
+ mov #12,r0
+ add r6,r4
+ cmp/gt r6,r0
+ bt/s 40f ! if it's too small, set a byte at once
+ mov r4,r0
+ and #3,r0
+ cmp/eq #0,r0
+ bt/s 2f ! It's aligned
+ sub r0,r6
+1:
+ dt r0
+ bf/s 1b
+ mov.b r5,@-r4
+2: ! make VVVV
+ extu.b r5,r5
+ swap.b r5,r0 ! V0
+ or r0,r5 ! VV
+ swap.w r5,r0 ! VV00
+ or r0,r5 ! VVVV
+
+ ! Check if enough bytes need to be copied to be worth the big loop
+ mov #0x40, r0 ! (MT)
+ cmp/gt r6,r0 ! (MT) 64 > len => slow loop
+
+ bt/s 22f
+ mov r6,r0
+
+ ! align the dst to the cache block size if necessary
+ mov r4, r3
+ mov #~(0x1f), r1
+
+ and r3, r1
+ cmp/eq r3, r1
+
+ bt/s 11f ! dst is already aligned
+ sub r1, r3 ! r3-r1 -> r3
+ shlr2 r3 ! number of loops
+
+10: mov.l r5,@-r4
+ dt r3
+ bf/s 10b
+ add #-4, r6
+
+11: ! dst is 32byte aligned
+ mov r6,r2
+ mov #-5,r0
+ shld r0,r2 ! number of loops
+
+ add #-32, r4
+ mov r5, r0
+
+#ifdef MEMSET_USES_FPU
+ lds r5, fpul ! (CO)
+ fsts fpul, fr0 ! Dr0 will be 'VVVVVVVV'
+ fsts fpul, fr1
+
+ FPU_SET_PAIRED_PREC
+12:
+ movca.l r0, @r4
+ mov.l r5, @(4, r4)
+ add #32, r4
+ fmov dr0, @-r4
+ fmov dr0, @-r4
+ add #-0x20, r6
+ fmov dr0, @-r4
+ dt r2
+ bf/s 12b
+ add #-40, r4
+
+ RESTORE_FPSCR
+#else
+12:
+ movca.l r0,@r4
+ mov.l r5,@(4, r4)
+ mov.l r5,@(8, r4)
+ mov.l r5,@(12,r4)
+ mov.l r5,@(16,r4)
+ mov.l r5,@(20,r4)
+ add #-0x20, r6
+ mov.l r5,@(24,r4)
+ dt r2
+ mov.l r5,@(28,r4)
+ bf/s 12b
+ add #-32, r4
+
+#endif
+ add #32, r4
+ mov #8, r0
+ cmp/ge r0, r6
+ bf 40f
+
+ mov r6,r0
+22:
+ shlr2 r0
+ shlr r0 ! r0 = r6 >> 3
+3:
+ dt r0
+ mov.l r5,@-r4 ! set 8-byte at once
+ bf/s 3b
+ mov.l r5,@-r4
+ !
+ mov #7,r0
+ and r0,r6
+
+ ! fill bytes (length may be zero)
+40: tst r6,r6
+ bt 5f
+4:
+ dt r6
+ bf/s 4b
+ mov.b r5,@-r4
+5:
+ rts
+ mov r4,r0
+END(memset)
+libc_hidden_def (memset)
diff --git a/ap/build/uClibc/libc/string/sh/sh4/strcpy.S b/ap/build/uClibc/libc/string/sh/sh4/strcpy.S
new file mode 100644
index 0000000..0f82780
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh/sh4/strcpy.S
@@ -0,0 +1,28 @@
+/* strcpy implementation for SUPERH
+ *
+ * Copyright (C) 2009 STMicroelectronics Ltd.
+ *
+ * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ char *strcpy(char *dest, const char *src);
+ */
+
+#include <sysdep.h>
+
+ENTRY(strcpy)
+ mov r4,r2
+1:
+ mov.b @r5+,r1
+ tst r1,r1
+ mov.b r1,@r2
+ bf/s 1b
+ add #1,r2
+
+ rts
+ mov r4,r0
+END(strcpy)
+libc_hidden_def (strcpy)
diff --git a/ap/build/uClibc/libc/string/sh/sh4/strncpy.S b/ap/build/uClibc/libc/string/sh/sh4/strncpy.S
new file mode 100644
index 0000000..8a16f39
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh/sh4/strncpy.S
@@ -0,0 +1,43 @@
+/* strncpy implementation for SUPERH
+ *
+ * Copyright (C) 2009 STMicroelectronics Ltd.
+ *
+ * Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ char *strncpy(char *dest, const char *src, size_t n);
+ */
+
+#include <sysdep.h>
+
+ENTRY(strncpy)
+ mov #0,r0
+ bra 2f
+ mov r4,r2
+1:
+ mov.b r1,@(r0,r2)
+ add #1,r0
+2:
+ cmp/hs r6,r0
+ bt 5f
+ mov.b @(r0,r5),r1
+ tst r1,r1
+ bf/s 1b
+ cmp/hs r6,r0
+ bra 4f
+ nop
+3:
+ mov.b r1,@(r0,r2)
+ add #1,r0
+ cmp/hs r6,r0
+4:
+ bf/s 3b
+ mov #0,r1
+5:
+ rts
+ mov r2,r0
+END(strncpy)
+libc_hidden_def(strncpy)
diff --git a/ap/build/uClibc/libc/string/sh/strlen.S b/ap/build/uClibc/libc/string/sh/strlen.S
new file mode 100644
index 0000000..1ccecc1
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh/strlen.S
@@ -0,0 +1,75 @@
+/* $Id: strlen.S,v 1.2 2001/06/29 14:07:15 gniibe Exp $
+ *
+ * "strlen" implementation of SuperH
+ *
+ * Copyright (C) 1999 Kaz Kojima
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/* size_t strlen (const char *s) */
+
+#include <sysdep.h>
+#include <endian.h>
+
+ENTRY(strlen)
+ mov r4,r0
+ and #3,r0
+ tst r0,r0
+ bt/s 1f
+ mov #0,r2
+
+ add #-1,r0
+ shll2 r0
+ shll r0
+ braf r0
+ nop
+
+ mov.b @r4+,r1
+ tst r1,r1
+ bt 8f
+ add #1,r2
+
+ mov.b @r4+,r1
+ tst r1,r1
+ bt 8f
+ add #1,r2
+
+ mov.b @r4+,r1
+ tst r1,r1
+ bt 8f
+ add #1,r2
+
+1:
+ mov #0,r3
+2:
+ mov.l @r4+,r1
+ cmp/str r3,r1
+ bf/s 2b
+ add #4,r2
+
+ add #-4,r2
+#ifndef __LITTLE_ENDIAN__
+ swap.b r1,r1
+ swap.w r1,r1
+ swap.b r1,r1
+#endif
+ extu.b r1,r0
+ tst r0,r0
+ bt/s 8f
+ shlr8 r1
+ add #1,r2
+ extu.b r1,r0
+ tst r0,r0
+ bt/s 8f
+ shlr8 r1
+ add #1,r2
+ extu.b r1,r0
+ tst r0,r0
+ bt 8f
+ add #1,r2
+8:
+ rts
+ mov r2,r0
+END(strlen)
+libc_hidden_def (strlen)
diff --git a/ap/build/uClibc/libc/string/sh64/Makefile b/ap/build/uClibc/libc/string/sh64/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh64/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/sh64/memcpy.S b/ap/build/uClibc/libc/string/sh64/memcpy.S
new file mode 100644
index 0000000..470784e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh64/memcpy.S
@@ -0,0 +1,205 @@
+/* Cloned and hacked for uClibc by Paul Mundt, December 2003 */
+/* Modified by SuperH, Inc. September 2003 */
+!
+! Fast SH memcpy
+!
+! by Toshiyasu Morita (tm@netcom.com)
+! hacked by J"orn Rernnecke (joern.rennecke@superh.com) ("o for o-umlaut)
+! SH5 code Copyright 2002 SuperH Ltd.
+!
+! Entry: ARG0: destination pointer
+! ARG1: source pointer
+! ARG2: byte count
+!
+! Exit: RESULT: destination pointer
+! any other registers in the range r0-r7: trashed
+!
+! Notes: Usually one wants to do small reads and write a longword, but
+! unfortunately it is difficult in some cases to concatanate bytes
+! into a longword on the SH, so this does a longword read and small
+! writes.
+!
+! This implementation makes two assumptions about how it is called:
+!
+! 1.: If the byte count is nonzero, the address of the last byte to be
+! copied is unsigned greater than the address of the first byte to
+! be copied. This could be easily swapped for a signed comparison,
+! but the algorithm used needs some comparison.
+!
+! 2.: When there are two or three bytes in the last word of an 11-or-more
+! bytes memory chunk to b copied, the rest of the word can be read
+! without side effects.
+! This could be easily changed by increasing the minumum size of
+! a fast memcpy and the amount subtracted from r7 before L_2l_loop be 2,
+! however, this would cost a few extra cyles on average.
+! For SHmedia, the assumption is that any quadword can be read in its
+! enirety if at least one byte is included in the copy.
+!
+
+#include <features.h>
+
+ .section .text..SHmedia32,"ax"
+ .globl memcpy
+ .type memcpy, @function
+ .align 5
+
+memcpy:
+
+#define LDUAQ(P,O,D0,D1) ldlo.q P,O,D0; ldhi.q P,O+7,D1
+#define STUAQ(P,O,D0,D1) stlo.q P,O,D0; sthi.q P,O+7,D1
+#define LDUAL(P,O,D0,D1) ldlo.l P,O,D0; ldhi.l P,O+3,D1
+#define STUAL(P,O,D0,D1) stlo.l P,O,D0; sthi.l P,O+3,D1
+
+ ld.b r3,0,r63
+ pta/l Large,tr0
+ movi 25,r0
+ bgeu/u r4,r0,tr0
+ nsb r4,r0
+ shlli r0,5,r0
+ movi (L1-L0+63*32 + 1) & 0xffff,r1
+ sub r1, r0, r0
+L0: ptrel r0,tr0
+ add r2,r4,r5
+ ptabs r18,tr1
+ add r3,r4,r6
+ blink tr0,r63
+
+/* Rearranged to make cut2 safe */
+ .balign 8
+L4_7: /* 4..7 byte memcpy cntd. */
+ stlo.l r2, 0, r0
+ or r6, r7, r6
+ sthi.l r5, -1, r6
+ stlo.l r5, -4, r6
+ blink tr1,r63
+
+ .balign 8
+L1: /* 0 byte memcpy */
+ nop
+ blink tr1,r63
+ nop
+ nop
+ nop
+ nop
+
+L2_3: /* 2 or 3 byte memcpy cntd. */
+ st.b r5,-1,r6
+ blink tr1,r63
+
+ /* 1 byte memcpy */
+ ld.b r3,0,r0
+ st.b r2,0,r0
+ blink tr1,r63
+
+L8_15: /* 8..15 byte memcpy cntd. */
+ stlo.q r2, 0, r0
+ or r6, r7, r6
+ sthi.q r5, -1, r6
+ stlo.q r5, -8, r6
+ blink tr1,r63
+
+ /* 2 or 3 byte memcpy */
+ ld.b r3,0,r0
+ ld.b r2,0,r63
+ ld.b r3,1,r1
+ st.b r2,0,r0
+ pta/l L2_3,tr0
+ ld.b r6,-1,r6
+ st.b r2,1,r1
+ blink tr0, r63
+
+ /* 4 .. 7 byte memcpy */
+ LDUAL (r3, 0, r0, r1)
+ pta L4_7, tr0
+ ldlo.l r6, -4, r7
+ or r0, r1, r0
+ sthi.l r2, 3, r0
+ ldhi.l r6, -1, r6
+ blink tr0, r63
+
+ /* 8 .. 15 byte memcpy */
+ LDUAQ (r3, 0, r0, r1)
+ pta L8_15, tr0
+ ldlo.q r6, -8, r7
+ or r0, r1, r0
+ sthi.q r2, 7, r0
+ ldhi.q r6, -1, r6
+ blink tr0, r63
+
+ /* 16 .. 24 byte memcpy */
+ LDUAQ (r3, 0, r0, r1)
+ LDUAQ (r3, 8, r8, r9)
+ or r0, r1, r0
+ sthi.q r2, 7, r0
+ or r8, r9, r8
+ sthi.q r2, 15, r8
+ ldlo.q r6, -8, r7
+ ldhi.q r6, -1, r6
+ stlo.q r2, 8, r8
+ stlo.q r2, 0, r0
+ or r6, r7, r6
+ sthi.q r5, -1, r6
+ stlo.q r5, -8, r6
+ blink tr1,r63
+
+Large:
+ ld.b r2, 0, r63
+ pta/l Loop_ua, tr1
+ ori r3, -8, r7
+ sub r2, r7, r22
+ sub r3, r2, r6
+ add r2, r4, r5
+ ldlo.q r3, 0, r0
+ addi r5, -16, r5
+ movi 64+8, r27 /* could subtract r7 from that. */
+ stlo.q r2, 0, r0
+ sthi.q r2, 7, r0
+ ldx.q r22, r6, r0
+ bgtu/l r27, r4, tr1
+
+ addi r5, -48, r27
+ pta/l Loop_line, tr0
+ addi r6, 64, r36
+ addi r6, -24, r19
+ addi r6, -16, r20
+ addi r6, -8, r21
+
+Loop_line:
+ ldx.q r22, r36, r63
+ alloco r22, 32
+ addi r22, 32, r22
+ ldx.q r22, r19, r23
+ sthi.q r22, -25, r0
+ ldx.q r22, r20, r24
+ ldx.q r22, r21, r25
+ stlo.q r22, -32, r0
+ ldx.q r22, r6, r0
+ sthi.q r22, -17, r23
+ sthi.q r22, -9, r24
+ sthi.q r22, -1, r25
+ stlo.q r22, -24, r23
+ stlo.q r22, -16, r24
+ stlo.q r22, -8, r25
+ bgeu r27, r22, tr0
+
+Loop_ua:
+ addi r22, 8, r22
+ sthi.q r22, -1, r0
+ stlo.q r22, -8, r0
+ ldx.q r22, r6, r0
+ bgtu/l r5, r22, tr1
+
+ add r3, r4, r7
+ ldlo.q r7, -8, r1
+ sthi.q r22, 7, r0
+ ldhi.q r7, -1, r7
+ ptabs r18,tr1
+ stlo.q r22, 0, r0
+ or r1, r7, r1
+ sthi.q r5, 15, r1
+ stlo.q r5, 8, r1
+ blink tr1, r63
+
+ .size memcpy,.-memcpy
+
+libc_hidden_def(memcpy)
diff --git a/ap/build/uClibc/libc/string/sh64/memset.S b/ap/build/uClibc/libc/string/sh64/memset.S
new file mode 100644
index 0000000..1b8812c
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh64/memset.S
@@ -0,0 +1,97 @@
+/* Cloned and hacked for uClibc by Paul Mundt, December 2003 */
+/* Modified by SuperH, Inc. September 2003 */
+!
+! Fast SH memset
+!
+! by Toshiyasu Morita (tm@netcom.com)
+!
+! SH5 code by J"orn Rennecke (joern.rennecke@superh.com)
+! Copyright 2002 SuperH Ltd.
+!
+
+#include <features.h>
+#include <endian.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define SHHI shlld
+#define SHLO shlrd
+#else
+#define SHHI shlrd
+#define SHLO shlld
+#endif
+
+ .section .text..SHmedia32,"ax"
+ .globl memset
+ .type memset, @function
+
+ .align 5
+
+memset:
+ pta/l multiquad, tr0
+ andi r2, 7, r22
+ ptabs r18, tr2
+ mshflo.b r3,r3,r3
+ add r4, r22, r23
+ mperm.w r3, r63, r3 /* Fill pattern now in every byte of r3 */
+
+ movi 8, r9
+ bgtu/u r23, r9, tr0 /* multiquad */
+
+ beqi/u r4, 0, tr2 /* Return with size 0 - ensures no mem accesses */
+ ldlo.q r2, 0, r7
+ shlli r4, 2, r4
+ movi -1, r8
+ SHHI r8, r4, r8
+ SHHI r8, r4, r8
+ mcmv r7, r8, r3
+ stlo.q r2, 0, r3
+ blink tr2, r63
+
+multiquad:
+ pta/l lastquad, tr0
+ stlo.q r2, 0, r3
+ shlri r23, 3, r24
+ add r2, r4, r5
+ beqi/u r24, 1, tr0 /* lastquad */
+ pta/l loop, tr1
+ sub r2, r22, r25
+ andi r5, -8, r20 /* calculate end address and */
+ addi r20, -7*8, r8 /* loop end address; This might overflow, so we need
+ to use a different test before we start the loop
+ */
+ bge/u r24, r9, tr1 /* loop */
+ st.q r25, 8, r3
+ st.q r20, -8, r3
+ shlri r24, 1, r24
+ beqi/u r24, 1, tr0 /* lastquad */
+ st.q r25, 16, r3
+ st.q r20, -16, r3
+ beqi/u r24, 2, tr0 /* lastquad */
+ st.q r25, 24, r3
+ st.q r20, -24, r3
+lastquad:
+ sthi.q r5, -1, r3
+ blink tr2,r63
+
+loop:
+!!! alloco r25, 32 /* QQQ comment out for short-term fix to SHUK #3895.
+ QQQ commenting out is locically correct, but sub-optimal
+ QQQ Sean McGoogan - 4th April 2003. */
+ st.q r25, 8, r3
+ st.q r25, 16, r3
+ st.q r25, 24, r3
+ st.q r25, 32, r3
+ addi r25, 32, r25
+ bgeu/l r8, r25, tr1 /* loop */
+
+ st.q r20, -40, r3
+ st.q r20, -32, r3
+ st.q r20, -24, r3
+ st.q r20, -16, r3
+ st.q r20, -8, r3
+ sthi.q r5, -1, r3
+ blink tr2,r63
+
+ .size memset,.-memset
+
+libc_hidden_def(memset)
diff --git a/ap/build/uClibc/libc/string/sh64/strcpy.S b/ap/build/uClibc/libc/string/sh64/strcpy.S
new file mode 100644
index 0000000..f317707
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh64/strcpy.S
@@ -0,0 +1,102 @@
+/* Cloned and hacked for uClibc by Paul Mundt, December 2003 */
+/* Modified by SuperH, Inc. September 2003 */
+! Entry: arg0: destination
+! arg1: source
+! Exit: result: destination
+!
+! SH5 code Copyright 2002 SuperH Ltd.
+
+#include <features.h>
+#include <endian.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define SHHI shlld
+#define SHLO shlrd
+#else
+#define SHHI shlrd
+#define SHLO shlld
+#endif
+
+ .section .text..SHmedia32,"ax"
+ .globl strcpy
+ .type strcpy, @function
+ .align 5
+
+strcpy:
+
+ pta/l shortstring,tr1
+ ldlo.q r3,0,r4
+ ptabs r18,tr4
+ shlli r3,3,r7
+ addi r2, 8, r0
+ mcmpeq.b r4,r63,r6
+ SHHI r6,r7,r6
+ bnei/u r6,0,tr1 /* shortstring */
+ pta/l no_lddst, tr2
+ ori r3,-8,r23
+ sub r2, r23, r0
+ sub r3, r2, r21
+ addi r21, 8, r20
+ ldx.q r0, r21, r5
+ pta/l loop, tr0
+ ori r2,-8,r22
+ mcmpeq.b r5, r63, r6
+ bgt/u r22, r23, tr2 /* no_lddst */
+
+ /* r22 < r23 : Need to do a load from the destination. */
+ /* r22 == r23 : Doesn't actually need to load from destination, */
+ /* but still can be handled here. */
+ ldlo.q r2, 0, r9
+ movi -1, r8
+ SHLO r8, r7, r8
+ mcmv r4, r8, r9
+ stlo.q r2, 0, r9
+ beqi/l r6, 0, tr0 /* loop */
+
+ add r5, r63, r4
+ addi r0, 8, r0
+ blink tr1, r63 /* shortstring */
+no_lddst:
+ /* r22 > r23: note that for r22 == r23 the sthi.q would clobber */
+ /* bytes before the destination region. */
+ stlo.q r2, 0, r4
+ SHHI r4, r7, r4
+ sthi.q r0, -1, r4
+ beqi/l r6, 0, tr0 /* loop */
+
+ add r5, r63, r4
+ addi r0, 8, r0
+shortstring:
+#if __BYTE_ORDER != __LITTLE_ENDIAN
+ pta/l shortstring2,tr1
+ byterev r4,r4
+#endif
+shortstring2:
+ st.b r0,-8,r4
+ andi r4,0xff,r5
+ shlri r4,8,r4
+ addi r0,1,r0
+ bnei/l r5,0,tr1
+ blink tr4,r63 /* return */
+
+ .balign 8
+loop:
+ stlo.q r0, 0, r5
+ ldx.q r0, r20, r4
+ addi r0, 16, r0
+ sthi.q r0, -9, r5
+ mcmpeq.b r4, r63, r6
+ bnei/u r6, 0, tr1 /* shortstring */
+ ldx.q r0, r21, r5
+ stlo.q r0, -8, r4
+ sthi.q r0, -1, r4
+ mcmpeq.b r5, r63, r6
+ beqi/l r6, 0, tr0 /* loop */
+
+ add r5, r63, r4
+ addi r0, 8, r0
+ blink tr1, r63 /* shortstring */
+
+ .size strcpy,.-strcpy
+
+libc_hidden_def(strcpy)
diff --git a/ap/build/uClibc/libc/string/sh64/strlen.S b/ap/build/uClibc/libc/string/sh64/strlen.S
new file mode 100644
index 0000000..18f4164
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sh64/strlen.S
@@ -0,0 +1,63 @@
+/* vi: set sw=8 ts=8: */
+/*
+ * libc/string/sh64/strlen.S
+ *
+ * Simplistic strlen() implementation for SHmedia.
+ *
+ * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. The name of the above contributors may not be
+ * used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <features.h>
+
+ .section .text..SHmedia32,"ax"
+ .globl strlen
+ .type strlen,@function
+
+ .balign 16
+strlen:
+ ptabs r18, tr4
+
+ /*
+ * Note: We could easily deal with the NULL case here with a simple
+ * sanity check, though it seems that the behavior we want is to fault
+ * in the event that r2 == NULL, so we don't bother.
+ */
+/* beqi r2, 0, tr4 */ ! Sanity check
+
+ movi -1, r0
+ pta/l loop, tr0
+loop:
+ ld.b r2, 0, r1
+ addi r2, 1, r2
+ addi r0, 1, r0
+ bnei/l r1, 0, tr0
+
+ or r0, r63, r2
+ blink tr4, r63
+
+ .size strlen,.-strlen
+
+libc_hidden_def(strlen)
diff --git a/ap/build/uClibc/libc/string/sparc/Makefile b/ap/build/uClibc/libc/string/sparc/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/sparc/_glibc_inc.h b/ap/build/uClibc/libc/string/sparc/_glibc_inc.h
new file mode 100644
index 0000000..e0aef52
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/_glibc_inc.h
@@ -0,0 +1,27 @@
+/*
+ * Setup some glibc defines so we can just drop in the
+ * asm files from glibc without any modification.
+ */
+
+#include <features.h>
+#include <bits/wordsize.h>
+
+/* Is alignment really needed? */
+
+#if __WORDSIZE == 32
+# define ENTRY_ALIGN 4
+#else
+# define ENTRY_ALIGN 2
+#endif
+
+#define ENTRY(sym) \
+ .global sym; \
+ .align ENTRY_ALIGN; \
+ .type sym,%function; \
+ sym:
+
+#define LOC(sym) \
+ .L ## sym
+
+#define END(sym) \
+ .size sym,.-sym;
diff --git a/ap/build/uClibc/libc/string/sparc/bcopy.c b/ap/build/uClibc/libc/string/sparc/bcopy.c
new file mode 100644
index 0000000..9a455f3
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/bcopy.c
@@ -0,0 +1 @@
+/* bcopy is in memcpy.S */
diff --git a/ap/build/uClibc/libc/string/sparc/bzero.c b/ap/build/uClibc/libc/string/sparc/bzero.c
new file mode 100644
index 0000000..37f0f6f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/bzero.c
@@ -0,0 +1 @@
+/* bzero is in memset.S */
diff --git a/ap/build/uClibc/libc/string/sparc/memchr.S b/ap/build/uClibc/libc/string/sparc/memchr.S
new file mode 100644
index 0000000..73e5101
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/memchr.S
@@ -0,0 +1,13 @@
+#include "_glibc_inc.h"
+
+#if __WORDSIZE == 32
+
+# if defined(__CONFIG_SPARC_V9B__)
+# include "sparc32/sparcv9b/memchr.S"
+# else
+# include "sparc32/memchr.S"
+# endif
+
+#else
+# include "sparc64/memchr.S"
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/memcpy.S b/ap/build/uClibc/libc/string/sparc/memcpy.S
new file mode 100644
index 0000000..478cb10
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/memcpy.S
@@ -0,0 +1,19 @@
+#include "_glibc_inc.h"
+
+#if __WORDSIZE == 32
+
+# if defined(__CONFIG_SPARC_V9B__)
+# include "sparc32/sparcv9b/memcpy.S"
+# else
+# include "sparc32/memcpy.S"
+# endif
+
+#else
+
+# if defined(__CONFIG_SPARC_V9B__)
+# include "sparc64/sparcv9b/memcpy.S"
+# else
+# include "sparc64/memcpy.S"
+#endif
+
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/memmove.c b/ap/build/uClibc/libc/string/sparc/memmove.c
new file mode 100644
index 0000000..a8d2d49
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/memmove.c
@@ -0,0 +1 @@
+/* memmove is in memcpy.S */
diff --git a/ap/build/uClibc/libc/string/sparc/memset.S b/ap/build/uClibc/libc/string/sparc/memset.S
new file mode 100644
index 0000000..4aed774
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/memset.S
@@ -0,0 +1,13 @@
+#include "_glibc_inc.h"
+
+#if __WORDSIZE == 32
+
+# if defined(__CONFIG_SPARC_V9B__)
+# include "sparc32/sparcv9b/memset.S"
+# else
+# include "sparc32/memset.S"
+# endif
+
+#else
+# include "sparc64/memset.S"
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/memchr.S b/ap/build/uClibc/libc/string/sparc/sparc32/memchr.S
new file mode 100644
index 0000000..d926e97
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/memchr.S
@@ -0,0 +1,142 @@
+/* memchr (str, ch, n) -- Return pointer to first occurrence of CH in STR less
+ than N.
+ For SPARC v7.
+ Copyright (C) 1996, 1999, 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz> and
+ David S. Miller <davem@caip.rutgers.edu>.
+ This version is developed using the same algorithm as the fast C
+ version which carries the following introduction:
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ 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. */
+
+ .text
+ .align 4
+0: cmp %o2, 0
+ be 9f
+ sethi %hi(0x80808080), %o4
+ ldub [%o0], %g4
+ cmp %g4, %o1
+ be 1f
+ add %o0, 1, %o0
+ subcc %o2, 1, %o2
+ be 9f
+ andcc %o0, 3, %g0
+ be 4f
+ or %o4, %lo(0x80808080), %o3
+ ldub [%o0], %g4
+ cmp %g4, %o1
+ be 1f
+ add %o0, 1, %o0
+ subcc %o2, 1, %o2
+ be 9f
+ andcc %o0, 3, %g0
+ be 5f
+ sethi %hi(0x01010101), %o5
+ ldub [%o0], %g4
+ cmp %g4, %o1
+ be 1f
+ add %o0, 1, %o0
+ subcc %o2, 1, %o2
+ bne,a 7f
+ and %o2, 3, %g1
+ retl
+ clr %o0
+1: retl
+ sub %o0, 1, %o0
+
+ENTRY(memchr)
+ andcc %o1, 0xff, %o1
+ sll %o1, 8, %g6
+ andcc %o0, 3, %g0
+ or %o1, %g6, %g6
+ sll %g6, 16, %o3
+ bne 0b
+ or %o3, %g6, %g2
+ sethi %hi(0x80808080), %o4
+ or %o4, %lo(0x80808080), %o3
+4: sethi %hi(0x01010101), %o5
+5: and %o2, 3, %g1
+7: andcc %o2, 0xfffffffc, %o2
+ be 0f
+ or %o5, %lo(0x01010101), %g6
+ ld [%o0], %g4
+6: xor %g4, %g2, %g5
+ add %o0, 4, %o0
+ sub %g5, %g6, %g5
+ andcc %g5, %o3, %g0
+ bne 8f
+ subcc %o2, 4, %o2
+ bne,a 6b
+ ld [%o0], %g4
+0: cmp %g1, 0
+1: be 9f
+ add %o0, 4, %o0
+ ldub [%o0 - 4], %g4
+ cmp %g4, %o1
+ be 4f
+ cmp %g1, 1
+ be 9f
+ ldub [%o0 - 3], %g4
+ cmp %g4, %o1
+ be 3f
+ cmp %g1, 2
+ be 9f
+ ldub [%o0 - 2], %g4
+ cmp %g4, %o1
+ be 2f
+ nop
+9: retl
+ clr %o0
+
+ /* Check every byte. */
+8: srl %g4, 24, %g5
+ and %g5, 0xff, %g5
+ cmp %g5, %o1
+ be 4f
+ srl %g4, 16, %g5
+ and %g5, 0xff, %g5
+ cmp %g5, %o1
+ be 3f
+ srl %g4, 8, %g5
+ and %g5, 0xff, %g5
+ cmp %g5, %o1
+ be 2f
+ and %g4, 0xff, %g5
+ cmp %g5, %o1
+ be 1f
+ cmp %o2, 0
+ bne,a 6b
+ ld [%o0], %g4
+ b 1b
+ cmp %g1, 0
+1: retl
+ sub %o0, 1, %o0
+2: retl
+ sub %o0, 2, %o0
+3: retl
+ sub %o0, 3, %o0
+4: retl
+ sub %o0, 4, %o0
+END(memchr)
+libc_hidden_def(memchr)
+
+weak_alias(memchr,__ubp_memchr)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/memcpy.S b/ap/build/uClibc/libc/string/sparc/sparc32/memcpy.S
new file mode 100644
index 0000000..25a4884
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/memcpy.S
@@ -0,0 +1,973 @@
+/* Copy SIZE bytes from SRC to DEST.
+ For SPARC v7.
+ Copyright (C) 1996, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@caip.rutgers.edu>,
+ Eddie C. Dost <ecd@skynet.be> and
+ Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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>
+
+/* Both these macros have to start with exactly the same insn */
+#define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
+ ldd [%src + offset + 0x00], %t0; \
+ ldd [%src + offset + 0x08], %t2; \
+ ldd [%src + offset + 0x10], %t4; \
+ ldd [%src + offset + 0x18], %t6; \
+ st %t0, [%dst + offset + 0x00]; \
+ st %t1, [%dst + offset + 0x04]; \
+ st %t2, [%dst + offset + 0x08]; \
+ st %t3, [%dst + offset + 0x0c]; \
+ st %t4, [%dst + offset + 0x10]; \
+ st %t5, [%dst + offset + 0x14]; \
+ st %t6, [%dst + offset + 0x18]; \
+ st %t7, [%dst + offset + 0x1c];
+
+#define MOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
+ ldd [%src + offset + 0x00], %t0; \
+ ldd [%src + offset + 0x08], %t2; \
+ ldd [%src + offset + 0x10], %t4; \
+ ldd [%src + offset + 0x18], %t6; \
+ std %t0, [%dst + offset + 0x00]; \
+ std %t2, [%dst + offset + 0x08]; \
+ std %t4, [%dst + offset + 0x10]; \
+ std %t6, [%dst + offset + 0x18];
+
+#define MOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldd [%src - offset - 0x10], %t0; \
+ ldd [%src - offset - 0x08], %t2; \
+ st %t0, [%dst - offset - 0x10]; \
+ st %t1, [%dst - offset - 0x0c]; \
+ st %t2, [%dst - offset - 0x08]; \
+ st %t3, [%dst - offset - 0x04];
+
+#define MOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldd [%src - offset - 0x10], %t0; \
+ ldd [%src - offset - 0x08], %t2; \
+ std %t0, [%dst - offset - 0x10]; \
+ std %t2, [%dst - offset - 0x08];
+
+#define MOVE_SHORTCHUNK(src, dst, offset, t0, t1) \
+ ldub [%src - offset - 0x02], %t0; \
+ ldub [%src - offset - 0x01], %t1; \
+ stb %t0, [%dst - offset - 0x02]; \
+ stb %t1, [%dst - offset - 0x01];
+
+/* Both these macros have to start with exactly the same insn */
+#define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
+ ldd [%src - offset - 0x20], %t0; \
+ ldd [%src - offset - 0x18], %t2; \
+ ldd [%src - offset - 0x10], %t4; \
+ ldd [%src - offset - 0x08], %t6; \
+ st %t0, [%dst - offset - 0x20]; \
+ st %t1, [%dst - offset - 0x1c]; \
+ st %t2, [%dst - offset - 0x18]; \
+ st %t3, [%dst - offset - 0x14]; \
+ st %t4, [%dst - offset - 0x10]; \
+ st %t5, [%dst - offset - 0x0c]; \
+ st %t6, [%dst - offset - 0x08]; \
+ st %t7, [%dst - offset - 0x04];
+
+#define RMOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, t7) \
+ ldd [%src - offset - 0x20], %t0; \
+ ldd [%src - offset - 0x18], %t2; \
+ ldd [%src - offset - 0x10], %t4; \
+ ldd [%src - offset - 0x08], %t6; \
+ std %t0, [%dst - offset - 0x20]; \
+ std %t2, [%dst - offset - 0x18]; \
+ std %t4, [%dst - offset - 0x10]; \
+ std %t6, [%dst - offset - 0x08];
+
+#define RMOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldd [%src + offset + 0x00], %t0; \
+ ldd [%src + offset + 0x08], %t2; \
+ st %t0, [%dst + offset + 0x00]; \
+ st %t1, [%dst + offset + 0x04]; \
+ st %t2, [%dst + offset + 0x08]; \
+ st %t3, [%dst + offset + 0x0c];
+
+#define RMOVE_SHORTCHUNK(src, dst, offset, t0, t1) \
+ ldub [%src + offset + 0x00], %t0; \
+ ldub [%src + offset + 0x01], %t1; \
+ stb %t0, [%dst + offset + 0x00]; \
+ stb %t1, [%dst + offset + 0x01];
+
+#define SMOVE_CHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, prev, shil, shir, offset2) \
+ ldd [%src + offset + 0x00], %t0; \
+ ldd [%src + offset + 0x08], %t2; \
+ srl %t0, shir, %t5; \
+ srl %t1, shir, %t6; \
+ sll %t0, shil, %t0; \
+ or %t5, %prev, %t5; \
+ sll %t1, shil, %prev; \
+ or %t6, %t0, %t0; \
+ srl %t2, shir, %t1; \
+ srl %t3, shir, %t6; \
+ sll %t2, shil, %t2; \
+ or %t1, %prev, %t1; \
+ std %t4, [%dst + offset + offset2 - 0x04]; \
+ std %t0, [%dst + offset + offset2 + 0x04]; \
+ sll %t3, shil, %prev; \
+ or %t6, %t2, %t4;
+
+#define SMOVE_ALIGNCHUNK(src, dst, offset, t0, t1, t2, t3, t4, t5, t6, prev, shil, shir, offset2) \
+ ldd [%src + offset + 0x00], %t0; \
+ ldd [%src + offset + 0x08], %t2; \
+ srl %t0, shir, %t4; \
+ srl %t1, shir, %t5; \
+ sll %t0, shil, %t6; \
+ or %t4, %prev, %t0; \
+ sll %t1, shil, %prev; \
+ or %t5, %t6, %t1; \
+ srl %t2, shir, %t4; \
+ srl %t3, shir, %t5; \
+ sll %t2, shil, %t6; \
+ or %t4, %prev, %t2; \
+ sll %t3, shil, %prev; \
+ or %t5, %t6, %t3; \
+ std %t0, [%dst + offset + offset2 + 0x00]; \
+ std %t2, [%dst + offset + offset2 + 0x08];
+
+ .text
+ .align 4
+
+70: andcc %o1, 1, %g0
+ be 4f
+ andcc %o1, 2, %g0
+
+ ldub [%o1 - 1], %g2
+ sub %o1, 1, %o1
+ stb %g2, [%o0 - 1]
+ sub %o2, 1, %o2
+ be 3f
+ sub %o0, 1, %o0
+4: lduh [%o1 - 2], %g2
+ sub %o1, 2, %o1
+ sth %g2, [%o0 - 2]
+ sub %o2, 2, %o2
+ b 3f
+ sub %o0, 2, %o0
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+ENTRY(bcopy)
+ mov %o0, %o3
+ mov %o1, %o0
+ mov %o3, %o1
+END(bcopy)
+#endif
+
+ENTRY(memmove)
+ cmp %o0, %o1
+ st %o0, [%sp + 64]
+ bleu 9f
+ sub %o0, %o1, %o4
+
+ add %o1, %o2, %o3
+ cmp %o3, %o0
+ bleu 0f
+ andcc %o4, 3, %o5
+
+ add %o1, %o2, %o1
+ add %o0, %o2, %o0
+ bne 77f
+ cmp %o2, 15
+ bleu 91f
+ andcc %o1, 3, %g0
+ bne 70b
+3: andcc %o1, 4, %g0
+
+ be 2f
+ mov %o2, %g1
+
+ ld [%o1 - 4], %o4
+ sub %g1, 4, %g1
+ st %o4, [%o0 - 4]
+ sub %o1, 4, %o1
+ sub %o0, 4, %o0
+2: andcc %g1, 0xffffff80, %g6
+ be 3f
+ andcc %o0, 4, %g0
+
+ be 74f + 4
+5: RMOVE_BIGCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
+ RMOVE_BIGCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
+ RMOVE_BIGCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
+ RMOVE_BIGCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
+ subcc %g6, 128, %g6
+ sub %o1, 128, %o1
+ bne 5b
+ sub %o0, 128, %o0
+
+3: andcc %g1, 0x70, %g6
+ be 72f
+ andcc %g1, 8, %g0
+
+ srl %g6, 1, %o4
+ mov %o7, %g2
+ add %g6, %o4, %o4
+101: call 100f
+ sub %o1, %g6, %o1
+ mov %g2, %o7
+ jmpl %o5 + (72f - 101b), %g0
+ sub %o0, %g6, %o0
+
+71: RMOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g4, g5)
+ RMOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g4, g5)
+ RMOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g4, g5)
+ RMOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g4, g5)
+ RMOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g4, g5)
+ RMOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g4, g5)
+ RMOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g4, g5)
+72: be 73f
+ andcc %g1, 4, %g0
+
+ ldd [%o1 - 0x08], %g2
+ sub %o0, 8, %o0
+ sub %o1, 8, %o1
+ st %g2, [%o0]
+ st %g3, [%o0 + 0x04]
+73: be 1f
+ andcc %g1, 2, %g0
+
+ ld [%o1 - 4], %g2
+ sub %o1, 4, %o1
+ st %g2, [%o0 - 4]
+ sub %o0, 4, %o0
+1: be 1f
+ andcc %g1, 1, %g0
+
+ lduh [%o1 - 2], %g2
+ sub %o1, 2, %o1
+ sth %g2, [%o0 - 2]
+ sub %o0, 2, %o0
+1: be 1f
+ nop
+
+ ldub [%o1 - 1], %g2
+ stb %g2, [%o0 - 1]
+1: retl
+ ld [%sp + 64], %o0
+
+74: RMOVE_BIGALIGNCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
+ RMOVE_BIGALIGNCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
+ RMOVE_BIGALIGNCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
+ RMOVE_BIGALIGNCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
+ subcc %g6, 128, %g6
+ sub %o1, 128, %o1
+ bne 74b
+ sub %o0, 128, %o0
+
+ andcc %g1, 0x70, %g6
+ be 72b
+ andcc %g1, 8, %g0
+
+ srl %g6, 1, %o4
+ mov %o7, %g2
+ add %g6, %o4, %o4
+102: call 100f
+ sub %o1, %g6, %o1
+ mov %g2, %o7
+ jmpl %o5 + (72b - 102b), %g0
+ sub %o0, %g6, %o0
+
+75: and %o2, 0xe, %o3
+ mov %o7, %g2
+ sll %o3, 3, %o4
+ sub %o0, %o3, %o0
+103: call 100f
+ sub %o1, %o3, %o1
+ mov %g2, %o7
+ jmpl %o5 + (76f - 103b), %g0
+ andcc %o2, 1, %g0
+
+ RMOVE_SHORTCHUNK(o1, o0, 0x0c, g2, g3)
+ RMOVE_SHORTCHUNK(o1, o0, 0x0a, g2, g3)
+ RMOVE_SHORTCHUNK(o1, o0, 0x08, g2, g3)
+ RMOVE_SHORTCHUNK(o1, o0, 0x06, g2, g3)
+ RMOVE_SHORTCHUNK(o1, o0, 0x04, g2, g3)
+ RMOVE_SHORTCHUNK(o1, o0, 0x02, g2, g3)
+ RMOVE_SHORTCHUNK(o1, o0, 0x00, g2, g3)
+
+76: be 1f
+ nop
+ ldub [%o1 - 1], %g2
+ stb %g2, [%o0 - 1]
+1: retl
+ ld [%sp + 64], %o0
+
+91: bne 75b
+ andcc %o2, 8, %g0
+
+ be 1f
+ andcc %o2, 4, %g0
+
+ ld [%o1 - 0x08], %g2
+ ld [%o1 - 0x04], %g3
+ sub %o1, 8, %o1
+ st %g2, [%o0 - 0x08]
+ st %g3, [%o0 - 0x04]
+ sub %o0, 8, %o0
+1: b 73b
+ mov %o2, %g1
+
+77: cmp %o2, 15
+ bleu 75b
+ andcc %o0, 3, %g0
+ be 64f
+ andcc %o0, 1, %g0
+ be 63f
+ andcc %o0, 2, %g0
+ ldub [%o1 - 1], %g5
+ sub %o1, 1, %o1
+ stb %g5, [%o0 - 1]
+ sub %o0, 1, %o0
+ be 64f
+ sub %o2, 1, %o2
+
+63: ldub [%o1 - 1], %g5
+ sub %o1, 2, %o1
+ stb %g5, [%o0 - 1]
+ sub %o0, 2, %o0
+ ldub [%o1], %g5
+ sub %o2, 2, %o2
+ stb %g5, [%o0]
+64: and %o1, 3, %g2
+ and %o1, -4, %o1
+ and %o2, 0xc, %g3
+ add %o1, 4, %o1
+ cmp %g3, 4
+ sll %g2, 3, %g4
+ mov 32, %g2
+ be 4f
+ sub %g2, %g4, %g6
+
+ blu 3f
+ cmp %g3, 8
+
+ be 2f
+ srl %o2, 2, %g3
+
+ ld [%o1 - 4], %o3
+ add %o0, -8, %o0
+ ld [%o1 - 8], %o4
+ add %o1, -16, %o1
+ b 7f
+ add %g3, 1, %g3
+2: ld [%o1 - 4], %o4
+ add %o0, -4, %o0
+ ld [%o1 - 8], %g1
+ add %o1, -12, %o1
+ b 8f
+ add %g3, 2, %g3
+3: ld [%o1 - 4], %o5
+ add %o0, -12, %o0
+ ld [%o1 - 8], %o3
+ add %o1, -20, %o1
+ b 6f
+ srl %o2, 2, %g3
+4: ld [%o1 - 4], %g1
+ srl %o2, 2, %g3
+ ld [%o1 - 8], %o5
+ add %o1, -24, %o1
+ add %o0, -16, %o0
+ add %g3, -1, %g3
+
+ ld [%o1 + 12], %o3
+5: sll %o5, %g4, %g2
+ srl %g1, %g6, %g5
+ or %g2, %g5, %g2
+ st %g2, [%o0 + 12]
+6: ld [%o1 + 8], %o4
+ sll %o3, %g4, %g2
+ srl %o5, %g6, %g5
+ or %g2, %g5, %g2
+ st %g2, [%o0 + 8]
+7: ld [%o1 + 4], %g1
+ sll %o4, %g4, %g2
+ srl %o3, %g6, %g5
+ or %g2, %g5, %g2
+ st %g2, [%o0 + 4]
+8: ld [%o1], %o5
+ sll %g1, %g4, %g2
+ srl %o4, %g6, %g5
+ addcc %g3, -4, %g3
+ or %g2, %g5, %g2
+ add %o1, -16, %o1
+ st %g2, [%o0]
+ add %o0, -16, %o0
+ bne,a 5b
+ ld [%o1 + 12], %o3
+ sll %o5, %g4, %g2
+ srl %g1, %g6, %g5
+ srl %g4, 3, %g3
+ or %g2, %g5, %g2
+ add %o1, %g3, %o1
+ andcc %o2, 2, %g0
+ st %g2, [%o0 + 12]
+ be 1f
+ andcc %o2, 1, %g0
+
+ ldub [%o1 + 15], %g5
+ add %o1, -2, %o1
+ stb %g5, [%o0 + 11]
+ add %o0, -2, %o0
+ ldub [%o1 + 16], %g5
+ stb %g5, [%o0 + 12]
+1: be 1f
+ nop
+ ldub [%o1 + 15], %g5
+ stb %g5, [%o0 + 11]
+1: retl
+ ld [%sp + 64], %o0
+
+78: andcc %o1, 1, %g0
+ be 4f
+ andcc %o1, 2, %g0
+
+ ldub [%o1], %g2
+ add %o1, 1, %o1
+ stb %g2, [%o0]
+ sub %o2, 1, %o2
+ bne 3f
+ add %o0, 1, %o0
+4: lduh [%o1], %g2
+ add %o1, 2, %o1
+ sth %g2, [%o0]
+ sub %o2, 2, %o2
+ b 3f
+ add %o0, 2, %o0
+END(memmove)
+libc_hidden_def(memmove)
+
+ENTRY(memcpy) /* %o0=dst %o1=src %o2=len */
+ sub %o0, %o1, %o4
+ st %o0, [%sp + 64]
+9: andcc %o4, 3, %o5
+0: bne 86f
+ cmp %o2, 15
+
+ bleu 90f
+ andcc %o1, 3, %g0
+
+ bne 78b
+3: andcc %o1, 4, %g0
+
+ be 2f
+ mov %o2, %g1
+
+ ld [%o1], %o4
+ sub %g1, 4, %g1
+ st %o4, [%o0]
+ add %o1, 4, %o1
+ add %o0, 4, %o0
+2: andcc %g1, 0xffffff80, %g6
+ be 3f
+ andcc %o0, 4, %g0
+
+ be 82f + 4
+5: MOVE_BIGCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
+ MOVE_BIGCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
+ MOVE_BIGCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
+ MOVE_BIGCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
+ subcc %g6, 128, %g6
+ add %o1, 128, %o1
+ bne 5b
+ add %o0, 128, %o0
+3: andcc %g1, 0x70, %g6
+ be 80f
+ andcc %g1, 8, %g0
+
+ srl %g6, 1, %o4
+ mov %o7, %g2
+ add %g6, %o4, %o4
+ add %o1, %g6, %o1
+104: call 100f
+ add %o0, %g6, %o0
+ jmpl %o5 + (80f - 104b), %g0
+ mov %g2, %o7
+
+79: MOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g4, g5)
+ MOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g4, g5)
+ MOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g4, g5)
+ MOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g4, g5)
+ MOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g4, g5)
+ MOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g4, g5)
+ MOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g4, g5)
+
+80: be 81f
+ andcc %g1, 4, %g0
+
+ ldd [%o1], %g2
+ add %o0, 8, %o0
+ st %g2, [%o0 - 0x08]
+ add %o1, 8, %o1
+ st %g3, [%o0 - 0x04]
+
+81: be 1f
+ andcc %g1, 2, %g0
+
+ ld [%o1], %g2
+ add %o1, 4, %o1
+ st %g2, [%o0]
+ add %o0, 4, %o0
+1: be 1f
+ andcc %g1, 1, %g0
+
+ lduh [%o1], %g2
+ add %o1, 2, %o1
+ sth %g2, [%o0]
+ add %o0, 2, %o0
+1: be 1f
+ nop
+
+ ldub [%o1], %g2
+ stb %g2, [%o0]
+1: retl
+ ld [%sp + 64], %o0
+
+82: /* ldd_std */
+ MOVE_BIGALIGNCHUNK(o1, o0, 0x00, o2, o3, o4, o5, g2, g3, g4, g5)
+ MOVE_BIGALIGNCHUNK(o1, o0, 0x20, o2, o3, o4, o5, g2, g3, g4, g5)
+ MOVE_BIGALIGNCHUNK(o1, o0, 0x40, o2, o3, o4, o5, g2, g3, g4, g5)
+ MOVE_BIGALIGNCHUNK(o1, o0, 0x60, o2, o3, o4, o5, g2, g3, g4, g5)
+ subcc %g6, 128, %g6
+ add %o1, 128, %o1
+ bne 82b
+ add %o0, 128, %o0
+
+ andcc %g1, 0x70, %g6
+ be 84f
+ andcc %g1, 8, %g0
+
+ mov %o7, %g2
+111: call 110f
+ add %o1, %g6, %o1
+ mov %g2, %o7
+ jmpl %o5 + (84f - 111b), %g0
+ add %o0, %g6, %o0
+
+83: MOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3, g4, g5)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3, g4, g5)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3, g4, g5)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5)
+
+84: be 85f
+ andcc %g1, 4, %g0
+
+ ldd [%o1], %g2
+ add %o0, 8, %o0
+ std %g2, [%o0 - 0x08]
+ add %o1, 8, %o1
+85: be 1f
+ andcc %g1, 2, %g0
+
+ ld [%o1], %g2
+ add %o1, 4, %o1
+ st %g2, [%o0]
+ add %o0, 4, %o0
+1: be 1f
+ andcc %g1, 1, %g0
+
+ lduh [%o1], %g2
+ add %o1, 2, %o1
+ sth %g2, [%o0]
+ add %o0, 2, %o0
+1: be 1f
+ nop
+
+ ldub [%o1], %g2
+ stb %g2, [%o0]
+1: retl
+ ld [%sp + 64], %o0
+
+86: cmp %o2, 6
+ bleu 88f
+
+ cmp %o2, 256
+ bcc 87f
+
+ andcc %o0, 3, %g0
+ be 61f
+ andcc %o0, 1, %g0
+ be 60f
+ andcc %o0, 2, %g0
+
+ ldub [%o1], %g5
+ add %o1, 1, %o1
+ stb %g5, [%o0]
+ sub %o2, 1, %o2
+ bne 61f
+ add %o0, 1, %o0
+60: ldub [%o1], %g3
+ add %o1, 2, %o1
+ stb %g3, [%o0]
+ sub %o2, 2, %o2
+ ldub [%o1 - 1], %g3
+ add %o0, 2, %o0
+ stb %g3, [%o0 - 1]
+61: and %o1, 3, %g2
+ and %o2, 0xc, %g3
+ and %o1, -4, %o1
+ cmp %g3, 4
+ sll %g2, 3, %g4
+ mov 32, %g2
+ be 4f
+ sub %g2, %g4, %g6
+
+ blu 3f
+ cmp %g3, 0x8
+
+ be 2f
+ srl %o2, 2, %g3
+
+ ld [%o1], %o3
+ add %o0, -8, %o0
+ ld [%o1 + 4], %o4
+ b 8f
+ add %g3, 1, %g3
+2: ld [%o1], %o4
+ add %o0, -12, %o0
+ ld [%o1 + 4], %o5
+ add %g3, 2, %g3
+ b 9f
+ add %o1, -4, %o1
+3: ld [%o1], %g1
+ add %o0, -4, %o0
+ ld [%o1 + 4], %o3
+ srl %o2, 2, %g3
+ b 7f
+ add %o1, 4, %o1
+4: ld [%o1], %o5
+ cmp %o2, 7
+ ld [%o1 + 4], %g1
+ srl %o2, 2, %g3
+ bleu 10f
+ add %o1, 8, %o1
+
+ ld [%o1], %o3
+ add %g3, -1, %g3
+5: sll %o5, %g4, %g2
+ srl %g1, %g6, %g5
+ or %g2, %g5, %g2
+ st %g2, [%o0]
+7: ld [%o1 + 4], %o4
+ sll %g1, %g4, %g2
+ srl %o3, %g6, %g5
+ or %g2, %g5, %g2
+ st %g2, [%o0 + 4]
+8: ld [%o1 + 8], %o5
+ sll %o3, %g4, %g2
+ srl %o4, %g6, %g5
+ or %g2, %g5, %g2
+ st %g2, [%o0 + 8]
+9: ld [%o1 + 12], %g1
+ sll %o4, %g4, %g2
+ srl %o5, %g6, %g5
+ addcc %g3, -4, %g3
+ or %g2, %g5, %g2
+ add %o1, 16, %o1
+ st %g2, [%o0 + 12]
+ add %o0, 16, %o0
+ bne,a 5b
+ ld [%o1], %o3
+10: sll %o5, %g4, %g2
+ srl %g1, %g6, %g5
+ srl %g6, 3, %g3
+ or %g2, %g5, %g2
+ sub %o1, %g3, %o1
+ andcc %o2, 2, %g0
+ st %g2, [%o0]
+ be 1f
+ andcc %o2, 1, %g0
+
+ ldub [%o1], %g2
+ add %o1, 2, %o1
+ stb %g2, [%o0 + 4]
+ add %o0, 2, %o0
+ ldub [%o1 - 1], %g2
+ stb %g2, [%o0 + 3]
+1: be 1f
+ nop
+ ldub [%o1], %g2
+ stb %g2, [%o0 + 4]
+1: retl
+ ld [%sp + 64], %o0
+
+87: andcc %o1, 3, %g0
+ be 3f
+ andcc %o1, 1, %g0
+
+ be 4f
+ andcc %o1, 2, %g0
+
+ ldub [%o1], %g2
+ add %o1, 1, %o1
+ stb %g2, [%o0]
+ sub %o2, 1, %o2
+ bne 3f
+ add %o0, 1, %o0
+4: lduh [%o1], %g2
+ add %o1, 2, %o1
+ srl %g2, 8, %g3
+ sub %o2, 2, %o2
+ stb %g3, [%o0]
+ add %o0, 2, %o0
+ stb %g2, [%o0 - 1]
+3: andcc %o1, 4, %g0
+
+ bne 2f
+ cmp %o5, 1
+
+ ld [%o1], %o4
+ srl %o4, 24, %g2
+ stb %g2, [%o0]
+ srl %o4, 16, %g3
+ stb %g3, [%o0 + 1]
+ srl %o4, 8, %g2
+ stb %g2, [%o0 + 2]
+ sub %o2, 4, %o2
+ stb %o4, [%o0 + 3]
+ add %o1, 4, %o1
+ add %o0, 4, %o0
+2: be 33f
+ cmp %o5, 2
+ be 32f
+ sub %o2, 4, %o2
+31: ld [%o1], %g2
+ add %o1, 4, %o1
+ srl %g2, 24, %g3
+ and %o0, 7, %g5
+ stb %g3, [%o0]
+ cmp %g5, 7
+ sll %g2, 8, %g1
+ add %o0, 4, %o0
+ be 41f
+ and %o2, 0xffffffc0, %o3
+ ld [%o0 - 7], %o4
+4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
+ SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
+ SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
+ SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
+ subcc %o3, 64, %o3
+ add %o1, 64, %o1
+ bne 4b
+ add %o0, 64, %o0
+
+ andcc %o2, 0x30, %o3
+ be,a 1f
+ srl %g1, 16, %g2
+4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
+ subcc %o3, 16, %o3
+ add %o1, 16, %o1
+ bne 4b
+ add %o0, 16, %o0
+
+ srl %g1, 16, %g2
+1: st %o4, [%o0 - 7]
+ sth %g2, [%o0 - 3]
+ srl %g1, 8, %g4
+ b 88f
+ stb %g4, [%o0 - 1]
+32: ld [%o1], %g2
+ add %o1, 4, %o1
+ srl %g2, 16, %g3
+ and %o0, 7, %g5
+ sth %g3, [%o0]
+ cmp %g5, 6
+ sll %g2, 16, %g1
+ add %o0, 4, %o0
+ be 42f
+ and %o2, 0xffffffc0, %o3
+ ld [%o0 - 6], %o4
+4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
+ SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
+ SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
+ SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
+ subcc %o3, 64, %o3
+ add %o1, 64, %o1
+ bne 4b
+ add %o0, 64, %o0
+
+ andcc %o2, 0x30, %o3
+ be,a 1f
+ srl %g1, 16, %g2
+4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
+ subcc %o3, 16, %o3
+ add %o1, 16, %o1
+ bne 4b
+ add %o0, 16, %o0
+
+ srl %g1, 16, %g2
+1: st %o4, [%o0 - 6]
+ b 88f
+ sth %g2, [%o0 - 2]
+33: ld [%o1], %g2
+ sub %o2, 4, %o2
+ srl %g2, 24, %g3
+ and %o0, 7, %g5
+ stb %g3, [%o0]
+ cmp %g5, 5
+ srl %g2, 8, %g4
+ sll %g2, 24, %g1
+ sth %g4, [%o0 + 1]
+ add %o1, 4, %o1
+ be 43f
+ and %o2, 0xffffffc0, %o3
+
+ ld [%o0 - 1], %o4
+ add %o0, 4, %o0
+4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, -1)
+ SMOVE_CHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, -1)
+ SMOVE_CHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, -1)
+ SMOVE_CHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, -1)
+ subcc %o3, 64, %o3
+ add %o1, 64, %o1
+ bne 4b
+ add %o0, 64, %o0
+
+ andcc %o2, 0x30, %o3
+ be,a 1f
+ srl %g1, 24, %g2
+4: SMOVE_CHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, -1)
+ subcc %o3, 16, %o3
+ add %o1, 16, %o1
+ bne 4b
+ add %o0, 16, %o0
+
+ srl %g1, 24, %g2
+1: st %o4, [%o0 - 5]
+ b 88f
+ stb %g2, [%o0 - 1]
+41: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
+ SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
+ SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
+ SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
+ subcc %o3, 64, %o3
+ add %o1, 64, %o1
+ bne 41b
+ add %o0, 64, %o0
+
+ andcc %o2, 0x30, %o3
+ be,a 1f
+ srl %g1, 16, %g2
+4: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 8, 24, -3)
+ subcc %o3, 16, %o3
+ add %o1, 16, %o1
+ bne 4b
+ add %o0, 16, %o0
+
+ srl %g1, 16, %g2
+1: sth %g2, [%o0 - 3]
+ srl %g1, 8, %g4
+ b 88f
+ stb %g4, [%o0 - 1]
+43: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, 3)
+ SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, 3)
+ SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, 3)
+ SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, 3)
+ subcc %o3, 64, %o3
+ add %o1, 64, %o1
+ bne 43b
+ add %o0, 64, %o0
+
+ andcc %o2, 0x30, %o3
+ be,a 1f
+ srl %g1, 24, %g2
+4: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 24, 8, 3)
+ subcc %o3, 16, %o3
+ add %o1, 16, %o1
+ bne 4b
+ add %o0, 16, %o0
+
+ srl %g1, 24, %g2
+1: stb %g2, [%o0 + 3]
+ b 88f
+ add %o0, 4, %o0
+42: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
+ SMOVE_ALIGNCHUNK(o1, o0, 0x10, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
+ SMOVE_ALIGNCHUNK(o1, o0, 0x20, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
+ SMOVE_ALIGNCHUNK(o1, o0, 0x30, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
+ subcc %o3, 64, %o3
+ add %o1, 64, %o1
+ bne 42b
+ add %o0, 64, %o0
+
+ andcc %o2, 0x30, %o3
+ be,a 1f
+ srl %g1, 16, %g2
+4: SMOVE_ALIGNCHUNK(o1, o0, 0x00, g2, g3, g4, g5, o4, o5, g6, g1, 16, 16, -2)
+ subcc %o3, 16, %o3
+ add %o1, 16, %o1
+ bne 4b
+ add %o0, 16, %o0
+
+ srl %g1, 16, %g2
+1: sth %g2, [%o0 - 2]
+
+ /* Fall through */
+
+88: and %o2, 0xe, %o3
+ mov %o7, %g2
+ sll %o3, 3, %o4
+ add %o0, %o3, %o0
+106: call 100f
+ add %o1, %o3, %o1
+ mov %g2, %o7
+ jmpl %o5 + (89f - 106b), %g0
+ andcc %o2, 1, %g0
+
+ MOVE_SHORTCHUNK(o1, o0, 0x0c, g2, g3)
+ MOVE_SHORTCHUNK(o1, o0, 0x0a, g2, g3)
+ MOVE_SHORTCHUNK(o1, o0, 0x08, g2, g3)
+ MOVE_SHORTCHUNK(o1, o0, 0x06, g2, g3)
+ MOVE_SHORTCHUNK(o1, o0, 0x04, g2, g3)
+ MOVE_SHORTCHUNK(o1, o0, 0x02, g2, g3)
+ MOVE_SHORTCHUNK(o1, o0, 0x00, g2, g3)
+
+89: be 1f
+ nop
+
+ ldub [%o1], %g2
+ stb %g2, [%o0]
+1: retl
+ ld [%sp + 64], %o0
+
+90: bne 88b
+ andcc %o2, 8, %g0
+
+ be 1f
+ andcc %o2, 4, %g0
+
+ ld [%o1 + 0x00], %g2
+ ld [%o1 + 0x04], %g3
+ add %o1, 8, %o1
+ st %g2, [%o0 + 0x00]
+ st %g3, [%o0 + 0x04]
+ add %o0, 8, %o0
+1: b 81b
+ mov %o2, %g1
+
+100: retl
+ sub %o7, %o4, %o5
+110: retl
+ sub %o7, %g6, %o5
+END(memcpy)
+libc_hidden_def(memcpy)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/memset.S b/ap/build/uClibc/libc/string/sparc/sparc32/memset.S
new file mode 100644
index 0000000..6c6424c
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/memset.S
@@ -0,0 +1,157 @@
+/* Set a block of memory to some byte value.
+ For SPARC v7.
+ Copyright (C) 1996, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller <davem@caip.rutgers.edu> and
+ Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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>
+
+ /* Store 64 bytes at (BASE + OFFSET) using value SOURCE. */
+#define ZERO_BIG_BLOCK(base, offset, source) \
+ std source, [base + offset + 0x00]; \
+ std source, [base + offset + 0x08]; \
+ std source, [base + offset + 0x10]; \
+ std source, [base + offset + 0x18]; \
+ std source, [base + offset + 0x20]; \
+ std source, [base + offset + 0x28]; \
+ std source, [base + offset + 0x30]; \
+ std source, [base + offset + 0x38];
+
+#define ZERO_LAST_BLOCKS(base, offset, source) \
+ std source, [base - offset - 0x38]; \
+ std source, [base - offset - 0x30]; \
+ std source, [base - offset - 0x28]; \
+ std source, [base - offset - 0x20]; \
+ std source, [base - offset - 0x18]; \
+ std source, [base - offset - 0x10]; \
+ std source, [base - offset - 0x08]; \
+ std source, [base - offset - 0x00];
+
+ .text
+ .align 4
+#ifdef __UCLIBC_SUSV3_LEGACY__
+ENTRY(bzero)
+ b 1f
+ mov %g0, %g3
+#endif
+
+3: cmp %o2, 3
+ be 2f
+ stb %g3, [%o0]
+
+ cmp %o2, 2
+ be 2f
+ stb %g3, [%o0 + 0x01]
+
+ stb %g3, [%o0 + 0x02]
+2: sub %o2, 4, %o2
+ add %o1, %o2, %o1
+ b 4f
+ sub %o0, %o2, %o0
+#ifdef __UCLIBC_SUSV3_LEGACY__
+END(bzero)
+#endif
+
+ENTRY(memset)
+ and %o1, 0xff, %g3
+ sll %g3, 8, %g2
+ or %g3, %g2, %g3
+ sll %g3, 16, %g2
+ or %g3, %g2, %g3
+ orcc %o2, %g0, %o1
+1: cmp %o1, 7
+ bleu 7f
+ mov %o0, %g1
+
+ andcc %o0, 3, %o2
+ bne 3b
+4: andcc %o0, 4, %g0
+
+ be 2f
+ mov %g3, %g2
+
+ st %g3, [%o0]
+ sub %o1, 4, %o1
+ add %o0, 4, %o0
+2: andcc %o1, 0xffffff80, %o3
+ be 9f
+ andcc %o1, 0x78, %o2
+4: ZERO_BIG_BLOCK (%o0, 0x00, %g2)
+ subcc %o3, 128, %o3
+ ZERO_BIG_BLOCK (%o0, 0x40, %g2)
+ bne 4b
+ add %o0, 128, %o0
+
+ orcc %o2, %g0, %g0
+9: be 6f
+ andcc %o1, 7, %o1
+
+ mov %o7, %g4
+101: call 100f
+ srl %o2, 1, %o3
+ mov %g4, %o7
+ jmpl %o4 + (20f + 64 - 101b), %g0
+ add %o0, %o2, %o0
+
+100: retl
+ sub %o7, %o3, %o4
+
+20: ZERO_LAST_BLOCKS(%o0, 0x48, %g2)
+ ZERO_LAST_BLOCKS(%o0, 0x08, %g2)
+
+6: be 8f
+ andcc %o1, 4, %g0
+ be 1f
+ andcc %o1, 2, %g0
+ st %g3, [%o0]
+ add %o0, 4, %o0
+1: be 1f
+ andcc %o1, 1, %g0
+ sth %g3, [%o0]
+ add %o0, 2, %o0
+1: bne,a 8f
+ stb %g3, [%o0]
+8: retl
+ mov %g1, %o0
+7: orcc %o1, 0, %g0
+ be 0f
+ subcc %o1, 1, %o1
+ stb %g3, [%o0]
+ be 0f
+ subcc %o1, 1, %o1
+ stb %g3, [%o0 + 1]
+ be 0f
+ subcc %o1, 1, %o1
+ stb %g3, [%o0 + 2]
+ be 0f
+ subcc %o1, 1, %o1
+ stb %g3, [%o0 + 3]
+ be 0f
+ subcc %o1, 1, %o1
+ stb %g3, [%o0 + 4]
+ be 0f
+ subcc %o1, 1, %o1
+ stb %g3, [%o0 + 5]
+ be 0f
+ subcc %o1, 1, %o1
+ stb %g3, [%o0 + 6]
+0: retl
+ nop
+END(memset)
+libc_hidden_def(memset)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/memchr.S b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/memchr.S
new file mode 100644
index 0000000..43a16ff
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/memchr.S
@@ -0,0 +1,4 @@
+#define ASI_PNF 0x82
+#define ASI_BLK_P 0xf0
+#define XCC icc
+#include "../../sparc64/memchr.S"
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/memcpy.S b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/memcpy.S
new file mode 100644
index 0000000..2024869
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/memcpy.S
@@ -0,0 +1,4 @@
+#define ASI_PNF 0x82
+#define ASI_BLK_P 0xf0
+#define XCC icc
+#include "../../sparc64/sparcv9b/memcpy.S"
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/memset.S b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/memset.S
new file mode 100644
index 0000000..e491731
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/memset.S
@@ -0,0 +1,4 @@
+#define ASI_PNF 0x82
+#define ASI_BLK_P 0xf0
+#define XCC icc
+#include "../../sparc64/memset.S"
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/stpcpy.S b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/stpcpy.S
new file mode 100644
index 0000000..17ffa5e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/stpcpy.S
@@ -0,0 +1,4 @@
+#define ASI_PNF 0x82
+#define ASI_BLK_P 0xf0
+#define XCC icc
+#include "../../sparc64/stpcpy.S"
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strcat.S b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strcat.S
new file mode 100644
index 0000000..9ed125a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strcat.S
@@ -0,0 +1,4 @@
+#define ASI_PNF 0x82
+#define ASI_BLK_P 0xf0
+#define XCC icc
+#include "../../sparc64/strcat.S"
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strchr.S b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strchr.S
new file mode 100644
index 0000000..6b2727a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strchr.S
@@ -0,0 +1,4 @@
+#define ASI_PNF 0x82
+#define ASI_BLK_P 0xf0
+#define XCC icc
+#include "../../sparc64/strchr.S"
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strcmp.S b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strcmp.S
new file mode 100644
index 0000000..854403f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strcmp.S
@@ -0,0 +1,4 @@
+#define ASI_PNF 0x82
+#define ASI_BLK_P 0xf0
+#define XCC icc
+#include "../../sparc64/strcmp.S"
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strcpy.S b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strcpy.S
new file mode 100644
index 0000000..e8102bd
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strcpy.S
@@ -0,0 +1,4 @@
+#define ASI_PNF 0x82
+#define ASI_BLK_P 0xf0
+#define XCC icc
+#include "../../sparc64/strcpy.S"
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strlen.S b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strlen.S
new file mode 100644
index 0000000..8673333
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/sparcv9b/strlen.S
@@ -0,0 +1,4 @@
+#define ASI_PNF 0x82
+#define ASI_BLK_P 0xf0
+#define XCC icc
+#include "../../sparc64/strlen.S"
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/stpcpy.S b/ap/build/uClibc/libc/string/sparc/sparc32/stpcpy.S
new file mode 100644
index 0000000..daf116e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/stpcpy.S
@@ -0,0 +1,161 @@
+/* Copy SRC to DEST returning the address of the terminating '\0' in DEST.
+ For SPARC v7.
+ Copyright (C) 1996, 1999, 2002, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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. */
+
+ /* Normally, this uses ((xword - 0x01010101) & 0x80808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x01010101) & (~xword) & 0x80808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 4
+10: ldub [%o1], %o5
+ stb %o5, [%o0]
+ cmp %o5, 0
+ add %o0, 1, %o0
+ be 1f
+ add %o1, 1, %o1
+ andcc %o1, 3, %g0
+ be 4f
+ or %o4, %lo(0x80808080), %o3
+ ldub [%o1], %o5
+ stb %o5, [%o0]
+ cmp %o5, 0
+ add %o0, 1, %o0
+ be 1f
+ add %o1, 1, %o1
+ andcc %o1, 3, %g0
+ be 5f
+ sethi %hi(0x01010101), %o4
+ ldub [%o1], %o5
+ stb %o5, [%o0]
+ cmp %o5, 0
+ add %o0, 1, %o0
+ be 1f
+ add %o1, 1, %o1
+ b 6f
+ or %o4, %lo(0x01010101), %o2
+1: retl
+ add %o0, -1, %o0
+
+ENTRY(stpcpy)
+ andcc %o1, 3, %g0
+ bne 10b
+ sethi %hi(0x80808080), %o4
+ or %o4, %lo(0x80808080), %o3
+4: sethi %hi(0x01010101), %o4
+5: or %o4, %lo(0x01010101), %o2
+6: andcc %o0, 3, %g0
+ bne 16f
+ sub %g0, 4, %g1
+
+11: add %g1, 4, %g1
+ ld [%o1 + %g1], %o5
+ sub %o5, %o2, %o4
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o5, %o4
+#endif
+ andcc %o4, %o3, %g0
+ be,a 11b
+ st %o5, [%o0 + %g1]
+
+ /* Check every byte. */
+ srl %o5, 24, %g5
+ andcc %g5, 0xff, %g0
+ be 14f
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g0
+ be 13f
+ srl %o5, 8, %g5
+ andcc %g5, 0xff, %g0
+ be 12f
+ andcc %o5, 0xff, %g0
+ bne 11b
+ st %o5, [%o0 + %g1]
+ add %o0, %g1, %o0
+ retl
+ add %o0, 3, %o0
+12: srl %o5, 16, %o5
+ sth %o5, [%o0 + %g1]
+ add %g1, 2, %g1
+ stb %g0, [%o0 + %g1]
+ retl
+ add %o0, %g1, %o0
+13: srl %o5, 16, %o5
+ sth %o5, [%o0 + %g1]
+ add %g1, 1, %g1
+ retl
+ add %o0, %g1, %o0
+14: stb %g0, [%o0 + %g1]
+ retl
+ add %o0, %g1, %o0
+
+15: srl %o5, 24, %o4
+ srl %o5, 16, %g1
+ stb %o4, [%o0]
+ srl %o5, 8, %g4
+ stb %g1, [%o0 + 1]
+ stb %g4, [%o0 + 2]
+ stb %o5, [%o0 + 3]
+ add %o0, 4, %o0
+16: ld [%o1], %o5
+ sub %o5, %o2, %o4
+ andcc %o4, %o3, %g0
+ be 15b
+ add %o1, 4, %o1
+
+ /* Check every byte. */
+ srl %o5, 24, %g5
+ andcc %g5, 0xff, %g4
+ be 19f
+ stb %g4, [%o0]
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g4
+ be 18f
+ stb %g4, [%o0 + 1]
+ srl %o5, 8, %g5
+ andcc %g5, 0xff, %g4
+ be 17f
+ stb %g4, [%o0 + 2]
+ andcc %o5, 0xff, %g4
+ stb %g4, [%o0 + 3]
+ bne 16b
+ add %o0, 4, %o0
+ retl
+ sub %o0, 1, %o0
+17: retl
+ add %o0, 2, %o0
+18: retl
+ add %o0, 1, %o0
+19: retl
+ nop
+END(stpcpy)
+
+libc_hidden_def(stpcpy)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/strcat.S b/ap/build/uClibc/libc/string/sparc/sparc32/strcat.S
new file mode 100644
index 0000000..eda029a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/strcat.S
@@ -0,0 +1,348 @@
+/* strcat (dest, src) -- Append SRC on the end of DEST.
+ For SPARC v7.
+ Copyright (C) 1996, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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. */
+
+ /* Normally, this uses ((xword - 0x01010101) & 0x80808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x01010101) & (~xword) & 0x80808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 4
+10: cmp %o4, 2
+ be 1f
+ cmp %o4, 3
+ ldub [%o1], %o5
+ add %o1, 1, %o1
+ stb %o5, [%o0]
+ be 3f
+ cmp %o5, 0
+ be 0f
+ add %o0, 1, %o0
+1: lduh [%o1], %o5
+ add %o1, 2, %o1
+ srl %o5, 8, %o4
+ cmp %o4, 0
+ stb %o4, [%o0]
+ bne,a 2f
+ stb %o5, [%o0 + 1]
+ retl
+ mov %g2, %o0
+2: andcc %o5, 0xff, %o5
+ bne 4f
+ add %o0, 2, %o0
+ retl
+ mov %g2, %o0
+3: bne 4f
+ add %o0, 1, %o0
+ retl
+ mov %g2, %o0
+
+11: ldub [%o0], %o5
+ cmp %o5, 0
+ be 1f
+ add %o0, 1, %o0
+ andcc %o0, 3, %g0
+ be 7f
+ or %o4, %lo(0x80808080), %o3
+ ldub [%o0], %o5
+ cmp %o5, 0
+ be 2f
+ add %o0, 1, %o0
+ andcc %o0, 3, %g0
+ be 8f
+ sethi %hi(0x01010101), %o4
+ ldub [%o0], %o5
+ cmp %o5, 0
+ be 3f
+ add %o0, 1, %o0
+ b 9f
+ or %o4, %lo(0x01010101), %o2
+1: or %o4, %lo(0x80808080), %o3
+2: sethi %hi(0x01010101), %o4
+3: or %o4, %lo(0x01010101), %o2
+ b 3f
+ sub %o0, 1, %o0
+
+ENTRY(strcat)
+ mov %o0, %g2
+ andcc %o0, 3, %g0
+ bne 11b
+ sethi %hi(0x80808080), %o4
+ or %o4, %lo(0x80808080), %o3
+7: sethi %hi(0x01010101), %o4
+8: or %o4, %lo(0x01010101), %o2
+9: ld [%o0], %o5
+7: sub %o5, %o2, %o4
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o5, %o4
+#endif
+ andcc %o4, %o3, %g0
+ be 9b
+ add %o0, 4, %o0
+
+ srl %o5, 24, %g5
+ andcc %g5, 0xff, %g0
+ be 3f
+ add %o0, -4, %o0
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g0
+ be 3f
+ add %o0, 1, %o0
+ srl %o5, 8, %g5
+ andcc %g5, 0xff, %g0
+ be 3f
+ add %o0, 1, %o0
+ andcc %o5, 0xff, %g0
+ add %o0, 2, %o0
+ bne,a 7b
+ ld [%o0], %o5
+ sub %o0, 1, %o0
+3: andcc %o1, 3, %o4
+ bne 10b
+4: andcc %o0, 3, %g3
+ bne 12f
+1: ld [%o1], %o5
+ add %o1, 4, %o1
+ sub %o5, %o2, %o4
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o5, %o4
+#endif
+ add %o0, 4, %o0
+ andcc %o4, %o3, %g0
+ be,a 1b
+ st %o5, [%o0 - 4]
+
+ srl %o5, 24, %g5
+ andcc %g5, 0xff, %g0
+ be 1f
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g0
+ be 2f
+ srl %o5, 8, %g5
+ andcc %g5, 0xff, %g0
+ be 3f
+ andcc %o5, 0xff, %g0
+ bne 1b
+ st %o5, [%o0 - 4]
+ retl
+ mov %g2, %o0
+3: srl %o5, 16, %o5
+ sth %o5, [%o0 - 4]
+ stb %g0, [%o0 - 2]
+ retl
+ mov %g2, %o0
+2: srl %o5, 16, %o5
+ sth %o5, [%o0 - 4]
+ retl
+ mov %g2, %o0
+1: stb %g0, [%o0 - 4]
+ retl
+ mov %g2, %o0
+
+12: add %o1, 4, %o1
+ sub %o5, %o2, %o4
+ cmp %g3, 2
+ be 2f
+ cmp %g3, 3
+ be 3f
+ andcc %o4, %o3, %g0
+ bne 5f
+ srl %o5, 24, %g5
+ stb %g5, [%o0]
+ sub %o0, 1, %o0
+ srl %o5, 8, %g5
+ sth %g5, [%o0 + 2]
+1: add %o0, 4, %o0
+4: sll %o5, 24, %g6
+ ld [%o1], %o5
+ add %o1, 4, %o1
+ srl %o5, 8, %g5
+ sub %o5, %o2, %o4
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o5, %o4
+#endif
+ or %g5, %g6, %g5
+ andcc %o4, %o3, %g0
+ be,a 1b
+ st %g5, [%o0]
+ srl %o5, 24, %o4
+ andcc %o4, 0xff, %g0
+ be 6f
+ srl %o5, 16, %o4
+ andcc %o4, 0xff, %g0
+ be 7f
+ srl %o5, 8, %o4
+ st %g5, [%o0]
+ andcc %o4, 0xff, %g0
+ be 0f
+ andcc %o5, 0xff, %g0
+1: bne 4b
+ add %o0, 4, %o0
+9: stb %g0, [%o0]
+0: retl
+ mov %g2, %o0
+
+6: srl %g5, 16, %g5
+ sth %g5, [%o0]
+ retl
+ mov %g2, %o0
+
+7: srl %g5, 16, %g5
+ sth %g5, [%o0]
+ stb %g0, [%o0 + 2]
+ retl
+ mov %g2, %o0
+
+5: andcc %g5, 0xff, %g4
+ be 9b
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g0
+ be 7f
+ srl %o5, 8, %g5
+ andcc %g5, 0xff, %g0
+ stb %g4, [%o0]
+ sth %g5, [%o0 + 1]
+ sub %o0, 1, %o0
+ bne 1b
+ andcc %o5, 0xff, %g0
+ retl
+ mov %g2, %o0
+
+7: stb %g4, [%o0]
+ stb %g0, [%o0 + 1]
+ retl
+ mov %g2, %o0
+
+2: andcc %o4, %o3, %g0
+ bne 5f
+ srl %o5, 16, %g5
+ sth %g5, [%o0]
+ sub %o0, 2, %o0
+1: add %o0, 4, %o0
+4: sll %o5, 16, %g6
+ ld [%o1], %o5
+ add %o1, 4, %o1
+ srl %o5, 16, %g5
+ sub %o5, %o2, %o4
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o5, %o4
+#endif
+ or %g5, %g6, %g5
+ andcc %o4, %o3, %g0
+ be,a 1b
+ st %g5, [%o0]
+ srl %o5, 24, %o4
+ andcc %o4, 0xff, %g0
+ be 7f
+ srl %o5, 16, %o4
+ st %g5, [%o0]
+ andcc %o4, 0xff, %g0
+ be 0b
+ srl %o5, 8, %o4
+1: andcc %o4, 0xff, %g0
+ be 8f
+ andcc %o5, 0xff, %g0
+ bne 4b
+ add %o0, 4, %o0
+ sth %o5, [%o0]
+ retl
+ mov %g2, %o0
+
+7: srl %g5, 16, %g5
+ sth %g5, [%o0]
+ stb %g0, [%o0 + 2]
+ retl
+ mov %g2, %o0
+
+8: stb %g0, [%o0 + 4]
+ retl
+ mov %g2, %o0
+
+5: srl %o5, 24, %g5
+ andcc %g5, 0xff, %g0
+ be 9b
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g0
+ sth %g5, [%o0]
+ sub %o0, 2, %o0
+ bne 1b
+ srl %o5, 8, %o4
+ retl
+ mov %g2, %o0
+
+3: bne 5f
+ srl %o5, 24, %g5
+ stb %g5, [%o0]
+ sub %o0, 3, %o0
+1: add %o0, 4, %o0
+4: sll %o5, 8, %g6
+ ld [%o1], %o5
+ add %o1, 4, %o1
+ srl %o5, 24, %g5
+ sub %o5, %o2, %o4
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o5, %o4
+#endif
+ or %g5, %g6, %g5
+ andcc %o4, %o3, %g0
+ be 1b
+ st %g5, [%o0]
+ srl %o5, 24, %o4
+ andcc %o4, 0xff, %g0
+ be 0b
+ srl %o5, 16, %o4
+1: andcc %o4, 0xff, %g0
+ be 8b
+ srl %o5, 8, %o4
+ andcc %o4, 0xff, %g0
+ be 9f
+ andcc %o5, 0xff, %g0
+ bne 4b
+ add %o0, 4, %o0
+ srl %o5, 8, %o5
+ sth %o5, [%o0]
+ stb %g0, [%o0 + 2]
+ retl
+ mov %g2, %o0
+9: srl %o5, 8, %o5
+ sth %o5, [%o0 + 4]
+ retl
+ mov %g2, %o0
+5: andcc %g5, 0xff, %g0
+ stb %g5, [%o0]
+ sub %o0, 3, %o0
+ bne 1b
+ srl %o5, 16, %o4
+ retl
+ mov %g2, %o0
+END(strcat)
+
+libc_hidden_def(strcat)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/strchr.S b/ap/build/uClibc/libc/string/sparc/sparc32/strchr.S
new file mode 100644
index 0000000..16710d4
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/strchr.S
@@ -0,0 +1,287 @@
+/* strchr (str, ch) -- Return pointer to first occurrence of CH in STR.
+ For SPARC v7.
+ Copyright (C) 1996, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz> and
+ David S. Miller <davem@caip.rutgers.edu>.
+
+ 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. */
+
+ /* Normally, this uses ((xword - 0x01010101) & 0x80808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x01010101) & (~xword) & 0x80808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+#include <features.h>
+
+ .text
+ .align 4
+10: ldub [%o0], %g4
+ cmp %g4, %o1
+ be 1f
+ add %o0, 1, %o0
+ cmp %g4, 0
+ be 9f
+ andcc %o0, 3, %g0
+ be 4f
+ or %o4, %lo(0x80808080), %o3
+ ldub [%o0], %g4
+ cmp %g4, %o1
+ be 1f
+ add %o0, 1, %o0
+ cmp %g4, 0
+ be 9f
+ andcc %o0, 3, %g0
+ be 5f
+ sethi %hi(0x01010101), %o5
+ ldub [%o0], %g4
+ cmp %g4, %o1
+ be 1f
+ add %o0, 1, %o0
+ cmp %g4, 0
+ be 9f
+ or %o5, %lo(0x01010101), %o2
+ b 6f
+ ld [%o0], %g4
+1: retl
+ sub %o0, 1, %o0
+
+ENTRY(strchr)
+ andcc %o1, 0xff, %o1
+ be 12f
+ sll %o1, 8, %o2
+ andcc %o0, 3, %g0
+ or %o1, %o2, %o2
+ sethi %hi(0x80808080), %o4
+ sll %o2, 16, %o3
+ bne 10b
+ or %o3, %o2, %g2
+ or %o4, %lo(0x80808080), %o3
+4: sethi %hi(0x01010101), %o5
+5: or %o5, %lo(0x01010101), %o2
+7: ld [%o0], %g4
+6: xor %g4, %g2, %g5
+ sub %g4, %o2, %o4
+#ifdef EIGHTBIT_NOT_RARE
+ sub %g5, %o2, %g6
+ andn %o4, %g4, %o4
+ andn %g6, %g5, %g5
+#else
+ sub %g5, %o2, %g5
+#endif
+ or %g5, %o4, %o4
+ andcc %o4, %o3, %g0
+ be 7b
+ add %o0, 4, %o0
+
+ /* Check every byte. */
+8: srl %g4, 24, %g5
+7: andcc %g5, 0xff, %g5
+ be 9f
+ cmp %g5, %o1
+ be 4f
+ srl %g4, 16, %g5
+ andcc %g5, 0xff, %g5
+ be 9f
+ cmp %g5, %o1
+ be 3f
+ srl %g4, 8, %g5
+ andcc %g5, 0xff, %g5
+ be 9f
+ cmp %g5, %o1
+ be 2f
+ andcc %g4, 0xff, %g5
+ be 9f
+ cmp %g5, %o1
+ bne,a 6b
+ ld [%o0], %g4
+ retl
+ sub %o0, 1, %o0
+2: retl
+ sub %o0, 2, %o0
+3: retl
+ sub %o0, 3, %o0
+4: retl
+ sub %o0, 4, %o0
+9: retl
+ clr %o0
+
+11: ldub [%o0], %o5
+ cmp %o5, 0
+ be 1f
+ add %o0, 1, %o0
+ andcc %o0, 3, %g0
+ be 4f
+ or %o4, %lo(0x80808080), %o3
+ ldub [%o0], %o5
+ cmp %o5, 0
+ be 1f
+ add %o0, 1, %o0
+ andcc %o0, 3, %g0
+ be 5f
+ sethi %hi(0x01010101), %o4
+ ldub [%o0], %o5
+ cmp %o5, 0
+ be 1f
+ add %o0, 1, %o0
+ b 6f
+ or %o4, %lo(0x01010101), %o2
+1: retl
+ sub %o0, 1, %o0
+
+12: andcc %o0, 3, %g0
+ bne 11b
+ sethi %hi(0x80808080), %o4
+ or %o4, %lo(0x80808080), %o3
+4: sethi %hi(0x01010101), %o4
+5: or %o4, %lo(0x01010101), %o2
+6: ld [%o0], %o5
+7: sub %o5, %o2, %o4
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o5, %o4
+#endif
+ andcc %o4, %o3, %g0
+ be 6b
+ add %o0, 4, %o0
+
+ /* Check every byte. */
+ srl %o5, 24, %g5
+ andcc %g5, 0xff, %g0
+ be 8f
+ add %o0, -4, %o4
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g0
+ be 8f
+ add %o4, 1, %o4
+ srl %o5, 8, %g5
+ andcc %g5, 0xff, %g0
+ be 8f
+ add %o4, 1, %o4
+ andcc %o5, 0xff, %g0
+ bne,a 7b
+ ld [%o0], %o5
+ add %o4, 1, %o4
+8: retl
+ mov %o4, %o0
+
+13: ldub [%o0], %g4
+ cmp %g4, %o1
+ add %o0, 1, %o0
+ be,a 1f
+ sub %o0, 1, %o5
+ cmp %g4, 0
+ be 9f
+1: andcc %o0, 3, %g0
+ be 4f
+ or %o4, %lo(0x80808080), %o3
+ ldub [%o0], %g4
+ cmp %g4, %o1
+ add %o0, 1, %o0
+ be,a 1f
+ sub %o0, 1, %o5
+ cmp %g4, 0
+ be 9f
+1: andcc %o0, 3, %g0
+ be 5f
+ sethi %hi(0x01010101), %o4
+ ldub [%o0], %g4
+ cmp %g4, %o1
+ add %o0, 1, %o0
+ be,a 1f
+ sub %o0, 1, %o5
+ cmp %g4, 0
+ be 9f
+1: or %o4, %lo(0x01010101), %o2
+ b 7f
+ ld [%o0], %g4
+END(strchr)
+libc_hidden_def(strchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(strchr,index)
+#endif
+
+ENTRY(strrchr)
+ andcc %o1, 0xff, %o1
+ clr %o5
+ be 12b
+ sll %o1, 8, %o2
+ andcc %o0, 3, %g0
+ or %o1, %o2, %o2
+ sethi %hi(0x80808080), %o4
+ sll %o2, 16, %o3
+ bne 13b
+ or %o3, %o2, %g2
+ or %o4, %lo(0x80808080), %o3
+4: sethi %hi(0x01010101), %o4
+5: or %o4, %lo(0x01010101), %o2
+6: ld [%o0], %g4
+7: xor %g4, %g2, %g5
+ sub %g4, %o2, %o4
+#ifdef EIGHTBIT_NOT_RARE
+ sub %g5, %o2, %g6
+ andn %o4, %g4, %o4
+ andn %g6, %g5, %g5
+#else
+ sub %g5, %o2, %g5
+#endif
+ or %g5, %o4, %o4
+ andcc %o4, %o3, %g0
+ be 6b
+ add %o0, 4, %o0
+
+ /* Check every byte. */
+3: srl %g4, 24, %g5
+8: andcc %g5, 0xff, %g5
+ be 9f
+ cmp %g5, %o1
+ be,a 1f
+ sub %o0, 4, %o5
+1: srl %g4, 16, %g5
+ andcc %g5, 0xff, %g5
+ be 9f
+ cmp %g5, %o1
+ be,a 1f
+ sub %o0, 3, %o5
+1: srl %g4, 8, %g5
+ andcc %g5, 0xff, %g5
+ be 9f
+ cmp %g5, %o1
+ be,a 1f
+ sub %o0, 2, %o5
+1: andcc %g4, 0xff, %g5
+ be 9f
+ cmp %g5, %o1
+ be,a 1f
+ sub %o0, 1, %o5
+1: b 7b
+ ld [%o0], %g4
+9: retl
+ mov %o5, %o0
+END(strrchr)
+libc_hidden_def(strrchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(strrchr,rindex)
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/strcmp.S b/ap/build/uClibc/libc/string/sparc/sparc32/strcmp.S
new file mode 100644
index 0000000..d43883d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/strcmp.S
@@ -0,0 +1,256 @@
+/* Compare two strings for differences.
+ For SPARC v7.
+ Copyright (C) 1996, 97, 99, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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. */
+
+ /* Normally, this uses ((xword - 0x01010101) & 0x80808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x01010101) & (~xword) & 0x80808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 4
+10: ldub [%o0], %o4
+ add %o0, 1, %o0
+ ldub [%o1], %o5
+ cmp %o4, 0
+ add %o1, 1, %o1
+ be 2f
+ subcc %o4, %o5, %o4
+ bne 2f
+ andcc %o0, 3, %g0
+ be 4f
+ or %g1, %lo(0x80808080), %o3
+ ldub [%o0], %o4
+ add %o0, 1, %o0
+ ldub [%o1], %o5
+ cmp %o4, 0
+ add %o1, 1, %o1
+ be 2f
+ subcc %o4, %o5, %o4
+ bne 2f
+ andcc %o0, 3, %g0
+ be 5f
+ sethi %hi(0x01010101), %g1
+ ldub [%o0], %o4
+ add %o0, 1, %o0
+ ldub [%o1], %o5
+ cmp %o4, 0
+ add %o1, 1, %o1
+ be 2f
+ subcc %o4, %o5, %o4
+ bne 2f
+ andcc %o1, 3, %g2
+ bne 12f
+ or %g1, %lo(0x01010101), %o2
+ b 1f
+ ld [%o0], %o4
+2: retl
+ mov %o4, %o0
+
+ENTRY(strcmp)
+ andcc %o0, 3, %g0
+ bne 10b
+ sethi %hi(0x80808080), %g1
+ or %g1, %lo(0x80808080), %o3
+4: sethi %hi(0x01010101), %g1
+5: andcc %o1, 3, %g2
+ bne 12f
+ or %g1, %lo(0x01010101), %o2
+
+0: ld [%o0], %o4
+1: ld [%o1], %o5
+ sub %o4, %o2, %g1
+ add %o0, 4, %o0
+ cmp %o4, %o5
+#ifdef EIGHTBIT_NOT_RARE
+ andn %g1, %o4, %g1
+#endif
+ bne 11f
+ andcc %g1, %o3, %g0
+ be 0b
+ add %o1, 4, %o1
+
+ srl %o4, 24, %g4
+ andcc %g4, 0xff, %g0
+ be 2f
+ srl %o4, 16, %g4
+ andcc %g4, 0xff, %g0
+ be 2f
+ srl %o4, 8, %g4
+ andcc %g4, 0xff, %g0
+ be 2f
+ andcc %o4, 0xff, %g0
+ bne,a 1b
+ ld [%o0], %o4
+2: retl
+ clr %o0
+
+11: srl %o4, 24, %g4
+ srl %o5, 24, %g5
+ andcc %g4, 0xff, %g0
+ be 3f
+ subcc %g4, %g5, %g4
+ bne 3f
+ srl %o5, 16, %g5
+ srl %o4, 16, %g4
+ andcc %g4, 0xff, %g0
+ be 3f
+ subcc %g4, %g5, %g4
+ bne 3f
+ srl %o5, 8, %g5
+ srl %o4, 8, %g4
+ andcc %g4, 0xff, %g0
+ be 3f
+ subcc %g4, %g5, %g4
+ bne 3f
+ subcc %o4, %o5, %o4
+ retl
+ mov %o4, %o0
+3: retl
+ mov %g4, %o0
+
+12: save %sp, -64, %sp
+ ld [%i0], %i4
+ sll %g2, 3, %g3
+ andn %i1, 3, %i1
+ mov 32, %l1
+ ld [%i1], %l2
+ mov -1, %g6
+ add %i1, 4, %i1
+ sub %l1, %g3, %l1
+ sll %g6, %g3, %g6
+
+1: sll %l2, %g3, %g5
+ and %i4, %g6, %l3
+ sub %i4, %i2, %g1
+#ifdef EIGHTBIT_NOT_RARE
+ andn %g1, %i4, %g1
+#endif
+ andcc %g1, %i3, %g1
+ bne 3f
+ cmp %g5, %l3
+ bne 2f
+ add %i0, 4, %i0
+ ld [%i1], %l2
+ add %i1, 4, %i1
+ srl %l2, %l1, %l4
+ or %l4, %g5, %l4
+ cmp %l4, %i4
+ be,a 1b
+ ld [%i0], %i4
+ restore %l4, %g0, %o3
+ retl
+ sub %o4, %o3, %o0
+
+2: sll %l2, %g3, %i2
+ srl %i4, %g3, %i3
+ srl %i2, %g3, %i2
+ restore
+ retl
+ sub %o3, %o2, %o0
+
+3: srl %i4, 24, %g4
+ srl %g5, 24, %l6
+ andcc %g4, 0xff, %g0
+ be 4f
+ subcc %g4, %l6, %g4
+ bne 4f
+ cmp %g2, 3
+ be 6f
+ srl %i4, 16, %g4
+ srl %g5, 16, %l6
+ andcc %g4, 0xff, %g0
+ be 4f
+ subcc %g4, %l6, %g4
+ bne 4f
+ cmp %g2, 2
+ be 5f
+ srl %i4, 8, %g4
+ srl %g5, 8, %l6
+ andcc %g4, 0xff, %g0
+ be 4f
+ subcc %g4, %l6, %g4
+ bne 4f
+ add %i0, 4, %i0
+ ld [%i1], %l2
+ add %i1, 4, %i1
+ srl %l2, 24, %g5
+ andcc %i4, 0xff, %g4
+ be 4f
+ subcc %g4, %g5, %g4
+ be,a 1b
+ ld [%i0], %i4
+4: jmpl %i7 + 8, %g0
+ restore %g4, %g0, %o0
+
+5: ld [%i1], %l2
+ add %i1, 4, %i1
+ add %i0, 4, %i0
+ srl %l2, 24, %l6
+ andcc %g4, 0xff, %g4
+ be 4b
+ subcc %g4, %l6, %g4
+ bne 4b
+ srl %l2, 16, %l6
+ andcc %i4, 0xff, %g4
+ and %l6, 0xff, %l6
+ be 4b
+ subcc %g4, %l6, %g4
+ be,a 1b
+ ld [%i0], %i4
+ jmpl %i7 + 8, %g0
+ restore %g4, %g0, %o0
+
+6: ld [%i1], %l2
+ add %i1, 4, %i1
+ add %i0, 4, %i0
+ srl %l2, 24, %l6
+ andcc %g4, 0xff, %g4
+ be 4b
+ subcc %g4, %l6, %g4
+ bne 4b
+ srl %l2, 16, %l6
+ srl %i4, 8, %g4
+ and %l6, 0xff, %l6
+ andcc %g4, 0xff, %g4
+ be 4b
+ subcc %g4, %l6, %g4
+ bne 4b
+ srl %l2, 8, %l6
+ andcc %i4, 0xff, %g4
+ and %l6, 0xff, %l6
+ be 4b
+ subcc %g4, %l6, %g4
+ be,a 1b
+ ld [%i0], %i4
+ jmpl %i7 + 8, %g0
+ restore %g4, %g0, %o0
+END(strcmp)
+libc_hidden_def(strcmp)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/strcpy.S b/ap/build/uClibc/libc/string/sparc/sparc32/strcpy.S
new file mode 100644
index 0000000..4d7742e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/strcpy.S
@@ -0,0 +1,273 @@
+/* Copy SRC to DEST returning DEST.
+ For SPARC v7.
+ Copyright (C) 1996, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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. */
+
+ /* Normally, this uses ((xword - 0x01010101) & 0x80808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x01010101) & (~xword) & 0x80808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 4
+1: ldub [%o1], %o5
+ stb %o5, [%o0]
+ cmp %o5, 0
+ add %o0, 1, %o0
+ be 0f
+ add %o1, 1, %o1
+ andcc %o1, 3, %g0
+ be 4f
+ or %o4, %lo(0x80808080), %o3
+ ldub [%o1], %o5
+ stb %o5, [%o0]
+ cmp %o5, 0
+ add %o0, 1, %o0
+ be 0f
+ add %o1, 1, %o1
+ andcc %o1, 3, %g0
+ be 5f
+ sethi %hi(0x01010101), %o4
+ ldub [%o1], %o5
+ stb %o5, [%o0]
+ cmp %o5, 0
+ add %o0, 1, %o0
+ be 0f
+ add %o1, 1, %o1
+ b 6f
+ andcc %o0, 3, %g3
+
+ENTRY(strcpy)
+ mov %o0, %g2
+ andcc %o1, 3, %g0
+ bne 1b
+ sethi %hi(0x80808080), %o4
+ or %o4, %lo(0x80808080), %o3
+4: sethi %hi(0x01010101), %o4
+5: andcc %o0, 3, %g3
+6: bne 10f
+ or %o4, %lo(0x01010101), %o2
+1: ld [%o1], %o5
+ add %o1, 4, %o1
+ sub %o5, %o2, %o4
+ add %o0, 4, %o0
+ andcc %o4, %o3, %g0
+ be,a 1b
+ st %o5, [%o0 - 4]
+
+ srl %o5, 24, %g5
+ andcc %g5, 0xff, %g0
+ be 1f
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g0
+ be 2f
+ srl %o5, 8, %g5
+ andcc %g5, 0xff, %g0
+ be 3f
+ andcc %o5, 0xff, %g0
+ bne 1b
+ st %o5, [%o0 - 4]
+ retl
+ mov %g2, %o0
+3: srl %o5, 16, %o5
+ sth %o5, [%o0 - 4]
+ stb %g0, [%o0 - 2]
+ retl
+ mov %g2, %o0
+2: srl %o5, 16, %o5
+ sth %o5, [%o0 - 4]
+ retl
+ mov %g2, %o0
+1: stb %g0, [%o0 - 4]
+ retl
+ mov %g2, %o0
+
+10: ld [%o1], %o5
+ add %o1, 4, %o1
+ sub %o5, %o2, %o4
+ cmp %g3, 2
+ be 2f
+ cmp %g3, 3
+ be 3f
+ andcc %o4, %o3, %g0
+ bne 5f
+ srl %o5, 24, %g5
+ stb %g5, [%o0]
+ sub %o0, 1, %o0
+ srl %o5, 8, %g5
+ sth %g5, [%o0 + 2]
+1: add %o0, 4, %o0
+4: sll %o5, 24, %g6
+ ld [%o1], %o5
+ add %o1, 4, %o1
+ srl %o5, 8, %g5
+ sub %o5, %o2, %o4
+ or %g5, %g6, %g5
+ andcc %o4, %o3, %g0
+ be,a 1b
+ st %g5, [%o0]
+ srl %o5, 24, %o4
+ andcc %o4, 0xff, %g0
+ be 6f
+ srl %o5, 16, %o4
+ andcc %o4, 0xff, %g0
+ be 7f
+ srl %o5, 8, %o4
+ st %g5, [%o0]
+ andcc %o4, 0xff, %g0
+ be 0f
+ andcc %o5, 0xff, %g0
+1: bne 4b
+ add %o0, 4, %o0
+9: stb %g0, [%o0]
+0: retl
+ mov %g2, %o0
+6: srl %g5, 16, %g5
+ sth %g5, [%o0]
+ retl
+ mov %g2, %o0
+7: srl %g5, 16, %g5
+ sth %g5, [%o0]
+ stb %g0, [%o0 + 2]
+ retl
+ mov %g2, %o0
+5: andcc %g5, 0xff, %g4
+ be 9b
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g0
+ be 7f
+ srl %o5, 8, %g5
+ andcc %g5, 0xff, %g0
+ stb %g4, [%o0]
+ sth %g5, [%o0 + 1]
+ sub %o0, 1, %o0
+ bne 1b
+ andcc %o5, 0xff, %g0
+ retl
+ mov %g2, %o0
+7: stb %g4, [%o0]
+ stb %g0, [%o0 + 1]
+ retl
+ mov %g2, %o0
+
+2: andcc %o4, %o3, %g0
+ bne 5f
+ srl %o5, 16, %g5
+ sth %g5, [%o0]
+ sub %o0, 2, %o0
+1: add %o0, 4, %o0
+4: sll %o5, 16, %g6
+ ld [%o1], %o5
+ add %o1, 4, %o1
+ srl %o5, 16, %g5
+ sub %o5, %o2, %o4
+ or %g5, %g6, %g5
+ andcc %o4, %o3, %g0
+ be,a 1b
+ st %g5, [%o0]
+ srl %o5, 24, %o4
+ andcc %o4, 0xff, %g0
+ be 7f
+ srl %o5, 16, %o4
+ st %g5, [%o0]
+ andcc %o4, 0xff, %g0
+ be 0b
+ srl %o5, 8, %o4
+1: andcc %o4, 0xff, %g0
+ be 8f
+ andcc %o5, 0xff, %g0
+ bne 4b
+ add %o0, 4, %o0
+ sth %o5, [%o0]
+ retl
+ mov %g2, %o0
+7: srl %g5, 16, %g5
+ sth %g5, [%o0]
+ stb %g0, [%o0 + 2]
+ retl
+ mov %g2, %o0
+8: stb %g0, [%o0 + 4]
+ retl
+ mov %g2, %o0
+5: srl %o5, 24, %g5
+ andcc %g5, 0xff, %g0
+ be 9b
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g0
+ sth %g5, [%o0]
+ sub %o0, 2, %o0
+ bne 1b
+ srl %o5, 8, %o4
+ retl
+ mov %g2, %o0
+
+3: bne 5f
+ srl %o5, 24, %g5
+ stb %g5, [%o0]
+ sub %o0, 3, %o0
+1: add %o0, 4, %o0
+4: sll %o5, 8, %g6
+ ld [%o1], %o5
+ add %o1, 4, %o1
+ srl %o5, 24, %g5
+ sub %o5, %o2, %o4
+ or %g5, %g6, %g5
+ andcc %o4, %o3, %g0
+ be 1b
+ st %g5, [%o0]
+ srl %o5, 24, %o4
+ andcc %o4, 0xff, %g0
+ be 0b
+ srl %o5, 16, %o4
+1: andcc %o4, 0xff, %g0
+ be 8b
+ srl %o5, 8, %o4
+ andcc %o4, 0xff, %g0
+ be 9f
+ andcc %o5, 0xff, %g0
+ bne 4b
+ add %o0, 4, %o0
+ srl %o5, 8, %o5
+ sth %o5, [%o0]
+ stb %g0, [%o0 + 2]
+ retl
+ mov %g2, %o0
+9: srl %o5, 8, %o5
+ sth %o5, [%o0 + 4]
+ retl
+ mov %g2, %o0
+5: andcc %g5, 0xff, %g0
+ stb %g5, [%o0]
+ sub %o0, 3, %o0
+ bne 1b
+ srl %o5, 16, %o4
+ retl
+ mov %g2, %o0
+END(strcpy)
+libc_hidden_def(strcpy)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc32/strlen.S b/ap/build/uClibc/libc/string/sparc/sparc32/strlen.S
new file mode 100644
index 0000000..4edfe7e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc32/strlen.S
@@ -0,0 +1,102 @@
+/* Determine the length of a string.
+ For SPARC v7.
+ Copyright (C) 1996, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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. */
+
+ /* Normally, this uses ((xword - 0x01010101) & 0x80808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x01010101) & (~xword) & 0x80808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 4
+10: ldub [%o0], %o5
+ cmp %o5, 0
+ be 1f
+ add %o0, 1, %o0
+ andcc %o0, 3, %g0
+ be 4f
+ or %o4, %lo(0x80808080), %o3
+ ldub [%o0], %o5
+ cmp %o5, 0
+ be 2f
+ add %o0, 1, %o0
+ andcc %o0, 3, %g0
+ be 5f
+ sethi %hi(0x01010101), %o4
+ ldub [%o0], %o5
+ cmp %o5, 0
+ be 3f
+ add %o0, 1, %o0
+ b 11f
+ or %o4, %lo(0x01010101), %o2
+1: retl
+ mov 0, %o0
+2: retl
+ mov 1, %o0
+3: retl
+ mov 2, %o0
+
+ENTRY(strlen)
+ mov %o0, %o1
+ andcc %o0, 3, %g0
+ bne 10b
+ sethi %hi(0x80808080), %o4
+ or %o4, %lo(0x80808080), %o3
+4: sethi %hi(0x01010101), %o4
+5: or %o4, %lo(0x01010101), %o2
+11: ld [%o0], %o5
+12: sub %o5, %o2, %o4
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o5, %o4
+#endif
+ andcc %o4, %o3, %g0
+ be 11b
+ add %o0, 4, %o0
+
+ srl %o5, 24, %g5
+ andcc %g5, 0xff, %g0
+ be 13f
+ add %o0, -4, %o4
+ srl %o5, 16, %g5
+ andcc %g5, 0xff, %g0
+ be 13f
+ add %o4, 1, %o4
+ srl %o5, 8, %g5
+ andcc %g5, 0xff, %g0
+ be 13f
+ add %o4, 1, %o4
+ andcc %o5, 0xff, %g0
+ bne,a 12b
+ ld [%o0], %o5
+ add %o4, 1, %o4
+13: retl
+ sub %o4, %o1, %o0
+END(strlen)
+libc_hidden_def(strlen)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc64/memchr.S b/ap/build/uClibc/libc/string/sparc/sparc64/memchr.S
new file mode 100644
index 0000000..f44850b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc64/memchr.S
@@ -0,0 +1,259 @@
+/* memchr (str, ch, n) -- Return pointer to first occurrence of CH in STR less
+ than N.
+ For SPARC v9.
+ Copyright (C) 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jan Vondrak <jvon4518@ss1000.ms.mff.cuni.cz> and
+ Jakub Jelinek <jj@ultra.linux.cz>.
+ This version is developed using the same algorithm as the fast C
+ version which carries the following introduction:
+ Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
+ with help from Dan Sahlin (dan@sics.se) and
+ commentary by Jim Blandy (jimb@ai.mit.edu);
+ adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
+ and implemented by Roland McGrath (roland@ai.mit.edu).
+
+ 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 <asm/asi.h>
+#ifndef XCC
+#define XCC xcc
+#define USE_BPR
+ .register %g2, #scratch
+ .register %g3, #scratch
+#endif
+
+ /* Normally, this uses
+ ((xword - 0x0101010101010101) & 0x8080808080808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 32
+ENTRY(memchr)
+ and %o1, 0xff, %o1 /* IEU0 Group */
+#ifdef USE_BPR
+ brz,pn %o2, 12f /* CTI+IEU1 */
+#else
+ tst %o2 /* IEU1 */
+ be,pn %XCC, 12f /* CTI */
+#endif
+ sll %o1, 8, %g3 /* IEU0 Group */
+ add %o0, %o2, %o2 /* IEU1 */
+
+ sethi %hi(0x01010101), %g1 /* IEU0 Group */
+ or %g3, %o1, %g3 /* IEU1 */
+ ldub [%o0], %o3 /* Load */
+ sllx %g3, 16, %g5 /* IEU0 Group */
+
+ or %g1, %lo(0x01010101), %g1 /* IEU1 */
+ sllx %g1, 32, %g2 /* IEU0 Group */
+ or %g3, %g5, %g3 /* IEU1 */
+ sllx %g3, 32, %g5 /* IEU0 Group */
+
+ cmp %o3, %o1 /* IEU1 */
+ be,pn %xcc, 13f /* CTI */
+ or %g1, %g2, %g1 /* IEU0 Group */
+ andcc %o0, 7, %g0 /* IEU1 */
+
+ bne,a,pn %icc, 21f /* CTI */
+ add %o0, 1, %o0 /* IEU0 Group */
+ ldx [%o0], %o3 /* Load Group */
+ sllx %g1, 7, %g2 /* IEU0 */
+
+ or %g3, %g5, %g3 /* IEU1 */
+1: add %o0, 8, %o0 /* IEU0 Group */
+ xor %o3, %g3, %o4 /* IEU1 */
+ /* %g1 = 0101010101010101 *
+ * %g2 = 8080088080808080 *
+ * %g3 = c c c c c c c c *
+ * %o3 = value *
+ * %o4 = value XOR c */
+2: cmp %o0, %o2 /* IEU1 Group */
+
+ bg,pn %XCC, 11f /* CTI */
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ sub %o4, %g1, %o5 /* IEU0 Group */
+ add %o0, 8, %o0 /* IEU1 */
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o5, %o4, %o5 /* IEU0 Group */
+#endif
+
+ andcc %o5, %g2, %g0 /* IEU1 Group */
+ be,a,pt %xcc, 2b /* CTI */
+ xor %o3, %g3, %o4 /* IEU0 */
+ srlx %o4, 56, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 3f /* CTI */
+ srlx %o4, 48, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 4f /* CTI */
+ srlx %o4, 40, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+
+ srlx %o4, 32, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 6f /* CTI */
+ srlx %o4, 24, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 7f /* CTI */
+ srlx %o4, 16, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 8f /* CTI */
+ srlx %o4, 8, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 9f /* CTI */
+
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ bne,pt %icc, 2b /* CTI */
+ xor %o3, %g3, %o4 /* IEU0 */
+ retl /* CTI+IEU1 Group */
+
+ add %o0, -9, %o0 /* IEU0 */
+
+ .align 16
+3: retl /* CTI+IEU1 Group */
+ add %o0, -16, %o0 /* IEU0 */
+4: retl /* CTI+IEU1 Group */
+ add %o0, -15, %o0 /* IEU0 */
+
+5: retl /* CTI+IEU1 Group */
+ add %o0, -14, %o0 /* IEU0 */
+6: retl /* CTI+IEU1 Group */
+ add %o0, -13, %o0 /* IEU0 */
+
+7: retl /* CTI+IEU1 Group */
+ add %o0, -12, %o0 /* IEU0 */
+8: retl /* CTI+IEU1 Group */
+ add %o0, -11, %o0 /* IEU0 */
+
+9: retl /* CTI+IEU1 Group */
+ add %o0, -10, %o0 /* IEU0 */
+11: sub %o4, %g1, %o5 /* IEU0 Group */
+ sub %o0, 8, %o0 /* IEU1 */
+
+ andcc %o5, %g2, %g0 /* IEU1 Group */
+ be,pt %xcc, 12f /* CTI */
+ sub %o2, %o0, %o2 /* IEU0 */
+ tst %o2 /* IEU1 Group */
+
+ be,pn %XCC, 12f /* CTI */
+ srlx %o4, 56, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 13f /* CTI */
+
+ cmp %o2, 1 /* IEU0 */
+ be,pn %XCC, 12f /* CTI Group */
+ srlx %o4, 48, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 14f /* CTI */
+ cmp %o2, 2 /* IEU1 Group */
+ be,pn %XCC, 12f /* CTI */
+ srlx %o4, 40, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 15f /* CTI */
+ cmp %o2, 3 /* IEU1 Group */
+ be,pn %XCC, 12f /* CTI */
+
+ srlx %o4, 32, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 16f /* CTI */
+ cmp %o2, 4 /* IEU1 Group */
+
+ be,pn %XCC, 12f /* CTI */
+ srlx %o4, 24, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 17f /* CTI */
+
+ cmp %o2, 5 /* IEU1 Group */
+ be,pn %XCC, 12f /* CTI */
+ srlx %o4, 16, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 18f /* CTI */
+ cmp %o2, 6 /* IEU1 Group */
+ be,pn %XCC, 12f /* CTI */
+ srlx %o4, 8, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 19f /* CTI */
+ nop /* IEU0 */
+12: retl /* CTI+IEU1 Group */
+
+ clr %o0 /* IEU0 */
+ nop /* Stub */
+13: retl /* CTI+IEU1 Group */
+ nop /* IEU0 */
+
+14: retl /* CTI+IEU1 Group */
+ add %o0, 1, %o0 /* IEU0 */
+15: retl /* CTI+IEU1 Group */
+ add %o0, 2, %o0 /* IEU0 */
+
+16: retl /* CTI+IEU1 Group */
+ add %o0, 3, %o0 /* IEU0 */
+17: retl /* CTI+IEU1 Group */
+ add %o0, 4, %o0 /* IEU0 */
+
+18: retl /* CTI+IEU1 Group */
+ add %o0, 5, %o0 /* IEU0 */
+19: retl /* CTI+IEU1 Group */
+ add %o0, 6, %o0 /* IEU0 */
+
+21: cmp %o0, %o2 /* IEU1 */
+ be,pn %XCC, 12b /* CTI */
+ sllx %g1, 7, %g2 /* IEU0 Group */
+ ldub [%o0], %o3 /* Load */
+
+ or %g3, %g5, %g3 /* IEU1 */
+22: andcc %o0, 7, %g0 /* IEU1 Group */
+ be,a,pn %icc, 1b /* CTI */
+ ldx [%o0], %o3 /* Load */
+
+ cmp %o3, %o1 /* IEU1 Group */
+ be,pn %xcc, 23f /* CTI */
+ add %o0, 1, %o0 /* IEU0 */
+ cmp %o0, %o2 /* IEU1 Group */
+
+ bne,a,pt %XCC, 22b /* CTI */
+ ldub [%o0], %o3 /* Load */
+ retl /* CTI+IEU1 Group */
+ clr %o0 /* IEU0 */
+
+23: retl /* CTI+IEU1 Group */
+ add %o0, -1, %o0 /* IEU0 */
+END(memchr)
+
+libc_hidden_def(memchr)
+weak_alias(memchr,__ubp_memchr)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc64/memcpy.S b/ap/build/uClibc/libc/string/sparc/sparc64/memcpy.S
new file mode 100644
index 0000000..db63d1d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc64/memcpy.S
@@ -0,0 +1,923 @@
+/* Copy SIZE bytes from SRC to DEST.
+ For UltraSPARC.
+ Copyright (C) 1996, 97, 98, 99, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller (davem@caip.rutgers.edu) and
+ Jakub Jelinek (jakub@redhat.com).
+
+ 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/asi.h>
+#ifndef XCC
+#define USE_BPR
+ .register %g2, #scratch
+ .register %g3, #scratch
+ .register %g6, #scratch
+#define XCC xcc
+#endif
+#define FPRS_FEF 4
+
+#define FREG_FROB(f1, f2, f3, f4, f5, f6, f7, f8, f9) \
+ faligndata %f1, %f2, %f48; \
+ faligndata %f2, %f3, %f50; \
+ faligndata %f3, %f4, %f52; \
+ faligndata %f4, %f5, %f54; \
+ faligndata %f5, %f6, %f56; \
+ faligndata %f6, %f7, %f58; \
+ faligndata %f7, %f8, %f60; \
+ faligndata %f8, %f9, %f62;
+
+#define MAIN_LOOP_CHUNK(src, dest, fdest, fsrc, len, jmptgt) \
+ ldda [%src] %asi, %fdest; \
+ add %src, 0x40, %src; \
+ add %dest, 0x40, %dest; \
+ subcc %len, 0x40, %len; \
+ be,pn %xcc, jmptgt; \
+ stda %fsrc, [%dest - 0x40] %asi;
+
+#define LOOP_CHUNK1(src, dest, len, branch_dest) \
+ MAIN_LOOP_CHUNK(src, dest, f0, f48, len, branch_dest)
+#define LOOP_CHUNK2(src, dest, len, branch_dest) \
+ MAIN_LOOP_CHUNK(src, dest, f16, f48, len, branch_dest)
+#define LOOP_CHUNK3(src, dest, len, branch_dest) \
+ MAIN_LOOP_CHUNK(src, dest, f32, f48, len, branch_dest)
+
+#define STORE_SYNC(dest, fsrc) \
+ stda %fsrc, [%dest] %asi; \
+ add %dest, 0x40, %dest;
+
+#define STORE_JUMP(dest, fsrc, target) \
+ stda %fsrc, [%dest] %asi; \
+ add %dest, 0x40, %dest; \
+ ba,pt %xcc, target;
+
+#define VISLOOP_PAD nop; nop; nop; nop; \
+ nop; nop; nop; nop; \
+ nop; nop; nop; nop; \
+ nop; nop; nop;
+
+#define FINISH_VISCHUNK(dest, f0, f1, left) \
+ subcc %left, 8, %left; \
+ bl,pn %xcc, 205f; \
+ faligndata %f0, %f1, %f48; \
+ std %f48, [%dest]; \
+ add %dest, 8, %dest;
+
+#define UNEVEN_VISCHUNK(dest, f0, f1, left) \
+ subcc %left, 8, %left; \
+ bl,pn %xcc, 205f; \
+ fsrc1 %f0, %f1; \
+ ba,a,pt %xcc, 204f;
+
+ /* Macros for non-VIS memcpy code. */
+#define MOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldx [%src + offset + 0x00], %t0; \
+ ldx [%src + offset + 0x08], %t1; \
+ ldx [%src + offset + 0x10], %t2; \
+ ldx [%src + offset + 0x18], %t3; \
+ stw %t0, [%dst + offset + 0x04]; \
+ srlx %t0, 32, %t0; \
+ stw %t0, [%dst + offset + 0x00]; \
+ stw %t1, [%dst + offset + 0x0c]; \
+ srlx %t1, 32, %t1; \
+ stw %t1, [%dst + offset + 0x08]; \
+ stw %t2, [%dst + offset + 0x14]; \
+ srlx %t2, 32, %t2; \
+ stw %t2, [%dst + offset + 0x10]; \
+ stw %t3, [%dst + offset + 0x1c]; \
+ srlx %t3, 32, %t3; \
+ stw %t3, [%dst + offset + 0x18];
+
+#define MOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldx [%src + offset + 0x00], %t0; \
+ ldx [%src + offset + 0x08], %t1; \
+ ldx [%src + offset + 0x10], %t2; \
+ ldx [%src + offset + 0x18], %t3; \
+ stx %t0, [%dst + offset + 0x00]; \
+ stx %t1, [%dst + offset + 0x08]; \
+ stx %t2, [%dst + offset + 0x10]; \
+ stx %t3, [%dst + offset + 0x18]; \
+ ldx [%src + offset + 0x20], %t0; \
+ ldx [%src + offset + 0x28], %t1; \
+ ldx [%src + offset + 0x30], %t2; \
+ ldx [%src + offset + 0x38], %t3; \
+ stx %t0, [%dst + offset + 0x20]; \
+ stx %t1, [%dst + offset + 0x28]; \
+ stx %t2, [%dst + offset + 0x30]; \
+ stx %t3, [%dst + offset + 0x38];
+
+#define MOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldx [%src - offset - 0x10], %t0; \
+ ldx [%src - offset - 0x08], %t1; \
+ stw %t0, [%dst - offset - 0x0c]; \
+ srlx %t0, 32, %t2; \
+ stw %t2, [%dst - offset - 0x10]; \
+ stw %t1, [%dst - offset - 0x04]; \
+ srlx %t1, 32, %t3; \
+ stw %t3, [%dst - offset - 0x08];
+
+#define MOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1) \
+ ldx [%src - offset - 0x10], %t0; \
+ ldx [%src - offset - 0x08], %t1; \
+ stx %t0, [%dst - offset - 0x10]; \
+ stx %t1, [%dst - offset - 0x08];
+
+ /* Macros for non-VIS memmove code. */
+#define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldx [%src - offset - 0x20], %t0; \
+ ldx [%src - offset - 0x18], %t1; \
+ ldx [%src - offset - 0x10], %t2; \
+ ldx [%src - offset - 0x08], %t3; \
+ stw %t0, [%dst - offset - 0x1c]; \
+ srlx %t0, 32, %t0; \
+ stw %t0, [%dst - offset - 0x20]; \
+ stw %t1, [%dst - offset - 0x14]; \
+ srlx %t1, 32, %t1; \
+ stw %t1, [%dst - offset - 0x18]; \
+ stw %t2, [%dst - offset - 0x0c]; \
+ srlx %t2, 32, %t2; \
+ stw %t2, [%dst - offset - 0x10]; \
+ stw %t3, [%dst - offset - 0x04]; \
+ srlx %t3, 32, %t3; \
+ stw %t3, [%dst - offset - 0x08];
+
+#define RMOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldx [%src - offset - 0x20], %t0; \
+ ldx [%src - offset - 0x18], %t1; \
+ ldx [%src - offset - 0x10], %t2; \
+ ldx [%src - offset - 0x08], %t3; \
+ stx %t0, [%dst - offset - 0x20]; \
+ stx %t1, [%dst - offset - 0x18]; \
+ stx %t2, [%dst - offset - 0x10]; \
+ stx %t3, [%dst - offset - 0x08]; \
+ ldx [%src - offset - 0x40], %t0; \
+ ldx [%src - offset - 0x38], %t1; \
+ ldx [%src - offset - 0x30], %t2; \
+ ldx [%src - offset - 0x28], %t3; \
+ stx %t0, [%dst - offset - 0x40]; \
+ stx %t1, [%dst - offset - 0x38]; \
+ stx %t2, [%dst - offset - 0x30]; \
+ stx %t3, [%dst - offset - 0x28];
+
+#define RMOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldx [%src + offset + 0x00], %t0; \
+ ldx [%src + offset + 0x08], %t1; \
+ stw %t0, [%dst + offset + 0x04]; \
+ srlx %t0, 32, %t2; \
+ stw %t2, [%dst + offset + 0x00]; \
+ stw %t1, [%dst + offset + 0x0c]; \
+ srlx %t1, 32, %t3; \
+ stw %t3, [%dst + offset + 0x08];
+
+#define RMOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1) \
+ ldx [%src + offset + 0x00], %t0; \
+ ldx [%src + offset + 0x08], %t1; \
+ stx %t0, [%dst + offset + 0x00]; \
+ stx %t1, [%dst + offset + 0x08];
+
+ .text
+ .align 32
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+ENTRY(bcopy)
+ sub %o1, %o0, %o4 /* IEU0 Group */
+ mov %o0, %g3 /* IEU1 */
+ cmp %o4, %o2 /* IEU1 Group */
+ mov %o1, %o0 /* IEU0 */
+ bgeu,pt %XCC, 210f /* CTI */
+ mov %g3, %o1 /* IEU0 Group */
+#ifndef USE_BPR
+ srl %o2, 0, %o2 /* IEU1 */
+#endif
+ brnz,pn %o2, 220f /* CTI Group */
+ add %o0, %o2, %o0 /* IEU0 */
+ retl
+ nop
+END(bcopy)
+#endif
+
+ .align 32
+200: be,pt %xcc, 201f /* CTI */
+ andcc %o0, 0x38, %g5 /* IEU1 Group */
+ mov 8, %g1 /* IEU0 */
+ sub %g1, %g2, %g2 /* IEU0 Group */
+ andcc %o0, 1, %g0 /* IEU1 */
+ be,pt %icc, 2f /* CTI */
+ sub %o2, %g2, %o2 /* IEU0 Group */
+1: ldub [%o1], %o5 /* Load Group */
+ add %o1, 1, %o1 /* IEU0 */
+ add %o0, 1, %o0 /* IEU1 */
+ subcc %g2, 1, %g2 /* IEU1 Group */
+ be,pn %xcc, 3f /* CTI */
+ stb %o5, [%o0 - 1] /* Store */
+2: ldub [%o1], %o5 /* Load Group */
+ add %o0, 2, %o0 /* IEU0 */
+ ldub [%o1 + 1], %g3 /* Load Group */
+ subcc %g2, 2, %g2 /* IEU1 Group */
+ stb %o5, [%o0 - 2] /* Store */
+ add %o1, 2, %o1 /* IEU0 */
+ bne,pt %xcc, 2b /* CTI Group */
+ stb %g3, [%o0 - 1] /* Store */
+3: andcc %o0, 0x38, %g5 /* IEU1 Group */
+201: be,pt %icc, 202f /* CTI */
+ mov 64, %g1 /* IEU0 */
+ fmovd %f0, %f2 /* FPU */
+ sub %g1, %g5, %g5 /* IEU0 Group */
+ alignaddr %o1, %g0, %g1 /* GRU Group */
+ ldd [%g1], %f4 /* Load Group */
+ sub %o2, %g5, %o2 /* IEU0 */
+1: ldd [%g1 + 0x8], %f6 /* Load Group */
+ add %g1, 0x8, %g1 /* IEU0 Group */
+ subcc %g5, 8, %g5 /* IEU1 */
+ faligndata %f4, %f6, %f0 /* GRU Group */
+ std %f0, [%o0] /* Store */
+ add %o1, 8, %o1 /* IEU0 Group */
+ be,pn %xcc, 202f /* CTI */
+ add %o0, 8, %o0 /* IEU1 */
+ ldd [%g1 + 0x8], %f4 /* Load Group */
+ add %g1, 8, %g1 /* IEU0 */
+ subcc %g5, 8, %g5 /* IEU1 */
+ faligndata %f6, %f4, %f0 /* GRU Group */
+ std %f0, [%o0] /* Store */
+ add %o1, 8, %o1 /* IEU0 */
+ bne,pt %xcc, 1b /* CTI Group */
+ add %o0, 8, %o0 /* IEU0 */
+202: membar #LoadStore | #StoreStore | #StoreLoad /* LSU Group */
+ wr %g0, ASI_BLK_P, %asi /* LSU Group */
+ subcc %o2, 0x40, %g6 /* IEU1 Group */
+ mov %o1, %g1 /* IEU0 */
+ andncc %g6, (0x40 - 1), %g6 /* IEU1 Group */
+ srl %g1, 3, %g2 /* IEU0 */
+ sub %o2, %g6, %g3 /* IEU0 Group */
+ andn %o1, (0x40 - 1), %o1 /* IEU1 */
+ and %g2, 7, %g2 /* IEU0 Group */
+ andncc %g3, 0x7, %g3 /* IEU1 */
+ fmovd %f0, %f2 /* FPU */
+ sub %g3, 0x10, %g3 /* IEU0 Group */
+ sub %o2, %g6, %o2 /* IEU1 */
+ alignaddr %g1, %g0, %g0 /* GRU Group */
+ add %g1, %g6, %g1 /* IEU0 Group */
+ subcc %o2, %g3, %o2 /* IEU1 */
+ ldda [%o1 + 0x00] %asi, %f0 /* LSU Group */
+ add %g1, %g3, %g1 /* IEU0 */
+ ldda [%o1 + 0x40] %asi, %f16 /* LSU Group */
+ sub %g6, 0x80, %g6 /* IEU0 */
+ ldda [%o1 + 0x80] %asi, %f32 /* LSU Group */
+ /* Clk1 Group 8-( */
+ /* Clk2 Group 8-( */
+ /* Clk3 Group 8-( */
+ /* Clk4 Group 8-( */
+203: rd %pc, %g5 /* PDU Group 8-( */
+ addcc %g5, %lo(300f - 203b), %g5 /* IEU1 Group */
+ sll %g2, 9, %g2 /* IEU0 */
+ jmpl %g5 + %g2, %g0 /* CTI Group brk forced*/
+ addcc %o1, 0xc0, %o1 /* IEU1 Group */
+
+ .align 512 /* OK, here comes the fun part... */
+300: FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) LOOP_CHUNK1(o1, o0, g6, 301f)
+ FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) LOOP_CHUNK2(o1, o0, g6, 302f)
+ FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) LOOP_CHUNK3(o1, o0, g6, 303f)
+ b,pt %xcc, 300b+4; faligndata %f0, %f2, %f48
+301: FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) STORE_JUMP(o0, f48, 400f) membar #Sync
+302: FREG_FROB(f32,f34,f36,f38,f40,f42,f44,f46,f0) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) STORE_JUMP(o0, f48, 416f) membar #Sync
+303: FREG_FROB(f0, f2, f4, f6, f8, f10,f12,f14,f16) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f16,f18,f20,f22,f24,f26,f28,f30,f32) STORE_JUMP(o0, f48, 432f) membar #Sync
+ VISLOOP_PAD
+310: FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) LOOP_CHUNK1(o1, o0, g6, 311f)
+ FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) LOOP_CHUNK2(o1, o0, g6, 312f)
+ FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) LOOP_CHUNK3(o1, o0, g6, 313f)
+ b,pt %xcc, 310b+4; faligndata %f2, %f4, %f48
+311: FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) STORE_JUMP(o0, f48, 402f) membar #Sync
+312: FREG_FROB(f34,f36,f38,f40,f42,f44,f46,f0, f2) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) STORE_JUMP(o0, f48, 418f) membar #Sync
+313: FREG_FROB(f2, f4, f6, f8, f10,f12,f14,f16,f18) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f18,f20,f22,f24,f26,f28,f30,f32,f34) STORE_JUMP(o0, f48, 434f) membar #Sync
+ VISLOOP_PAD
+320: FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) LOOP_CHUNK1(o1, o0, g6, 321f)
+ FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) LOOP_CHUNK2(o1, o0, g6, 322f)
+ FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) LOOP_CHUNK3(o1, o0, g6, 323f)
+ b,pt %xcc, 320b+4; faligndata %f4, %f6, %f48
+321: FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) STORE_JUMP(o0, f48, 404f) membar #Sync
+322: FREG_FROB(f36,f38,f40,f42,f44,f46,f0, f2, f4) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) STORE_JUMP(o0, f48, 420f) membar #Sync
+323: FREG_FROB(f4, f6, f8, f10,f12,f14,f16,f18,f20) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f20,f22,f24,f26,f28,f30,f32,f34,f36) STORE_JUMP(o0, f48, 436f) membar #Sync
+ VISLOOP_PAD
+330: FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) LOOP_CHUNK1(o1, o0, g6, 331f)
+ FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) LOOP_CHUNK2(o1, o0, g6, 332f)
+ FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) LOOP_CHUNK3(o1, o0, g6, 333f)
+ b,pt %xcc, 330b+4; faligndata %f6, %f8, %f48
+331: FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) STORE_JUMP(o0, f48, 406f) membar #Sync
+332: FREG_FROB(f38,f40,f42,f44,f46,f0, f2, f4, f6) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) STORE_JUMP(o0, f48, 422f) membar #Sync
+333: FREG_FROB(f6, f8, f10,f12,f14,f16,f18,f20,f22) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f22,f24,f26,f28,f30,f32,f34,f36,f38) STORE_JUMP(o0, f48, 438f) membar #Sync
+ VISLOOP_PAD
+340: FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) LOOP_CHUNK1(o1, o0, g6, 341f)
+ FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) LOOP_CHUNK2(o1, o0, g6, 342f)
+ FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) LOOP_CHUNK3(o1, o0, g6, 343f)
+ b,pt %xcc, 340b+4; faligndata %f8, %f10, %f48
+341: FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) STORE_JUMP(o0, f48, 408f) membar #Sync
+342: FREG_FROB(f40,f42,f44,f46,f0, f2, f4, f6, f8) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) STORE_JUMP(o0, f48, 424f) membar #Sync
+343: FREG_FROB(f8, f10,f12,f14,f16,f18,f20,f22,f24) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f24,f26,f28,f30,f32,f34,f36,f38,f40) STORE_JUMP(o0, f48, 440f) membar #Sync
+ VISLOOP_PAD
+350: FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) LOOP_CHUNK1(o1, o0, g6, 351f)
+ FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) LOOP_CHUNK2(o1, o0, g6, 352f)
+ FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) LOOP_CHUNK3(o1, o0, g6, 353f)
+ b,pt %xcc, 350b+4; faligndata %f10, %f12, %f48
+351: FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) STORE_JUMP(o0, f48, 410f) membar #Sync
+352: FREG_FROB(f42,f44,f46,f0, f2, f4, f6, f8, f10) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) STORE_JUMP(o0, f48, 426f) membar #Sync
+353: FREG_FROB(f10,f12,f14,f16,f18,f20,f22,f24,f26) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f26,f28,f30,f32,f34,f36,f38,f40,f42) STORE_JUMP(o0, f48, 442f) membar #Sync
+ VISLOOP_PAD
+360: FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) LOOP_CHUNK1(o1, o0, g6, 361f)
+ FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) LOOP_CHUNK2(o1, o0, g6, 362f)
+ FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) LOOP_CHUNK3(o1, o0, g6, 363f)
+ b,pt %xcc, 360b+4; faligndata %f12, %f14, %f48
+361: FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) STORE_JUMP(o0, f48, 412f) membar #Sync
+362: FREG_FROB(f44,f46,f0, f2, f4, f6, f8, f10,f12) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) STORE_JUMP(o0, f48, 428f) membar #Sync
+363: FREG_FROB(f12,f14,f16,f18,f20,f22,f24,f26,f28) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f28,f30,f32,f34,f36,f38,f40,f42,f44) STORE_JUMP(o0, f48, 444f) membar #Sync
+ VISLOOP_PAD
+370: FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) LOOP_CHUNK1(o1, o0, g6, 371f)
+ FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) LOOP_CHUNK2(o1, o0, g6, 372f)
+ FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) LOOP_CHUNK3(o1, o0, g6, 373f)
+ b,pt %xcc, 370b+4; faligndata %f14, %f16, %f48
+371: FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) STORE_JUMP(o0, f48, 414f) membar #Sync
+372: FREG_FROB(f46,f0, f2, f4, f6, f8, f10,f12,f14) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) STORE_JUMP(o0, f48, 430f) membar #Sync
+373: FREG_FROB(f14,f16,f18,f20,f22,f24,f26,f28,f30) STORE_SYNC(o0, f48) membar #Sync
+ FREG_FROB(f30,f32,f34,f36,f38,f40,f42,f44,f46) STORE_JUMP(o0, f48, 446f) membar #Sync
+ VISLOOP_PAD
+400: FINISH_VISCHUNK(o0, f0, f2, g3)
+402: FINISH_VISCHUNK(o0, f2, f4, g3)
+404: FINISH_VISCHUNK(o0, f4, f6, g3)
+406: FINISH_VISCHUNK(o0, f6, f8, g3)
+408: FINISH_VISCHUNK(o0, f8, f10, g3)
+410: FINISH_VISCHUNK(o0, f10, f12, g3)
+412: FINISH_VISCHUNK(o0, f12, f14, g3)
+414: UNEVEN_VISCHUNK(o0, f14, f0, g3)
+416: FINISH_VISCHUNK(o0, f16, f18, g3)
+418: FINISH_VISCHUNK(o0, f18, f20, g3)
+420: FINISH_VISCHUNK(o0, f20, f22, g3)
+422: FINISH_VISCHUNK(o0, f22, f24, g3)
+424: FINISH_VISCHUNK(o0, f24, f26, g3)
+426: FINISH_VISCHUNK(o0, f26, f28, g3)
+428: FINISH_VISCHUNK(o0, f28, f30, g3)
+430: UNEVEN_VISCHUNK(o0, f30, f0, g3)
+432: FINISH_VISCHUNK(o0, f32, f34, g3)
+434: FINISH_VISCHUNK(o0, f34, f36, g3)
+436: FINISH_VISCHUNK(o0, f36, f38, g3)
+438: FINISH_VISCHUNK(o0, f38, f40, g3)
+440: FINISH_VISCHUNK(o0, f40, f42, g3)
+442: FINISH_VISCHUNK(o0, f42, f44, g3)
+444: FINISH_VISCHUNK(o0, f44, f46, g3)
+446: UNEVEN_VISCHUNK(o0, f46, f0, g3)
+204: ldd [%o1], %f2 /* Load Group */
+ add %o1, 8, %o1 /* IEU0 */
+ subcc %g3, 8, %g3 /* IEU1 */
+ faligndata %f0, %f2, %f8 /* GRU Group */
+ std %f8, [%o0] /* Store */
+ bl,pn %xcc, 205f /* CTI */
+ add %o0, 8, %o0 /* IEU0 Group */
+ ldd [%o1], %f0 /* Load Group */
+ add %o1, 8, %o1 /* IEU0 */
+ subcc %g3, 8, %g3 /* IEU1 */
+ faligndata %f2, %f0, %f8 /* GRU Group */
+ std %f8, [%o0] /* Store */
+ bge,pt %xcc, 204b /* CTI */
+ add %o0, 8, %o0 /* IEU0 Group */
+205: brz,pt %o2, 207f /* CTI Group */
+ mov %g1, %o1 /* IEU0 */
+206: ldub [%o1], %g5 /* LOAD */
+ add %o1, 1, %o1 /* IEU0 */
+ add %o0, 1, %o0 /* IEU1 */
+ subcc %o2, 1, %o2 /* IEU1 */
+ bne,pt %xcc, 206b /* CTI */
+ stb %g5, [%o0 - 1] /* Store Group */
+207: membar #StoreLoad | #StoreStore /* LSU Group */
+ wr %g0, FPRS_FEF, %fprs
+ retl
+ mov %g4, %o0
+
+208: andcc %o2, 1, %g0 /* IEU1 Group */
+ be,pt %icc, 2f+4 /* CTI */
+1: ldub [%o1], %g5 /* LOAD Group */
+ add %o1, 1, %o1 /* IEU0 */
+ add %o0, 1, %o0 /* IEU1 */
+ subcc %o2, 1, %o2 /* IEU1 Group */
+ be,pn %xcc, 209f /* CTI */
+ stb %g5, [%o0 - 1] /* Store */
+2: ldub [%o1], %g5 /* LOAD Group */
+ add %o0, 2, %o0 /* IEU0 */
+ ldub [%o1 + 1], %o5 /* LOAD Group */
+ add %o1, 2, %o1 /* IEU0 */
+ subcc %o2, 2, %o2 /* IEU1 Group */
+ stb %g5, [%o0 - 2] /* Store */
+ bne,pt %xcc, 2b /* CTI */
+ stb %o5, [%o0 - 1] /* Store */
+209: retl
+ mov %g4, %o0
+
+#ifdef USE_BPR
+
+ /* void *__align_cpy_4(void *dest, void *src, size_t n)
+ * SPARC v9 SYSV ABI
+ * Like memcpy, but results are undefined if (!n || ((dest | src | n) & 3))
+ */
+
+ .align 32
+ENTRY(__align_cpy_4)
+ mov %o0, %g4 /* IEU0 Group */
+ cmp %o2, 15 /* IEU1 */
+ bleu,pn %xcc, 208b /* CTI */
+ cmp %o2, (64 * 6) /* IEU1 Group */
+ bgeu,pn %xcc, 200b /* CTI */
+ andcc %o0, 7, %g2 /* IEU1 Group */
+ ba,pt %xcc, 216f /* CTI */
+ andcc %o1, 4, %g0 /* IEU1 Group */
+END(__align_cpy_4)
+
+ /* void *__align_cpy_8(void *dest, void *src, size_t n)
+ * SPARC v9 SYSV ABI
+ * Like memcpy, but results are undefined if (!n || ((dest | src | n) & 7))
+ */
+
+ .align 32
+ENTRY(__align_cpy_8)
+ mov %o0, %g4 /* IEU0 Group */
+ cmp %o2, 15 /* IEU1 */
+ bleu,pn %xcc, 208b /* CTI */
+ cmp %o2, (64 * 6) /* IEU1 Group */
+ bgeu,pn %xcc, 201b /* CTI */
+ andcc %o0, 0x38, %g5 /* IEU1 Group */
+ andcc %o2, -128, %g6 /* IEU1 Group */
+ bne,a,pt %xcc, 82f + 4 /* CTI */
+ ldx [%o1], %g1 /* Load */
+ ba,pt %xcc, 41f /* CTI Group */
+ andcc %o2, 0x70, %g6 /* IEU1 */
+END(__align_cpy_8)
+
+ /* void *__align_cpy_16(void *dest, void *src, size_t n)
+ * SPARC v9 SYSV ABI
+ * Like memcpy, but results are undefined if (!n || ((dest | src | n) & 15))
+ */
+
+ .align 32
+ENTRY(__align_cpy_16)
+ mov %o0, %g4 /* IEU0 Group */
+ cmp %o2, (64 * 6) /* IEU1 */
+ bgeu,pn %xcc, 201b /* CTI */
+ andcc %o0, 0x38, %g5 /* IEU1 Group */
+ andcc %o2, -128, %g6 /* IEU1 Group */
+ bne,a,pt %xcc, 82f + 4 /* CTI */
+ ldx [%o1], %g1 /* Load */
+ ba,pt %xcc, 41f /* CTI Group */
+ andcc %o2, 0x70, %g6 /* IEU1 */
+END(__align_cpy_16)
+
+#endif
+
+ .align 32
+ENTRY(memcpy)
+210:
+#ifndef USE_BPR
+ srl %o2, 0, %o2 /* IEU1 Group */
+#endif
+ brz,pn %o2, 209b /* CTI Group */
+ mov %o0, %g4 /* IEU0 */
+218: cmp %o2, 15 /* IEU1 Group */
+ bleu,pn %xcc, 208b /* CTI */
+ cmp %o2, (64 * 6) /* IEU1 Group */
+ bgeu,pn %xcc, 200b /* CTI */
+ andcc %o0, 7, %g2 /* IEU1 Group */
+ sub %o0, %o1, %g5 /* IEU0 */
+ andcc %g5, 3, %o5 /* IEU1 Group */
+ bne,pn %xcc, 212f /* CTI */
+ andcc %o1, 3, %g0 /* IEU1 Group */
+ be,a,pt %xcc, 216f /* CTI */
+ andcc %o1, 4, %g0 /* IEU1 Group */
+ andcc %o1, 1, %g0 /* IEU1 Group */
+ be,pn %xcc, 4f /* CTI */
+ andcc %o1, 2, %g0 /* IEU1 Group */
+ ldub [%o1], %g2 /* Load Group */
+ add %o1, 1, %o1 /* IEU0 */
+ add %o0, 1, %o0 /* IEU1 */
+ sub %o2, 1, %o2 /* IEU0 Group */
+ bne,pn %xcc, 5f /* CTI Group */
+ stb %g2, [%o0 - 1] /* Store */
+4: lduh [%o1], %g2 /* Load Group */
+ add %o1, 2, %o1 /* IEU0 */
+ add %o0, 2, %o0 /* IEU1 */
+ sub %o2, 2, %o2 /* IEU0 */
+ sth %g2, [%o0 - 2] /* Store Group + bubble */
+5: andcc %o1, 4, %g0 /* IEU1 */
+216: be,a,pn %xcc, 2f /* CTI */
+ andcc %o2, -128, %g6 /* IEU1 Group */
+ lduw [%o1], %g5 /* Load Group */
+ add %o1, 4, %o1 /* IEU0 */
+ add %o0, 4, %o0 /* IEU1 */
+ sub %o2, 4, %o2 /* IEU0 Group */
+ stw %g5, [%o0 - 4] /* Store */
+ andcc %o2, -128, %g6 /* IEU1 Group */
+2: be,pn %xcc, 215f /* CTI */
+ andcc %o0, 4, %g0 /* IEU1 Group */
+ be,pn %xcc, 82f + 4 /* CTI Group */
+5: MOVE_BIGCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
+ MOVE_BIGCHUNK(o1, o0, 0x20, g1, g3, g5, o5)
+ MOVE_BIGCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
+ MOVE_BIGCHUNK(o1, o0, 0x60, g1, g3, g5, o5)
+35: subcc %g6, 128, %g6 /* IEU1 Group */
+ add %o1, 128, %o1 /* IEU0 */
+ bne,pt %xcc, 5b /* CTI */
+ add %o0, 128, %o0 /* IEU0 Group */
+215: andcc %o2, 0x70, %g6 /* IEU1 Group */
+41: be,pn %xcc, 80f /* CTI */
+ andcc %o2, 8, %g0 /* IEU1 Group */
+ /* Clk1 8-( */
+ /* Clk2 8-( */
+ /* Clk3 8-( */
+ /* Clk4 8-( */
+79: rd %pc, %o5 /* PDU Group */
+ sll %g6, 1, %g5 /* IEU0 Group */
+ add %o1, %g6, %o1 /* IEU1 */
+ sub %o5, %g5, %o5 /* IEU0 Group */
+ jmpl %o5 + %lo(80f - 79b), %g0 /* CTI Group brk forced*/
+ add %o0, %g6, %o0 /* IEU0 Group */
+36: MOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g5, o5)
+ MOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g5, o5)
+ MOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g5, o5)
+ MOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g5, o5)
+ MOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g5, o5)
+ MOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g5, o5)
+ MOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g5, o5)
+80: be,pt %xcc, 81f /* CTI */
+ andcc %o2, 4, %g0 /* IEU1 */
+ ldx [%o1], %g2 /* Load Group */
+ add %o0, 8, %o0 /* IEU0 */
+ stw %g2, [%o0 - 0x4] /* Store Group */
+ add %o1, 8, %o1 /* IEU1 */
+ srlx %g2, 32, %g2 /* IEU0 Group */
+ stw %g2, [%o0 - 0x8] /* Store */
+81: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 2, %g0 /* IEU1 Group */
+ lduw [%o1], %g2 /* Load Group */
+ add %o1, 4, %o1 /* IEU0 */
+ stw %g2, [%o0] /* Store Group */
+ add %o0, 4, %o0 /* IEU0 */
+1: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 1, %g0 /* IEU1 Group */
+ lduh [%o1], %g2 /* Load Group */
+ add %o1, 2, %o1 /* IEU0 */
+ sth %g2, [%o0] /* Store Group */
+ add %o0, 2, %o0 /* IEU0 */
+1: be,pt %xcc, 211f /* CTI */
+ nop /* IEU1 */
+ ldub [%o1], %g2 /* Load Group */
+ stb %g2, [%o0] /* Store Group + bubble */
+211: retl
+ mov %g4, %o0
+
+82: MOVE_BIGALIGNCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
+ MOVE_BIGALIGNCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
+37: subcc %g6, 128, %g6 /* IEU1 Group */
+ add %o1, 128, %o1 /* IEU0 */
+ bne,pt %xcc, 82b /* CTI */
+ add %o0, 128, %o0 /* IEU0 Group */
+ andcc %o2, 0x70, %g6 /* IEU1 */
+ be,pn %xcc, 84f /* CTI */
+ andcc %o2, 8, %g0 /* IEU1 Group */
+ /* Clk1 8-( */
+ /* Clk2 8-( */
+ /* Clk3 8-( */
+ /* Clk4 8-( */
+83: rd %pc, %o5 /* PDU Group */
+ add %o1, %g6, %o1 /* IEU0 Group */
+ sub %o5, %g6, %o5 /* IEU1 */
+ jmpl %o5 + %lo(84f - 83b), %g0 /* CTI Group brk forced*/
+ add %o0, %g6, %o0 /* IEU0 Group */
+38: MOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3)
+ MOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3)
+84: be,pt %xcc, 85f /* CTI Group */
+ andcc %o2, 4, %g0 /* IEU1 */
+ ldx [%o1], %g2 /* Load Group */
+ add %o0, 8, %o0 /* IEU0 */
+ add %o1, 8, %o1 /* IEU0 Group */
+ stx %g2, [%o0 - 0x8] /* Store */
+85: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 2, %g0 /* IEU1 Group */
+ lduw [%o1], %g2 /* Load Group */
+ add %o0, 4, %o0 /* IEU0 */
+ add %o1, 4, %o1 /* IEU0 Group */
+ stw %g2, [%o0 - 0x4] /* Store */
+1: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 1, %g0 /* IEU1 Group */
+ lduh [%o1], %g2 /* Load Group */
+ add %o0, 2, %o0 /* IEU0 */
+ add %o1, 2, %o1 /* IEU0 Group */
+ sth %g2, [%o0 - 0x2] /* Store */
+1: be,pt %xcc, 1f /* CTI */
+ nop /* IEU0 Group */
+ ldub [%o1], %g2 /* Load Group */
+ stb %g2, [%o0] /* Store Group + bubble */
+1: retl
+ mov %g4, %o0
+
+212: brz,pt %g2, 2f /* CTI Group */
+ mov 8, %g1 /* IEU0 */
+ sub %g1, %g2, %g2 /* IEU0 Group */
+ sub %o2, %g2, %o2 /* IEU0 Group */
+1: ldub [%o1], %g5 /* Load Group */
+ add %o1, 1, %o1 /* IEU0 */
+ add %o0, 1, %o0 /* IEU1 */
+ subcc %g2, 1, %g2 /* IEU1 Group */
+ bne,pt %xcc, 1b /* CTI */
+ stb %g5, [%o0 - 1] /* Store */
+2: andn %o2, 7, %g5 /* IEU0 Group */
+ and %o2, 7, %o2 /* IEU1 */
+ fmovd %f0, %f2 /* FPU */
+ alignaddr %o1, %g0, %g1 /* GRU Group */
+ ldd [%g1], %f4 /* Load Group */
+1: ldd [%g1 + 0x8], %f6 /* Load Group */
+ add %g1, 0x8, %g1 /* IEU0 Group */
+ subcc %g5, 8, %g5 /* IEU1 */
+ faligndata %f4, %f6, %f0 /* GRU Group */
+ std %f0, [%o0] /* Store */
+ add %o1, 8, %o1 /* IEU0 Group */
+ be,pn %xcc, 213f /* CTI */
+ add %o0, 8, %o0 /* IEU1 */
+ ldd [%g1 + 0x8], %f4 /* Load Group */
+ add %g1, 8, %g1 /* IEU0 */
+ subcc %g5, 8, %g5 /* IEU1 */
+ faligndata %f6, %f4, %f0 /* GRU Group */
+ std %f0, [%o0] /* Store */
+ add %o1, 8, %o1 /* IEU0 */
+ bne,pn %xcc, 1b /* CTI Group */
+ add %o0, 8, %o0 /* IEU0 */
+213: brz,pn %o2, 214f /* CTI Group */
+ nop /* IEU0 */
+ ldub [%o1], %g5 /* LOAD */
+ add %o1, 1, %o1 /* IEU0 */
+ add %o0, 1, %o0 /* IEU1 */
+ subcc %o2, 1, %o2 /* IEU1 */
+ bne,pt %xcc, 206b /* CTI */
+ stb %g5, [%o0 - 1] /* Store Group */
+214: wr %g0, FPRS_FEF, %fprs
+ retl
+ mov %g4, %o0
+END(memcpy)
+libc_hidden_def(memcpy)
+
+ .align 32
+228: andcc %o2, 1, %g0 /* IEU1 Group */
+ be,pt %icc, 2f+4 /* CTI */
+1: ldub [%o1 - 1], %o5 /* LOAD Group */
+ sub %o1, 1, %o1 /* IEU0 */
+ sub %o0, 1, %o0 /* IEU1 */
+ subcc %o2, 1, %o2 /* IEU1 Group */
+ be,pn %xcc, 229f /* CTI */
+ stb %o5, [%o0] /* Store */
+2: ldub [%o1 - 1], %o5 /* LOAD Group */
+ sub %o0, 2, %o0 /* IEU0 */
+ ldub [%o1 - 2], %g5 /* LOAD Group */
+ sub %o1, 2, %o1 /* IEU0 */
+ subcc %o2, 2, %o2 /* IEU1 Group */
+ stb %o5, [%o0 + 1] /* Store */
+ bne,pt %xcc, 2b /* CTI */
+ stb %g5, [%o0] /* Store */
+229: retl
+ mov %g4, %o0
+219: retl
+ nop
+
+ .align 32
+ENTRY(memmove)
+#ifndef USE_BPR
+ srl %o2, 0, %o2 /* IEU1 Group */
+#endif
+ brz,pn %o2, 219b /* CTI Group */
+ sub %o0, %o1, %o4 /* IEU0 */
+ cmp %o4, %o2 /* IEU1 Group */
+ bgeu,pt %XCC, 218b /* CTI */
+ mov %o0, %g4 /* IEU0 */
+ add %o0, %o2, %o0 /* IEU0 Group */
+220: add %o1, %o2, %o1 /* IEU1 */
+ cmp %o2, 15 /* IEU1 Group */
+ bleu,pn %xcc, 228b /* CTI */
+ andcc %o0, 7, %g2 /* IEU1 Group */
+ sub %o0, %o1, %g5 /* IEU0 */
+ andcc %g5, 3, %o5 /* IEU1 Group */
+ bne,pn %xcc, 232f /* CTI */
+ andcc %o1, 3, %g0 /* IEU1 Group */
+ be,a,pt %xcc, 236f /* CTI */
+ andcc %o1, 4, %g0 /* IEU1 Group */
+ andcc %o1, 1, %g0 /* IEU1 Group */
+ be,pn %xcc, 4f /* CTI */
+ andcc %o1, 2, %g0 /* IEU1 Group */
+ ldub [%o1 - 1], %g2 /* Load Group */
+ sub %o1, 1, %o1 /* IEU0 */
+ sub %o0, 1, %o0 /* IEU1 */
+ sub %o2, 1, %o2 /* IEU0 Group */
+ be,pn %xcc, 5f /* CTI Group */
+ stb %g2, [%o0] /* Store */
+4: lduh [%o1 - 2], %g2 /* Load Group */
+ sub %o1, 2, %o1 /* IEU0 */
+ sub %o0, 2, %o0 /* IEU1 */
+ sub %o2, 2, %o2 /* IEU0 */
+ sth %g2, [%o0] /* Store Group + bubble */
+5: andcc %o1, 4, %g0 /* IEU1 */
+236: be,a,pn %xcc, 2f /* CTI */
+ andcc %o2, -128, %g6 /* IEU1 Group */
+ lduw [%o1 - 4], %g5 /* Load Group */
+ sub %o1, 4, %o1 /* IEU0 */
+ sub %o0, 4, %o0 /* IEU1 */
+ sub %o2, 4, %o2 /* IEU0 Group */
+ stw %g5, [%o0] /* Store */
+ andcc %o2, -128, %g6 /* IEU1 Group */
+2: be,pn %xcc, 235f /* CTI */
+ andcc %o0, 4, %g0 /* IEU1 Group */
+ be,pn %xcc, 282f + 4 /* CTI Group */
+5: RMOVE_BIGCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
+ RMOVE_BIGCHUNK(o1, o0, 0x20, g1, g3, g5, o5)
+ RMOVE_BIGCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
+ RMOVE_BIGCHUNK(o1, o0, 0x60, g1, g3, g5, o5)
+ subcc %g6, 128, %g6 /* IEU1 Group */
+ sub %o1, 128, %o1 /* IEU0 */
+ bne,pt %xcc, 5b /* CTI */
+ sub %o0, 128, %o0 /* IEU0 Group */
+235: andcc %o2, 0x70, %g6 /* IEU1 Group */
+41: be,pn %xcc, 280f /* CTI */
+ andcc %o2, 8, %g0 /* IEU1 Group */
+ /* Clk1 8-( */
+ /* Clk2 8-( */
+ /* Clk3 8-( */
+ /* Clk4 8-( */
+279: rd %pc, %o5 /* PDU Group */
+ sll %g6, 1, %g5 /* IEU0 Group */
+ sub %o1, %g6, %o1 /* IEU1 */
+ sub %o5, %g5, %o5 /* IEU0 Group */
+ jmpl %o5 + %lo(280f - 279b), %g0 /* CTI Group brk forced*/
+ sub %o0, %g6, %o0 /* IEU0 Group */
+ RMOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g5, o5)
+280: be,pt %xcc, 281f /* CTI */
+ andcc %o2, 4, %g0 /* IEU1 */
+ ldx [%o1 - 8], %g2 /* Load Group */
+ sub %o0, 8, %o0 /* IEU0 */
+ stw %g2, [%o0 + 4] /* Store Group */
+ sub %o1, 8, %o1 /* IEU1 */
+ srlx %g2, 32, %g2 /* IEU0 Group */
+ stw %g2, [%o0] /* Store */
+281: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 2, %g0 /* IEU1 Group */
+ lduw [%o1 - 4], %g2 /* Load Group */
+ sub %o1, 4, %o1 /* IEU0 */
+ stw %g2, [%o0 - 4] /* Store Group */
+ sub %o0, 4, %o0 /* IEU0 */
+1: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 1, %g0 /* IEU1 Group */
+ lduh [%o1 - 2], %g2 /* Load Group */
+ sub %o1, 2, %o1 /* IEU0 */
+ sth %g2, [%o0 - 2] /* Store Group */
+ sub %o0, 2, %o0 /* IEU0 */
+1: be,pt %xcc, 211f /* CTI */
+ nop /* IEU1 */
+ ldub [%o1 - 1], %g2 /* Load Group */
+ stb %g2, [%o0 - 1] /* Store Group + bubble */
+211: retl
+ mov %g4, %o0
+
+282: RMOVE_BIGALIGNCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
+ RMOVE_BIGALIGNCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
+ subcc %g6, 128, %g6 /* IEU1 Group */
+ sub %o1, 128, %o1 /* IEU0 */
+ bne,pt %xcc, 282b /* CTI */
+ sub %o0, 128, %o0 /* IEU0 Group */
+ andcc %o2, 0x70, %g6 /* IEU1 */
+ be,pn %xcc, 284f /* CTI */
+ andcc %o2, 8, %g0 /* IEU1 Group */
+ /* Clk1 8-( */
+ /* Clk2 8-( */
+ /* Clk3 8-( */
+ /* Clk4 8-( */
+283: rd %pc, %o5 /* PDU Group */
+ sub %o1, %g6, %o1 /* IEU0 Group */
+ sub %o5, %g6, %o5 /* IEU1 */
+ jmpl %o5 + %lo(284f - 283b), %g0 /* CTI Group brk forced*/
+ sub %o0, %g6, %o0 /* IEU0 Group */
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3)
+284: be,pt %xcc, 285f /* CTI Group */
+ andcc %o2, 4, %g0 /* IEU1 */
+ ldx [%o1 - 8], %g2 /* Load Group */
+ sub %o0, 8, %o0 /* IEU0 */
+ sub %o1, 8, %o1 /* IEU0 Group */
+ stx %g2, [%o0] /* Store */
+285: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 2, %g0 /* IEU1 Group */
+ lduw [%o1 - 4], %g2 /* Load Group */
+ sub %o0, 4, %o0 /* IEU0 */
+ sub %o1, 4, %o1 /* IEU0 Group */
+ stw %g2, [%o0] /* Store */
+1: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 1, %g0 /* IEU1 Group */
+ lduh [%o1 - 2], %g2 /* Load Group */
+ sub %o0, 2, %o0 /* IEU0 */
+ sub %o1, 2, %o1 /* IEU0 Group */
+ sth %g2, [%o0] /* Store */
+1: be,pt %xcc, 1f /* CTI */
+ nop /* IEU0 Group */
+ ldub [%o1 - 1], %g2 /* Load Group */
+ stb %g2, [%o0 - 1] /* Store Group + bubble */
+1: retl
+ mov %g4, %o0
+
+232: brz,pt %g2, 2f /* CTI Group */
+ sub %o2, %g2, %o2 /* IEU0 Group */
+1: ldub [%o1 - 1], %g5 /* Load Group */
+ sub %o1, 1, %o1 /* IEU0 */
+ sub %o0, 1, %o0 /* IEU1 */
+ subcc %g2, 1, %g2 /* IEU1 Group */
+ bne,pt %xcc, 1b /* CTI */
+ stb %g5, [%o0] /* Store */
+2: andn %o2, 7, %g5 /* IEU0 Group */
+ and %o2, 7, %o2 /* IEU1 */
+ fmovd %f0, %f2 /* FPU */
+ alignaddr %o1, %g0, %g1 /* GRU Group */
+ ldd [%g1], %f4 /* Load Group */
+1: ldd [%g1 - 8], %f6 /* Load Group */
+ sub %g1, 8, %g1 /* IEU0 Group */
+ subcc %g5, 8, %g5 /* IEU1 */
+ faligndata %f6, %f4, %f0 /* GRU Group */
+ std %f0, [%o0 - 8] /* Store */
+ sub %o1, 8, %o1 /* IEU0 Group */
+ be,pn %xcc, 233f /* CTI */
+ sub %o0, 8, %o0 /* IEU1 */
+ ldd [%g1 - 8], %f4 /* Load Group */
+ sub %g1, 8, %g1 /* IEU0 */
+ subcc %g5, 8, %g5 /* IEU1 */
+ faligndata %f4, %f6, %f0 /* GRU Group */
+ std %f0, [%o0 - 8] /* Store */
+ sub %o1, 8, %o1 /* IEU0 */
+ bne,pn %xcc, 1b /* CTI Group */
+ sub %o0, 8, %o0 /* IEU0 */
+233: brz,pn %o2, 234f /* CTI Group */
+ nop /* IEU0 */
+237: ldub [%o1 - 1], %g5 /* LOAD */
+ sub %o1, 1, %o1 /* IEU0 */
+ sub %o0, 1, %o0 /* IEU1 */
+ subcc %o2, 1, %o2 /* IEU1 */
+ bne,pt %xcc, 237b /* CTI */
+ stb %g5, [%o0] /* Store Group */
+234: wr %g0, FPRS_FEF, %fprs
+ retl
+ mov %g4, %o0
+END(memmove)
+libc_hidden_def(memmove)
+
+#ifdef USE_BPR
+weak_alias(memcpy,__align_cpy_1)
+weak_alias(memcpy,__align_cpy_2)
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/sparc64/memset.S b/ap/build/uClibc/libc/string/sparc/sparc64/memset.S
new file mode 100644
index 0000000..50e404b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc64/memset.S
@@ -0,0 +1,317 @@
+/* Set a block of memory to some byte value.
+ For UltraSPARC.
+ Copyright (C) 1996, 97, 98, 99, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller (davem@caip.rutgers.edu) and
+ Jakub Jelinek (jj@ultra.linux.cz).
+
+ 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/asi.h>
+#ifndef XCC
+#define XCC xcc
+#define USE_BPR
+#endif
+#define FPRS_FEF 4
+
+#define SET_BLOCKS(base, offset, source) \
+ stx source, [base - offset - 0x18]; \
+ stx source, [base - offset - 0x10]; \
+ stx source, [base - offset - 0x08]; \
+ stx source, [base - offset - 0x00];
+
+ /* Well, memset is a lot easier to get right than bcopy... */
+ .text
+ .align 32
+ENTRY(memset)
+ andcc %o1, 0xff, %o1
+ mov %o0, %o5
+ be,a,pt %icc, 50f
+#ifndef USE_BPR
+ srl %o2, 0, %o1
+#else
+ mov %o2, %o1
+#endif
+ cmp %o2, 7
+#ifndef USE_BPR
+ srl %o2, 0, %o2
+#endif
+ bleu,pn %XCC, 17f
+ andcc %o0, 3, %g5
+ be,pt %xcc, 4f
+ and %o1, 0xff, %o1
+ cmp %g5, 3
+ be,pn %xcc, 2f
+ stb %o1, [%o0 + 0x00]
+ cmp %g5, 2
+ be,pt %xcc, 2f
+ stb %o1, [%o0 + 0x01]
+ stb %o1, [%o0 + 0x02]
+2: sub %g5, 4, %g5
+ sub %o0, %g5, %o0
+ add %o2, %g5, %o2
+4: sllx %o1, 8, %g1
+ andcc %o0, 4, %g0
+ or %o1, %g1, %o1
+ sllx %o1, 16, %g1
+ or %o1, %g1, %o1
+ be,pt %xcc, 2f
+ sllx %o1, 32, %g1
+ stw %o1, [%o0]
+ sub %o2, 4, %o2
+ add %o0, 4, %o0
+2: cmp %o2, 128
+ or %o1, %g1, %o1
+ blu,pn %xcc, 9f
+ andcc %o0, 0x38, %g5
+ be,pn %icc, 6f
+ mov 64, %o4
+ andcc %o0, 8, %g0
+ be,pn %icc, 1f
+ sub %o4, %g5, %o4
+ stx %o1, [%o0]
+ add %o0, 8, %o0
+1: andcc %o4, 16, %g0
+ be,pn %icc, 1f
+ sub %o2, %o4, %o2
+ stx %o1, [%o0]
+ stx %o1, [%o0 + 8]
+ add %o0, 16, %o0
+1: andcc %o4, 32, %g0
+ be,pn %icc, 7f
+ andncc %o2, 0x3f, %o3
+ stw %o1, [%o0]
+ stw %o1, [%o0 + 4]
+ stw %o1, [%o0 + 8]
+ stw %o1, [%o0 + 12]
+ stw %o1, [%o0 + 16]
+ stw %o1, [%o0 + 20]
+ stw %o1, [%o0 + 24]
+ stw %o1, [%o0 + 28]
+ add %o0, 32, %o0
+7: be,pn %xcc, 9f
+ nop
+ ldd [%o0 - 8], %f0
+18: wr %g0, ASI_BLK_P, %asi
+ membar #StoreStore | #LoadStore
+ andcc %o3, 0xc0, %g5
+ and %o2, 0x3f, %o2
+ fmovd %f0, %f2
+ fmovd %f0, %f4
+ andn %o3, 0xff, %o3
+ fmovd %f0, %f6
+ cmp %g5, 64
+ fmovd %f0, %f8
+ fmovd %f0, %f10
+ fmovd %f0, %f12
+ brz,pn %g5, 10f
+ fmovd %f0, %f14
+ be,pn %icc, 2f
+ stda %f0, [%o0 + 0x00] %asi
+ cmp %g5, 128
+ be,pn %icc, 2f
+ stda %f0, [%o0 + 0x40] %asi
+ stda %f0, [%o0 + 0x80] %asi
+2: brz,pn %o3, 12f
+ add %o0, %g5, %o0
+10: stda %f0, [%o0 + 0x00] %asi
+ stda %f0, [%o0 + 0x40] %asi
+ stda %f0, [%o0 + 0x80] %asi
+ stda %f0, [%o0 + 0xc0] %asi
+11: subcc %o3, 256, %o3
+ bne,pt %xcc, 10b
+ add %o0, 256, %o0
+12: wr %g0, FPRS_FEF, %fprs
+ membar #StoreLoad | #StoreStore
+9: andcc %o2, 0x78, %g5
+ be,pn %xcc, 13f
+ andcc %o2, 7, %o2
+14: rd %pc, %o4
+ srl %g5, 1, %o3
+ sub %o4, %o3, %o4
+ jmpl %o4 + (13f - 14b), %g0
+ add %o0, %g5, %o0
+12: SET_BLOCKS (%o0, 0x68, %o1)
+ SET_BLOCKS (%o0, 0x48, %o1)
+ SET_BLOCKS (%o0, 0x28, %o1)
+ SET_BLOCKS (%o0, 0x08, %o1)
+13: be,pn %xcc, 8f
+ andcc %o2, 4, %g0
+ be,pn %xcc, 1f
+ andcc %o2, 2, %g0
+ stw %o1, [%o0]
+ add %o0, 4, %o0
+1: be,pn %xcc, 1f
+ andcc %o2, 1, %g0
+ sth %o1, [%o0]
+ add %o0, 2, %o0
+1: bne,a,pn %xcc, 8f
+ stb %o1, [%o0]
+8: retl
+ mov %o5, %o0
+17: brz,pn %o2, 0f
+8: add %o0, 1, %o0
+ subcc %o2, 1, %o2
+ bne,pt %xcc, 8b
+ stb %o1, [%o0 - 1]
+0: retl
+ mov %o5, %o0
+
+6: stx %o1, [%o0]
+ andncc %o2, 0x3f, %o3
+ be,pn %xcc, 9b
+ nop
+ ba,pt %xcc, 18b
+ ldd [%o0], %f0
+END(memset)
+libc_hidden_def(memset)
+
+#define ZERO_BLOCKS(base, offset, source) \
+ stx source, [base - offset - 0x38]; \
+ stx source, [base - offset - 0x30]; \
+ stx source, [base - offset - 0x28]; \
+ stx source, [base - offset - 0x20]; \
+ stx source, [base - offset - 0x18]; \
+ stx source, [base - offset - 0x10]; \
+ stx source, [base - offset - 0x08]; \
+ stx source, [base - offset - 0x00];
+
+ .text
+ .align 32
+#ifdef __UCLIBC_SUSV3_LEGACY__
+ENTRY(bzero)
+#ifndef USE_BPR
+ srl %o1, 0, %o1
+#endif
+ mov %o0, %o5
+#endif
+50: cmp %o1, 7
+ bleu,pn %xcc, 17f
+ andcc %o0, 3, %o2
+ be,a,pt %xcc, 4f
+ andcc %o0, 4, %g0
+ cmp %o2, 3
+ be,pn %xcc, 2f
+ stb %g0, [%o0 + 0x00]
+ cmp %o2, 2
+ be,pt %xcc, 2f
+ stb %g0, [%o0 + 0x01]
+ stb %g0, [%o0 + 0x02]
+2: sub %o2, 4, %o2
+ sub %o0, %o2, %o0
+ add %o1, %o2, %o1
+ andcc %o0, 4, %g0
+4: be,pt %xcc, 2f
+ cmp %o1, 128
+ stw %g0, [%o0]
+ sub %o1, 4, %o1
+ add %o0, 4, %o0
+2: blu,pn %xcc, 9f
+ andcc %o0, 0x38, %o2
+ be,pn %icc, 6f
+ mov 64, %o4
+ andcc %o0, 8, %g0
+ be,pn %icc, 1f
+ sub %o4, %o2, %o4
+ stx %g0, [%o0]
+ add %o0, 8, %o0
+1: andcc %o4, 16, %g0
+ be,pn %icc, 1f
+ sub %o1, %o4, %o1
+ stx %g0, [%o0]
+ stx %g0, [%o0 + 8]
+ add %o0, 16, %o0
+1: andcc %o4, 32, %g0
+ be,pn %icc, 7f
+ andncc %o1, 0x3f, %o3
+ stx %g0, [%o0]
+ stx %g0, [%o0 + 8]
+ stx %g0, [%o0 + 16]
+ stx %g0, [%o0 + 24]
+ add %o0, 32, %o0
+6: andncc %o1, 0x3f, %o3
+7: be,pn %xcc, 9f
+ wr %g0, ASI_BLK_P, %asi
+ membar #StoreLoad | #StoreStore | #LoadStore
+ fzero %f0
+ andcc %o3, 0xc0, %o2
+ and %o1, 0x3f, %o1
+ fzero %f2
+ andn %o3, 0xff, %o3
+ faddd %f0, %f2, %f4
+ fmuld %f0, %f2, %f6
+ cmp %o2, 64
+ faddd %f0, %f2, %f8
+ fmuld %f0, %f2, %f10
+ faddd %f0, %f2, %f12
+ brz,pn %o2, 10f
+ fmuld %f0, %f2, %f14
+ be,pn %icc, 2f
+ stda %f0, [%o0 + 0x00] %asi
+ cmp %o2, 128
+ be,pn %icc, 2f
+ stda %f0, [%o0 + 0x40] %asi
+ stda %f0, [%o0 + 0x80] %asi
+2: brz,pn %o3, 12f
+ add %o0, %o2, %o0
+10: stda %f0, [%o0 + 0x00] %asi
+ stda %f0, [%o0 + 0x40] %asi
+ stda %f0, [%o0 + 0x80] %asi
+ stda %f0, [%o0 + 0xc0] %asi
+11: subcc %o3, 256, %o3
+ bne,pt %xcc, 10b
+ add %o0, 256, %o0
+12: wr %g0, FPRS_FEF, %fprs
+ membar #StoreLoad | #StoreStore
+9: andcc %o1, 0xf8, %o2
+ be,pn %xcc, 13f
+ andcc %o1, 7, %o1
+14: rd %pc, %o4
+ srl %o2, 1, %o3
+ sub %o4, %o3, %o4
+ jmpl %o4 + (13f - 14b), %g0
+ add %o0, %o2, %o0
+12: ZERO_BLOCKS (%o0, 0xc8, %g0)
+ ZERO_BLOCKS (%o0, 0x88, %g0)
+ ZERO_BLOCKS (%o0, 0x48, %g0)
+ ZERO_BLOCKS (%o0, 0x08, %g0)
+13: be,pn %xcc, 8f
+ andcc %o1, 4, %g0
+ be,pn %xcc, 1f
+ andcc %o1, 2, %g0
+ stw %g0, [%o0]
+ add %o0, 4, %o0
+1: be,pn %xcc, 1f
+ andcc %o1, 1, %g0
+ sth %g0, [%o0]
+ add %o0, 2, %o0
+1: bne,a,pn %xcc, 8f
+ stb %g0, [%o0]
+8: retl
+ mov %o5, %o0
+17: be,pn %xcc, 13b
+ orcc %o1, 0, %g0
+ be,pn %xcc, 0f
+8: add %o0, 1, %o0
+ subcc %o1, 1, %o1
+ bne,pt %xcc, 8b
+ stb %g0, [%o0 - 1]
+0: retl
+ mov %o5, %o0
+#ifdef __UCLIBC_SUSV3_LEGACY__
+END(bzero)
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/sparc64/sparcv9b/memcpy.S b/ap/build/uClibc/libc/string/sparc/sparc64/sparcv9b/memcpy.S
new file mode 100644
index 0000000..64f6a92
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc64/sparcv9b/memcpy.S
@@ -0,0 +1,612 @@
+/* Copy SIZE bytes from SRC to DEST.
+ For UltraSPARC-III.
+ Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by David S. Miller (davem@redhat.com)
+
+ 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>
+
+#define ASI_BLK_P 0xf0
+#define FPRS_FEF 0x04
+#define VISEntryHalf rd %fprs, %o5; wr %g0, FPRS_FEF, %fprs
+#define VISExitHalf and %o5, FPRS_FEF, %o5; wr %o5, 0x0, %fprs
+
+#ifndef XCC
+#define USE_BPR
+#define XCC xcc
+#endif
+
+ .register %g2,#scratch
+ .register %g3,#scratch
+ .register %g6,#scratch
+
+ .text
+ .align 32
+
+#ifdef __UCLIBC_SUSV3_LEGACY__
+ENTRY(bcopy)
+ sub %o1, %o0, %o4
+ mov %o0, %g4
+ cmp %o4, %o2
+ mov %o1, %o0
+ bgeu,pt %XCC, 100f
+ mov %g4, %o1
+#ifndef USE_BPR
+ srl %o2, 0, %o2
+#endif
+ brnz,pn %o2, 220f
+ add %o0, %o2, %o0
+ retl
+ nop
+END(bcopy)
+#endif
+
+ /* Special/non-trivial issues of this code:
+ *
+ * 1) %o5 is preserved from VISEntryHalf to VISExitHalf
+ * 2) Only low 32 FPU registers are used so that only the
+ * lower half of the FPU register set is dirtied by this
+ * code. This is especially important in the kernel.
+ * 3) This code never prefetches cachelines past the end
+ * of the source buffer.
+ *
+ * The cheetah's flexible spine, oversized liver, enlarged heart,
+ * slender muscular body, and claws make it the swiftest hunter
+ * in Africa and the fastest animal on land. Can reach speeds
+ * of up to 2.4GB per second.
+ */
+ .align 32
+ENTRY(memcpy)
+
+100: /* %o0=dst, %o1=src, %o2=len */
+ mov %o0, %g5
+ cmp %o2, 0
+ be,pn %XCC, out
+218: or %o0, %o1, %o3
+ cmp %o2, 16
+ bleu,a,pn %XCC, small_copy
+ or %o3, %o2, %o3
+
+ cmp %o2, 256
+ blu,pt %XCC, medium_copy
+ andcc %o3, 0x7, %g0
+
+ ba,pt %xcc, enter
+ andcc %o0, 0x3f, %g2
+
+ /* Here len >= 256 and condition codes reflect execution
+ * of "andcc %o0, 0x7, %g2", done by caller.
+ */
+ .align 64
+enter:
+ /* Is 'dst' already aligned on an 64-byte boundary? */
+ be,pt %XCC, 2f
+
+ /* Compute abs((dst & 0x3f) - 0x40) into %g2. This is the number
+ * of bytes to copy to make 'dst' 64-byte aligned. We pre-
+ * subtract this from 'len'.
+ */
+ sub %g2, 0x40, %g2
+ sub %g0, %g2, %g2
+ sub %o2, %g2, %o2
+
+ /* Copy %g2 bytes from src to dst, one byte at a time. */
+1: ldub [%o1 + 0x00], %o3
+ add %o1, 0x1, %o1
+ add %o0, 0x1, %o0
+ subcc %g2, 0x1, %g2
+
+ bg,pt %XCC, 1b
+ stb %o3, [%o0 + -1]
+
+2: VISEntryHalf
+ and %o1, 0x7, %g1
+ ba,pt %xcc, begin
+ alignaddr %o1, %g0, %o1
+
+ .align 64
+begin:
+ prefetch [%o1 + 0x000], #one_read
+ prefetch [%o1 + 0x040], #one_read
+ andn %o2, (0x40 - 1), %o4
+ prefetch [%o1 + 0x080], #one_read
+ prefetch [%o1 + 0x0c0], #one_read
+ ldd [%o1 + 0x000], %f0
+ prefetch [%o1 + 0x100], #one_read
+ ldd [%o1 + 0x008], %f2
+ prefetch [%o1 + 0x140], #one_read
+ ldd [%o1 + 0x010], %f4
+ prefetch [%o1 + 0x180], #one_read
+ faligndata %f0, %f2, %f16
+ ldd [%o1 + 0x018], %f6
+ faligndata %f2, %f4, %f18
+ ldd [%o1 + 0x020], %f8
+ faligndata %f4, %f6, %f20
+ ldd [%o1 + 0x028], %f10
+ faligndata %f6, %f8, %f22
+
+ ldd [%o1 + 0x030], %f12
+ faligndata %f8, %f10, %f24
+ ldd [%o1 + 0x038], %f14
+ faligndata %f10, %f12, %f26
+ ldd [%o1 + 0x040], %f0
+
+ sub %o4, 0x80, %o4
+ add %o1, 0x40, %o1
+ ba,pt %xcc, loop
+ srl %o4, 6, %o3
+
+ .align 64
+loop:
+ ldd [%o1 + 0x008], %f2
+ faligndata %f12, %f14, %f28
+ ldd [%o1 + 0x010], %f4
+ faligndata %f14, %f0, %f30
+ stda %f16, [%o0] ASI_BLK_P
+ ldd [%o1 + 0x018], %f6
+ faligndata %f0, %f2, %f16
+
+ ldd [%o1 + 0x020], %f8
+ faligndata %f2, %f4, %f18
+ ldd [%o1 + 0x028], %f10
+ faligndata %f4, %f6, %f20
+ ldd [%o1 + 0x030], %f12
+ faligndata %f6, %f8, %f22
+ ldd [%o1 + 0x038], %f14
+ faligndata %f8, %f10, %f24
+
+ ldd [%o1 + 0x040], %f0
+ prefetch [%o1 + 0x180], #one_read
+ faligndata %f10, %f12, %f26
+ subcc %o3, 0x01, %o3
+ add %o1, 0x40, %o1
+ bg,pt %XCC, loop
+ add %o0, 0x40, %o0
+
+ /* Finally we copy the last full 64-byte block. */
+loopfini:
+ ldd [%o1 + 0x008], %f2
+ faligndata %f12, %f14, %f28
+ ldd [%o1 + 0x010], %f4
+ faligndata %f14, %f0, %f30
+ stda %f16, [%o0] ASI_BLK_P
+ ldd [%o1 + 0x018], %f6
+ faligndata %f0, %f2, %f16
+ ldd [%o1 + 0x020], %f8
+ faligndata %f2, %f4, %f18
+ ldd [%o1 + 0x028], %f10
+ faligndata %f4, %f6, %f20
+ ldd [%o1 + 0x030], %f12
+ faligndata %f6, %f8, %f22
+ ldd [%o1 + 0x038], %f14
+ faligndata %f8, %f10, %f24
+ cmp %g1, 0
+ be,pt %XCC, 1f
+ add %o0, 0x40, %o0
+ ldd [%o1 + 0x040], %f0
+1: faligndata %f10, %f12, %f26
+ faligndata %f12, %f14, %f28
+ faligndata %f14, %f0, %f30
+ stda %f16, [%o0] ASI_BLK_P
+ add %o0, 0x40, %o0
+ add %o1, 0x40, %o1
+ membar #Sync
+
+ /* Now we copy the (len modulo 64) bytes at the end.
+ * Note how we borrow the %f0 loaded above.
+ *
+ * Also notice how this code is careful not to perform a
+ * load past the end of the src buffer.
+ */
+loopend:
+ and %o2, 0x3f, %o2
+ andcc %o2, 0x38, %g2
+ be,pn %XCC, endcruft
+ subcc %g2, 0x8, %g2
+ be,pn %XCC, endcruft
+ cmp %g1, 0
+
+ be,a,pt %XCC, 1f
+ ldd [%o1 + 0x00], %f0
+
+1: ldd [%o1 + 0x08], %f2
+ add %o1, 0x8, %o1
+ sub %o2, 0x8, %o2
+ subcc %g2, 0x8, %g2
+ faligndata %f0, %f2, %f8
+ std %f8, [%o0 + 0x00]
+ be,pn %XCC, endcruft
+ add %o0, 0x8, %o0
+ ldd [%o1 + 0x08], %f0
+ add %o1, 0x8, %o1
+ sub %o2, 0x8, %o2
+ subcc %g2, 0x8, %g2
+ faligndata %f2, %f0, %f8
+ std %f8, [%o0 + 0x00]
+ bne,pn %XCC, 1b
+ add %o0, 0x8, %o0
+
+ /* If anything is left, we copy it one byte at a time.
+ * Note that %g1 is (src & 0x3) saved above before the
+ * alignaddr was performed.
+ */
+endcruft:
+ cmp %o2, 0
+ add %o1, %g1, %o1
+ VISExitHalf
+ be,pn %XCC, out
+ sub %o0, %o1, %o3
+
+ andcc %g1, 0x7, %g0
+ bne,pn %icc, small_copy_unaligned
+ andcc %o2, 0x8, %g0
+ be,pt %icc, 1f
+ nop
+ ldx [%o1], %o5
+ stx %o5, [%o1 + %o3]
+ add %o1, 0x8, %o1
+
+1: andcc %o2, 0x4, %g0
+ be,pt %icc, 1f
+ nop
+ lduw [%o1], %o5
+ stw %o5, [%o1 + %o3]
+ add %o1, 0x4, %o1
+
+1: andcc %o2, 0x2, %g0
+ be,pt %icc, 1f
+ nop
+ lduh [%o1], %o5
+ sth %o5, [%o1 + %o3]
+ add %o1, 0x2, %o1
+
+1: andcc %o2, 0x1, %g0
+ be,pt %icc, out
+ nop
+ ldub [%o1], %o5
+ ba,pt %xcc, out
+ stb %o5, [%o1 + %o3]
+
+medium_copy: /* 16 < len <= 64 */
+ bne,pn %XCC, small_copy_unaligned
+ sub %o0, %o1, %o3
+
+medium_copy_aligned:
+ andn %o2, 0x7, %o4
+ and %o2, 0x7, %o2
+1: subcc %o4, 0x8, %o4
+ ldx [%o1], %o5
+ stx %o5, [%o1 + %o3]
+ bgu,pt %XCC, 1b
+ add %o1, 0x8, %o1
+ andcc %o2, 0x4, %g0
+ be,pt %XCC, 1f
+ nop
+ sub %o2, 0x4, %o2
+ lduw [%o1], %o5
+ stw %o5, [%o1 + %o3]
+ add %o1, 0x4, %o1
+1: cmp %o2, 0
+ be,pt %XCC, out
+ nop
+ ba,pt %xcc, small_copy_unaligned
+ nop
+
+small_copy: /* 0 < len <= 16 */
+ andcc %o3, 0x3, %g0
+ bne,pn %XCC, small_copy_unaligned
+ sub %o0, %o1, %o3
+
+small_copy_aligned:
+ subcc %o2, 4, %o2
+ lduw [%o1], %g1
+ stw %g1, [%o1 + %o3]
+ bgu,pt %XCC, small_copy_aligned
+ add %o1, 4, %o1
+
+out: retl
+ mov %g5, %o0
+
+ .align 32
+small_copy_unaligned:
+ subcc %o2, 1, %o2
+ ldub [%o1], %g1
+ stb %g1, [%o1 + %o3]
+ bgu,pt %XCC, small_copy_unaligned
+ add %o1, 1, %o1
+ retl
+ mov %g5, %o0
+
+END(memcpy)
+libc_hidden_def(memcpy)
+
+#define RMOVE_BIGCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldx [%src - offset - 0x20], %t0; \
+ ldx [%src - offset - 0x18], %t1; \
+ ldx [%src - offset - 0x10], %t2; \
+ ldx [%src - offset - 0x08], %t3; \
+ stw %t0, [%dst - offset - 0x1c]; \
+ srlx %t0, 32, %t0; \
+ stw %t0, [%dst - offset - 0x20]; \
+ stw %t1, [%dst - offset - 0x14]; \
+ srlx %t1, 32, %t1; \
+ stw %t1, [%dst - offset - 0x18]; \
+ stw %t2, [%dst - offset - 0x0c]; \
+ srlx %t2, 32, %t2; \
+ stw %t2, [%dst - offset - 0x10]; \
+ stw %t3, [%dst - offset - 0x04]; \
+ srlx %t3, 32, %t3; \
+ stw %t3, [%dst - offset - 0x08];
+
+#define RMOVE_BIGALIGNCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldx [%src - offset - 0x20], %t0; \
+ ldx [%src - offset - 0x18], %t1; \
+ ldx [%src - offset - 0x10], %t2; \
+ ldx [%src - offset - 0x08], %t3; \
+ stx %t0, [%dst - offset - 0x20]; \
+ stx %t1, [%dst - offset - 0x18]; \
+ stx %t2, [%dst - offset - 0x10]; \
+ stx %t3, [%dst - offset - 0x08]; \
+ ldx [%src - offset - 0x40], %t0; \
+ ldx [%src - offset - 0x38], %t1; \
+ ldx [%src - offset - 0x30], %t2; \
+ ldx [%src - offset - 0x28], %t3; \
+ stx %t0, [%dst - offset - 0x40]; \
+ stx %t1, [%dst - offset - 0x38]; \
+ stx %t2, [%dst - offset - 0x30]; \
+ stx %t3, [%dst - offset - 0x28];
+
+#define RMOVE_LASTCHUNK(src, dst, offset, t0, t1, t2, t3) \
+ ldx [%src + offset + 0x00], %t0; \
+ ldx [%src + offset + 0x08], %t1; \
+ stw %t0, [%dst + offset + 0x04]; \
+ srlx %t0, 32, %t2; \
+ stw %t2, [%dst + offset + 0x00]; \
+ stw %t1, [%dst + offset + 0x0c]; \
+ srlx %t1, 32, %t3; \
+ stw %t3, [%dst + offset + 0x08];
+
+#define RMOVE_LASTALIGNCHUNK(src, dst, offset, t0, t1) \
+ ldx [%src + offset + 0x00], %t0; \
+ ldx [%src + offset + 0x08], %t1; \
+ stx %t0, [%dst + offset + 0x00]; \
+ stx %t1, [%dst + offset + 0x08];
+
+ .align 32
+228: andcc %o2, 1, %g0 /* IEU1 Group */
+ be,pt %icc, 2f+4 /* CTI */
+1: ldub [%o1 - 1], %o5 /* LOAD Group */
+ sub %o1, 1, %o1 /* IEU0 */
+ sub %o0, 1, %o0 /* IEU1 */
+ subcc %o2, 1, %o2 /* IEU1 Group */
+ be,pn %xcc, 229f /* CTI */
+ stb %o5, [%o0] /* Store */
+2: ldub [%o1 - 1], %o5 /* LOAD Group */
+ sub %o0, 2, %o0 /* IEU0 */
+ ldub [%o1 - 2], %g5 /* LOAD Group */
+ sub %o1, 2, %o1 /* IEU0 */
+ subcc %o2, 2, %o2 /* IEU1 Group */
+ stb %o5, [%o0 + 1] /* Store */
+ bne,pt %xcc, 2b /* CTI */
+ stb %g5, [%o0] /* Store */
+229: retl
+ mov %g4, %o0
+
+ .align 32
+ENTRY(memmove)
+ mov %o0, %g5
+#ifndef USE_BPR
+ srl %o2, 0, %o2 /* IEU1 Group */
+#endif
+ brz,pn %o2, out /* CTI Group */
+ sub %o0, %o1, %o4 /* IEU0 */
+ cmp %o4, %o2 /* IEU1 Group */
+ bgeu,pt %XCC, 218b /* CTI */
+ mov %o0, %g4 /* IEU0 */
+ add %o0, %o2, %o0 /* IEU0 Group */
+220: add %o1, %o2, %o1 /* IEU1 */
+ cmp %o2, 15 /* IEU1 Group */
+ bleu,pn %xcc, 228b /* CTI */
+ andcc %o0, 7, %g2 /* IEU1 Group */
+ sub %o0, %o1, %g5 /* IEU0 */
+ andcc %g5, 3, %o5 /* IEU1 Group */
+ bne,pn %xcc, 232f /* CTI */
+ andcc %o1, 3, %g0 /* IEU1 Group */
+ be,a,pt %xcc, 236f /* CTI */
+ andcc %o1, 4, %g0 /* IEU1 Group */
+ andcc %o1, 1, %g0 /* IEU1 Group */
+ be,pn %xcc, 4f /* CTI */
+ andcc %o1, 2, %g0 /* IEU1 Group */
+ ldub [%o1 - 1], %g2 /* Load Group */
+ sub %o1, 1, %o1 /* IEU0 */
+ sub %o0, 1, %o0 /* IEU1 */
+ sub %o2, 1, %o2 /* IEU0 Group */
+ be,pn %xcc, 5f /* CTI Group */
+ stb %g2, [%o0] /* Store */
+4: lduh [%o1 - 2], %g2 /* Load Group */
+ sub %o1, 2, %o1 /* IEU0 */
+ sub %o0, 2, %o0 /* IEU1 */
+ sub %o2, 2, %o2 /* IEU0 */
+ sth %g2, [%o0] /* Store Group + bubble */
+5: andcc %o1, 4, %g0 /* IEU1 */
+236: be,a,pn %xcc, 2f /* CTI */
+ andcc %o2, -128, %g6 /* IEU1 Group */
+ lduw [%o1 - 4], %g5 /* Load Group */
+ sub %o1, 4, %o1 /* IEU0 */
+ sub %o0, 4, %o0 /* IEU1 */
+ sub %o2, 4, %o2 /* IEU0 Group */
+ stw %g5, [%o0] /* Store */
+ andcc %o2, -128, %g6 /* IEU1 Group */
+2: be,pn %xcc, 235f /* CTI */
+ andcc %o0, 4, %g0 /* IEU1 Group */
+ be,pn %xcc, 282f + 4 /* CTI Group */
+5: RMOVE_BIGCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
+ RMOVE_BIGCHUNK(o1, o0, 0x20, g1, g3, g5, o5)
+ RMOVE_BIGCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
+ RMOVE_BIGCHUNK(o1, o0, 0x60, g1, g3, g5, o5)
+ subcc %g6, 128, %g6 /* IEU1 Group */
+ sub %o1, 128, %o1 /* IEU0 */
+ bne,pt %xcc, 5b /* CTI */
+ sub %o0, 128, %o0 /* IEU0 Group */
+235: andcc %o2, 0x70, %g6 /* IEU1 Group */
+41: be,pn %xcc, 280f /* CTI */
+ andcc %o2, 8, %g0 /* IEU1 Group */
+ /* Clk1 8-( */
+ /* Clk2 8-( */
+ /* Clk3 8-( */
+ /* Clk4 8-( */
+279: rd %pc, %o5 /* PDU Group */
+ sll %g6, 1, %g5 /* IEU0 Group */
+ sub %o1, %g6, %o1 /* IEU1 */
+ sub %o5, %g5, %o5 /* IEU0 Group */
+ jmpl %o5 + %lo(280f - 279b), %g0 /* CTI Group brk forced*/
+ sub %o0, %g6, %o0 /* IEU0 Group */
+ RMOVE_LASTCHUNK(o1, o0, 0x60, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x50, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x40, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x30, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x20, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x10, g2, g3, g5, o5)
+ RMOVE_LASTCHUNK(o1, o0, 0x00, g2, g3, g5, o5)
+280: be,pt %xcc, 281f /* CTI */
+ andcc %o2, 4, %g0 /* IEU1 */
+ ldx [%o1 - 8], %g2 /* Load Group */
+ sub %o0, 8, %o0 /* IEU0 */
+ stw %g2, [%o0 + 4] /* Store Group */
+ sub %o1, 8, %o1 /* IEU1 */
+ srlx %g2, 32, %g2 /* IEU0 Group */
+ stw %g2, [%o0] /* Store */
+281: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 2, %g0 /* IEU1 Group */
+ lduw [%o1 - 4], %g2 /* Load Group */
+ sub %o1, 4, %o1 /* IEU0 */
+ stw %g2, [%o0 - 4] /* Store Group */
+ sub %o0, 4, %o0 /* IEU0 */
+1: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 1, %g0 /* IEU1 Group */
+ lduh [%o1 - 2], %g2 /* Load Group */
+ sub %o1, 2, %o1 /* IEU0 */
+ sth %g2, [%o0 - 2] /* Store Group */
+ sub %o0, 2, %o0 /* IEU0 */
+1: be,pt %xcc, 211f /* CTI */
+ nop /* IEU1 */
+ ldub [%o1 - 1], %g2 /* Load Group */
+ stb %g2, [%o0 - 1] /* Store Group + bubble */
+211: retl
+ mov %g4, %o0
+
+282: RMOVE_BIGALIGNCHUNK(o1, o0, 0x00, g1, g3, g5, o5)
+ RMOVE_BIGALIGNCHUNK(o1, o0, 0x40, g1, g3, g5, o5)
+ subcc %g6, 128, %g6 /* IEU1 Group */
+ sub %o1, 128, %o1 /* IEU0 */
+ bne,pt %xcc, 282b /* CTI */
+ sub %o0, 128, %o0 /* IEU0 Group */
+ andcc %o2, 0x70, %g6 /* IEU1 */
+ be,pn %xcc, 284f /* CTI */
+ andcc %o2, 8, %g0 /* IEU1 Group */
+ /* Clk1 8-( */
+ /* Clk2 8-( */
+ /* Clk3 8-( */
+ /* Clk4 8-( */
+283: rd %pc, %o5 /* PDU Group */
+ sub %o1, %g6, %o1 /* IEU0 Group */
+ sub %o5, %g6, %o5 /* IEU1 */
+ jmpl %o5 + %lo(284f - 283b), %g0 /* CTI Group brk forced*/
+ sub %o0, %g6, %o0 /* IEU0 Group */
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x60, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x50, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x40, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x30, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x20, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x10, g2, g3)
+ RMOVE_LASTALIGNCHUNK(o1, o0, 0x00, g2, g3)
+284: be,pt %xcc, 285f /* CTI Group */
+ andcc %o2, 4, %g0 /* IEU1 */
+ ldx [%o1 - 8], %g2 /* Load Group */
+ sub %o0, 8, %o0 /* IEU0 */
+ sub %o1, 8, %o1 /* IEU0 Group */
+ stx %g2, [%o0] /* Store */
+285: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 2, %g0 /* IEU1 Group */
+ lduw [%o1 - 4], %g2 /* Load Group */
+ sub %o0, 4, %o0 /* IEU0 */
+ sub %o1, 4, %o1 /* IEU0 Group */
+ stw %g2, [%o0] /* Store */
+1: be,pt %xcc, 1f /* CTI */
+ andcc %o2, 1, %g0 /* IEU1 Group */
+ lduh [%o1 - 2], %g2 /* Load Group */
+ sub %o0, 2, %o0 /* IEU0 */
+ sub %o1, 2, %o1 /* IEU0 Group */
+ sth %g2, [%o0] /* Store */
+1: be,pt %xcc, 1f /* CTI */
+ nop /* IEU0 Group */
+ ldub [%o1 - 1], %g2 /* Load Group */
+ stb %g2, [%o0 - 1] /* Store Group + bubble */
+1: retl
+ mov %g4, %o0
+
+232: brz,pt %g2, 2f /* CTI Group */
+ sub %o2, %g2, %o2 /* IEU0 Group */
+1: ldub [%o1 - 1], %g5 /* Load Group */
+ sub %o1, 1, %o1 /* IEU0 */
+ sub %o0, 1, %o0 /* IEU1 */
+ subcc %g2, 1, %g2 /* IEU1 Group */
+ bne,pt %xcc, 1b /* CTI */
+ stb %g5, [%o0] /* Store */
+2: andn %o2, 7, %g5 /* IEU0 Group */
+ and %o2, 7, %o2 /* IEU1 */
+ fmovd %f0, %f2 /* FPU */
+ alignaddr %o1, %g0, %g1 /* GRU Group */
+ ldd [%g1], %f4 /* Load Group */
+1: ldd [%g1 - 8], %f6 /* Load Group */
+ sub %g1, 8, %g1 /* IEU0 Group */
+ subcc %g5, 8, %g5 /* IEU1 */
+ faligndata %f6, %f4, %f0 /* GRU Group */
+ std %f0, [%o0 - 8] /* Store */
+ sub %o1, 8, %o1 /* IEU0 Group */
+ be,pn %xcc, 233f /* CTI */
+ sub %o0, 8, %o0 /* IEU1 */
+ ldd [%g1 - 8], %f4 /* Load Group */
+ sub %g1, 8, %g1 /* IEU0 */
+ subcc %g5, 8, %g5 /* IEU1 */
+ faligndata %f4, %f6, %f0 /* GRU Group */
+ std %f0, [%o0 - 8] /* Store */
+ sub %o1, 8, %o1 /* IEU0 */
+ bne,pn %xcc, 1b /* CTI Group */
+ sub %o0, 8, %o0 /* IEU0 */
+233: brz,pn %o2, 234f /* CTI Group */
+ nop /* IEU0 */
+237: ldub [%o1 - 1], %g5 /* LOAD */
+ sub %o1, 1, %o1 /* IEU0 */
+ sub %o0, 1, %o0 /* IEU1 */
+ subcc %o2, 1, %o2 /* IEU1 */
+ bne,pt %xcc, 237b /* CTI */
+ stb %g5, [%o0] /* Store Group */
+234: wr %g0, FPRS_FEF, %fprs
+ retl
+ mov %g4, %o0
+END(memmove)
+libc_hidden_def(memmove)
+
+#ifdef USE_BPR
+weak_alias(memcpy,__align_cpy_1)
+weak_alias(memcpy,__align_cpy_2)
+weak_alias(memcpy,__align_cpy_4)
+weak_alias(memcpy,__align_cpy_8)
+weak_alias(memcpy,__align_cpy_16)
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/sparc64/stpcpy.S b/ap/build/uClibc/libc/string/sparc/sparc64/stpcpy.S
new file mode 100644
index 0000000..8c26c6b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc64/stpcpy.S
@@ -0,0 +1,271 @@
+/* Copy SRC to DEST returning the address of the terminating '\0' in DEST.
+ For SPARC v9.
+ Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jan Vondrak <jvon4518@ss1000.ms.mff.cuni.cz> and
+ Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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 <asm/asi.h>
+#ifndef XCC
+ .register %g2, #scratch
+ .register %g3, #scratch
+ .register %g6, #scratch
+#endif
+
+ /* Normally, this uses
+ ((xword - 0x0101010101010101) & 0x8080808080808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 32
+ENTRY(stpcpy)
+ sethi %hi(0x01010101), %g1 /* IEU0 Group */
+ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */
+ andcc %o0, 7, %g0 /* IEU1 */
+ sllx %g1, 32, %g2 /* IEU0 Group */
+
+ bne,pn %icc, 12f /* CTI */
+ andcc %o1, 7, %g3 /* IEU1 */
+ or %g1, %g2, %g1 /* IEU0 Group */
+ bne,pn %icc, 14f /* CTI */
+
+ sllx %g1, 7, %g2 /* IEU0 Group */
+1: ldx [%o1], %o3 /* Load */
+ add %o1, 8, %o1 /* IEU1 */
+2: mov %o3, %g3 /* IEU0 Group */
+
+ sub %o3, %g1, %o2 /* IEU1 */
+3: ldxa [%o1] ASI_PNF, %o3 /* Load */
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o2, %g3, %o2 /* IEU0 Group */
+#endif
+ add %o0, 8, %o0 /* IEU0 Group */
+ andcc %o2, %g2, %g0 /* IEU1 */
+
+ add %o1, 8, %o1 /* IEU0 Group */
+ be,a,pt %xcc, 2b /* CTI */
+ stx %g3, [%o0 - 8] /* Store */
+ srlx %g3, 56, %g5 /* IEU0 Group */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 11f /* CTI */
+ srlx %g3, 48, %g4 /* IEU0 */
+ andcc %g4, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 10f /* CTI */
+ srlx %g3, 40, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 9f /* CTI */
+
+ srlx %g3, 32, %g4 /* IEU0 */
+ andcc %g4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 8f /* CTI */
+ srlx %g3, 24, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 7f /* CTI */
+ srlx %g3, 16, %g4 /* IEU0 */
+ andcc %g4, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 6f /* CTI */
+ srlx %g3, 8, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+
+ sub %o3, %g1, %o2 /* IEU0 */
+ stx %g3, [%o0 - 8] /* Store Group */
+ andcc %g3, 0xff, %g0 /* IEU1 */
+ bne,pt %icc, 3b /* CTI */
+
+ mov %o3, %g3 /* IEU0 Group */
+4: retl /* CTI+IEU1 Group */
+ sub %o0, 1, %o0 /* IEU0 */
+
+ .align 16
+6: ba,pt %xcc, 23f /* CTI Group */
+ sub %o0, 3, %g6 /* IEU0 */
+5: sub %o0, 2, %g6 /* IEU0 Group */
+ stb %g5, [%o0 - 2] /* Store */
+
+ srlx %g3, 16, %g4 /* IEU0 Group */
+23: sth %g4, [%o0 - 4] /* Store */
+ srlx %g3, 32, %g4 /* IEU0 Group */
+ stw %g4, [%o0 - 8] /* Store */
+
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+8: ba,pt %xcc, 24f /* CTI Group */
+ sub %o0, 5, %g6 /* IEU0 */
+
+7: sub %o0, 4, %g6 /* IEU0 Group */
+ stb %g5, [%o0 - 4] /* Store */
+ srlx %g3, 32, %g4 /* IEU0 Group */
+24: stw %g4, [%o0 - 8] /* Store */
+
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+10: ba,pt %xcc, 25f /* CTI Group */
+ sub %o0, 7, %g6 /* IEU0 */
+
+9: sub %o0, 6, %g6 /* IEU0 Group */
+ stb %g5, [%o0 - 6] /* Store */
+ srlx %g3, 48, %g4 /* IEU0 */
+25: sth %g4, [%o0 - 8] /* Store Group */
+
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+11: stb %g5, [%o0 - 8] /* Store Group */
+ retl /* CTI+IEU1 Group */
+
+ sub %o0, 8, %o0 /* IEU0 */
+
+ .align 16
+12: or %g1, %g2, %g1 /* IEU0 Group */
+ ldub [%o1], %o3 /* Load */
+ sllx %g1, 7, %g2 /* IEU0 Group */
+ stb %o3, [%o0] /* Store Group */
+
+13: add %o0, 1, %o0 /* IEU0 */
+ add %o1, 1, %o1 /* IEU1 */
+ andcc %o3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4b /* CTI */
+
+ lduba [%o1] ASI_PNF, %o3 /* Load */
+ andcc %o0, 7, %g0 /* IEU1 Group */
+ bne,a,pt %icc, 13b /* CTI */
+ stb %o3, [%o0] /* Store */
+
+ andcc %o1, 7, %g3 /* IEU1 Group */
+ be,a,pt %icc, 1b /* CTI */
+ ldx [%o1], %o3 /* Load */
+14: orcc %g0, 64, %g4 /* IEU1 Group */
+
+ sllx %g3, 3, %g5 /* IEU0 */
+ sub %o1, %g3, %o1 /* IEU0 Group */
+ sub %g4, %g5, %g4 /* IEU1 */
+ /* %g1 = 0101010101010101 *
+ * %g2 = 8080808080808080 *
+ * %g3 = source alignment *
+ * %g5 = number of bits to shift left *
+ * %g4 = number of bits to shift right */
+ ldxa [%o1] ASI_PNF, %o5 /* Load Group */
+
+ addcc %o1, 8, %o1 /* IEU1 */
+15: sllx %o5, %g5, %o3 /* IEU0 Group */
+ ldxa [%o1] ASI_PNF, %o5 /* Load */
+ srlx %o5, %g4, %o4 /* IEU0 Group */
+
+ add %o0, 8, %o0 /* IEU1 */
+ or %o3, %o4, %o3 /* IEU0 Group */
+ add %o1, 8, %o1 /* IEU1 */
+ sub %o3, %g1, %o4 /* IEU0 Group */
+
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o3, %o4 /* IEU0 Group */
+#endif
+ andcc %o4, %g2, %g0 /* IEU1 Group */
+ be,a,pt %xcc, 15b /* CTI */
+ stx %o3, [%o0 - 8] /* Store */
+ srlx %o3, 56, %o4 /* IEU0 Group */
+
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 22f /* CTI */
+ srlx %o3, 48, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 21f /* CTI */
+ srlx %o3, 40, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 20f /* CTI */
+
+ srlx %o3, 32, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 19f /* CTI */
+ srlx %o3, 24, %o4 /* IEU0 */
+
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 18f /* CTI */
+ srlx %o3, 16, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 17f /* CTI */
+ srlx %o3, 8, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 16f /* CTI */
+
+ andcc %o3, 0xff, %g0 /* IEU1 Group */
+ bne,pn %icc, 15b /* CTI */
+ stx %o3, [%o0 - 8] /* Store */
+ retl /* CTI+IEU1 Group */
+
+ sub %o0, 1, %o0 /* IEU0 */
+
+ .align 16
+17: ba,pt %xcc, 26f /* CTI Group */
+ subcc %o0, 3, %g6 /* IEU1 */
+18: ba,pt %xcc, 27f /* CTI Group */
+ subcc %o0, 4, %g6 /* IEU1 */
+
+19: ba,pt %xcc, 28f /* CTI Group */
+ subcc %o0, 5, %g6 /* IEU1 */
+16: subcc %o0, 2, %g6 /* IEU1 Group */
+ srlx %o3, 8, %o4 /* IEU0 */
+
+ stb %o4, [%o0 - 2] /* Store */
+26: srlx %o3, 16, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 3] /* Store */
+27: srlx %o3, 24, %o4 /* IEU0 Group */
+
+ stb %o4, [%o0 - 4] /* Store */
+28: srlx %o3, 32, %o4 /* IEU0 Group */
+ stw %o4, [%o0 - 8] /* Store */
+ retl /* CTI+IEU1 Group */
+
+ mov %g6, %o0 /* IEU0 */
+
+ .align 16
+21: ba,pt %xcc, 29f /* CTI Group */
+ subcc %o0, 7, %g6 /* IEU1 */
+22: ba,pt %xcc, 30f /* CTI Group */
+ subcc %o0, 8, %g6 /* IEU1 */
+
+20: subcc %o0, 6, %g6 /* IEU1 Group */
+ srlx %o3, 40, %o4 /* IEU0 */
+ stb %o4, [%o0 - 6] /* Store */
+29: srlx %o3, 48, %o4 /* IEU0 Group */
+
+ stb %o4, [%o0 - 7] /* Store */
+30: srlx %o3, 56, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 8] /* Store */
+ retl /* CTI+IEU1 Group */
+
+ mov %g6, %o0 /* IEU0 */
+END(stpcpy)
+libc_hidden_def(stpcpy)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc64/strcat.S b/ap/build/uClibc/libc/string/sparc/sparc64/strcat.S
new file mode 100644
index 0000000..fcc4ba5
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc64/strcat.S
@@ -0,0 +1,339 @@
+/* strcat (dest, src) -- Append SRC on the end of DEST.
+ For SPARC v9.
+ Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz> and
+ Jan Vondrak <jvon4518@ss1000.ms.mff.cuni.cz>.
+
+ 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 <asm/asi.h>
+#ifndef XCC
+#define XCC xcc
+#define USE_BPR
+ .register %g2, #scratch
+ .register %g3, #scratch
+ .register %g6, #scratch
+#endif
+
+ /* Normally, this uses
+ ((xword - 0x0101010101010101) & 0x8080808080808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 32
+ENTRY(strcat)
+ sethi %hi(0x01010101), %g1 /* IEU0 Group */
+ ldub [%o0], %o3 /* Load */
+ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */
+ mov %o0, %g6 /* IEU1 */
+
+ sllx %g1, 32, %g2 /* IEU0 Group */
+ andcc %o0, 7, %g0 /* IEU1 */
+ or %g1, %g2, %g1 /* IEU0 Group */
+ bne,pn %icc, 32f /* CTI */
+
+ sllx %g1, 7, %g2 /* IEU0 Group */
+ brz,pn %o3, 30f /* CTI+IEU1 */
+ ldx [%o0], %o3 /* Load */
+48: add %o0, 8, %o0 /* IEU0 Group */
+
+49: sub %o3, %g1, %o2 /* IEU0 Group */
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o2, %o3, %g5 /* IEU0 Group */
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ andcc %g5, %g2, %g0 /* IEU1 Group */
+#else
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ andcc %o2, %g2, %g0 /* IEU1 Group */
+#endif
+ be,pt %xcc, 49b /* CTI */
+
+ add %o0, 8, %o0 /* IEU0 */
+ addcc %o2, %g1, %g3 /* IEU1 Group */
+ srlx %o2, 32, %o2 /* IEU0 */
+50: andcc %o2, %g2, %g0 /* IEU1 Group */
+
+ be,pn %xcc, 51f /* CTI */
+ srlx %g3, 56, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 29f /* CTI */
+
+ srlx %g3, 48, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 28f /* CTI */
+ srlx %g3, 40, %o2 /* IEU0 */
+
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 27f /* CTI */
+ srlx %g3, 32, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 26f /* CTI */
+51: srlx %g3, 24, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 25f /* CTI */
+
+ srlx %g3, 16, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 24f /* CTI */
+ srlx %g3, 8, %o2 /* IEU0 */
+
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 23f /* CTI */
+ sub %o3, %g1, %o2 /* IEU0 */
+ andcc %g3, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 52f /* CTI */
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ andcc %o2, %g2, %g0 /* IEU1 Group */
+ be,pt %xcc, 49b /* CTI */
+
+ add %o0, 8, %o0 /* IEU0 */
+ addcc %o2, %g1, %g3 /* IEU1 Group */
+ ba,pt %xcc, 50b /* CTI */
+ srlx %o2, 32, %o2 /* IEU0 */
+
+ .align 16
+52: ba,pt %xcc, 12f /* CTI Group */
+ add %o0, -9, %o0 /* IEU0 */
+23: ba,pt %xcc, 12f /* CTI Group */
+ add %o0, -10, %o0 /* IEU0 */
+
+24: ba,pt %xcc, 12f /* CTI Group */
+ add %o0, -11, %o0 /* IEU0 */
+25: ba,pt %xcc, 12f /* CTI Group */
+ add %o0, -12, %o0 /* IEU0 */
+
+26: ba,pt %xcc, 12f /* CTI Group */
+ add %o0, -13, %o0 /* IEU0 */
+27: ba,pt %xcc, 12f /* CTI Group */
+ add %o0, -14, %o0 /* IEU0 */
+
+28: ba,pt %xcc, 12f /* CTI Group */
+ add %o0, -15, %o0 /* IEU0 */
+29: add %o0, -16, %o0 /* IEU0 Group */
+30: andcc %o1, 7, %g3 /* IEU1 */
+
+31: bne,pn %icc, 14f /* CTI */
+ orcc %g0, 64, %g4 /* IEU1 Group */
+1: ldx [%o1], %o3 /* Load */
+ add %o1, 8, %o1 /* IEU1 */
+
+2: mov %o3, %g3 /* IEU0 Group */
+3: sub %o3, %g1, %o2 /* IEU1 */
+ ldxa [%o1] ASI_PNF, %o3 /* Load */
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o2, %g3, %o2 /* IEU0 Group */
+#endif
+ add %o0, 8, %o0 /* IEU0 Group */
+
+ andcc %o2, %g2, %g0 /* IEU1 */
+ add %o1, 8, %o1 /* IEU0 Group */
+ be,a,pt %xcc, 2b /* CTI */
+ stx %g3, [%o0 - 8] /* Store */
+
+ srlx %g3, 56, %g5 /* IEU0 Group */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 11f /* CTI */
+ srlx %g3, 48, %g4 /* IEU0 */
+
+ andcc %g4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 10f /* CTI */
+ srlx %g3, 40, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 9f /* CTI */
+ srlx %g3, 32, %g4 /* IEU0 */
+ andcc %g4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 8f /* CTI */
+
+ srlx %g3, 24, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 7f /* CTI */
+ srlx %g3, 16, %g4 /* IEU0 */
+
+ andcc %g4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 6f /* CTI */
+ srlx %g3, 8, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 5f /* CTI */
+ sub %o3, %g1, %o2 /* IEU0 */
+ stx %g3, [%o0 - 8] /* Store Group */
+ andcc %g3, 0xff, %g0 /* IEU1 */
+
+ bne,pt %icc, 3b /* CTI */
+ mov %o3, %g3 /* IEU0 Group */
+4: retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+
+ .align 16
+5: stb %g5, [%o0 - 2] /* Store Group */
+ srlx %g3, 16, %g4 /* IEU0 */
+6: sth %g4, [%o0 - 4] /* Store Group */
+ srlx %g3, 32, %g4 /* IEU0 */
+
+ stw %g4, [%o0 - 8] /* Store Group */
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+7: stb %g5, [%o0 - 4] /* Store Group */
+
+ srlx %g3, 32, %g4 /* IEU0 */
+8: stw %g4, [%o0 - 8] /* Store Group */
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+
+9: stb %g5, [%o0 - 6] /* Store Group */
+ srlx %g3, 48, %g4 /* IEU0 */
+10: sth %g4, [%o0 - 8] /* Store Group */
+ retl /* CTI+IEU1 Group */
+
+ mov %g6, %o0 /* IEU0 */
+11: stb %g5, [%o0 - 8] /* Store Group */
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+
+ .align 16
+32: andcc %o0, 7, %g0 /* IEU1 Group */
+ be,a,pn %icc, 48b /* CTI */
+ ldx [%o0], %o3 /* Load */
+ add %o0, 1, %o0 /* IEU0 Group */
+
+ brnz,a,pt %o3, 32b /* CTI+IEU1 */
+ lduba [%o0] ASI_PNF, %o3 /* Load */
+ add %o0, -1, %o0 /* IEU0 Group */
+ andcc %o0, 7, %g0 /* IEU1 Group */
+
+ be,a,pn %icc, 31b /* CTI */
+ andcc %o1, 7, %g3 /* IEU1 Group */
+12: ldub [%o1], %o3 /* Load */
+ stb %o3, [%o0] /* Store Group */
+
+13: add %o0, 1, %o0 /* IEU0 */
+ add %o1, 1, %o1 /* IEU1 */
+ andcc %o3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4b /* CTI */
+
+ lduba [%o1] ASI_PNF, %o3 /* Load */
+ andcc %o0, 7, %g0 /* IEU1 Group */
+ bne,a,pt %icc, 13b /* CTI */
+ stb %o3, [%o0] /* Store */
+
+ andcc %o1, 7, %g3 /* IEU1 Group */
+ be,a,pt %icc, 1b /* CTI */
+ ldx [%o1], %o3 /* Load */
+ orcc %g0, 64, %g4 /* IEU1 Group */
+
+14: sllx %g3, 3, %g5 /* IEU0 */
+ sub %o1, %g3, %o1 /* IEU0 Group */
+ sub %g4, %g5, %g4 /* IEU1 */
+ /* %g1 = 0101010101010101 *
+ * %g2 = 8080808080808080 *
+ * %g3 = source alignment *
+ * %g5 = number of bits to shift left *
+ * %g4 = number of bits to shift right */
+ ldxa [%o1] ASI_PNF, %o5 /* Load Group */
+
+ addcc %o1, 8, %o1 /* IEU1 */
+15: sllx %o5, %g5, %o3 /* IEU0 Group */
+ ldxa [%o1] ASI_PNF, %o5 /* Load */
+ srlx %o5, %g4, %o4 /* IEU0 Group */
+
+ add %o0, 8, %o0 /* IEU1 */
+ or %o3, %o4, %o3 /* IEU0 Group */
+ add %o1, 8, %o1 /* IEU1 */
+ sub %o3, %g1, %o4 /* IEU0 Group */
+
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o3, %o4 /* IEU0 Group */
+#endif
+ andcc %o4, %g2, %g0 /* IEU1 Group */
+ be,a,pt %xcc, 15b /* CTI */
+ stx %o3, [%o0 - 8] /* Store */
+ srlx %o3, 56, %o4 /* IEU0 Group */
+
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 22f /* CTI */
+ srlx %o3, 48, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 21f /* CTI */
+ srlx %o3, 40, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 20f /* CTI */
+
+ srlx %o3, 32, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 19f /* CTI */
+ srlx %o3, 24, %o4 /* IEU0 */
+
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 18f /* CTI */
+ srlx %o3, 16, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 17f /* CTI */
+ srlx %o3, 8, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 16f /* CTI */
+
+ andcc %o3, 0xff, %g0 /* IEU1 Group */
+ bne,pn %icc, 15b /* CTI */
+ stx %o3, [%o0 - 8] /* Store */
+ retl /* CTI+IEU1 Group */
+
+ mov %g6, %o0 /* IEU0 */
+
+ .align 16
+16: srlx %o3, 8, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 2] /* Store */
+17: srlx %o3, 16, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 3] /* Store */
+
+18: srlx %o3, 24, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 4] /* Store */
+19: srlx %o3, 32, %o4 /* IEU0 Group */
+ stw %o4, [%o0 - 8] /* Store */
+
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+ nop
+ nop
+
+20: srlx %o3, 40, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 6] /* Store */
+21: srlx %o3, 48, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 7] /* Store */
+
+22: srlx %o3, 56, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 8] /* Store */
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+END(strcat)
+libc_hidden_def(strcat)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc64/strchr.S b/ap/build/uClibc/libc/string/sparc/sparc64/strchr.S
new file mode 100644
index 0000000..da26d1f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc64/strchr.S
@@ -0,0 +1,486 @@
+/* strchr (str, ch) -- Return pointer to first occurrence of CH in STR.
+ For SPARC v9.
+ Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jan Vondrak <jvon4518@ss1000.ms.mff.cuni.cz> and
+ Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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/asi.h>
+#ifndef XCC
+#define XCC xcc
+#define USE_BPR
+ .register %g2, #scratch
+ .register %g3, #scratch
+ .register %g6, #scratch
+#endif
+
+ /* Normally, this uses
+ ((xword - 0x0101010101010101) & 0x8080808080808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 32
+ENTRY(strchr)
+ andcc %o1, 0xff, %o1 /* IEU1 Group */
+ be,pn %icc, 17f /* CTI */
+ sllx %o1, 8, %g3 /* IEU0 Group */
+ sethi %hi(0x01010101), %g1 /* IEU1 */
+
+ or %g3, %o1, %g3 /* IEU0 Group */
+ ldub [%o0], %o3 /* Load */
+ sllx %g3, 16, %g5 /* IEU0 Group */
+ or %g1, %lo(0x01010101), %g1 /* IEU1 */
+
+ sllx %g1, 32, %g2 /* IEU0 Group */
+ brz,pn %o3, 5f /* CTI+IEU1 */
+ orcc %g3, %g5, %g3 /* IEU1 Group */
+ sllx %g3, 32, %g5 /* IEU0 */
+
+ cmp %o3, %o1 /* IEU1 Group */
+ be,pn %xcc, 14f /* CTI */
+ or %g1, %g2, %g1 /* IEU0 */
+ andcc %o0, 7, %g0 /* IEU1 Group */
+
+ bne,a,pn %icc, 15f /* CTI */
+ add %o0, 1, %o0 /* IEU0 */
+ ldx [%o0], %o3 /* Load Group */
+1: sllx %g1, 7, %g2 /* IEU0 */
+
+ or %g3, %g5, %g3 /* IEU1 */
+ add %o0, 8, %o0 /* IEU0 Group */
+ xor %o3, %g3, %o4 /* IEU1 */
+ /* %g1 = 0101010101010101 *
+ * %g2 = 8080088080808080 *
+ * %g3 = c c c c c c c c *
+ * %o3 = value *
+ * %o4 = value XOR c */
+2: sub %o3, %g1, %o2 /* IEU0 Group */
+
+ sub %o4, %g1, %o5 /* IEU1 */
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o2, %o3, %g6 /* IEU0 Group */
+ andn %o5, %o4, %o5 /* IEU1 */
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ or %o5, %g6, %o5 /* IEU0 Group */
+#else
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ or %o5, %o2, %o5 /* IEU0 Group */
+#endif
+ add %o0, 8, %o0 /* IEU1 */
+
+ andcc %o5, %g2, %g0 /* IEU1 Group */
+ be,a,pt %xcc, 2b /* CTI */
+ xor %o3, %g3, %o4 /* IEU0 */
+ srlx %o5, 32, %g5 /* IEU0 Group */
+
+ add %o2, %g1, %o2 /* IEU1 */
+3: andcc %g5, %g2, %g0 /* IEU1 Group */
+ be,pn %xcc, 4f /* CTI */
+ srlx %o2, 56, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+ srlx %o4, 56, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 6f /* CTI */
+ srlx %o2, 48, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+
+ srlx %o4, 48, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 7f /* CTI */
+ srlx %o2, 40, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+ srlx %o4, 40, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 8f /* CTI */
+ srlx %o2, 32, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+
+ srlx %o4, 32, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 9f /* CTI */
+4: srlx %o2, 24, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+ srlx %o4, 24, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 10f /* CTI */
+ srlx %o2, 16, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+
+ srlx %o4, 16, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 11f /* CTI */
+ srlx %o2, 8, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+ srlx %o4, 8, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 12f /* CTI */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+ sub %o3, %g1, %o2 /* IEU0 */
+
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 13f /* CTI */
+ xor %o3, %g3, %o4 /* IEU0 */
+ ldxa [%o0] ASI_PNF, %o3 /* Load Group */
+
+ sub %o4, %g1, %o5 /* IEU0 */
+ or %o5, %o2, %o5 /* IEU1 */
+ add %o0, 8, %o0 /* IEU0 Group */
+ andcc %o5, %g2, %g0 /* IEU1 */
+
+ be,a,pt %xcc, 2b /* CTI */
+ xor %o3, %g3, %o4 /* IEU0 Group */
+ srlx %o5, 32, %g5 /* IEU0 Group */
+ ba,pt %xcc, 3b /* CTI */
+
+ add %o2, %g1, %o2 /* IEU1 */
+
+ .align 16
+5: retl /* CTI+IEU1 Group */
+ clr %o0 /* IEU0 */
+6: retl /* CTI+IEU1 Group */
+ add %o0, -16, %o0 /* IEU0 */
+
+7: retl /* CTI+IEU1 Group */
+ add %o0, -15, %o0 /* IEU0 */
+8: retl /* CTI+IEU1 Group */
+ add %o0, -14, %o0 /* IEU0 */
+
+9: retl /* CTI+IEU1 Group */
+ add %o0, -13, %o0 /* IEU0 */
+10: retl /* CTI+IEU1 Group */
+ add %o0, -12, %o0 /* IEU0 */
+
+11: retl /* CTI+IEU1 Group */
+ add %o0, -11, %o0 /* IEU0 */
+12: retl /* CTI+IEU1 Group */
+ add %o0, -10, %o0 /* IEU0 */
+
+13: retl /* CTI+IEU1 Group */
+ add %o0, -9, %o0 /* IEU0 */
+14: retl /* CTI+IEU1 Group */
+ nop /* IEU0 */
+
+ .align 16
+15: ldub [%o0], %o3 /* Load Group */
+16: andcc %o0, 7, %g0 /* IEU1 */
+ be,a,pn %icc, 1b /* CTI */
+ ldx [%o0], %o3 /* Load Group */
+
+ andcc %o3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5b /* CTI */
+ add %o0, 1, %o0 /* IEU0 */
+ cmp %o3, %o1 /* IEU1 Group */
+
+ bne,a,pn %icc, 16b /* CTI */
+ ldub [%o0], %o3 /* Load */
+ retl /* CTI+IEU1 Group */
+ add %o0, -1, %o0 /* IEU0 */
+
+ /* strchr (str, 0) */
+ .align 32
+ nop
+ .align 16
+17: sethi %hi(0x01010101), %g1 /* IEU0 Group */
+ ldub [%o0], %o3 /* Load */
+ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */
+ sllx %g1, 32, %g2 /* IEU0 Group */
+
+ andcc %o0, 7, %g0 /* IEU1 */
+ or %g1, %g2, %g1 /* IEU0 Group */
+ bne,pn %icc, 32f /* CTI */
+ sllx %g1, 7, %g2 /* IEU0 Group */
+
+ brz,pn %o3, 30f /* CTI+IEU1 */
+ ldx [%o0], %o3 /* Load */
+18: add %o0, 8, %o0 /* IEU0 Group */
+19: sub %o3, %g1, %o2 /* IEU0 Group */
+
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o2, %o3, %g6 /* IEU0 Group */
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ andcc %g6, %g2, %g0 /* IEU1 Group */
+#else
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ andcc %o2, %g2, %g0 /* IEU1 Group */
+#endif
+ be,pt %xcc, 19b /* CTI */
+ add %o0, 8, %o0 /* IEU0 */
+
+ addcc %o2, %g1, %g3 /* IEU1 Group */
+ srlx %o2, 32, %o2 /* IEU0 */
+20: andcc %o2, %g2, %g0 /* IEU1 Group */
+ be,pn %xcc, 21f /* CTI */
+
+ srlx %g3, 56, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 29f /* CTI */
+ srlx %g3, 48, %o2 /* IEU0 */
+
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 28f /* CTI */
+ srlx %g3, 40, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 27f /* CTI */
+ srlx %g3, 32, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 26f /* CTI */
+
+21: srlx %g3, 24, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 25f /* CTI */
+ srlx %g3, 16, %o2 /* IEU0 */
+
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 24f /* CTI */
+ srlx %g3, 8, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 23f /* CTI */
+ sub %o3, %g1, %o2 /* IEU0 */
+ andcc %g3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 22f /* CTI */
+
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ andcc %o2, %g2, %g0 /* IEU1 Group */
+ be,pt %xcc, 19b /* CTI */
+ add %o0, 8, %o0 /* IEU0 */
+
+ addcc %o2, %g1, %g3 /* IEU1 Group */
+ ba,pt %xcc, 20b /* CTI */
+ srlx %o2, 32, %o2 /* IEU0 */
+
+ .align 16
+22: retl /* CTI+IEU1 Group */
+ add %o0, -9, %o0 /* IEU0 */
+23: retl /* CTI+IEU1 Group */
+ add %o0, -10, %o0 /* IEU0 */
+
+24: retl /* CTI+IEU1 Group */
+ add %o0, -11, %o0 /* IEU0 */
+25: retl /* CTI+IEU1 Group */
+ add %o0, -12, %o0 /* IEU0 */
+
+26: retl /* CTI+IEU1 Group */
+ add %o0, -13, %o0 /* IEU0 */
+27: retl /* CTI+IEU1 Group */
+ add %o0, -14, %o0 /* IEU0 */
+
+28: retl /* CTI+IEU1 Group */
+ add %o0, -15, %o0 /* IEU0 */
+29: retl /* CTI+IEU1 Group */
+ add %o0, -16, %o0 /* IEU0 */
+
+30: retl /* CTI+IEU1 Group */
+ nop /* IEU0 */
+
+ .align 16
+32: andcc %o0, 7, %g0 /* IEU1 Group */
+ be,a,pn %icc, 18b /* CTI */
+ ldx [%o0], %o3 /* Load */
+ add %o0, 1, %o0 /* IEU0 Group */
+
+ brnz,a,pt %o3, 32b /* CTI+IEU1 */
+ lduba [%o0] ASI_PNF, %o3 /* Load */
+ retl /* CTI+IEU1 Group */
+ add %o0, -1, %o0 /* IEU0 */
+END(strchr)
+libc_hidden_def(strchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(strchr,index)
+#endif
+
+ .align 32
+ENTRY(strrchr)
+ andcc %o1, 0xff, %o1 /* IEU1 Group */
+ be,pn %icc, 17b /* CTI */
+ clr %g4 /* IEU0 */
+ andcc %o0, 7, %g0 /* IEU1 Group */
+
+ bne,pn %icc, 13f /* CTI */
+ sllx %o1, 8, %g3 /* IEU0 */
+ ldx [%o0], %o3 /* Load Group */
+1: sethi %hi(0x01010101), %g1 /* IEU0 */
+
+ or %g3, %o1, %g3 /* IEU1 */
+ sllx %g3, 16, %g5 /* IEU0 Group */
+ or %g1, %lo(0x01010101), %g1 /* IEU1 */
+ sllx %g1, 32, %g2 /* IEU0 Group */
+
+ or %g3, %g5, %g3 /* IEU1 */
+ sllx %g3, 32, %g5 /* IEU0 Group */
+ or %g1, %g2, %g1 /* IEU1 */
+ sllx %g1, 7, %g2 /* IEU0 Group */
+
+ or %g3, %g5, %g3 /* IEU1 */
+ add %o0, 8, %o0 /* IEU0 Group */
+ xor %o3, %g3, %o4 /* IEU1 */
+ /* %g1 = 0101010101010101 *
+ * %g2 = 8080088080808080 *
+ * %g3 = c c c c c c c c *
+ * %o3 = value *
+ * %o4 = value XOR c */
+2: sub %o3, %g1, %o2 /* IEU0 Group */
+
+3: sub %o4, %g1, %o5 /* IEU1 */
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o2, %o3, %g6 /* IEU0 Group */
+ andn %o5, %o4, %o5 /* IEU1 */
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+
+ or %o5, %g6, %o5 /* IEU0 Group */
+#else
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+
+ or %o5, %o2, %o5 /* IEU0 Group */
+#endif
+ add %o0, 8, %o0 /* IEU1 */
+ andcc %o5, %g2, %g0 /* IEU1 Group */
+ be,a,pt %xcc, 2b /* CTI */
+
+ xor %o3, %g3, %o4 /* IEU0 */
+ srlx %o5, 32, %g5 /* IEU0 Group */
+ add %o2, %g1, %o2 /* IEU1 */
+ andcc %g5, %g2, %g0 /* IEU1 Group */
+
+ be,pn %xcc, 7f /* CTI */
+ srlx %o2, 56, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 12f /* CTI */
+
+ srlx %o4, 56, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ srlx %o2, 48, %g5 /* IEU0 */
+ be,a,pn %icc, 4f /* CTI */
+
+ add %o0, -16, %g4 /* IEU0 Group */
+4: andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 12f /* CTI */
+ srlx %o4, 48, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ srlx %o2, 40, %g5 /* IEU0 */
+ be,a,pn %icc, 5f /* CTI */
+ add %o0, -15, %g4 /* IEU0 Group */
+
+5: andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 12f /* CTI */
+ srlx %o4, 40, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ srlx %o2, 32, %g5 /* IEU0 */
+ be,a,pn %icc, 6f /* CTI */
+ add %o0, -14, %g4 /* IEU0 Group */
+6: andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 12f /* CTI */
+ srlx %o4, 32, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,a,pn %icc, 7f /* CTI */
+
+ add %o0, -13, %g4 /* IEU0 */
+7: srlx %o2, 24, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 12f /* CTI */
+
+ srlx %o4, 24, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ srlx %o2, 16, %g5 /* IEU0 */
+ be,a,pn %icc, 8f /* CTI */
+
+ add %o0, -12, %g4 /* IEU0 Group */
+8: andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 12f /* CTI */
+ srlx %o4, 16, %g5 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ srlx %o2, 8, %g5 /* IEU0 */
+ be,a,pn %icc, 9f /* CTI */
+ add %o0, -11, %g4 /* IEU0 Group */
+
+9: andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 12f /* CTI */
+ srlx %o4, 8, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,a,pn %icc, 10f /* CTI */
+ add %o0, -10, %g4 /* IEU0 */
+10: andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 12f /* CTI */
+
+ sub %o3, %g1, %o2 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,a,pn %icc, 11f /* CTI */
+ add %o0, -9, %g4 /* IEU0 */
+
+11: ba,pt %xcc, 3b /* CTI Group */
+ xor %o3, %g3, %o4 /* IEU0 Group */
+12: retl /* CTI+IEU1 Group */
+ mov %g4, %o0 /* IEU0 */
+
+ .align 16
+13: ldub [%o0], %o3 /* Load Group */
+ add %o0, 1, %o0 /* IEU0 */
+14: andcc %o3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 12b /* CTI */
+
+ cmp %o3, %o1 /* IEU1 Group */
+ ldub [%o0], %o3 /* Load */
+ be,a,pn %icc, 15f /* CTI */
+ add %o0, -1, %g4 /* IEU0 Group */
+
+15: andcc %o0, 7, %g0 /* IEU1 Group */
+ bne,a,pt %icc, 14b /* CTI */
+ add %o0, 1, %o0 /* IEU0 */
+ ba,pt %xcc, 1b /* CTI Group */
+
+ ldx [%o0], %o3 /* Load */
+END(strrchr)
+libc_hidden_def(strrchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias(strrchr,rindex)
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/sparc64/strcmp.S b/ap/build/uClibc/libc/string/sparc/sparc64/strcmp.S
new file mode 100644
index 0000000..df9e691
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc64/strcmp.S
@@ -0,0 +1,279 @@
+/* Compare two strings for differences.
+ For SPARC v9.
+ Copyright (C) 1997, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jan Vondrak <jvon4518@ss1000.ms.mff.cuni.cz> and
+ Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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 <asm/asi.h>
+#ifndef XCC
+ .register %g2, #scratch
+ .register %g3, #scratch
+ .register %g6, #scratch
+#endif
+
+ /* Normally, this uses
+ ((xword - 0x0101010101010101) & 0x8080808080808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 32
+ENTRY(strcmp)
+ sethi %hi(0x01010101), %g1 /* IEU0 Group */
+ andcc %o0, 7, %g0 /* IEU1 */
+ bne,pn %icc, 7f /* CTI */
+ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */
+
+ andcc %o1, 7, %g3 /* IEU1 */
+ bne,pn %icc, 9f /* CTI */
+ sllx %g1, 32, %g2 /* IEU0 Group */
+ ldx [%o0], %o2 /* Load */
+
+ or %g1, %g2, %g1 /* IEU0 Group */
+1: ldx [%o1], %o3 /* Load */
+ sub %o1, %o0, %o1 /* IEU1 */
+ sllx %g1, 7, %g2 /* IEU0 Group */
+
+2: add %o0, 8, %o0 /* IEU1 */
+ sub %o2, %g1, %g3 /* IEU0 Group */
+ subcc %o2, %o3, %g0 /* IEU1 */
+ bne,pn %xcc, 13f /* CTI */
+
+#ifdef EIGHTBIT_NOT_RARE
+ andn %g3, %o2, %g4 /* IEU0 Group */
+ ldxa [%o0] ASI_PNF, %o2 /* Load */
+ andcc %g4, %g2, %g0 /* IEU1 Group */
+#else
+ ldxa [%o0] ASI_PNF, %o2 /* Load Group */
+ andcc %g3, %g2, %g0 /* IEU1 */
+#endif
+ be,a,pt %xcc, 2b /* CTI */
+ ldxa [%o1 + %o0] ASI_PNF, %o3 /* Load Group */
+
+ addcc %g3, %g1, %o4 /* IEU1 */
+ srlx %g3, 32, %g3 /* IEU0 */
+ andcc %g3, %g2, %g0 /* IEU1 Group */
+ be,pt %xcc, 3f /* CTI */
+
+ srlx %o4, 56, %o5 /* IEU0 */
+ andcc %o5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4f /* CTI */
+ srlx %o4, 48, %o5 /* IEU0 */
+
+ andcc %o5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4f /* CTI */
+ srlx %o4, 40, %o5 /* IEU0 */
+ andcc %o5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 4f /* CTI */
+ srlx %o4, 32, %o5 /* IEU0 */
+ andcc %o5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4f /* CTI */
+
+3: srlx %o4, 24, %o5 /* IEU0 */
+ andcc %o5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4f /* CTI */
+ srlx %o4, 16, %o5 /* IEU0 */
+
+ andcc %o5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4f /* CTI */
+ srlx %o4, 8, %o5 /* IEU0 */
+ andcc %o5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 4f /* CTI */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ bne,a,pn %icc, 2b /* CTI */
+ ldxa [%o1 + %o0] ASI_PNF, %o3 /* Load */
+
+4: retl /* CTI+IEU1 Group */
+ clr %o0 /* IEU0 */
+
+ .align 32
+13: mov 0xff, %g6 /* IEU0 Group */
+#ifdef EIGHTBIT_NOT_RARE
+ andcc %g4, %g2, %g0 /* IEU1 */
+#else
+ andcc %g3, %g2, %g0 /* IEU1 */
+#endif
+ be,pt %xcc, 25f /* CTI */
+ addcc %g3, %g1, %o4 /* IEU1 Group */
+
+ srlx %g3, 32, %g3 /* IEU0 */
+ andcc %g3, %g2, %g0 /* IEU1 Group */
+ be,pt %xcc, 23f /* CTI */
+ sllx %g6, 56, %o5 /* IEU0 */
+
+ andcc %o4, %o5, %g0 /* IEU1 Group */
+ be,pn %xcc, 24f /* CTI */
+ sllx %g6, 48, %o5 /* IEU0 */
+ andcc %o4, %o5, %g0 /* IEU1 Group */
+
+ be,pn %xcc, 24f /* CTI */
+ sllx %g6, 40, %o5 /* IEU0 */
+ andcc %o4, %o5, %g0 /* IEU1 Group */
+ be,pn %xcc, 24f /* CTI */
+
+ sllx %g6, 32, %o5 /* IEU0 */
+ andcc %o4, %o5, %g0 /* IEU1 Group */
+ be,pn %xcc, 24f /* CTI */
+23: sllx %g6, 24, %o5 /* IEU0 */
+
+ andcc %o4, %o5, %g0 /* IEU1 Group */
+ be,pn %icc, 24f /* CTI */
+ sllx %g6, 16, %o5 /* IEU0 */
+ andcc %o4, %o5, %g0 /* IEU1 Group */
+
+ be,pn %icc, 24f /* CTI */
+ sllx %g6, 8, %o5 /* IEU0 */
+ andcc %o4, %o5, %g0 /* IEU1 Group */
+ be,pn %icc, 24f /* CTI */
+
+ mov %g6, %o5 /* IEU0 */
+25: cmp %o4, %o3 /* IEU1 Group */
+5: mov -1, %o0 /* IEU0 */
+ retl /* CTI+IEU1 Group */
+
+ movgu %xcc, 1, %o0 /* Single Group */
+
+ .align 16
+24: sub %o5, 1, %g6 /* IEU0 Group */
+ clr %o0 /* IEU1 */
+ or %o5, %g6, %o5 /* IEU0 Group */
+ andn %o4, %o5, %o4 /* IEU0 Group */
+
+ andn %o3, %o5, %o3 /* IEU1 */
+ cmp %o4, %o3 /* IEU1 Group */
+ movgu %xcc, 1, %o0 /* Single Group */
+ retl /* CTI+IEU1 Group */
+
+ movlu %xcc, -1, %o0 /* Single Group */
+6: retl /* CTI+IEU1 Group */
+ mov %o4, %o0 /* IEU0 */
+
+ .align 16
+7: ldub [%o0], %o2 /* Load */
+ add %o0, 1, %o0 /* IEU1 */
+ ldub [%o1], %o3 /* Load Group */
+ sllx %g1, 32, %g2 /* IEU0 */
+
+8: add %o1, 1, %o1 /* IEU1 */
+ subcc %o2, %o3, %o4 /* IEU1 Group */
+ bne,pn %xcc, 6b /* CTI */
+ lduba [%o0] ASI_PNF, %o2 /* Load */
+
+ brz,pn %o3, 4b /* CTI+IEU1 Group */
+ lduba [%o1] ASI_PNF, %o3 /* Load */
+ andcc %o0, 7, %g0 /* IEU1 Group */
+ bne,a,pn %icc, 8b /* CTI */
+
+ add %o0, 1, %o0 /* IEU0 */
+ or %g1, %g2, %g1 /* IEU0 Group */
+ andcc %o1, 7, %g3 /* IEU1 */
+ be,a,pn %icc, 1b /* CTI */
+
+ ldxa [%o0] ASI_PNF, %o2 /* Load Group */
+9: sllx %g3, 3, %g5 /* IEU0 */
+ mov 64, %o5 /* IEU1 */
+ sub %o1, %g3, %o1 /* IEU0 Group */
+
+ sub %o5, %g5, %o5 /* IEU1 */
+ ldxa [%o1] ASI_PNF, %g6 /* Load Group */
+ or %g1, %g2, %g1 /* IEU0 */
+ sub %o1, %o0, %o1 /* IEU1 */
+
+ sllx %g1, 7, %g2 /* IEU0 Group */
+ add %o1, 8, %o1 /* IEU1 */
+ /* %g1 = 0101010101010101
+ * %g2 = 8080808080800880
+ * %g5 = number of bits to shift left
+ * %o5 = number of bits to shift right */
+10: sllx %g6, %g5, %o3 /* IEU0 Group */
+ ldxa [%o1 + %o0] ASI_PNF, %g6 /* Load */
+
+11: srlx %g6, %o5, %o4 /* IEU0 Group */
+ ldxa [%o0] ASI_PNF, %o2 /* Load */
+ or %o3, %o4, %o3 /* IEU1 */
+ add %o0, 8, %o0 /* IEU0 Group */
+
+ subcc %o2, %o3, %g0 /* IEU1 */
+#ifdef EIGHTBIT_NOT_RARE
+ sub %o2, %g1, %g3 /* IEU0 Group */
+ bne,pn %xcc, 13b /* CTI */
+ andn %g3, %o2, %g4 /* IEU0 Group */
+
+ andcc %g4, %g2, %g0 /* IEU1 Group */
+ be,pt %xcc, 10b /* CTI */
+ srlx %g4, 32, %g4 /* IEU0 */
+ andcc %g4, %g2, %g0 /* IEU1 Group */
+#else
+ bne,pn %xcc, 13b /* CTI */
+ sub %o2, %g1, %g3 /* IEU0 Group */
+ andcc %g3, %g2, %g0 /* IEU1 Group */
+
+ be,pt %xcc, 10b /* CTI */
+ srlx %g3, 32, %g3 /* IEU0 */
+ andcc %g3, %g2, %g0 /* IEU1 Group */
+#endif
+ be,pt %xcc, 12f /* CTI */
+
+ srlx %o2, 56, %g3 /* IEU0 */
+ andcc %g3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4b /* CTI */
+ srlx %o2, 48, %g3 /* IEU0 */
+
+ andcc %g3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4b /* CTI */
+ srlx %o2, 40, %g3 /* IEU0 */
+ andcc %g3, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 4b /* CTI */
+ srlx %o2, 32, %g3 /* IEU0 */
+ andcc %g3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4b /* CTI */
+
+12: srlx %o2, 24, %g3 /* IEU0 */
+ andcc %g3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4b /* CTI */
+ srlx %o2, 16, %g3 /* IEU0 */
+
+ andcc %g3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4b /* CTI */
+ srlx %o2, 8, %g3 /* IEU0 */
+ andcc %g3, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 4b /* CTI */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4b /* CTI */
+ sllx %g6, %g5, %o3 /* IEU0 */
+
+ ba,pt %xcc, 11b /* CTI Group */
+ ldxa [%o1 + %o0] ASI_PNF, %g6 /* Load */
+END(strcmp)
+libc_hidden_def(strcmp)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc64/strcpy.S b/ap/build/uClibc/libc/string/sparc/sparc64/strcpy.S
new file mode 100644
index 0000000..1317d54
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc64/strcpy.S
@@ -0,0 +1,245 @@
+/* Copy SRC to DEST returning DEST.
+ For SPARC v9.
+ Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jan Vondrak <jvon4518@ss1000.ms.mff.cuni.cz> and
+ Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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 <asm/asi.h>
+#ifndef XCC
+ .register %g2, #scratch
+ .register %g3, #scratch
+ .register %g6, #scratch
+#endif
+
+ /* Normally, this uses
+ ((xword - 0x0101010101010101) & 0x8080808080808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 32
+ENTRY(strcpy)
+ sethi %hi(0x01010101), %g1 /* IEU0 Group */
+ mov %o0, %g6 /* IEU1 */
+ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */
+ andcc %o0, 7, %g0 /* IEU1 */
+
+ sllx %g1, 32, %g2 /* IEU0 Group */
+ bne,pn %icc, 12f /* CTI */
+ andcc %o1, 7, %g3 /* IEU1 */
+ or %g1, %g2, %g1 /* IEU0 Group */
+
+ bne,pn %icc, 14f /* CTI */
+ sllx %g1, 7, %g2 /* IEU0 Group */
+1: ldx [%o1], %o3 /* Load */
+ add %o1, 8, %o1 /* IEU1 */
+
+2: mov %o3, %g3 /* IEU0 Group */
+3: sub %o3, %g1, %o2 /* IEU1 */
+ ldxa [%o1] ASI_PNF, %o3 /* Load */
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o2, %g3, %o2 /* IEU0 Group */
+#endif
+ add %o0, 8, %o0 /* IEU0 Group */
+
+ andcc %o2, %g2, %g0 /* IEU1 */
+ add %o1, 8, %o1 /* IEU0 Group */
+ be,a,pt %xcc, 2b /* CTI */
+ stx %g3, [%o0 - 8] /* Store */
+
+ srlx %g3, 56, %g5 /* IEU0 Group */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 11f /* CTI */
+ srlx %g3, 48, %g4 /* IEU0 */
+
+ andcc %g4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 10f /* CTI */
+ srlx %g3, 40, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 9f /* CTI */
+ srlx %g3, 32, %g4 /* IEU0 */
+ andcc %g4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 8f /* CTI */
+
+ srlx %g3, 24, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 7f /* CTI */
+ srlx %g3, 16, %g4 /* IEU0 */
+
+ andcc %g4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 6f /* CTI */
+ srlx %g3, 8, %g5 /* IEU0 */
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 5f /* CTI */
+ sub %o3, %g1, %o2 /* IEU0 */
+ stx %g3, [%o0 - 8] /* Store Group */
+ andcc %g3, 0xff, %g0 /* IEU1 */
+
+ bne,pt %icc, 3b /* CTI */
+ mov %o3, %g3 /* IEU0 Group */
+4: retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+
+ .align 16
+5: stb %g5, [%o0 - 2] /* Store Group */
+ srlx %g3, 16, %g4 /* IEU0 */
+6: sth %g4, [%o0 - 4] /* Store Group */
+ srlx %g3, 32, %g4 /* IEU0 */
+
+ stw %g4, [%o0 - 8] /* Store Group */
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+7: stb %g5, [%o0 - 4] /* Store Group */
+
+ srlx %g3, 32, %g4 /* IEU0 */
+8: stw %g4, [%o0 - 8] /* Store Group */
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+
+9: stb %g5, [%o0 - 6] /* Store Group */
+ srlx %g3, 48, %g4 /* IEU0 */
+10: sth %g4, [%o0 - 8] /* Store Group */
+ retl /* CTI+IEU1 Group */
+
+ mov %g6, %o0 /* IEU0 */
+11: stb %g5, [%o0 - 8] /* Store Group */
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+
+12: or %g1, %g2, %g1 /* IEU0 Group */
+ ldub [%o1], %o3 /* Load */
+ sllx %g1, 7, %g2 /* IEU0 Group */
+ stb %o3, [%o0] /* Store Group */
+
+13: add %o0, 1, %o0 /* IEU0 */
+ add %o1, 1, %o1 /* IEU1 */
+ andcc %o3, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 4b /* CTI */
+
+ lduba [%o1] ASI_PNF, %o3 /* Load */
+ andcc %o0, 7, %g0 /* IEU1 Group */
+ bne,a,pt %icc, 13b /* CTI */
+ stb %o3, [%o0] /* Store */
+
+ andcc %o1, 7, %g3 /* IEU1 Group */
+ be,a,pt %icc, 1b /* CTI */
+ ldx [%o1], %o3 /* Load */
+14: orcc %g0, 64, %g4 /* IEU1 Group */
+
+ sllx %g3, 3, %g5 /* IEU0 */
+ sub %o1, %g3, %o1 /* IEU0 Group */
+ sub %g4, %g5, %g4 /* IEU1 */
+ /* %g1 = 0101010101010101 *
+ * %g2 = 8080808080808080 *
+ * %g3 = source alignment *
+ * %g5 = number of bits to shift left *
+ * %g4 = number of bits to shift right */
+ ldxa [%o1] ASI_PNF, %o5 /* Load Group */
+
+ addcc %o1, 8, %o1 /* IEU1 */
+15: sllx %o5, %g5, %o3 /* IEU0 Group */
+ ldxa [%o1] ASI_PNF, %o5 /* Load */
+ srlx %o5, %g4, %o4 /* IEU0 Group */
+
+ add %o0, 8, %o0 /* IEU1 */
+ or %o3, %o4, %o3 /* IEU0 Group */
+ add %o1, 8, %o1 /* IEU1 */
+ sub %o3, %g1, %o4 /* IEU0 Group */
+
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o4, %o3, %o4 /* IEU0 Group */
+#endif
+ andcc %o4, %g2, %g0 /* IEU1 Group */
+ be,a,pt %xcc, 15b /* CTI */
+ stx %o3, [%o0 - 8] /* Store */
+ srlx %o3, 56, %o4 /* IEU0 Group */
+
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 22f /* CTI */
+ srlx %o3, 48, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 21f /* CTI */
+ srlx %o3, 40, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 20f /* CTI */
+
+ srlx %o3, 32, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 19f /* CTI */
+ srlx %o3, 24, %o4 /* IEU0 */
+
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 18f /* CTI */
+ srlx %o3, 16, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 17f /* CTI */
+ srlx %o3, 8, %o4 /* IEU0 */
+ andcc %o4, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 16f /* CTI */
+
+ andcc %o3, 0xff, %g0 /* IEU1 Group */
+ bne,pn %icc, 15b /* CTI */
+ stx %o3, [%o0 - 8] /* Store */
+ retl /* CTI+IEU1 Group */
+
+ mov %g6, %o0 /* IEU0 */
+
+ .align 16
+16: srlx %o3, 8, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 2] /* Store */
+17: srlx %o3, 16, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 3] /* Store */
+
+18: srlx %o3, 24, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 4] /* Store */
+19: srlx %o3, 32, %o4 /* IEU0 Group */
+ stw %o4, [%o0 - 8] /* Store */
+
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+ nop
+ nop
+
+20: srlx %o3, 40, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 6] /* Store */
+21: srlx %o3, 48, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 7] /* Store */
+
+22: srlx %o3, 56, %o4 /* IEU0 Group */
+ stb %o4, [%o0 - 8] /* Store */
+ retl /* CTI+IEU1 Group */
+ mov %g6, %o0 /* IEU0 */
+END(strcpy)
+
+libc_hidden_def(strcpy)
diff --git a/ap/build/uClibc/libc/string/sparc/sparc64/strlen.S b/ap/build/uClibc/libc/string/sparc/sparc64/strlen.S
new file mode 100644
index 0000000..1fe8549
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/sparc64/strlen.S
@@ -0,0 +1,173 @@
+/* Determine the length of a string. For SPARC v9.
+ Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jan Vondrak <jvon4518@ss1000.ms.mff.cuni.cz> and
+ Jakub Jelinek <jj@ultra.linux.cz>.
+
+ 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 <asm/asi.h>
+
+ /* Normally, this uses
+ ((xword - 0x0101010101010101) & 0x8080808080808080) test
+ to find out if any byte in xword could be zero. This is fast, but
+ also gives false alarm for any byte in range 0x81-0xff. It does
+ not matter for correctness, as if this test tells us there could
+ be some zero byte, we check it byte by byte, but if bytes with
+ high bits set are common in the strings, then this will give poor
+ performance. You can #define EIGHTBIT_NOT_RARE and the algorithm
+ will use one tick slower, but more precise test
+ ((xword - 0x0101010101010101) & (~xword) & 0x8080808080808080),
+ which does not give any false alarms (but if some bits are set,
+ one cannot assume from it which bytes are zero and which are not).
+ It is yet to be measured, what is the correct default for glibc
+ in these days for an average user.
+ */
+
+ .text
+ .align 32
+ENTRY(strlen)
+ sethi %hi(0x01010101), %g1 /* IEU0 Group */
+ ldub [%o0], %o3 /* Load */
+ or %g1, %lo(0x01010101), %g1 /* IEU0 Group */
+ mov %o0, %o1 /* IEU1 */
+
+ sllx %g1, 32, %g4 /* IEU0 Group */
+ andcc %o0, 7, %g0 /* IEU1 */
+ or %g1, %g4, %g1 /* IEU0 Group */
+ brz,pn %o3, 13f /* CTI+IEU1 */
+
+ sllx %g1, 7, %g4 /* IEU0 Group */
+ bne,a,pn %icc, 15f /* CTI */
+ add %o0, 1, %o0 /* IEU1 */
+ /* %g1 = 0x0101010101010101 *
+ * %g4 = 0x8080808080808080 *
+ * %o0 = string pointer *
+ * %o1 = start of string */
+1: ldx [%o0], %o3 /* Load Group */
+
+ add %o0, 8, %o0 /* IEU1 */
+2: sub %o3, %g1, %o2 /* IEU0 Group */
+#ifdef EIGHTBIT_NOT_RARE
+ andn %o2, %o3, %o5 /* IEU0 Group */
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ andcc %o5, %g4, %g0 /* IEU1 Group */
+#else
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ andcc %o2, %g4, %g0 /* IEU1 Group */
+#endif
+
+ be,pt %xcc, 2b /* CTI */
+ add %o0, 8, %o0 /* IEU0 */
+ addcc %o2, %g1, %g5 /* IEU1 Group */
+#ifdef EIGHTBIT_NOT_RARE
+ srlx %o5, 32, %o5 /* IEU0 */
+
+3: andcc %o5, %g4, %g0 /* IEU1 Group */
+#else
+ srlx %o2, 32, %o2 /* IEU0 */
+
+3: andcc %o2, %g4, %g0 /* IEU1 Group */
+#endif
+ be,pn %xcc, 4f /* CTI */
+ srlx %g5, 56, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 12f /* CTI */
+ srlx %g5, 48, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 11f /* CTI */
+
+ srlx %g5, 40, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 10f /* CTI */
+ srlx %g5, 32, %o2 /* IEU0 */
+
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 9f /* CTI */
+4: srlx %g5, 24, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+
+ be,pn %icc, 8f /* CTI */
+ srlx %g5, 16, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 7f /* CTI */
+
+ srlx %g5, 8, %o2 /* IEU0 */
+ andcc %o2, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 6f /* CTI */
+ sub %o3, %g1, %o2 /* IEU0 */
+
+ andcc %g5, 0xff, %g0 /* IEU1 Group */
+ be,pn %icc, 5f /* CTI */
+ ldxa [%o0] ASI_PNF, %o3 /* Load */
+ andcc %o2, %g4, %g0 /* IEU1 Group */
+
+ be,pt %xcc, 2b /* CTI */
+ add %o0, 8, %o0 /* IEU0 */
+ addcc %o2, %g1, %g5 /* IEU1 Group */
+ ba,pt %xcc, 3b /* CTI */
+
+ srlx %o2, 32, %o2 /* IEU0 */
+5: add %o0, -9, %o0 /* IEU0 Group */
+ retl /* CTI+IEU1 Group */
+ sub %o0, %o1, %o0 /* IEU0 */
+
+6: add %o0, -10, %o0 /* IEU0 Group */
+ retl /* CTI+IEU1 Group */
+ sub %o0, %o1, %o0 /* IEU0 */
+7: add %o0, -11, %o0 /* IEU0 Group */
+
+ retl /* CTI+IEU1 Group */
+ sub %o0, %o1, %o0 /* IEU0 */
+8: add %o0, -12, %o0 /* IEU0 Group */
+ retl /* CTI+IEU1 Group */
+
+ sub %o0, %o1, %o0 /* IEU0 */
+9: add %o0, -13, %o0 /* IEU0 Group */
+ retl /* CTI+IEU1 Group */
+ sub %o0, %o1, %o0 /* IEU0 */
+
+10: add %o0, -14, %o0 /* IEU0 Group */
+ retl /* CTI+IEU1 Group */
+ sub %o0, %o1, %o0 /* IEU0 */
+11: add %o0, -15, %o0 /* IEU0 Group */
+
+ retl /* CTI+IEU1 Group */
+ sub %o0, %o1, %o0 /* IEU0 */
+12: add %o0, -16, %o0 /* IEU0 Group */
+ retl /* CTI+IEU1 Group */
+
+ sub %o0, %o1, %o0 /* IEU0 */
+13: retl /* CTI+IEU1 Group */
+ mov 0, %o0 /* IEU0 */
+ nop
+
+15: ldub [%o0], %o3 /* Load Group */
+16: andcc %o0, 7, %g0 /* IEU1 */
+ be,pn %icc, 1b /* CTI */
+ nop /* IEU0 Group */
+
+ add %o0, 1, %o0 /* IEU1 */
+ andcc %o3, 0xff, %g0 /* IEU1 Group */
+ bne,a,pt %icc, 16b /* CTI */
+ lduba [%o0] ASI_PNF, %o3 /* Load */
+
+ add %o0, -1, %o0 /* IEU0 Group */
+ retl /* CTI+IEU1 Group */
+ sub %o0, %o1, %o0 /* IEU0 */
+END(strlen)
+libc_hidden_def(strlen)
diff --git a/ap/build/uClibc/libc/string/sparc/stpcpy.S b/ap/build/uClibc/libc/string/sparc/stpcpy.S
new file mode 100644
index 0000000..2d27393
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/stpcpy.S
@@ -0,0 +1,13 @@
+#include "_glibc_inc.h"
+
+#if __WORDSIZE == 32
+
+# if defined(__CONFIG_SPARC_V9B__)
+# include "sparc32/sparcv9b/stpcpy.S"
+# else
+# include "sparc32/stpcpy.S"
+# endif
+
+#else
+# include "sparc64/stpcpy.S"
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/strcat.S b/ap/build/uClibc/libc/string/sparc/strcat.S
new file mode 100644
index 0000000..ae18e4e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/strcat.S
@@ -0,0 +1,13 @@
+#include "_glibc_inc.h"
+
+#if __WORDSIZE == 32
+
+# if defined(__CONFIG_SPARC_V9B__)
+# include "sparc32/sparcv9b/strcat.S"
+# else
+# include "sparc32/strcat.S"
+# endif
+
+#else
+# include "sparc64/strcat.S"
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/strchr.S b/ap/build/uClibc/libc/string/sparc/strchr.S
new file mode 100644
index 0000000..99b5119
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/strchr.S
@@ -0,0 +1,13 @@
+#include "_glibc_inc.h"
+
+#if __WORDSIZE == 32
+
+# if defined(__CONFIG_SPARC_V9B__)
+# include "sparc32/sparcv9b/strchr.S"
+# else
+# include "sparc32/strchr.S"
+# endif
+
+#else
+# include "sparc64/strchr.S"
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/strcmp.S b/ap/build/uClibc/libc/string/sparc/strcmp.S
new file mode 100644
index 0000000..556537c
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/strcmp.S
@@ -0,0 +1,18 @@
+#include "_glibc_inc.h"
+
+#if __WORDSIZE == 32
+
+# if defined(__CONFIG_SPARC_V9B__)
+# include "sparc32/sparcv9b/strcmp.S"
+# else
+# include "sparc32/strcmp.S"
+# endif
+
+#else
+# include "sparc64/strcmp.S"
+#endif
+
+#ifndef __UCLIBC_HAS_LOCALE__
+strong_alias(strcmp,strcoll)
+libc_hidden_def(strcoll)
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/strcpy.S b/ap/build/uClibc/libc/string/sparc/strcpy.S
new file mode 100644
index 0000000..6dbbf5a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/strcpy.S
@@ -0,0 +1,13 @@
+#include "_glibc_inc.h"
+
+#if __WORDSIZE == 32
+
+# if defined(__CONFIG_SPARC_V9B__)
+# include "sparc32/sparcv9b/strcpy.S"
+# else
+# include "sparc32/strcpy.S"
+# endif
+
+#else
+# include "sparc64/strcpy.S"
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/strlen.S b/ap/build/uClibc/libc/string/sparc/strlen.S
new file mode 100644
index 0000000..0bfa3f5
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/strlen.S
@@ -0,0 +1,13 @@
+#include "_glibc_inc.h"
+
+#if __WORDSIZE == 32
+
+# if defined(__CONFIG_SPARC_V9B__)
+# include "sparc32/sparcv9b/strlen.S"
+# else
+# include "sparc32/strlen.S"
+# endif
+
+#else
+# include "sparc64/strlen.S"
+#endif
diff --git a/ap/build/uClibc/libc/string/sparc/strrchr.c b/ap/build/uClibc/libc/string/sparc/strrchr.c
new file mode 100644
index 0000000..ec608d6
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sparc/strrchr.c
@@ -0,0 +1 @@
+/* strrchr is in strchr.S */
diff --git a/ap/build/uClibc/libc/string/stpcpy.c b/ap/build/uClibc/libc/string/stpcpy.c
new file mode 100644
index 0000000..2fd2c06
--- /dev/null
+++ b/ap/build/uClibc/libc/string/stpcpy.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstpcpy wcpcpy
+#else
+# undef stpcpy
+# define Wstpcpy stpcpy
+#endif
+
+Wchar *Wstpcpy(register Wchar * __restrict s1, const Wchar * __restrict s2)
+{
+ while ( (*s1++ = *s2++) != 0 );
+
+ return s1 - 1;
+}
+
+#ifndef WANT_WIDE
+libc_hidden_def(stpcpy)
+#endif
diff --git a/ap/build/uClibc/libc/string/stpncpy.c b/ap/build/uClibc/libc/string/stpncpy.c
new file mode 100644
index 0000000..50d83a1
--- /dev/null
+++ b/ap/build/uClibc/libc/string/stpncpy.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstpncpy wcpncpy
+#else
+# define Wstpncpy stpncpy
+#endif
+
+Wchar *Wstpncpy(register Wchar * __restrict s1,
+ register const Wchar * __restrict s2,
+ size_t n)
+{
+ Wchar *s = s1;
+ const Wchar *p = s2;
+
+ while (n) {
+ if ((*s = *s2) != 0) s2++; /* Need to fill tail with 0s. */
+ ++s;
+ --n;
+ }
+ return s1 + (s2 - p);
+}
diff --git a/ap/build/uClibc/libc/string/strcasecmp.c b/ap/build/uClibc/libc/string/strcasecmp.c
new file mode 100644
index 0000000..f894e42
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strcasecmp.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+#include <ctype.h>
+#include <locale.h>
+
+#ifdef WANT_WIDE
+# define strcasecmp wcscasecmp
+# define strcasecmp_l wcscasecmp_l
+# ifdef __UCLIBC_DO_XLOCALE
+# define TOLOWER(C) towlower_l((C), locale_arg)
+# else
+# define TOLOWER(C) towlower((C))
+# endif
+#else
+# ifdef __UCLIBC_DO_XLOCALE
+# define TOLOWER(C) tolower_l((C), locale_arg)
+# else
+# define TOLOWER(C) tolower((C))
+# endif
+#endif
+
+#if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE)
+
+int strcasecmp(register const Wchar *s1, register const Wchar *s2)
+{
+ return strcasecmp_l(s1, s2, __UCLIBC_CURLOCALE);
+}
+#ifndef WANT_WIDE
+libc_hidden_def(strcasecmp)
+#endif
+
+#else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
+
+int __XL_NPP(strcasecmp)(register const Wchar *s1, register const Wchar *s2
+ __LOCALE_PARAM )
+{
+#ifdef WANT_WIDE
+ while ((*s1 == *s2) || (TOLOWER(*s1) == TOLOWER(*s2))) {
+ if (!*s1++) {
+ return 0;
+ }
+ ++s2;
+ }
+
+ return (((Wuchar)TOLOWER(*s1)) < ((Wuchar)TOLOWER(*s2))) ? -1 : 1;
+ /* TODO -- should wide cmp funcs do wchar or Wuchar compares? */
+#else
+ int r = 0;
+
+ while ( ((s1 == s2) ||
+ !(r = ((int)( TOLOWER(*((Wuchar *)s1))))
+ - TOLOWER(*((Wuchar *)s2))))
+ && (++s2, *s1++));
+
+ return r;
+#endif
+}
+#if !defined WANT_WIDE || (defined WANT_WIDE && defined __UCLIBC_DO_XLOCALE)
+libc_hidden_def(__XL_NPP(strcasecmp))
+#endif
+
+#endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
diff --git a/ap/build/uClibc/libc/string/strcasecmp_l.c b/ap/build/uClibc/libc/string/strcasecmp_l.c
new file mode 100644
index 0000000..a3f74c4
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strcasecmp_l.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define __UCLIBC_DO_XLOCALE
+#include "strcasecmp.c"
diff --git a/ap/build/uClibc/libc/string/strcasestr.c b/ap/build/uClibc/libc/string/strcasestr.c
new file mode 100644
index 0000000..3334086
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strcasestr.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+#include <ctype.h>
+
+char *strcasestr(const char *s1, const char *s2)
+{
+ register const char *s = s1;
+ register const char *p = s2;
+
+#if 1
+ do {
+ if (!*p) {
+ return (char *) s1;;
+ }
+ if ((*p == *s)
+ || (tolower(*((unsigned char *)p)) == tolower(*((unsigned char *)s)))
+ ) {
+ ++p;
+ ++s;
+ } else {
+ p = s2;
+ if (!*s) {
+ return NULL;
+ }
+ s = ++s1;
+ }
+ } while (1);
+#else
+ while (*p && *s) {
+ if ((*p == *s)
+ || (tolower(*((unsigned char *)p)) == tolower(*((unsigned char *)s)))
+ ) {
+ ++p;
+ ++s;
+ } else {
+ p = s2;
+ s = ++s1;
+ }
+ }
+
+ return (*p) ? NULL : (char *) s1;
+#endif
+}
+libc_hidden_def(strcasestr)
diff --git a/ap/build/uClibc/libc/string/strcat.c b/ap/build/uClibc/libc/string/strcat.c
new file mode 100644
index 0000000..63619bc
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strcat.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrcat wcscat
+#else
+# define Wstrcat strcat
+#endif
+
+Wchar *Wstrcat(Wchar * __restrict s1, register const Wchar * __restrict s2)
+{
+ register Wchar *s = s1;
+
+ while (*s++);
+ --s;
+ while ((*s++ = *s2++) != 0);
+
+ return s1;
+}
+libc_hidden_def(Wstrcat)
diff --git a/ap/build/uClibc/libc/string/strchr.c b/ap/build/uClibc/libc/string/strchr.c
new file mode 100644
index 0000000..7ea4773
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strchr.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrchr wcschr
+#else
+# define Wstrchr strchr
+#endif
+
+Wchar *Wstrchr(register const Wchar *s, Wint c)
+{
+ do {
+ if (*s == ((Wchar)c)) {
+ return (Wchar *) s; /* silence the warning */
+ }
+ } while (*s++);
+
+ return NULL;
+}
+#ifndef WANT_WIDE
+libc_hidden_def(strchr)
+# ifdef __UCLIBC_SUSV3_LEGACY__
+weak_alias(strchr,index)
+# endif
+#endif
diff --git a/ap/build/uClibc/libc/string/strchrnul.c b/ap/build/uClibc/libc/string/strchrnul.c
new file mode 100644
index 0000000..4751971
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strchrnul.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef __USE_GNU
+
+#ifdef WANT_WIDE
+# define Wstrchrnul wcschrnul
+#else
+# define Wstrchrnul strchrnul
+#endif
+
+Wchar *Wstrchrnul(register const Wchar *s, Wint c)
+{
+ --s;
+ while (*++s && (*s != ((Wchar)c)));
+ return (Wchar *) s;
+}
+# ifndef WANT_WIDE
+libc_hidden_def(Wstrchrnul)
+# endif
+#endif
diff --git a/ap/build/uClibc/libc/string/strcmp.c b/ap/build/uClibc/libc/string/strcmp.c
new file mode 100644
index 0000000..abae618
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strcmp.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrcmp wcscmp
+# define Wstrcoll wcscoll
+#else
+# define Wstrcmp strcmp
+# define Wstrcoll strcoll
+#endif
+
+int Wstrcmp(register const Wchar *s1, register const Wchar *s2)
+{
+#ifdef WANT_WIDE
+ while (*((Wuchar *)s1) == *((Wuchar *)s2)) {
+ if (!*s1++) {
+ return 0;
+ }
+ ++s2;
+ }
+
+ return (*((Wuchar *)s1) < *((Wuchar *)s2)) ? -1 : 1;
+#else
+ int r;
+
+ while (((r = ((int)(*((Wuchar *)s1))) - *((Wuchar *)s2++))
+ == 0) && *s1++);
+
+ return r;
+#endif
+}
+libc_hidden_def(Wstrcmp)
+
+#ifndef __UCLIBC_HAS_LOCALE__
+strong_alias(Wstrcmp,Wstrcoll)
+libc_hidden_def(Wstrcoll)
+#endif
diff --git a/ap/build/uClibc/libc/string/strcpy.c b/ap/build/uClibc/libc/string/strcpy.c
new file mode 100644
index 0000000..549360c
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strcpy.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrcpy wcscpy
+#else
+# define Wstrcpy strcpy
+#endif
+
+Wchar *Wstrcpy(Wchar * __restrict s1, const Wchar * __restrict s2)
+{
+ register Wchar *s = s1;
+
+ while ( (*s++ = *s2++) != 0 );
+
+ return s1;
+}
+
+#ifndef WANT_WIDE
+libc_hidden_def(strcpy)
+#endif
diff --git a/ap/build/uClibc/libc/string/strcspn.c b/ap/build/uClibc/libc/string/strcspn.c
new file mode 100644
index 0000000..0466af9
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strcspn.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrcspn wcscspn
+#else
+# define Wstrcspn strcspn
+#endif
+
+size_t Wstrcspn(const Wchar *s1, const Wchar *s2)
+{
+ register const Wchar *s;
+ register const Wchar *p;
+
+ for ( s=s1 ; *s ; s++ ) {
+ for ( p=s2 ; *p ; p++ ) {
+ if (*p == *s) goto done;
+ }
+ }
+ done:
+ return s - s1;
+}
+
+#ifndef WANT_WIDE
+libc_hidden_def(strcspn)
+#endif
diff --git a/ap/build/uClibc/libc/string/strdup.c b/ap/build/uClibc/libc/string/strdup.c
new file mode 100644
index 0000000..049a23f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strdup.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+#include <stdlib.h>
+
+#ifdef WANT_WIDE
+# define Wstrdup wcsdup
+# define Wstrlen wcslen
+#else
+# define Wstrdup strdup
+# define Wstrlen strlen
+#endif
+
+Wchar *Wstrdup(register const Wchar *s1)
+{
+ register Wchar *s;
+ register size_t l = (Wstrlen(s1) + 1) * sizeof(Wchar);
+
+ if ((s = malloc(l)) != NULL) {
+ memcpy(s, s1, l);
+ }
+
+ return s;
+}
+
+#ifndef WANT_WIDE
+libc_hidden_weak(strdup)
+#endif
diff --git a/ap/build/uClibc/libc/string/strerror.c b/ap/build/uClibc/libc/string/strerror.c
new file mode 100644
index 0000000..7250da0
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strerror.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+#include <string.h>
+#include "_syserrmsg.h"
+
+
+char *strerror(int errnum)
+{
+ static char buf[_STRERROR_BUFSIZE];
+
+ __xpg_strerror_r(errnum, buf, sizeof(buf));
+
+ return buf;
+}
+libc_hidden_def(strerror)
diff --git a/ap/build/uClibc/libc/string/strlcat.c b/ap/build/uClibc/libc/string/strlcat.c
new file mode 100644
index 0000000..d55761d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strlcat.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/* OpenBSD function:
+ * Append at most n-1-strlen(dst) chars from src to dst and nul-terminate dst.
+ * Returns strlen(src) + strlen({original} dst), so truncation occurred if the
+ * return val is >= n.
+ * Note: If dst doesn't contain a nul in the first n chars, strlen(dst) is
+ * taken as n. */
+
+#include "_string.h"
+
+size_t strlcat(register char *__restrict dst,
+ register const char *__restrict src,
+ size_t n)
+{
+ size_t len;
+ char dummy[1];
+
+ len = 0;
+
+ while (1) {
+ if (len >= n) {
+ dst = dummy;
+ break;
+ }
+ if (!*dst) {
+ break;
+ }
+ ++dst;
+ ++len;
+ }
+
+ while ((*dst = *src) != 0) {
+ if (++len < n) {
+ ++dst;
+ }
+ ++src;
+ }
+
+ return len;
+}
+libc_hidden_def(strlcat)
diff --git a/ap/build/uClibc/libc/string/strlcpy.c b/ap/build/uClibc/libc/string/strlcpy.c
new file mode 100644
index 0000000..8378704
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strlcpy.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrlcpy __wcslcpy
+# define Wstrxfrm wcsxfrm
+#else
+# define Wstrlcpy strlcpy
+# define Wstrxfrm strxfrm
+#endif
+
+/* OpenBSD function:
+ * Copy at most n-1 chars from src to dst and nul-terminate dst.
+ * Returns strlen(src), so truncation occurred if the return value is >= n. */
+
+size_t Wstrlcpy(register Wchar *__restrict dst,
+ register const Wchar *__restrict src,
+ size_t n)
+{
+ const Wchar *src0 = src;
+ Wchar dummy[1];
+
+ if (!n) {
+ dst = dummy;
+ } else {
+ --n;
+ }
+
+ while ((*dst = *src) != 0) {
+ if (n) {
+ --n;
+ ++dst;
+ }
+ ++src;
+ }
+
+ return src - src0;
+}
+#ifndef WANT_WIDE
+libc_hidden_def(strlcpy)
+#endif
+
+#ifndef __UCLIBC_HAS_LOCALE__
+strong_alias(Wstrlcpy,Wstrxfrm)
+#endif
diff --git a/ap/build/uClibc/libc/string/strlen.c b/ap/build/uClibc/libc/string/strlen.c
new file mode 100644
index 0000000..021a8ca
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strlen.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrlen wcslen
+#else
+# define Wstrlen strlen
+#endif
+
+size_t Wstrlen(const Wchar *s)
+{
+ register const Wchar *p;
+
+ for (p=s ; *p ; p++);
+
+ return p - s;
+}
+libc_hidden_weak(Wstrlen)
diff --git a/ap/build/uClibc/libc/string/strncasecmp.c b/ap/build/uClibc/libc/string/strncasecmp.c
new file mode 100644
index 0000000..2eac47d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strncasecmp.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+#include <ctype.h>
+#include <locale.h>
+
+#ifdef WANT_WIDE
+# define strncasecmp wcsncasecmp
+# define strncasecmp_l wcsncasecmp_l
+# ifdef __UCLIBC_DO_XLOCALE
+# define TOLOWER(C) towlower_l((C), locale_arg)
+# else
+# define TOLOWER(C) towlower((C))
+# endif
+#else
+# ifdef __UCLIBC_DO_XLOCALE
+# define TOLOWER(C) tolower_l((C), locale_arg)
+# else
+# define TOLOWER(C) tolower((C))
+# endif
+#endif
+
+#if defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE)
+
+int strncasecmp(register const Wchar *s1, register const Wchar *s2, size_t n)
+{
+ return strncasecmp_l(s1, s2, n, __UCLIBC_CURLOCALE);
+}
+#ifndef WANT_WIDE
+libc_hidden_def(strncasecmp)
+#endif
+
+#else /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
+
+int __XL_NPP(strncasecmp)(register const Wchar *s1, register const Wchar *s2,
+ size_t n __LOCALE_PARAM )
+{
+#ifdef WANT_WIDE
+ while (n && ((*s1 == *s2) || (TOLOWER(*s1) == TOLOWER(*s2)))) {
+ if (!*s1++) {
+ return 0;
+ }
+ ++s2;
+ --n;
+ }
+
+ return (n == 0)
+ ? 0
+ : ((((Wuchar)TOLOWER(*s1)) < ((Wuchar)TOLOWER(*s2))) ? -1 : 1);
+ /* TODO -- should wide cmp funcs do wchar or Wuchar compares? */
+#else
+ int r = 0;
+
+ while ( n
+ && ((s1 == s2) ||
+ !(r = ((int)( TOLOWER(*((unsigned char *)s1))))
+ - TOLOWER(*((unsigned char *)s2))))
+ && (--n, ++s2, *s1++));
+ return r;
+#endif
+}
+#if !defined WANT_WIDE || (defined WANT_WIDE && defined __UCLIBC_DO_XLOCALE)
+libc_hidden_def(__XL_NPP(strncasecmp))
+#endif
+
+#endif /* defined(__UCLIBC_HAS_XLOCALE__) && !defined(__UCLIBC_DO_XLOCALE) */
diff --git a/ap/build/uClibc/libc/string/strncasecmp_l.c b/ap/build/uClibc/libc/string/strncasecmp_l.c
new file mode 100644
index 0000000..7f251ba
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strncasecmp_l.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define __UCLIBC_DO_XLOCALE
+#include "strncasecmp.c"
diff --git a/ap/build/uClibc/libc/string/strncat.c b/ap/build/uClibc/libc/string/strncat.c
new file mode 100644
index 0000000..0fa9b4a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strncat.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrncat wcsncat
+#else
+# define Wstrncat strncat
+#endif
+
+Wchar *Wstrncat(Wchar * __restrict s1, register const Wchar * __restrict s2,
+ size_t n)
+{
+ register Wchar *s = s1;
+
+ while (*s++);
+ --s;
+ while (n && ((*s = *s2++) != 0)) {
+ --n;
+ ++s;
+ }
+ *s = 0;
+
+ return s1;
+}
+
+#ifndef WANT_WIDE
+libc_hidden_def(strncat)
+#endif
diff --git a/ap/build/uClibc/libc/string/strncmp.c b/ap/build/uClibc/libc/string/strncmp.c
new file mode 100644
index 0000000..2da6177
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strncmp.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrncmp wcsncmp
+#else
+# define Wstrncmp strncmp
+#endif
+
+int Wstrncmp(register const Wchar *s1, register const Wchar *s2, size_t n)
+{
+#ifdef WANT_WIDE
+ while (n && (*((Wuchar *)s1) == *((Wuchar *)s2))) {
+ if (!*s1++) {
+ return 0;
+ }
+ ++s2;
+ --n;
+ }
+
+ return (n == 0) ? 0 : (*((Wuchar *)s1) - *((Wuchar *)s2));
+#else
+ int r = 0;
+
+ while (n--
+ && ((r = ((int)(*((unsigned char *)s1))) - *((unsigned char *)s2++))
+ == 0)
+ && *s1++);
+
+ return r;
+#endif
+}
+#ifndef WANT_WIDE
+libc_hidden_weak(strncmp)
+#endif
diff --git a/ap/build/uClibc/libc/string/strncpy.c b/ap/build/uClibc/libc/string/strncpy.c
new file mode 100644
index 0000000..4a44e1f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strncpy.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrncpy wcsncpy
+#else
+# define Wstrncpy strncpy
+#endif
+
+Wchar *Wstrncpy(Wchar * __restrict s1, register const Wchar * __restrict s2,
+ size_t n)
+{
+ register Wchar *s = s1;
+
+ while (n) {
+ if ((*s = *s2) != 0) s2++; /* Need to fill tail with 0s. */
+ ++s;
+ --n;
+ }
+
+ return s1;
+}
+#ifndef WANT_WIDE
+libc_hidden_def(strncpy)
+#endif
diff --git a/ap/build/uClibc/libc/string/strndup.c b/ap/build/uClibc/libc/string/strndup.c
new file mode 100644
index 0000000..8e60866
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strndup.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+#include <stdlib.h>
+
+
+char *strndup(register const char *s1, size_t n)
+{
+ register char *s;
+
+ n = strnlen(s1,n); /* Avoid problems if s1 not nul-terminated. */
+
+ if ((s = malloc(n + 1)) != NULL) {
+ memcpy(s, s1, n);
+ s[n] = 0;
+ }
+
+ return s;
+}
+libc_hidden_def(strndup)
diff --git a/ap/build/uClibc/libc/string/strnlen.c b/ap/build/uClibc/libc/string/strnlen.c
new file mode 100644
index 0000000..08de088
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strnlen.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef __USE_GNU
+
+#ifdef WANT_WIDE
+# define Wstrnlen wcsnlen
+#else
+# define Wstrnlen strnlen
+#endif
+
+size_t Wstrnlen(const Wchar *s, size_t max)
+{
+ register const Wchar *p = s;
+
+ while (max && *p) {
+ ++p;
+ --max;
+ }
+
+ return p - s;
+}
+
+libc_hidden_def(Wstrnlen)
+#endif
diff --git a/ap/build/uClibc/libc/string/strpbrk.c b/ap/build/uClibc/libc/string/strpbrk.c
new file mode 100644
index 0000000..ddfc751
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strpbrk.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrpbrk wcspbrk
+#else
+# define Wstrpbrk strpbrk
+#endif
+
+Wchar *Wstrpbrk(const Wchar *s1, const Wchar *s2)
+{
+ register const Wchar *s;
+ register const Wchar *p;
+
+ for ( s=s1 ; *s ; s++ ) {
+ for ( p=s2 ; *p ; p++ ) {
+ if (*p == *s) return (Wchar *) s; /* silence the warning */
+ }
+ }
+ return NULL;
+}
+libc_hidden_def(Wstrpbrk)
diff --git a/ap/build/uClibc/libc/string/strrchr.c b/ap/build/uClibc/libc/string/strrchr.c
new file mode 100644
index 0000000..db12bbc
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strrchr.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrrchr wcsrchr
+#else
+# define Wstrrchr strrchr
+#endif
+
+Wchar *Wstrrchr(register const Wchar *s, Wint c)
+{
+ register const Wchar *p;
+
+ p = NULL;
+ do {
+ if (*s == (Wchar) c) {
+ p = s;
+ }
+ } while (*s++);
+
+ return (Wchar *) p; /* silence the warning */
+}
+#ifndef WANT_WIDE
+libc_hidden_weak(strrchr)
+# ifdef __UCLIBC_SUSV3_LEGACY__
+weak_alias(strrchr,rindex)
+# endif
+#endif
diff --git a/ap/build/uClibc/libc/string/strsep.c b/ap/build/uClibc/libc/string/strsep.c
new file mode 100644
index 0000000..ce17dcf
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strsep.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef __USE_BSD
+
+
+char *strsep(char ** __restrict s1, const char * __restrict s2)
+{
+ register char *s = *s1;
+ register char *p;
+
+#if 1
+ p = NULL;
+ if (s && *s && (p = strpbrk(s, s2))) {
+ *p++ = 0;
+ }
+#else
+ if (s && *s && *(p = s + strcspn(s, s2))) {
+ *p++ = 0;
+ } else {
+ p = NULL;
+ }
+#endif
+ *s1 = p;
+ return s;
+}
+libc_hidden_def(strsep)
+#endif
diff --git a/ap/build/uClibc/libc/string/strsignal.c b/ap/build/uClibc/libc/string/strsignal.c
new file mode 100644
index 0000000..0fbbf85
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strsignal.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+/*
+ * Sep 11, 2003
+ * Patch by Atsushi Nemoto <anemo@mba.ocn.ne.jp> to do arch-required
+ * mapping of signal strings (alpha, mips, hppa, sparc).
+ */
+
+/* TODO: make a threadsafe version? */
+
+#include <features.h>
+#include <string.h>
+#include <bits/uClibc_uintmaxtostr.h>
+#include <signal.h>
+
+#define _SYS_NSIG 32
+
+#ifdef __UCLIBC_HAS_SIGNUM_MESSAGES__
+# define _SYS_SIGMSG_MAXLEN 25
+#else
+# define _SYS_SIGMSG_MAXLEN 0
+#endif
+
+#if _SYS_SIGMSG_MAXLEN < __UIM_BUFLEN_INT + 15
+# define _STRSIGNAL_BUFSIZE (__UIM_BUFLEN_INT + 15)
+#else
+# define _STRSIGNAL_BUFSIZE _SYS_SIGMSG_MAXLEN
+#endif
+
+#ifdef __UCLIBC_HAS_SIGNUM_MESSAGES__
+
+extern const char _string_syssigmsgs[] attribute_hidden;
+
+#if defined(__alpha__) || defined(__mips__) || defined(__hppa__) || defined(__sparc__)
+static const unsigned char sstridx[] = {
+ 0,
+ SIGHUP,
+ SIGINT,
+ SIGQUIT,
+ SIGILL,
+ SIGTRAP,
+ SIGIOT,
+ SIGBUS,
+ SIGFPE,
+ SIGKILL,
+ SIGUSR1,
+ SIGSEGV,
+ SIGUSR2,
+ SIGPIPE,
+ SIGALRM,
+ SIGTERM,
+#if defined SIGSTKFLT
+ SIGSTKFLT,
+#else
+ 0,
+#endif
+ SIGCHLD,
+ SIGCONT,
+ SIGSTOP,
+ SIGTSTP,
+ SIGTTIN,
+ SIGTTOU,
+ SIGURG,
+ SIGXCPU,
+ SIGXFSZ,
+ SIGVTALRM,
+ SIGPROF,
+ SIGWINCH,
+ SIGIO,
+ SIGPWR,
+ SIGSYS,
+#if defined SIGEMT
+ SIGEMT,
+#endif
+};
+#endif
+
+char *strsignal(int signum)
+{
+ register char *s;
+ int i;
+ static char buf[_STRSIGNAL_BUFSIZE];
+ static const char unknown[] = {
+ 'U', 'n', 'k', 'n', 'o', 'w', 'n', ' ', 's', 'i', 'g', 'n', 'a', 'l', ' '
+ };
+
+#if defined(__alpha__) || defined(__mips__) || defined(__hppa__) || defined(__sparc__)
+ /* Need to translate signum to string index. */
+ for (i = 0; i < sizeof(sstridx)/sizeof(sstridx[0]); i++) {
+ if (sstridx[i] == signum) {
+ goto GOT_SSTRIDX;
+ }
+ }
+ i = INT_MAX; /* Failed. */
+ GOT_SSTRIDX:
+#else
+ /* No signum to string index translation needed. */
+ i = signum;
+#endif
+
+ if (((unsigned int) signum) < _SYS_NSIG) {
+ /* Trade time for space. This function should rarely be called
+ * so rather than keeping an array of pointers for the different
+ * messages, just run through the buffer until we find the
+ * correct string. */
+ for (s = (char *) _string_syssigmsgs; i; ++s) {
+ if (!*s) {
+ --i;
+ }
+ }
+ if (*s) { /* Make sure we have an actual message. */
+ goto DONE;
+ }
+ }
+
+ s = _int10tostr(buf + sizeof(buf)-1, signum) - sizeof(unknown);
+ memcpy(s, unknown, sizeof(unknown));
+
+ DONE:
+ return s;
+}
+
+#else /* __UCLIBC_HAS_SIGNUM_MESSAGES__ */
+
+char *strsignal(int signum)
+{
+ static char buf[_STRSIGNAL_BUFSIZE];
+ static const char unknown[] = {
+ 'U', 'n', 'k', 'n', 'o', 'w', 'n', ' ', 's', 'i', 'g', 'n', 'a', 'l', ' '
+ };
+
+ return memcpy(_int10tostr(buf + sizeof(buf)-1, signum) - sizeof(unknown),
+ unknown, sizeof(unknown));
+}
+
+#endif /* __UCLIBC_HAS_SIGNUM_MESSAGES__ */
+
+libc_hidden_def(strsignal)
diff --git a/ap/build/uClibc/libc/string/strspn.c b/ap/build/uClibc/libc/string/strspn.c
new file mode 100644
index 0000000..942b6f3
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strspn.c
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrspn wcsspn
+#else
+# define Wstrspn strspn
+#endif
+
+size_t Wstrspn(const Wchar *s1, const Wchar *s2)
+{
+ register const Wchar *s = s1;
+ register const Wchar *p = s2;
+
+ while (*p) {
+ if (*p++ == *s) {
+ ++s;
+ p = s2;
+ }
+ }
+ return s - s1;
+}
+libc_hidden_def(Wstrspn)
diff --git a/ap/build/uClibc/libc/string/strstr.c b/ap/build/uClibc/libc/string/strstr.c
new file mode 100644
index 0000000..7e2a64e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strstr.c
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrstr wcsstr
+#else
+# define Wstrstr strstr
+#endif
+
+/* NOTE: This is the simple-minded O(len(s1) * len(s2)) worst-case approach. */
+
+Wchar *Wstrstr(const Wchar *s1, const Wchar *s2)
+{
+ register const Wchar *s = s1;
+ register const Wchar *p = s2;
+
+ do {
+ if (!*p) {
+ return (Wchar *) s1;;
+ }
+ if (*p == *s) {
+ ++p;
+ ++s;
+ } else {
+ p = s2;
+ if (!*s) {
+ return NULL;
+ }
+ s = ++s1;
+ }
+ } while (1);
+}
+#ifndef WANT_WIDE
+libc_hidden_def(strstr)
+#elif defined __UCLIBC_SUSV3_LEGACY__
+strong_alias(wcsstr,wcswcs)
+#endif
diff --git a/ap/build/uClibc/libc/string/strtok.c b/ap/build/uClibc/libc/string/strtok.c
new file mode 100644
index 0000000..c337d81
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strtok.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#if 0 /*def WANT_WIDE*/
+# define Wstrtok wcstok
+# define Wstrtok_r wcstok_r
+#else
+# define Wstrtok strtok
+# define Wstrtok_r strtok_r
+#endif
+
+
+Wchar *Wstrtok(Wchar * __restrict s1, const Wchar * __restrict s2)
+{
+ static Wchar *next_start; /* Initialized to 0 since in bss. */
+ return Wstrtok_r(s1, s2, &next_start);
+}
+libc_hidden_def(Wstrtok)
diff --git a/ap/build/uClibc/libc/string/strtok_r.c b/ap/build/uClibc/libc/string/strtok_r.c
new file mode 100644
index 0000000..2026888
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strtok_r.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include "_string.h"
+
+#ifdef WANT_WIDE
+# define Wstrtok_r wcstok
+# define Wstrspn wcsspn
+# define Wstrpbrk wcspbrk
+#else
+# define Wstrtok_r strtok_r
+# define Wstrspn strspn
+# define Wstrpbrk strpbrk
+#endif
+
+Wchar *Wstrtok_r(Wchar * __restrict s1, const Wchar * __restrict s2,
+ Wchar ** __restrict next_start)
+{
+ register Wchar *s;
+ register Wchar *p;
+
+#if 1
+ if (((s = s1) != NULL) || ((s = *next_start) != NULL)) {
+ if (*(s += Wstrspn(s, s2))) {
+ if ((p = Wstrpbrk(s, s2)) != NULL) {
+ *p++ = 0;
+ }
+ } else {
+ p = s = NULL;
+ }
+ *next_start = p;
+ }
+ return s;
+#else
+ if (!(s = s1)) {
+ s = *next_start;
+ }
+ if (s && *(s += Wstrspn(s, s2))) {
+ if (*(p = s + Wstrcspn(s, s2))) {
+ *p++ = 0;
+ }
+ *next_start = p;
+ return s;
+ }
+ return NULL; /* TODO: set *next_start = NULL for safety? */
+#endif
+}
+
+#ifndef WANT_WIDE
+libc_hidden_def(strtok_r)
+#endif
diff --git a/ap/build/uClibc/libc/string/strverscmp.c b/ap/build/uClibc/libc/string/strverscmp.c
new file mode 100644
index 0000000..b19e8f0
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strverscmp.c
@@ -0,0 +1,118 @@
+/* GNU's strverscmp() function, taken from glibc 2.3.2 sources
+ */
+
+/* Compare strings while treating digits characters numerically.
+ Copyright (C) 1997, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
+
+ Derived work for uClibc by Hai Zaar, Codefidence Ltd <haizaar@codefidence.com>
+
+ 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 <string.h>
+#include <ctype.h>
+#include <stdint.h>
+
+
+/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
+ fractional parts, S_Z: idem but with leading Zeroes only */
+#define S_N 0x0
+#define S_I 0x4
+#define S_F 0x8
+#define S_Z 0xC
+
+/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
+#define CMP 2
+#define LEN 3
+
+/* using more efficient isdigit() */
+#undef isdigit
+#define isdigit(a) ((unsigned)((a) - '0') <= 9)
+
+/* Compare S1 and S2 as strings holding indices/version numbers,
+ returning less than, equal to or greater than zero if S1 is less than,
+ equal to or greater than S2 (for more info, see the texinfo doc).
+*/
+int strverscmp (const char *s1, const char *s2)
+{
+ const unsigned char *p1 = (const unsigned char *) s1;
+ const unsigned char *p2 = (const unsigned char *) s2;
+ unsigned char c1, c2;
+ int state;
+ int diff;
+
+ /* Symbol(s) 0 [1-9] others (padding)
+ Transition (10) 0 (01) d (00) x (11) - */
+ static const uint8_t next_state[] =
+ {
+ /* state x d 0 - */
+ /* S_N */ S_N, S_I, S_Z, S_N,
+ /* S_I */ S_N, S_I, S_I, S_I,
+ /* S_F */ S_N, S_F, S_F, S_F,
+ /* S_Z */ S_N, S_F, S_Z, S_Z
+ };
+
+ static const int8_t result_type[] =
+ {
+ /* state x/x x/d x/0 x/- d/x d/d d/0 d/-
+ 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */
+
+ /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
+ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
+ /* S_I */ CMP, -1, -1, CMP, +1, LEN, LEN, CMP,
+ +1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
+ /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
+ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
+ /* S_Z */ CMP, +1, +1, CMP, -1, CMP, CMP, CMP,
+ -1, CMP, CMP, CMP
+ };
+
+ if (p1 == p2)
+ return 0;
+
+ c1 = *p1++;
+ c2 = *p2++;
+ /* Hint: '0' is a digit too. */
+ state = S_N | ((c1 == '0') + (isdigit (c1) != 0));
+
+ while ((diff = c1 - c2) == 0 && c1 != '\0')
+ {
+ state = next_state[state];
+ c1 = *p1++;
+ c2 = *p2++;
+ state |= (c1 == '0') + (isdigit (c1) != 0);
+ }
+
+ state = result_type[state << 2 | (((c2 == '0') + (isdigit (c2) != 0)))];
+
+ switch (state)
+ {
+ case CMP:
+ return diff;
+
+ case LEN:
+ while (isdigit (*p1++))
+ if (!isdigit (*p2++))
+ return 1;
+
+ return isdigit (*p2) ? -1 : diff;
+
+ default:
+ return state;
+ }
+}
+libc_hidden_def(strverscmp)
diff --git a/ap/build/uClibc/libc/string/strxfrm.c b/ap/build/uClibc/libc/string/strxfrm.c
new file mode 100644
index 0000000..037d47b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strxfrm.c
@@ -0,0 +1,9 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#define L_strxfrm
+#include "_collate.c"
diff --git a/ap/build/uClibc/libc/string/strxfrm_l.c b/ap/build/uClibc/libc/string/strxfrm_l.c
new file mode 100644
index 0000000..85e1cdf
--- /dev/null
+++ b/ap/build/uClibc/libc/string/strxfrm_l.c
@@ -0,0 +1,10 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#define __UCLIBC_DO_XLOCALE
+#define L_strxfrm_l
+#include "_collate.c"
diff --git a/ap/build/uClibc/libc/string/sys_errlist.c b/ap/build/uClibc/libc/string/sys_errlist.c
new file mode 100644
index 0000000..17ed4d6
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sys_errlist.c
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+#include <errno.h>
+
+extern const char _string_syserrmsgs[] attribute_hidden;
+
+#ifdef __UCLIBC_HAS_SYS_ERRLIST__
+
+link_warning(_sys_errlist, "sys_nerr and sys_errlist are obsolete and uClibc support for them (in at least some configurations) will probably be unavailable in the near future.")
+
+const char *const sys_errlist[] = {
+ [0] = _string_syserrmsgs + 0,
+ [EPERM] = _string_syserrmsgs + 8,
+ [ENOENT] = _string_syserrmsgs + 32,
+ [ESRCH] = _string_syserrmsgs + 58,
+ [EINTR] = _string_syserrmsgs + 74,
+ [EIO] = _string_syserrmsgs + 98,
+ [ENXIO] = _string_syserrmsgs + 117,
+ [E2BIG] = _string_syserrmsgs + 143,
+ [ENOEXEC] = _string_syserrmsgs + 166,
+ [EBADF] = _string_syserrmsgs + 184,
+ [ECHILD] = _string_syserrmsgs + 204,
+ [EAGAIN] = _string_syserrmsgs + 223,
+ [ENOMEM] = _string_syserrmsgs + 256,
+ [EACCES] = _string_syserrmsgs + 279,
+ [EFAULT] = _string_syserrmsgs + 297,
+ [ENOTBLK] = _string_syserrmsgs + 309,
+ [EBUSY] = _string_syserrmsgs + 331,
+ [EEXIST] = _string_syserrmsgs + 355,
+ [EXDEV] = _string_syserrmsgs + 367,
+ [ENODEV] = _string_syserrmsgs + 393,
+ [ENOTDIR] = _string_syserrmsgs + 408,
+ [EISDIR] = _string_syserrmsgs + 424,
+ [EINVAL] = _string_syserrmsgs + 439,
+ [ENFILE] = _string_syserrmsgs + 456,
+ [EMFILE] = _string_syserrmsgs + 486,
+ [ENOTTY] = _string_syserrmsgs + 506,
+ [ETXTBSY] = _string_syserrmsgs + 537,
+ [EFBIG] = _string_syserrmsgs + 552,
+ [ENOSPC] = _string_syserrmsgs + 567,
+ [ESPIPE] = _string_syserrmsgs + 591,
+ [EROFS] = _string_syserrmsgs + 604,
+ [EMLINK] = _string_syserrmsgs + 626,
+ [EPIPE] = _string_syserrmsgs + 641,
+ [EDOM] = _string_syserrmsgs + 653,
+ [ERANGE] = _string_syserrmsgs + 686,
+ [EDEADLK] = _string_syserrmsgs + 716,
+ [ENAMETOOLONG] = _string_syserrmsgs + 742,
+ [ENOLCK] = _string_syserrmsgs + 761,
+ [ENOSYS] = _string_syserrmsgs + 780,
+ [ENOTEMPTY] = _string_syserrmsgs + 805,
+ [ELOOP] = _string_syserrmsgs + 825,
+ /* _string_syserrmsgs + 859, */
+ [ENOMSG] = _string_syserrmsgs + 860,
+ [EIDRM] = _string_syserrmsgs + 887,
+ [ECHRNG] = _string_syserrmsgs + 906,
+ [EL2NSYNC] = _string_syserrmsgs + 934,
+ [EL3HLT] = _string_syserrmsgs + 959,
+ [EL3RST] = _string_syserrmsgs + 974,
+ [ELNRNG] = _string_syserrmsgs + 988,
+ [EUNATCH] = _string_syserrmsgs + 1013,
+ [ENOCSI] = _string_syserrmsgs + 1042,
+ [EL2HLT] = _string_syserrmsgs + 1069,
+ [EBADE] = _string_syserrmsgs + 1084,
+ [EBADR] = _string_syserrmsgs + 1101,
+ [EXFULL] = _string_syserrmsgs + 1128,
+ [ENOANO] = _string_syserrmsgs + 1142,
+ [EBADRQC] = _string_syserrmsgs + 1151,
+ [EBADSLT] = _string_syserrmsgs + 1172,
+ /* _string_syserrmsgs + 1185, */
+ [EBFONT] = _string_syserrmsgs + 1186,
+ [ENOSTR] = _string_syserrmsgs + 1207,
+ [ENODATA] = _string_syserrmsgs + 1227,
+ [ETIME] = _string_syserrmsgs + 1245,
+ [ENOSR] = _string_syserrmsgs + 1259,
+ [ENONET] = _string_syserrmsgs + 1284,
+ [ENOPKG] = _string_syserrmsgs + 1314,
+ [EREMOTE] = _string_syserrmsgs + 1336,
+ [ENOLINK] = _string_syserrmsgs + 1353,
+ [EADV] = _string_syserrmsgs + 1375,
+ [ESRMNT] = _string_syserrmsgs + 1391,
+ [ECOMM] = _string_syserrmsgs + 1405,
+ [EPROTO] = _string_syserrmsgs + 1433,
+ [EMULTIHOP] = _string_syserrmsgs + 1448,
+ [EDOTDOT] = _string_syserrmsgs + 1467,
+ [EBADMSG] = _string_syserrmsgs + 1486,
+ [EOVERFLOW] = _string_syserrmsgs + 1498,
+ [ENOTUNIQ] = _string_syserrmsgs + 1536,
+ [EBADFD] = _string_syserrmsgs + 1563,
+ [EREMCHG] = _string_syserrmsgs + 1592,
+ [ELIBACC] = _string_syserrmsgs + 1615,
+ [ELIBBAD] = _string_syserrmsgs + 1654,
+ [ELIBSCN] = _string_syserrmsgs + 1691,
+ [ELIBMAX] = _string_syserrmsgs + 1723,
+ [ELIBEXEC] = _string_syserrmsgs + 1771,
+ [EILSEQ] = _string_syserrmsgs + 1809,
+ [ERESTART] = _string_syserrmsgs + 1859,
+ [ESTRPIPE] = _string_syserrmsgs + 1903,
+ [EUSERS] = _string_syserrmsgs + 1922,
+ [ENOTSOCK] = _string_syserrmsgs + 1937,
+ [EDESTADDRREQ] = _string_syserrmsgs + 1968,
+ [EMSGSIZE] = _string_syserrmsgs + 1997,
+ [EPROTOTYPE] = _string_syserrmsgs + 2014,
+ [ENOPROTOOPT] = _string_syserrmsgs + 2045,
+ [EPROTONOSUPPORT] = _string_syserrmsgs + 2068,
+ [ESOCKTNOSUPPORT] = _string_syserrmsgs + 2091,
+ [EOPNOTSUPP] = _string_syserrmsgs + 2117,
+ [EPFNOSUPPORT] = _string_syserrmsgs + 2141,
+ [EAFNOSUPPORT] = _string_syserrmsgs + 2171,
+ [EADDRINUSE] = _string_syserrmsgs + 2212,
+ [EADDRNOTAVAIL] = _string_syserrmsgs + 2235,
+ [ENETDOWN] = _string_syserrmsgs + 2267,
+ [ENETUNREACH] = _string_syserrmsgs + 2283,
+ [ENETRESET] = _string_syserrmsgs + 2306,
+ [ECONNABORTED] = _string_syserrmsgs + 2342,
+ [ECONNRESET] = _string_syserrmsgs + 2375,
+ [ENOBUFS] = _string_syserrmsgs + 2400,
+ [EISCONN] = _string_syserrmsgs + 2426,
+ [ENOTCONN] = _string_syserrmsgs + 2466,
+ [ESHUTDOWN] = _string_syserrmsgs + 2502,
+ [ETOOMANYREFS] = _string_syserrmsgs + 2548,
+ [ETIMEDOUT] = _string_syserrmsgs + 2583,
+ [ECONNREFUSED] = _string_syserrmsgs + 2604,
+ [EHOSTDOWN] = _string_syserrmsgs + 2623,
+ [EHOSTUNREACH] = _string_syserrmsgs + 2636,
+ [EALREADY] = _string_syserrmsgs + 2653,
+ [EINPROGRESS] = _string_syserrmsgs + 2683,
+ [ESTALE] = _string_syserrmsgs + 2709,
+ [EUCLEAN] = _string_syserrmsgs + 2731,
+ [ENOTNAM] = _string_syserrmsgs + 2756,
+ [ENAVAIL] = _string_syserrmsgs + 2784,
+ [EISNAM] = _string_syserrmsgs + 2814,
+ [EREMOTEIO] = _string_syserrmsgs + 2835,
+ [EDQUOT] = _string_syserrmsgs + 2852,
+ [ENOMEDIUM] = _string_syserrmsgs + 2872,
+ [EMEDIUMTYPE] = _string_syserrmsgs + 2888,
+
+#if EDEADLOCK != EDEADLK
+ [EDEADLOCK] = _string_syserrmsgs + 2906,
+#endif
+
+#if EWOULDBLOCK != EAGAIN
+#error EWOULDBLOCK does not equal EAGAIN
+#endif
+
+ /* For now, ignore the other arch-specific errors. glibc only maps EPROCLIM. */
+
+ /* some other mips errors */
+#ifdef ECANCELED
+#endif
+#ifdef EINIT
+#endif
+#ifdef EREMDEV
+#endif
+
+ /* some other sparc errors */
+#ifdef EPROCLIM
+#endif
+#ifdef ERREMOTE
+#endif
+};
+
+int sys_nerr = sizeof(sys_errlist)/sizeof(sys_errlist[0]);
+
+#endif
diff --git a/ap/build/uClibc/libc/string/sys_siglist.c b/ap/build/uClibc/libc/string/sys_siglist.c
new file mode 100644
index 0000000..8443375
--- /dev/null
+++ b/ap/build/uClibc/libc/string/sys_siglist.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2002 Manuel Novoa III
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <features.h>
+#define __need_NULL
+#include <stddef.h>
+#include <signal.h>
+
+extern const char _string_syssigmsgs[] attribute_hidden;
+
+#ifdef __UCLIBC_HAS_SYS_SIGLIST__
+
+const char *const sys_siglist[_NSIG] = {
+ [0] = NULL,
+ [SIGHUP] = _string_syssigmsgs + 1,
+ [SIGINT] = _string_syssigmsgs + 8,
+ [SIGQUIT] = _string_syssigmsgs + 18,
+ [SIGILL] = _string_syssigmsgs + 23,
+ [SIGTRAP] = _string_syssigmsgs + 43,
+ [SIGABRT] = _string_syssigmsgs + 65,
+ [SIGBUS] = _string_syssigmsgs + 73,
+ [SIGFPE] = _string_syssigmsgs + 83,
+ [SIGKILL] = _string_syssigmsgs + 108,
+ [SIGUSR1] = _string_syssigmsgs + 115,
+ [SIGSEGV] = _string_syssigmsgs + 137,
+ [SIGUSR2] = _string_syssigmsgs + 156,
+ [SIGPIPE] = _string_syssigmsgs + 178,
+ [SIGALRM] = _string_syssigmsgs + 190,
+ [SIGTERM] = _string_syssigmsgs + 202,
+#if defined SIGSTKFLT /* not all arches define this, yeah ! */
+ [SIGSTKFLT] = _string_syssigmsgs + 213,
+#endif
+ [SIGCHLD] = _string_syssigmsgs + 225,
+ [SIGCONT] = _string_syssigmsgs + 238,
+ [SIGSTOP] = _string_syssigmsgs + 248,
+ [SIGTSTP] = _string_syssigmsgs + 265,
+ [SIGTTIN] = _string_syssigmsgs + 273,
+ [SIGTTOU] = _string_syssigmsgs + 293,
+ [SIGURG] = _string_syssigmsgs + 314,
+ [SIGXCPU] = _string_syssigmsgs + 335,
+ [SIGXFSZ] = _string_syssigmsgs + 359,
+ [SIGVTALRM] = _string_syssigmsgs + 384,
+ [SIGPROF] = _string_syssigmsgs + 406,
+ [SIGWINCH] = _string_syssigmsgs + 430,
+ [SIGIO] = _string_syssigmsgs + 445,
+ [SIGPWR] = _string_syssigmsgs + 458,
+ [SIGSYS] = _string_syssigmsgs + 472,
+#if defined SIGEMT /* only some arches define this, yeah ! */
+ [SIGEMT] = _string_syssigmsgs + 488,
+#endif
+};
+
+#endif
diff --git a/ap/build/uClibc/libc/string/wcpcpy.c b/ap/build/uClibc/libc/string/wcpcpy.c
new file mode 100644
index 0000000..b4fc8e6
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcpcpy.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "stpcpy.c"
diff --git a/ap/build/uClibc/libc/string/wcpncpy.c b/ap/build/uClibc/libc/string/wcpncpy.c
new file mode 100644
index 0000000..c5e5a76
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcpncpy.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "stpncpy.c"
diff --git a/ap/build/uClibc/libc/string/wcscasecmp.c b/ap/build/uClibc/libc/string/wcscasecmp.c
new file mode 100644
index 0000000..95291b1
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcscasecmp.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strcasecmp.c"
diff --git a/ap/build/uClibc/libc/string/wcscasecmp_l.c b/ap/build/uClibc/libc/string/wcscasecmp_l.c
new file mode 100644
index 0000000..99e5723
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcscasecmp_l.c
@@ -0,0 +1,9 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#define __UCLIBC_DO_XLOCALE
+#include "strcasecmp.c"
diff --git a/ap/build/uClibc/libc/string/wcscat.c b/ap/build/uClibc/libc/string/wcscat.c
new file mode 100644
index 0000000..36b4b63
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcscat.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strcat.c"
diff --git a/ap/build/uClibc/libc/string/wcschr.c b/ap/build/uClibc/libc/string/wcschr.c
new file mode 100644
index 0000000..d16650a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcschr.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strchr.c"
diff --git a/ap/build/uClibc/libc/string/wcschrnul.c b/ap/build/uClibc/libc/string/wcschrnul.c
new file mode 100644
index 0000000..dc1b1bc
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcschrnul.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strchrnul.c"
diff --git a/ap/build/uClibc/libc/string/wcscmp.c b/ap/build/uClibc/libc/string/wcscmp.c
new file mode 100644
index 0000000..a33ed83
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcscmp.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strcmp.c"
diff --git a/ap/build/uClibc/libc/string/wcscpy.c b/ap/build/uClibc/libc/string/wcscpy.c
new file mode 100644
index 0000000..3479984
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcscpy.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strcpy.c"
diff --git a/ap/build/uClibc/libc/string/wcscspn.c b/ap/build/uClibc/libc/string/wcscspn.c
new file mode 100644
index 0000000..945ecef
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcscspn.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strcspn.c"
diff --git a/ap/build/uClibc/libc/string/wcsdup.c b/ap/build/uClibc/libc/string/wcsdup.c
new file mode 100644
index 0000000..8885a2b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsdup.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strdup.c"
diff --git a/ap/build/uClibc/libc/string/wcslcpy.c b/ap/build/uClibc/libc/string/wcslcpy.c
new file mode 100644
index 0000000..f62ea14
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcslcpy.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strlcpy.c"
diff --git a/ap/build/uClibc/libc/string/wcslen.c b/ap/build/uClibc/libc/string/wcslen.c
new file mode 100644
index 0000000..ac4637e
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcslen.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strlen.c"
diff --git a/ap/build/uClibc/libc/string/wcsncasecmp.c b/ap/build/uClibc/libc/string/wcsncasecmp.c
new file mode 100644
index 0000000..230efda
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsncasecmp.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strncasecmp.c"
diff --git a/ap/build/uClibc/libc/string/wcsncasecmp_l.c b/ap/build/uClibc/libc/string/wcsncasecmp_l.c
new file mode 100644
index 0000000..acdb26b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsncasecmp_l.c
@@ -0,0 +1,9 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#define __UCLIBC_DO_XLOCALE
+#include "strncasecmp.c"
diff --git a/ap/build/uClibc/libc/string/wcsncat.c b/ap/build/uClibc/libc/string/wcsncat.c
new file mode 100644
index 0000000..776f1b7
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsncat.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strncat.c"
diff --git a/ap/build/uClibc/libc/string/wcsncmp.c b/ap/build/uClibc/libc/string/wcsncmp.c
new file mode 100644
index 0000000..224844f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsncmp.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strncmp.c"
diff --git a/ap/build/uClibc/libc/string/wcsncpy.c b/ap/build/uClibc/libc/string/wcsncpy.c
new file mode 100644
index 0000000..ac267e8
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsncpy.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strncpy.c"
diff --git a/ap/build/uClibc/libc/string/wcsnlen.c b/ap/build/uClibc/libc/string/wcsnlen.c
new file mode 100644
index 0000000..917a2c9
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsnlen.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strnlen.c"
diff --git a/ap/build/uClibc/libc/string/wcspbrk.c b/ap/build/uClibc/libc/string/wcspbrk.c
new file mode 100644
index 0000000..b416f7c
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcspbrk.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strpbrk.c"
diff --git a/ap/build/uClibc/libc/string/wcsrchr.c b/ap/build/uClibc/libc/string/wcsrchr.c
new file mode 100644
index 0000000..3290820
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsrchr.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strrchr.c"
diff --git a/ap/build/uClibc/libc/string/wcsspn.c b/ap/build/uClibc/libc/string/wcsspn.c
new file mode 100644
index 0000000..9716315
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsspn.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strspn.c"
diff --git a/ap/build/uClibc/libc/string/wcsstr.c b/ap/build/uClibc/libc/string/wcsstr.c
new file mode 100644
index 0000000..69a94e5
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsstr.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strstr.c"
diff --git a/ap/build/uClibc/libc/string/wcstok.c b/ap/build/uClibc/libc/string/wcstok.c
new file mode 100644
index 0000000..591c214
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcstok.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "strtok_r.c"
diff --git a/ap/build/uClibc/libc/string/wcsxfrm.c b/ap/build/uClibc/libc/string/wcsxfrm.c
new file mode 100644
index 0000000..8b37495
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsxfrm.c
@@ -0,0 +1,9 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#define L_wcsxfrm
+#include "_collate.c"
diff --git a/ap/build/uClibc/libc/string/wcsxfrm_l.c b/ap/build/uClibc/libc/string/wcsxfrm_l.c
new file mode 100644
index 0000000..67e2f17
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wcsxfrm_l.c
@@ -0,0 +1,10 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#define __UCLIBC_DO_XLOCALE
+#define L_wcsxfrm_l
+#include "_collate.c"
diff --git a/ap/build/uClibc/libc/string/wmemchr.c b/ap/build/uClibc/libc/string/wmemchr.c
new file mode 100644
index 0000000..f4069e4
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wmemchr.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "memchr.c"
diff --git a/ap/build/uClibc/libc/string/wmemcmp.c b/ap/build/uClibc/libc/string/wmemcmp.c
new file mode 100644
index 0000000..9168705
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wmemcmp.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "memcmp.c"
diff --git a/ap/build/uClibc/libc/string/wmemcpy.c b/ap/build/uClibc/libc/string/wmemcpy.c
new file mode 100644
index 0000000..6991ece
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wmemcpy.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "memcpy.c"
diff --git a/ap/build/uClibc/libc/string/wmemmove.c b/ap/build/uClibc/libc/string/wmemmove.c
new file mode 100644
index 0000000..1727049
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wmemmove.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "memmove.c"
diff --git a/ap/build/uClibc/libc/string/wmempcpy.c b/ap/build/uClibc/libc/string/wmempcpy.c
new file mode 100644
index 0000000..d995a80
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wmempcpy.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "mempcpy.c"
diff --git a/ap/build/uClibc/libc/string/wmemset.c b/ap/build/uClibc/libc/string/wmemset.c
new file mode 100644
index 0000000..0efe178
--- /dev/null
+++ b/ap/build/uClibc/libc/string/wmemset.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define WANT_WIDE
+#include "memset.c"
diff --git a/ap/build/uClibc/libc/string/x86_64/Makefile b/ap/build/uClibc/libc/string/x86_64/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/x86_64/_glibc_inc.h b/ap/build/uClibc/libc/string/x86_64/_glibc_inc.h
new file mode 100644
index 0000000..415ce90
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/_glibc_inc.h
@@ -0,0 +1,21 @@
+/*
+ * Setup some glibc defines so we can just drop in the
+ * asm files from glibc without any modification.
+ */
+
+#include <features.h>
+#include <bits/wordsize.h>
+
+#define ENTRY(sym) \
+ .global sym; \
+ .type sym,%function; \
+ sym:
+
+#define BP_SYM(sym) sym
+
+#define L(sym) LOC(sym)
+#define LOC(sym) \
+ .L ## sym
+
+#define END(sym) \
+ .size sym,.-sym;
diff --git a/ap/build/uClibc/libc/string/x86_64/bzero.S b/ap/build/uClibc/libc/string/x86_64/bzero.S
new file mode 100644
index 0000000..231d7cb
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/bzero.S
@@ -0,0 +1,6 @@
+#include <features.h>
+#ifdef __UCLIBC_SUSV3_LEGACY__
+# define memset bzero
+# define __memset_chk __bzero_chk
+# include "memset.S"
+#endif
diff --git a/ap/build/uClibc/libc/string/x86_64/memcpy.S b/ap/build/uClibc/libc/string/x86_64/memcpy.S
new file mode 100644
index 0000000..9c8169b
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/memcpy.S
@@ -0,0 +1,98 @@
+/* Highly optimized version for x86-64.
+ Copyright (C) 1997, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on i586 version contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
+
+ 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 "_glibc_inc.h"
+
+/* BEWARE: `#ifdef memcpy' means that memcpy is redefined as `mempcpy',
+ and the return value is the byte after the last one copied in
+ the destination. */
+#define MEMPCPY_P (defined memcpy)
+
+ .text
+#if defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__
+ENTRY (__memcpy_chk)
+ cmpq %rdx, %rcx
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+END (__memcpy_chk)
+#endif
+ENTRY (BP_SYM (memcpy))
+ /* Cutoff for the big loop is a size of 32 bytes since otherwise
+ the loop will never be entered. */
+ cmpq $32, %rdx
+ movq %rdx, %rcx
+#if !MEMPCPY_P
+ movq %rdi, %r10 /* Save value. */
+#endif
+
+ /* We need this in any case. */
+ cld
+
+ jbe 1f
+
+ /* Align destination. */
+ movq %rdi, %rax
+ negq %rax
+ andq $7, %rax
+ subq %rax, %rcx
+ xchgq %rax, %rcx
+
+ rep; movsb
+
+ movq %rax, %rcx
+ subq $32, %rcx
+ js 2f
+
+ /* Next 3 insns are 11 bytes total, make sure we decode them in one go */
+ .p2align 4,,11
+3:
+ /* Now correct the loop counter. Please note that in the following
+ code the flags are not changed anymore. */
+ subq $32, %rcx
+
+ movq (%rsi), %rax
+ movq 8(%rsi), %rdx
+ movq 16(%rsi), %r8
+ movq 24(%rsi), %r9
+ movq %rax, (%rdi)
+ movq %rdx, 8(%rdi)
+ movq %r8, 16(%rdi)
+ movq %r9, 24(%rdi)
+
+ leaq 32(%rsi), %rsi
+ leaq 32(%rdi), %rdi
+
+ jns 3b
+
+ /* Correct extra loop counter modification. */
+2: addq $32, %rcx
+1: rep; movsb
+
+#if MEMPCPY_P
+ movq %rdi, %rax /* Set return value. */
+#else
+ movq %r10, %rax /* Set return value. */
+
+#endif
+ ret
+
+END (BP_SYM (memcpy))
+#if !MEMPCPY_P
+libc_hidden_def(memcpy)
+#endif
diff --git a/ap/build/uClibc/libc/string/x86_64/mempcpy.S b/ap/build/uClibc/libc/string/x86_64/mempcpy.S
new file mode 100644
index 0000000..b0607aa
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/mempcpy.S
@@ -0,0 +1,4 @@
+#define memcpy mempcpy
+#define __memcpy_chk __mempcpy_chk
+#include "memcpy.S"
+libc_hidden_def(mempcpy)
diff --git a/ap/build/uClibc/libc/string/x86_64/memset.S b/ap/build/uClibc/libc/string/x86_64/memset.S
new file mode 100644
index 0000000..6b758ce
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/memset.S
@@ -0,0 +1,147 @@
+/* memset/bzero -- set memory area to CH/0
+ Optimized version for x86-64.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>.
+
+ 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 "_glibc_inc.h"
+
+/* BEWARE: `#ifdef memset' means that memset is redefined as `bzero' */
+#define BZERO_P (defined memset)
+
+/* This is somehow experimental and could made dependend on the cache
+ size. */
+#define LARGE $120000
+
+ .text
+#if defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__
+ENTRY (__memset_chk)
+ cmpq %rdx, %rcx
+ jb HIDDEN_JUMPTARGET (__chk_fail)
+END (__memset_chk)
+#endif
+ENTRY (memset)
+#if BZERO_P
+ mov %rsi,%rdx /* Adjust parameter. */
+ xorl %esi,%esi /* Fill with 0s. */
+#endif
+ cmp $0x7,%rdx /* Check for small length. */
+ mov %rdi,%rcx /* Save ptr as return value. */
+ jbe 7f
+
+#if BZERO_P
+ mov %rsi,%r8 /* Just copy 0. */
+#else
+ /* Populate 8 bit data to full 64-bit. */
+ movabs $0x0101010101010101,%r8
+ movzbl %sil,%eax
+ imul %rax,%r8
+#endif
+ test $0x7,%edi /* Check for alignment. */
+ jz 2f
+
+ /* Next 3 insns are 9 bytes total, make sure we decode them in one go */
+ .p2align 4,,9
+1:
+ /* Align ptr to 8 byte. */
+ mov %sil,(%rcx)
+ dec %rdx
+ inc %rcx
+ test $0x7,%cl
+ jnz 1b
+
+2: /* Check for really large regions. */
+ mov %rdx,%rax
+ shr $0x6,%rax
+ je 4f
+ cmp LARGE, %rdx
+ jae 11f
+
+ /* Next 3 insns are 11 bytes total, make sure we decode them in one go */
+ .p2align 4,,11
+3:
+ /* Fill 64 bytes. */
+ mov %r8,(%rcx)
+ mov %r8,0x8(%rcx)
+ mov %r8,0x10(%rcx)
+ mov %r8,0x18(%rcx)
+ mov %r8,0x20(%rcx)
+ mov %r8,0x28(%rcx)
+ mov %r8,0x30(%rcx)
+ mov %r8,0x38(%rcx)
+ add $0x40,%rcx
+ dec %rax
+ jne 3b
+
+4: /* Fill final bytes. */
+ and $0x3f,%edx
+ mov %rdx,%rax
+ shr $0x3,%rax
+ je 6f
+
+5: /* First in chunks of 8 bytes. */
+ mov %r8,(%rcx)
+ add $0x8,%rcx
+ dec %rax
+ jne 5b
+6:
+ and $0x7,%edx
+7:
+ test %rdx,%rdx
+ je 9f
+8: /* And finally as bytes (up to 7). */
+ mov %sil,(%rcx)
+ inc %rcx
+ dec %rdx
+ jne 8b
+9:
+#if BZERO_P
+ /* nothing */
+#else
+ /* Load result (only if used as memset). */
+ mov %rdi,%rax /* start address of destination is result */
+#endif
+ retq
+
+ /* Next 3 insns are 14 bytes total, make sure we decode them in one go */
+ .p2align 4,,14
+11:
+ /* Fill 64 bytes without polluting the cache. */
+ /* We could use movntdq %xmm0,(%rcx) here to further
+ speed up for large cases but let's not use XMM registers. */
+ movnti %r8,(%rcx)
+ movnti %r8,0x8(%rcx)
+ movnti %r8,0x10(%rcx)
+ movnti %r8,0x18(%rcx)
+ movnti %r8,0x20(%rcx)
+ movnti %r8,0x28(%rcx)
+ movnti %r8,0x30(%rcx)
+ movnti %r8,0x38(%rcx)
+ add $0x40,%rcx
+ dec %rax
+ jne 11b
+ jmp 4b
+
+END (memset)
+#if !BZERO_P
+libc_hidden_def(memset)
+#endif
+
+#if !BZERO_P && defined __PIC__ && !defined NOT_IN_libc && defined __UCLIBC_HAS_FORTIFY__
+strong_alias (__memset_chk, __memset_zero_constant_len_parameter)
+#endif
diff --git a/ap/build/uClibc/libc/string/x86_64/stpcpy.S b/ap/build/uClibc/libc/string/x86_64/stpcpy.S
new file mode 100644
index 0000000..138d0fb
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/stpcpy.S
@@ -0,0 +1,4 @@
+#define USE_AS_STPCPY
+#define STRCPY stpcpy
+#include "strcpy.S"
+libc_hidden_def(stpcpy)
diff --git a/ap/build/uClibc/libc/string/x86_64/strcat.S b/ap/build/uClibc/libc/string/x86_64/strcat.S
new file mode 100644
index 0000000..23d068f
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/strcat.S
@@ -0,0 +1,268 @@
+/* strcat(dest, src) -- Append SRC on the end of DEST.
+ Optimized for x86-64.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 2002.
+
+ 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 "_glibc_inc.h"
+
+/* Seems to be unrolled too much */
+
+ .text
+ENTRY (BP_SYM (strcat))
+ movq %rdi, %rcx /* Dest. register. */
+ andl $7, %ecx /* mask alignment bits */
+ movq %rdi, %rax /* Duplicate destination pointer. */
+ movq $0xfefefefefefefeff,%r8
+
+ /* First step: Find end of destination. */
+ jz 4f /* aligned => start loop */
+
+ neg %ecx /* We need to align to 8 bytes. */
+ addl $8,%ecx
+ /* Search the first bytes directly. */
+0: cmpb $0x0,(%rax) /* is byte NUL? */
+ je 2f /* yes => start copy */
+ incq %rax /* increment pointer */
+ decl %ecx
+ jnz 0b
+
+
+
+ /* Now the source is aligned. Scan for NUL byte. */
+
+ /* Next 3 insns are 10 bytes total, make sure we decode them in one go */
+ .p2align 4,,10
+4:
+ /* First unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 3f /* found NUL => return pointer */
+
+ /* Second unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 3f /* found NUL => return pointer */
+
+ /* Third unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 3f /* found NUL => return pointer */
+
+ /* Fourth unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jz 4b /* no NUL found => continue loop */
+
+ /* Align, it is a jump target. */
+ /* Next 3 insns are 8 bytes total, make sure we decode them in one go */
+ .p2align 3,,8
+3:
+ subq $8,%rax /* correct pointer increment. */
+
+ testb %cl, %cl /* is first byte NUL? */
+ jz 2f /* yes => return */
+ incq %rax /* increment pointer */
+
+ testb %ch, %ch /* is second byte NUL? */
+ jz 2f /* yes => return */
+ incq %rax /* increment pointer */
+
+ testl $0x00ff0000, %ecx /* is third byte NUL? */
+ jz 2f /* yes => return pointer */
+ incq %rax /* increment pointer */
+
+ testl $0xff000000, %ecx /* is fourth byte NUL? */
+ jz 2f /* yes => return pointer */
+ incq %rax /* increment pointer */
+
+ shrq $32, %rcx /* look at other half. */
+
+ testb %cl, %cl /* is first byte NUL? */
+ jz 2f /* yes => return */
+ incq %rax /* increment pointer */
+
+ testb %ch, %ch /* is second byte NUL? */
+ jz 2f /* yes => return */
+ incq %rax /* increment pointer */
+
+ testl $0xff0000, %ecx /* is third byte NUL? */
+ jz 2f /* yes => return pointer */
+ incq %rax /* increment pointer */
+
+2:
+ /* Second step: Copy source to destination. */
+
+ movq %rsi, %rcx /* duplicate */
+ andl $7,%ecx /* mask alignment bits */
+ movq %rax, %rdx /* move around */
+ jz 22f /* aligned => start loop */
+
+ neg %ecx /* align to 8 bytes. */
+ addl $8, %ecx
+ /* Align the source pointer. */
+21:
+ movb (%rsi), %al /* Fetch a byte */
+ testb %al, %al /* Is it NUL? */
+ movb %al, (%rdx) /* Store it */
+ jz 24f /* If it was NUL, done! */
+ incq %rsi
+ incq %rdx
+ decl %ecx
+ jnz 21b
+
+ /* Now the sources is aligned. Unfortunatly we cannot force
+ to have both source and destination aligned, so ignore the
+ alignment of the destination. */
+
+ /* Next 3 insns are 10 bytes total, make sure we decode them in one go */
+ .p2align 4,,10
+22:
+ /* 1st unroll. */
+ movq (%rsi), %rax /* Read double word (8 bytes). */
+ addq $8, %rsi /* Adjust pointer for next word. */
+ movq %rax, %r9 /* Save a copy for NUL finding. */
+ addq %r8, %r9 /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 23f /* highest byte is NUL => return pointer */
+ xorq %rax, %r9 /* (word+magic)^word */
+ orq %r8, %r9 /* set all non-carry bits */
+ incq %r9 /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+
+ jnz 23f /* found NUL => return pointer */
+
+ movq %rax, (%rdx) /* Write value to destination. */
+ addq $8, %rdx /* Adjust pointer. */
+
+ /* 2nd unroll. */
+ movq (%rsi), %rax /* Read double word (8 bytes). */
+ addq $8, %rsi /* Adjust pointer for next word. */
+ movq %rax, %r9 /* Save a copy for NUL finding. */
+ addq %r8, %r9 /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 23f /* highest byte is NUL => return pointer */
+ xorq %rax, %r9 /* (word+magic)^word */
+ orq %r8, %r9 /* set all non-carry bits */
+ incq %r9 /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+
+ jnz 23f /* found NUL => return pointer */
+
+ movq %rax, (%rdx) /* Write value to destination. */
+ addq $8, %rdx /* Adjust pointer. */
+
+ /* 3rd unroll. */
+ movq (%rsi), %rax /* Read double word (8 bytes). */
+ addq $8, %rsi /* Adjust pointer for next word. */
+ movq %rax, %r9 /* Save a copy for NUL finding. */
+ addq %r8, %r9 /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 23f /* highest byte is NUL => return pointer */
+ xorq %rax, %r9 /* (word+magic)^word */
+ orq %r8, %r9 /* set all non-carry bits */
+ incq %r9 /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+
+ jnz 23f /* found NUL => return pointer */
+
+ movq %rax, (%rdx) /* Write value to destination. */
+ addq $8, %rdx /* Adjust pointer. */
+
+ /* 4th unroll. */
+ movq (%rsi), %rax /* Read double word (8 bytes). */
+ addq $8, %rsi /* Adjust pointer for next word. */
+ movq %rax, %r9 /* Save a copy for NUL finding. */
+ addq %r8, %r9 /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 23f /* highest byte is NUL => return pointer */
+ xorq %rax, %r9 /* (word+magic)^word */
+ orq %r8, %r9 /* set all non-carry bits */
+ incq %r9 /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+
+ jnz 23f /* found NUL => return pointer */
+
+ movq %rax, (%rdx) /* Write value to destination. */
+ addq $8, %rdx /* Adjust pointer. */
+ jmp 22b /* Next iteration. */
+
+ /* Do the last few bytes. %rax contains the value to write.
+ The loop is unrolled twice. */
+
+ /* Next 3 insns are 6 bytes total, make sure we decode them in one go */
+ .p2align 3,,6
+23:
+ movb %al, (%rdx) /* 1st byte. */
+ testb %al, %al /* Is it NUL. */
+ jz 24f /* yes, finish. */
+ incq %rdx /* Increment destination. */
+ movb %ah, (%rdx) /* 2nd byte. */
+ testb %ah, %ah /* Is it NUL?. */
+ jz 24f /* yes, finish. */
+ incq %rdx /* Increment destination. */
+ shrq $16, %rax /* Shift... */
+ jmp 23b /* and look at next two bytes in %rax. */
+
+
+24:
+ movq %rdi, %rax /* Source is return value. */
+ retq
+END (BP_SYM (strcat))
+
+libc_hidden_def(strcat)
diff --git a/ap/build/uClibc/libc/string/x86_64/strchr.S b/ap/build/uClibc/libc/string/x86_64/strchr.S
new file mode 100644
index 0000000..9ef46b7
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/strchr.S
@@ -0,0 +1,295 @@
+/* strchr (str, ch) -- Return pointer to first occurrence of CH in STR.
+ For AMD x86-64.
+ Copyright (C) 2002, 2005 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 "_glibc_inc.h"
+
+/* Seems to be unrolled too much */
+
+ .text
+ENTRY (BP_SYM (strchr))
+
+ /* Before we start with the main loop we process single bytes
+ until the source pointer is aligned. This has two reasons:
+ 1. aligned 64-bit memory access is faster
+ and (more important)
+ 2. we process in the main loop 64 bit in one step although
+ we don't know the end of the string. But accessing at
+ 8-byte alignment guarantees that we never access illegal
+ memory if this would not also be done by the trivial
+ implementation (this is because all processor inherent
+ boundaries are multiples of 8). */
+
+ movq %rdi, %rdx
+ andl $7, %edx /* Mask alignment bits */
+ movq %rdi, %rax /* duplicate destination. */
+ jz 1f /* aligned => start loop */
+ neg %edx
+ addl $8, %edx /* Align to 8 bytes. */
+
+ /* Search the first bytes directly. */
+0: movb (%rax), %cl /* load byte */
+ cmpb %cl,%sil /* compare byte. */
+ je 6f /* target found */
+ testb %cl,%cl /* is byte NUL? */
+ je 7f /* yes => return NULL */
+ incq %rax /* increment pointer */
+ decl %edx
+ jnz 0b
+
+
+1:
+ /* At the moment %rsi contains C. What we need for the
+ algorithm is C in all bytes of the register. Avoid
+ operations on 16 bit words because these require an
+ prefix byte (and one more cycle). */
+ /* Populate 8 bit data to full 64-bit. */
+ movabs $0x0101010101010101,%r9
+ movzbl %sil,%edx
+ imul %rdx,%r9
+
+ movq $0xfefefefefefefeff, %r8 /* Save magic. */
+
+ /* We exit the loop if adding MAGIC_BITS to LONGWORD fails to
+ change any of the hole bits of LONGWORD.
+
+ 1) Is this safe? Will it catch all the zero bytes?
+ Suppose there is a byte with all zeros. Any carry bits
+ propagating from its left will fall into the hole at its
+ least significant bit and stop. Since there will be no
+ carry from its most significant bit, the LSB of the
+ byte to the left will be unchanged, and the zero will be
+ detected.
+
+ 2) Is this worthwhile? Will it ignore everything except
+ zero bytes? Suppose every byte of QUARDWORD has a bit set
+ somewhere. There will be a carry into bit 8. If bit 8
+ is set, this will carry into bit 16. If bit 8 is clear,
+ one of bits 9-15 must be set, so there will be a carry
+ into bit 16. Similarly, there will be a carry into bit
+ 24 tec.. If one of bits 54-63 is set, there will be a carry
+ into bit 64 (=carry flag), so all of the hole bits will
+ be changed.
+
+ 3) But wait! Aren't we looking for C, not zero?
+ Good point. So what we do is XOR LONGWORD with a longword,
+ each of whose bytes is C. This turns each byte that is C
+ into a zero. */
+
+ /* Next 3 insns are 10 bytes total, make sure we decode them in one go */
+ .p2align 4,,10
+4:
+ /* Main Loop is unrolled 4 times. */
+ /* First unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ xorq %r9, %rcx /* XOR with qword c|...|c => bytes of str == c
+ are now 0 */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 3f /* found c => return pointer */
+
+ /* The quadword we looked at does not contain the value we're looking
+ for. Let's search now whether we have reached the end of the
+ string. */
+ xorq %r9, %rcx /* restore original dword without reload */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 7f /* highest byte is NUL => return NULL */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 7f /* found NUL => return NULL */
+
+ /* Second unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ xorq %r9, %rcx /* XOR with qword c|...|c => bytes of str == c
+ are now 0 */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 3f /* found c => return pointer */
+
+ /* The quadword we looked at does not contain the value we're looking
+ for. Let's search now whether we have reached the end of the
+ string. */
+ xorq %r9, %rcx /* restore original dword without reload */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 7f /* highest byte is NUL => return NULL */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 7f /* found NUL => return NULL */
+ /* Third unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ xorq %r9, %rcx /* XOR with qword c|...|c => bytes of str == c
+ are now 0 */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 3f /* found c => return pointer */
+
+ /* The quadword we looked at does not contain the value we're looking
+ for. Let's search now whether we have reached the end of the
+ string. */
+ xorq %r9, %rcx /* restore original dword without reload */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 7f /* highest byte is NUL => return NULL */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 7f /* found NUL => return NULL */
+ /* Fourth unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ xorq %r9, %rcx /* XOR with qword c|...|c => bytes of str == c
+ are now 0 */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 3f /* found c => return pointer */
+
+ /* The quadword we looked at does not contain the value we're looking
+ for. Let's search now whether we have reached the end of the
+ string. */
+ xorq %r9, %rcx /* restore original dword without reload */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 7f /* highest byte is NUL => return NULL */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jz 4b /* no NUL found => restart loop */
+
+
+7: /* Return NULL. */
+ xorl %eax, %eax
+ retq
+
+
+ /* We now scan for the byte in which the character was matched.
+ But we have to take care of the case that a NUL char is
+ found before this in the dword. Note that we XORed %rcx
+ with the byte we're looking for, therefore the tests below look
+ reversed. */
+
+
+ /* Align, it's a jump target. */
+ /* Next 3 insns are 9 bytes total, make sure we decode them in one go */
+ .p2align 4,,9
+3:
+ movq %r9,%rdx /* move to %rdx so that we can access bytes */
+ subq $8,%rax /* correct pointer increment. */
+ testb %cl, %cl /* is first byte C? */
+ jz 6f /* yes => return pointer */
+ cmpb %dl, %cl /* is first byte NUL? */
+ je 7b /* yes => return NULL */
+ incq %rax /* increment pointer */
+
+ testb %ch, %ch /* is second byte C? */
+ jz 6f /* yes => return pointer */
+ cmpb %dl, %ch /* is second byte NUL? */
+ je 7b /* yes => return NULL? */
+ incq %rax /* increment pointer */
+
+ shrq $16, %rcx /* make upper bytes accessible */
+ testb %cl, %cl /* is third byte C? */
+ jz 6f /* yes => return pointer */
+ cmpb %dl, %cl /* is third byte NUL? */
+ je 7b /* yes => return NULL */
+ incq %rax /* increment pointer */
+
+ testb %ch, %ch /* is fourth byte C? */
+ jz 6f /* yes => return pointer */
+ cmpb %dl, %ch /* is fourth byte NUL? */
+ je 7b /* yes => return NULL? */
+ incq %rax /* increment pointer */
+
+ shrq $16, %rcx /* make upper bytes accessible */
+ testb %cl, %cl /* is fifth byte C? */
+ jz 6f /* yes => return pointer */
+ cmpb %dl, %cl /* is fifth byte NUL? */
+ je 7b /* yes => return NULL */
+ incq %rax /* increment pointer */
+
+ testb %ch, %ch /* is sixth byte C? */
+ jz 6f /* yes => return pointer */
+ cmpb %dl, %ch /* is sixth byte NUL? */
+ je 7b /* yes => return NULL? */
+ incq %rax /* increment pointer */
+
+ shrq $16, %rcx /* make upper bytes accessible */
+ testb %cl, %cl /* is seventh byte C? */
+ jz 6f /* yes => return pointer */
+ cmpb %dl, %cl /* is seventh byte NUL? */
+ je 7b /* yes => return NULL */
+
+ /* It must be in the eigth byte and it cannot be NUL. */
+ incq %rax
+
+6:
+ /* nop - huh?? */
+ retq
+END (BP_SYM (strchr))
+
+libc_hidden_def(strchr)
+#ifdef __UCLIBC_SUSV3_LEGACY__
+strong_alias (BP_SYM (strchr), BP_SYM (index))
+#endif
diff --git a/ap/build/uClibc/libc/string/x86_64/strcmp.S b/ap/build/uClibc/libc/string/x86_64/strcmp.S
new file mode 100644
index 0000000..437e145
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/strcmp.S
@@ -0,0 +1,47 @@
+/* Highly optimized version for x86-64.
+ Copyright (C) 1999, 2000, 2002, 2003, 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on i686 version contributed by Ulrich Drepper
+ <drepper@cygnus.com>, 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. */
+
+#include "_glibc_inc.h"
+
+ .text
+ENTRY (BP_SYM (strcmp))
+L(oop): movb (%rdi), %al
+ cmpb (%rsi), %al
+ jne L(neq)
+ incq %rdi
+ incq %rsi
+ testb %al, %al
+ jnz L(oop)
+
+ xorl %eax, %eax
+ ret
+
+L(neq): movl $1, %eax
+ movl $-1, %ecx
+ cmovbl %ecx, %eax
+ ret
+END (BP_SYM (strcmp))
+
+libc_hidden_def(strcmp)
+#ifndef __UCLIBC_HAS_LOCALE__
+strong_alias(strcmp,strcoll)
+libc_hidden_def(strcoll)
+#endif
diff --git a/ap/build/uClibc/libc/string/x86_64/strcpy.S b/ap/build/uClibc/libc/string/x86_64/strcpy.S
new file mode 100644
index 0000000..612a30d
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/strcpy.S
@@ -0,0 +1,162 @@
+/* strcpy/stpcpy implementation for x86-64.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Jaeger <aj@suse.de>, 2002.
+
+ 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 "_glibc_inc.h"
+
+/* Seems to be unrolled too much */
+
+#ifndef USE_AS_STPCPY
+# define STRCPY strcpy
+#endif
+
+ .text
+ENTRY (BP_SYM (STRCPY))
+ movq %rsi, %rcx /* Source register. */
+ andl $7, %ecx /* mask alignment bits */
+ movq %rdi, %rdx /* Duplicate destination pointer. */
+
+ jz 5f /* aligned => start loop */
+
+ neg %ecx /* We need to align to 8 bytes. */
+ addl $8,%ecx
+ /* Search the first bytes directly. */
+0:
+ movb (%rsi), %al /* Fetch a byte */
+ testb %al, %al /* Is it NUL? */
+ movb %al, (%rdx) /* Store it */
+ jz 4f /* If it was NUL, done! */
+ incq %rsi
+ incq %rdx
+ decl %ecx
+ jnz 0b
+
+5:
+ movq $0xfefefefefefefeff,%r8
+
+ /* Now the sources is aligned. Unfortunatly we cannot force
+ to have both source and destination aligned, so ignore the
+ alignment of the destination. */
+
+ /* Next 3 insns are 10 bytes total, make sure we decode them in one go */
+ .p2align 4,,10
+1:
+ /* 1st unroll. */
+ movq (%rsi), %rax /* Read double word (8 bytes). */
+ addq $8, %rsi /* Adjust pointer for next word. */
+ movq %rax, %r9 /* Save a copy for NUL finding. */
+ addq %r8, %r9 /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rax, %r9 /* (word+magic)^word */
+ orq %r8, %r9 /* set all non-carry bits */
+ incq %r9 /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+
+ jnz 3f /* found NUL => return pointer */
+
+ movq %rax, (%rdx) /* Write value to destination. */
+ addq $8, %rdx /* Adjust pointer. */
+
+ /* 2nd unroll. */
+ movq (%rsi), %rax /* Read double word (8 bytes). */
+ addq $8, %rsi /* Adjust pointer for next word. */
+ movq %rax, %r9 /* Save a copy for NUL finding. */
+ addq %r8, %r9 /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rax, %r9 /* (word+magic)^word */
+ orq %r8, %r9 /* set all non-carry bits */
+ incq %r9 /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+
+ jnz 3f /* found NUL => return pointer */
+
+ movq %rax, (%rdx) /* Write value to destination. */
+ addq $8, %rdx /* Adjust pointer. */
+
+ /* 3rd unroll. */
+ movq (%rsi), %rax /* Read double word (8 bytes). */
+ addq $8, %rsi /* Adjust pointer for next word. */
+ movq %rax, %r9 /* Save a copy for NUL finding. */
+ addq %r8, %r9 /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rax, %r9 /* (word+magic)^word */
+ orq %r8, %r9 /* set all non-carry bits */
+ incq %r9 /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+
+ jnz 3f /* found NUL => return pointer */
+
+ movq %rax, (%rdx) /* Write value to destination. */
+ addq $8, %rdx /* Adjust pointer. */
+
+ /* 4th unroll. */
+ movq (%rsi), %rax /* Read double word (8 bytes). */
+ addq $8, %rsi /* Adjust pointer for next word. */
+ movq %rax, %r9 /* Save a copy for NUL finding. */
+ addq %r8, %r9 /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rax, %r9 /* (word+magic)^word */
+ orq %r8, %r9 /* set all non-carry bits */
+ incq %r9 /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+
+ jnz 3f /* found NUL => return pointer */
+
+ movq %rax, (%rdx) /* Write value to destination. */
+ addq $8, %rdx /* Adjust pointer. */
+ jmp 1b /* Next iteration. */
+
+ /* Do the last few bytes. %rax contains the value to write.
+ The loop is unrolled twice. */
+
+ /* Next 3 insns are 6 bytes total, make sure we decode them in one go */
+ .p2align 3,,6
+3:
+ /* Note that stpcpy needs to return with the value of the NUL
+ byte. */
+ movb %al, (%rdx) /* 1st byte. */
+ testb %al, %al /* Is it NUL. */
+ jz 4f /* yes, finish. */
+ incq %rdx /* Increment destination. */
+ movb %ah, (%rdx) /* 2nd byte. */
+ testb %ah, %ah /* Is it NUL?. */
+ jz 4f /* yes, finish. */
+ incq %rdx /* Increment destination. */
+ shrq $16, %rax /* Shift... */
+ jmp 3b /* and look at next two bytes in %rax. */
+
+4:
+#ifdef USE_AS_STPCPY
+ movq %rdx, %rax /* Destination is return value. */
+#else
+ movq %rdi, %rax /* Source is return value. */
+#endif
+ retq
+END (BP_SYM (STRCPY))
+#ifndef USE_AS_STPCPY
+libc_hidden_def(strcpy)
+#endif
diff --git a/ap/build/uClibc/libc/string/x86_64/strcspn.S b/ap/build/uClibc/libc/string/x86_64/strcspn.S
new file mode 100644
index 0000000..fd9b09c
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/strcspn.S
@@ -0,0 +1,137 @@
+/* strcspn (str, ss) -- Return the length of the initial segment of STR
+ which contains no characters from SS.
+ For AMD x86-64.
+ Copyright (C) 1994-1997, 2000, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>.
+ Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>.
+ Adopted for x86-64 by Andreas Jaeger <aj@suse.de>.
+
+ 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 "_glibc_inc.h"
+
+/* Seems to be unrolled too much */
+
+/* BEWARE: `#ifdef strcspn' means that strcspn is redefined as `strpbrk' */
+#define STRPBRK_P (defined strcspn)
+
+ .text
+ENTRY (strcspn)
+
+ movq %rdi, %rdx /* Save SRC. */
+
+ /* First we create a table with flags for all possible characters.
+ For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
+ supported by the C string functions we have 256 characters.
+ Before inserting marks for the stop characters we clear the whole
+ table. */
+ movq %rdi, %r8 /* Save value. */
+ subq $256, %rsp /* Make space for 256 bytes. */
+ movl $32, %ecx /* 32*8 bytes = 256 bytes. */
+ movq %rsp, %rdi
+ xorl %eax, %eax /* We store 0s. */
+ cld
+ rep
+ stosq
+
+ movq %rsi, %rax /* Setup skipset. */
+
+/* For understanding the following code remember that %rcx == 0 now.
+ Although all the following instruction only modify %cl we always
+ have a correct zero-extended 64-bit value in %rcx. */
+
+ /* Next 3 insns are 6 bytes total, make sure we decode them in one go */
+ .p2align 3,,6
+
+L(2): movb (%rax), %cl /* get byte from skipset */
+ testb %cl, %cl /* is NUL char? */
+ jz L(1) /* yes => start compare loop */
+ movb %cl, (%rsp,%rcx) /* set corresponding byte in skipset table */
+
+ movb 1(%rax), %cl /* get byte from skipset */
+ testb %cl, %cl /* is NUL char? */
+ jz L(1) /* yes => start compare loop */
+ movb %cl, (%rsp,%rcx) /* set corresponding byte in skipset table */
+
+ movb 2(%rax), %cl /* get byte from skipset */
+ testb %cl, %cl /* is NUL char? */
+ jz L(1) /* yes => start compare loop */
+ movb %cl, (%rsp,%rcx) /* set corresponding byte in skipset table */
+
+ movb 3(%rax), %cl /* get byte from skipset */
+ addq $4, %rax /* increment skipset pointer */
+ movb %cl, (%rsp,%rcx) /* set corresponding byte in skipset table */
+ testb %cl, %cl /* is NUL char? */
+ jnz L(2) /* no => process next dword from skipset */
+
+L(1): leaq -4(%rdx), %rax /* prepare loop */
+
+ /* We use a neat trick for the following loop. Normally we would
+ have to test for two termination conditions
+ 1. a character in the skipset was found
+ and
+ 2. the end of the string was found
+ But as a sign that the character is in the skipset we store its
+ value in the table. But the value of NUL is NUL so the loop
+ terminates for NUL in every case. */
+
+ /* Next 3 insns are 9 bytes total. */
+ /* .p2align 4,,9 would make sure we decode them in one go, */
+ /* but it will also align entire function to 16 bytes, */
+ /* potentially creating largish padding at link time. */
+ /* We are aligning to 8 bytes instead: */
+ .p2align 3,,8
+
+L(3): addq $4, %rax /* adjust pointer for full loop round */
+
+ movb (%rax), %cl /* get byte from string */
+ cmpb %cl, (%rsp,%rcx) /* is it contained in skipset? */
+ je L(4) /* yes => return */
+
+ movb 1(%rax), %cl /* get byte from string */
+ cmpb %cl, (%rsp,%rcx) /* is it contained in skipset? */
+ je L(5) /* yes => return */
+
+ movb 2(%rax), %cl /* get byte from string */
+ cmpb %cl, (%rsp,%rcx) /* is it contained in skipset? */
+ jz L(6) /* yes => return */
+
+ movb 3(%rax), %cl /* get byte from string */
+ cmpb %cl, (%rsp,%rcx) /* is it contained in skipset? */
+ jne L(3) /* no => start loop again */
+
+ incq %rax /* adjust pointer */
+L(6): incq %rax
+L(5): incq %rax
+
+L(4): addq $256, %rsp /* remove skipset */
+#if STRPBRK_P
+ xorl %edx,%edx
+ orb %cl, %cl /* was last character NUL? */
+ cmovzq %rdx, %rax /* Yes: return NULL */
+#else
+ subq %rdx, %rax /* we have to return the number of valid
+ characters, so compute distance to first
+ non-valid character */
+#endif
+ ret
+END (strcspn)
+
+#if !STRPBRK_P
+libc_hidden_def(strcspn)
+#endif
diff --git a/ap/build/uClibc/libc/string/x86_64/strlen.S b/ap/build/uClibc/libc/string/x86_64/strlen.S
new file mode 100644
index 0000000..4213f0a
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/strlen.S
@@ -0,0 +1,144 @@
+/* strlen(str) -- determine the length of the string STR.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Based on i486 version contributed by Ulrich Drepper <drepper@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.
+
+ 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 "_glibc_inc.h"
+
+/* Seems to be unrolled too much */
+
+ .text
+ENTRY (strlen)
+ movq %rdi, %rcx /* Duplicate source pointer. */
+ andl $7, %ecx /* mask alignment bits */
+ movq %rdi, %rax /* duplicate destination. */
+ jz 1f /* aligned => start loop */
+
+ neg %ecx /* We need to align to 8 bytes. */
+ addl $8,%ecx
+ /* Search the first bytes directly. */
+0: cmpb $0x0,(%rax) /* is byte NUL? */
+ je 2f /* yes => return */
+ incq %rax /* increment pointer */
+ decl %ecx
+ jnz 0b
+
+1: movq $0xfefefefefefefeff,%r8 /* Save magic. */
+
+ /* Align loop. */
+ /* Next 3 insns are 10 bytes total, make sure we decode them in one go */
+ .p2align 4,,10
+4:
+ /* Main Loop is unrolled 4 times. */
+ /* First unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 3f /* found NUL => return pointer */
+
+ /* Second unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 3f /* found NUL => return pointer */
+
+ /* Third unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jnz 3f /* found NUL => return pointer */
+
+ /* Fourth unroll. */
+ movq (%rax), %rcx /* get double word (= 8 bytes) in question */
+ addq $8,%rax /* adjust pointer for next word */
+ movq %r8, %rdx /* magic value */
+ addq %rcx, %rdx /* add the magic value to the word. We get
+ carry bits reported for each byte which
+ is *not* 0 */
+ jnc 3f /* highest byte is NUL => return pointer */
+ xorq %rcx, %rdx /* (word+magic)^word */
+ orq %r8, %rdx /* set all non-carry bits */
+ incq %rdx /* add 1: if one carry bit was *not* set
+ the addition will not result in 0. */
+ jz 4b /* no NUL found => continue loop */
+
+ /* Align, it is a jump target. */
+ /* Next 3 insns are 8 bytes total, make sure we decode them in one go */
+ .p2align 3,,8
+3:
+ subq $8,%rax /* correct pointer increment. */
+
+ testb %cl, %cl /* is first byte NUL? */
+ jz 2f /* yes => return */
+ incq %rax /* increment pointer */
+
+ testb %ch, %ch /* is second byte NUL? */
+ jz 2f /* yes => return */
+ incq %rax /* increment pointer */
+
+ testl $0x00ff0000, %ecx /* is third byte NUL? */
+ jz 2f /* yes => return pointer */
+ incq %rax /* increment pointer */
+
+ testl $0xff000000, %ecx /* is fourth byte NUL? */
+ jz 2f /* yes => return pointer */
+ incq %rax /* increment pointer */
+
+ shrq $32, %rcx /* look at other half. */
+
+ testb %cl, %cl /* is first byte NUL? */
+ jz 2f /* yes => return */
+ incq %rax /* increment pointer */
+
+ testb %ch, %ch /* is second byte NUL? */
+ jz 2f /* yes => return */
+ incq %rax /* increment pointer */
+
+ testl $0xff0000, %ecx /* is third byte NUL? */
+ jz 2f /* yes => return pointer */
+ incq %rax /* increment pointer */
+2:
+ subq %rdi, %rax /* compute difference to string start */
+ ret
+END (strlen)
+
+libc_hidden_def(strlen)
diff --git a/ap/build/uClibc/libc/string/x86_64/strpbrk.S b/ap/build/uClibc/libc/string/x86_64/strpbrk.S
new file mode 100644
index 0000000..db6cc24
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/strpbrk.S
@@ -0,0 +1,3 @@
+#define strcspn strpbrk
+#include "strcspn.S"
+libc_hidden_def(strpbrk)
diff --git a/ap/build/uClibc/libc/string/x86_64/strspn.S b/ap/build/uClibc/libc/string/x86_64/strspn.S
new file mode 100644
index 0000000..41cff04
--- /dev/null
+++ b/ap/build/uClibc/libc/string/x86_64/strspn.S
@@ -0,0 +1,124 @@
+/* strspn (str, ss) -- Return the length of the initial segment of STR
+ which contains only characters from SS.
+ For AMD x86-64.
+ Copyright (C) 1994-1997, 2000, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>.
+ Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>.
+ Adopted for x86-64 by Andreas Jaeger <aj@suse.de>.
+
+ 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 "_glibc_inc.h"
+
+ .text
+ENTRY (strspn)
+
+ movq %rdi, %rdx /* Save SRC. */
+
+ /* First we create a table with flags for all possible characters.
+ For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
+ supported by the C string functions we have 256 characters.
+ Before inserting marks for the stop characters we clear the whole
+ table. */
+ movq %rdi, %r8 /* Save value. */
+ subq $256, %rsp /* Make space for 256 bytes. */
+ movl $32, %ecx /* 32*8 bytes = 256 bytes. */
+ movq %rsp, %rdi
+ xorl %eax, %eax /* We store 0s. */
+ cld
+ rep
+ stosq
+
+ movq %rsi, %rax /* Setup stopset. */
+
+/* For understanding the following code remember that %rcx == 0 now.
+ Although all the following instruction only modify %cl we always
+ have a correct zero-extended 64-bit value in %rcx. */
+
+ /* Next 3 insns are 6 bytes total, make sure we decode them in one go */
+ .p2align 3,,6
+L(2):
+ movb (%rax), %cl /* get byte from stopset */
+ testb %cl, %cl /* is NUL char? */
+ jz L(1) /* yes => start compare loop */
+ movb %cl, (%rsp,%rcx) /* set corresponding byte in stopset table */
+
+ movb 1(%rax), %cl /* get byte from stopset */
+ testb %cl, %cl /* is NUL char? */
+ jz L(1) /* yes => start compare loop */
+ movb %cl, (%rsp,%rcx) /* set corresponding byte in stopset table */
+
+ movb 2(%rax), %cl /* get byte from stopset */
+ testb %cl, %cl /* is NUL char? */
+ jz L(1) /* yes => start compare loop */
+ movb %cl, (%rsp,%rcx) /* set corresponding byte in stopset table */
+
+ movb 3(%rax), %cl /* get byte from stopset */
+ addq $4, %rax /* increment stopset pointer */
+ movb %cl, (%rsp,%rcx) /* set corresponding byte in stopset table */
+ testb %cl, %cl /* is NUL char? */
+ jnz L(2) /* no => process next dword from stopset */
+
+L(1): leaq -4(%rdx), %rax /* prepare loop */
+
+ /* We use a neat trick for the following loop. Normally we would
+ have to test for two termination conditions
+ 1. a character in the stopset was found
+ and
+ 2. the end of the string was found
+ But as a sign that the character is in the stopset we store its
+ value in the table. But the value of NUL is NUL so the loop
+ terminates for NUL in every case. */
+
+ /* Next 3 insns are 9 bytes total. */
+ /* .p2align 4,,9 would make sure we decode them in one go, */
+ /* but it will also align entire function to 16 bytes, */
+ /* potentially creating largish padding at link time. */
+ /* We are aligning to 8 bytes instead: */
+ .p2align 3,,8
+L(3):
+ addq $4, %rax /* adjust pointer for full loop round */
+
+ movb (%rax), %cl /* get byte from string */
+ testb %cl, (%rsp,%rcx) /* is it contained in skipset? */
+ jz L(4) /* no => return */
+
+ movb 1(%rax), %cl /* get byte from string */
+ testb %cl, (%rsp,%rcx) /* is it contained in skipset? */
+ jz L(5) /* no => return */
+
+ movb 2(%rax), %cl /* get byte from string */
+ testb %cl, (%rsp,%rcx) /* is it contained in skipset? */
+ jz L(6) /* no => return */
+
+ movb 3(%rax), %cl /* get byte from string */
+ testb %cl, (%rsp,%rcx) /* is it contained in skipset? */
+ jnz L(3) /* yes => start loop again */
+
+ incq %rax /* adjust pointer */
+L(6): incq %rax
+L(5): incq %rax
+
+L(4): addq $256, %rsp /* remove stopset */
+ subq %rdx, %rax /* we have to return the number of valid
+ characters, so compute distance to first
+ non-valid character */
+ ret
+END (strspn)
+
+libc_hidden_def(strspn)
diff --git a/ap/build/uClibc/libc/string/xtensa/Makefile b/ap/build/uClibc/libc/string/xtensa/Makefile
new file mode 100644
index 0000000..0a95346
--- /dev/null
+++ b/ap/build/uClibc/libc/string/xtensa/Makefile
@@ -0,0 +1,13 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
+#
+# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+#
+
+top_srcdir:=../../../
+top_builddir:=../../../
+all: objs
+include $(top_builddir)Rules.mak
+include ../Makefile.in
+include $(top_srcdir)Makerules
diff --git a/ap/build/uClibc/libc/string/xtensa/memcpy.S b/ap/build/uClibc/libc/string/xtensa/memcpy.S
new file mode 100644
index 0000000..fc04c02
--- /dev/null
+++ b/ap/build/uClibc/libc/string/xtensa/memcpy.S
@@ -0,0 +1,297 @@
+/* Optimized memcpy for Xtensa.
+ Copyright (C) 2001, 2007 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., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+#include "../../sysdeps/linux/xtensa/sysdep.h"
+#include <bits/xtensa-config.h>
+
+ .macro src_b r, w0, w1
+#ifdef __XTENSA_EB__
+ src \r, \w0, \w1
+#else
+ src \r, \w1, \w0
+#endif
+ .endm
+
+ .macro ssa8 r
+#ifdef __XTENSA_EB__
+ ssa8b \r
+#else
+ ssa8l \r
+#endif
+ .endm
+
+/* If the Xtensa Unaligned Load Exception option is not used, this
+ code can run a few cycles faster by relying on the low address bits
+ being ignored. However, if the code is then run with an Xtensa ISS
+ client that checks for unaligned accesses, it will produce a lot of
+ warning messages. Set this flag to disable the use of unaligned
+ accesses and keep the ISS happy. */
+
+#define UNALIGNED_ADDRESSES_CHECKED 1
+
+/* Do not use .literal_position in the ENTRY macro. */
+#undef LITERAL_POSITION
+#define LITERAL_POSITION
+
+
+/* void *memcpy (void *dst, const void *src, size_t len)
+
+ The algorithm is as follows:
+
+ If the destination is unaligned, align it by conditionally
+ copying 1- and/or 2-byte pieces.
+
+ If the source is aligned, copy 16 bytes with a loop, and then finish up
+ with 8, 4, 2, and 1-byte copies conditional on the length.
+
+ Else (if source is unaligned), do the same, but use SRC to align the
+ source data.
+
+ This code tries to use fall-through branches for the common
+ case of aligned source and destination and multiple of 4 (or 8) length. */
+
+
+/* Byte by byte copy. */
+
+ .text
+ .align 4
+ .literal_position
+__memcpy_aux:
+
+ /* Skip a byte to get 1 mod 4 alignment for LOOPNEZ
+ (0 mod 4 alignment for LBEG). */
+ .byte 0
+
+.Lbytecopy:
+#if XCHAL_HAVE_LOOPS
+ loopnez a4, 2f
+#else
+ beqz a4, 2f
+ add a7, a3, a4 /* a7 = end address for source */
+#endif
+1: l8ui a6, a3, 0
+ addi a3, a3, 1
+ s8i a6, a5, 0
+ addi a5, a5, 1
+#if !XCHAL_HAVE_LOOPS
+ blt a3, a7, 1b
+#endif
+2: retw
+
+
+/* Destination is unaligned. */
+
+ .align 4
+.Ldst1mod2: /* dst is only byte aligned */
+
+ /* Do short copies byte-by-byte. */
+ _bltui a4, 7, .Lbytecopy
+
+ /* Copy 1 byte. */
+ l8ui a6, a3, 0
+ addi a3, a3, 1
+ addi a4, a4, -1
+ s8i a6, a5, 0
+ addi a5, a5, 1
+
+ /* Return to main algorithm if dst is now aligned. */
+ _bbci.l a5, 1, .Ldstaligned
+
+.Ldst2mod4: /* dst has 16-bit alignment */
+
+ /* Do short copies byte-by-byte. */
+ _bltui a4, 6, .Lbytecopy
+
+ /* Copy 2 bytes. */
+ l8ui a6, a3, 0
+ l8ui a7, a3, 1
+ addi a3, a3, 2
+ addi a4, a4, -2
+ s8i a6, a5, 0
+ s8i a7, a5, 1
+ addi a5, a5, 2
+
+ /* dst is now aligned; return to main algorithm. */
+ j .Ldstaligned
+
+
+ENTRY (memcpy)
+ /* a2 = dst, a3 = src, a4 = len */
+
+ mov a5, a2 /* copy dst so that a2 is return value */
+ _bbsi.l a2, 0, .Ldst1mod2
+ _bbsi.l a2, 1, .Ldst2mod4
+.Ldstaligned:
+
+ /* Get number of loop iterations with 16B per iteration. */
+ srli a7, a4, 4
+
+ /* Check if source is aligned. */
+ movi a8, 3
+ _bany a3, a8, .Lsrcunaligned
+
+ /* Destination and source are word-aligned, use word copy. */
+#if XCHAL_HAVE_LOOPS
+ loopnez a7, 2f
+#else
+ beqz a7, 2f
+ slli a8, a7, 4
+ add a8, a8, a3 /* a8 = end of last 16B source chunk */
+#endif
+1: l32i a6, a3, 0
+ l32i a7, a3, 4
+ s32i a6, a5, 0
+ l32i a6, a3, 8
+ s32i a7, a5, 4
+ l32i a7, a3, 12
+ s32i a6, a5, 8
+ addi a3, a3, 16
+ s32i a7, a5, 12
+ addi a5, a5, 16
+#if !XCHAL_HAVE_LOOPS
+ blt a3, a8, 1b
+#endif
+
+ /* Copy any leftover pieces smaller than 16B. */
+2: bbci.l a4, 3, 3f
+
+ /* Copy 8 bytes. */
+ l32i a6, a3, 0
+ l32i a7, a3, 4
+ addi a3, a3, 8
+ s32i a6, a5, 0
+ s32i a7, a5, 4
+ addi a5, a5, 8
+
+3: bbsi.l a4, 2, 4f
+ bbsi.l a4, 1, 5f
+ bbsi.l a4, 0, 6f
+ retw
+
+ /* Copy 4 bytes. */
+4: l32i a6, a3, 0
+ addi a3, a3, 4
+ s32i a6, a5, 0
+ addi a5, a5, 4
+ bbsi.l a4, 1, 5f
+ bbsi.l a4, 0, 6f
+ retw
+
+ /* Copy 2 bytes. */
+5: l16ui a6, a3, 0
+ addi a3, a3, 2
+ s16i a6, a5, 0
+ addi a5, a5, 2
+ bbsi.l a4, 0, 6f
+ retw
+
+ /* Copy 1 byte. */
+6: l8ui a6, a3, 0
+ s8i a6, a5, 0
+
+.Ldone:
+ retw
+
+
+/* Destination is aligned; source is unaligned. */
+
+ .align 4
+.Lsrcunaligned:
+ /* Avoid loading anything for zero-length copies. */
+ _beqz a4, .Ldone
+
+ /* Copy 16 bytes per iteration for word-aligned dst and
+ unaligned src. */
+ ssa8 a3 /* set shift amount from byte offset */
+#if UNALIGNED_ADDRESSES_CHECKED
+ and a11, a3, a8 /* save unalignment offset for below */
+ sub a3, a3, a11 /* align a3 */
+#endif
+ l32i a6, a3, 0 /* load first word */
+#if XCHAL_HAVE_LOOPS
+ loopnez a7, 2f
+#else
+ beqz a7, 2f
+ slli a10, a7, 4
+ add a10, a10, a3 /* a10 = end of last 16B source chunk */
+#endif
+1: l32i a7, a3, 4
+ l32i a8, a3, 8
+ src_b a6, a6, a7
+ s32i a6, a5, 0
+ l32i a9, a3, 12
+ src_b a7, a7, a8
+ s32i a7, a5, 4
+ l32i a6, a3, 16
+ src_b a8, a8, a9
+ s32i a8, a5, 8
+ addi a3, a3, 16
+ src_b a9, a9, a6
+ s32i a9, a5, 12
+ addi a5, a5, 16
+#if !XCHAL_HAVE_LOOPS
+ blt a3, a10, 1b
+#endif
+
+2: bbci.l a4, 3, 3f
+
+ /* Copy 8 bytes. */
+ l32i a7, a3, 4
+ l32i a8, a3, 8
+ src_b a6, a6, a7
+ s32i a6, a5, 0
+ addi a3, a3, 8
+ src_b a7, a7, a8
+ s32i a7, a5, 4
+ addi a5, a5, 8
+ mov a6, a8
+
+3: bbci.l a4, 2, 4f
+
+ /* Copy 4 bytes. */
+ l32i a7, a3, 4
+ addi a3, a3, 4
+ src_b a6, a6, a7
+ s32i a6, a5, 0
+ addi a5, a5, 4
+ mov a6, a7
+4:
+#if UNALIGNED_ADDRESSES_CHECKED
+ add a3, a3, a11 /* readjust a3 with correct misalignment */
+#endif
+ bbsi.l a4, 1, 5f
+ bbsi.l a4, 0, 6f
+ retw
+
+ /* Copy 2 bytes. */
+5: l8ui a6, a3, 0
+ l8ui a7, a3, 1
+ addi a3, a3, 2
+ s8i a6, a5, 0
+ s8i a7, a5, 1
+ addi a5, a5, 2
+ bbsi.l a4, 0, 6f
+ retw
+
+ /* Copy 1 byte. */
+6: l8ui a6, a3, 0
+ s8i a6, a5, 0
+ retw
+
+libc_hidden_def (memcpy)
diff --git a/ap/build/uClibc/libc/string/xtensa/memset.S b/ap/build/uClibc/libc/string/xtensa/memset.S
new file mode 100644
index 0000000..076b8f0
--- /dev/null
+++ b/ap/build/uClibc/libc/string/xtensa/memset.S
@@ -0,0 +1,165 @@
+/* Optimized memset for Xtensa.
+ Copyright (C) 2001, 2007 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., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+#include "../../sysdeps/linux/xtensa/sysdep.h"
+#include <bits/xtensa-config.h>
+
+/* Do not use .literal_position in the ENTRY macro. */
+#undef LITERAL_POSITION
+#define LITERAL_POSITION
+
+/* void *memset (void *dst, int c, size_t length)
+
+ The algorithm is as follows:
+
+ Create a word with c in all byte positions.
+
+ If the destination is aligned, set 16B chunks with a loop, and then
+ finish up with 8B, 4B, 2B, and 1B stores conditional on the length.
+
+ If the destination is unaligned, align it by conditionally
+ setting 1B and/or 2B and then go to aligned case.
+
+ This code tries to use fall-through branches for the common
+ case of an aligned destination (except for the branches to
+ the alignment labels). */
+
+
+/* Byte-by-byte set. */
+
+ .text
+ .align 4
+ .literal_position
+__memset_aux:
+
+ /* Skip a byte to get 1 mod 4 alignment for LOOPNEZ
+ (0 mod 4 alignment for LBEG). */
+ .byte 0
+
+.Lbyteset:
+#if XCHAL_HAVE_LOOPS
+ loopnez a4, 2f
+#else
+ beqz a4, 2f
+ add a6, a5, a4 /* a6 = ending address */
+#endif
+1: s8i a3, a5, 0
+ addi a5, a5, 1
+#if !XCHAL_HAVE_LOOPS
+ blt a5, a6, 1b
+#endif
+2: retw
+
+
+/* Destination is unaligned. */
+
+ .align 4
+
+.Ldst1mod2: /* dst is only byte aligned */
+
+ /* Do short sizes byte-by-byte. */
+ bltui a4, 8, .Lbyteset
+
+ /* Set 1 byte. */
+ s8i a3, a5, 0
+ addi a5, a5, 1
+ addi a4, a4, -1
+
+ /* Now retest if dst is aligned. */
+ _bbci.l a5, 1, .Ldstaligned
+
+.Ldst2mod4: /* dst has 16-bit alignment */
+
+ /* Do short sizes byte-by-byte. */
+ bltui a4, 8, .Lbyteset
+
+ /* Set 2 bytes. */
+ s16i a3, a5, 0
+ addi a5, a5, 2
+ addi a4, a4, -2
+
+ /* dst is now aligned; return to main algorithm */
+ j .Ldstaligned
+
+
+ENTRY (memset)
+ /* a2 = dst, a3 = c, a4 = length */
+
+ /* Duplicate character into all bytes of word. */
+ extui a3, a3, 0, 8
+ slli a7, a3, 8
+ or a3, a3, a7
+ slli a7, a3, 16
+ or a3, a3, a7
+
+ mov a5, a2 /* copy dst so that a2 is return value */
+
+ /* Check if dst is unaligned. */
+ _bbsi.l a2, 0, .Ldst1mod2
+ _bbsi.l a2, 1, .Ldst2mod4
+.Ldstaligned:
+
+ /* Get number of loop iterations with 16B per iteration. */
+ srli a7, a4, 4
+
+ /* Destination is word-aligned. */
+#if XCHAL_HAVE_LOOPS
+ loopnez a7, 2f
+#else
+ beqz a7, 2f
+ slli a6, a7, 4
+ add a6, a6, a5 /* a6 = end of last 16B chunk */
+#endif
+ /* Set 16 bytes per iteration. */
+1: s32i a3, a5, 0
+ s32i a3, a5, 4
+ s32i a3, a5, 8
+ s32i a3, a5, 12
+ addi a5, a5, 16
+#if !XCHAL_HAVE_LOOPS
+ blt a5, a6, 1b
+#endif
+
+ /* Set any leftover pieces smaller than 16B. */
+2: bbci.l a4, 3, 3f
+
+ /* Set 8 bytes. */
+ s32i a3, a5, 0
+ s32i a3, a5, 4
+ addi a5, a5, 8
+
+3: bbci.l a4, 2, 4f
+
+ /* Set 4 bytes. */
+ s32i a3, a5, 0
+ addi a5, a5, 4
+
+4: bbci.l a4, 1, 5f
+
+ /* Set 2 bytes. */
+ s16i a3, a5, 0
+ addi a5, a5, 2
+
+5: bbci.l a4, 0, 6f
+
+ /* Set 1 byte. */
+ s8i a3, a5, 0
+6: retw
+
+libc_hidden_def (memset)
diff --git a/ap/build/uClibc/libc/string/xtensa/strcmp.S b/ap/build/uClibc/libc/string/xtensa/strcmp.S
new file mode 100644
index 0000000..ac058a2
--- /dev/null
+++ b/ap/build/uClibc/libc/string/xtensa/strcmp.S
@@ -0,0 +1,314 @@
+/* Optimized strcmp for Xtensa.
+ Copyright (C) 2001, 2007 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., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+#include "../../sysdeps/linux/xtensa/sysdep.h"
+#include <bits/xtensa-config.h>
+#include <features.h>
+
+#ifdef __XTENSA_EB__
+#define MASK0 0xff000000
+#define MASK1 0x00ff0000
+#define MASK2 0x0000ff00
+#define MASK3 0x000000ff
+#else
+#define MASK0 0x000000ff
+#define MASK1 0x0000ff00
+#define MASK2 0x00ff0000
+#define MASK3 0xff000000
+#endif
+
+#define MASK4 0x40404040
+
+ .literal .Lmask0, MASK0
+ .literal .Lmask1, MASK1
+ .literal .Lmask2, MASK2
+ .literal .Lmask3, MASK3
+ .literal .Lmask4, MASK4
+
+ .text
+ENTRY (strcmp)
+ /* a2 = s1, a3 = s2 */
+
+ l8ui a8, a2, 0 /* byte 0 from s1 */
+ l8ui a9, a3, 0 /* byte 0 from s2 */
+ movi a10, 3 /* mask */
+ bne a8, a9, .Lretdiff
+
+ or a11, a2, a3
+ bnone a11, a10, .Laligned
+
+ xor a11, a2, a3 /* compare low two bits of s1 and s2 */
+ bany a11, a10, .Lunaligned /* if they have different alignment */
+
+ /* s1/s2 are not word-aligned. */
+ addi a2, a2, 1 /* advance s1 */
+ beqz a8, .Leq /* bytes equal, if zero, strings are equal */
+ addi a3, a3, 1 /* advance s2 */
+ bnone a2, a10, .Laligned /* if s1/s2 now aligned */
+ l8ui a8, a2, 0 /* byte 1 from s1 */
+ l8ui a9, a3, 0 /* byte 1 from s2 */
+ addi a2, a2, 1 /* advance s1 */
+ bne a8, a9, .Lretdiff /* if different, return difference */
+ beqz a8, .Leq /* bytes equal, if zero, strings are equal */
+ addi a3, a3, 1 /* advance s2 */
+ bnone a2, a10, .Laligned /* if s1/s2 now aligned */
+ l8ui a8, a2, 0 /* byte 2 from s1 */
+ l8ui a9, a3, 0 /* byte 2 from s2 */
+ addi a2, a2, 1 /* advance s1 */
+ bne a8, a9, .Lretdiff /* if different, return difference */
+ beqz a8, .Leq /* bytes equal, if zero, strings are equal */
+ addi a3, a3, 1 /* advance s2 */
+ j .Laligned
+
+/* s1 and s2 have different alignment.
+
+ If the zero-overhead loop option is available, use an (almost)
+ infinite zero-overhead loop with conditional exits so we only pay
+ for taken branches when exiting the loop.
+
+ Note: It is important for this unaligned case to come before the
+ code for aligned strings, because otherwise some of the branches
+ above cannot reach and have to be transformed to branches around
+ jumps. The unaligned code is smaller and the branches can reach
+ over it. */
+
+ .align 4
+ /* (2 mod 4) alignment for loop instruction */
+.Lunaligned:
+#if XCHAL_HAVE_LOOPS
+ _movi.n a8, 0 /* set up for the maximum loop count */
+ loop a8, .Lretdiff /* loop forever (almost anyway) */
+#endif
+.Lnextbyte:
+ l8ui a8, a2, 0
+ l8ui a9, a3, 0
+ addi a2, a2, 1
+ bne a8, a9, .Lretdiff
+ addi a3, a3, 1
+#if XCHAL_HAVE_LOOPS
+ beqz a8, .Lretdiff
+#else
+ bnez a8, .Lnextbyte
+#endif
+.Lretdiff:
+ sub a2, a8, a9
+ retw
+
+/* s1 is word-aligned; s2 is word-aligned.
+
+ If the zero-overhead loop option is available, use an (almost)
+ infinite zero-overhead loop with conditional exits so we only pay
+ for taken branches when exiting the loop. */
+
+/* New algorithm, relying on the fact that all normal ASCII is between
+ 32 and 127.
+
+ Rather than check all bytes for zero:
+ Take one word (4 bytes). Call it w1.
+ Shift w1 left by one into w1'.
+ Or w1 and w1'. For all normal ASCII bit 6 will be 1; for zero it won't.
+ Check that all 4 bit 6's (one for each byte) are one:
+ If they are, we are definitely not done.
+ If they are not, we are probably done, but need to check for zero. */
+
+ .align 4
+#if XCHAL_HAVE_LOOPS
+.Laligned:
+ .begin no-transform
+ l32r a4, .Lmask0 /* mask for byte 0 */
+ l32r a7, .Lmask4
+ /* Loop forever. (a4 is more than than the maximum number
+ of iterations) */
+ loop a4, .Laligned_done
+
+ /* First unrolled loop body. */
+ l32i a8, a2, 0 /* get word from s1 */
+ l32i a9, a3, 0 /* get word from s2 */
+ slli a5, a8, 1
+ bne a8, a9, .Lwne2
+ or a9, a8, a5
+ bnall a9, a7, .Lprobeq
+
+ /* Second unrolled loop body. */
+ l32i a8, a2, 4 /* get word from s1+4 */
+ l32i a9, a3, 4 /* get word from s2+4 */
+ slli a5, a8, 1
+ bne a8, a9, .Lwne2
+ or a9, a8, a5
+ bnall a9, a7, .Lprobeq2
+
+ addi a2, a2, 8 /* advance s1 pointer */
+ addi a3, a3, 8 /* advance s2 pointer */
+.Laligned_done:
+ or a1, a1, a1 /* nop */
+
+.Lprobeq2:
+ /* Adjust pointers to account for the loop unrolling. */
+ addi a2, a2, 4
+ addi a3, a3, 4
+
+#else /* !XCHAL_HAVE_LOOPS */
+
+.Laligned:
+ movi a4, MASK0 /* mask for byte 0 */
+ movi a7, MASK4
+ j .Lfirstword
+.Lnextword:
+ addi a2, a2, 4 /* advance s1 pointer */
+ addi a3, a3, 4 /* advance s2 pointer */
+.Lfirstword:
+ l32i a8, a2, 0 /* get word from s1 */
+ l32i a9, a3, 0 /* get word from s2 */
+ slli a5, a8, 1
+ bne a8, a9, .Lwne2
+ or a9, a8, a5
+ ball a9, a7, .Lnextword
+#endif /* !XCHAL_HAVE_LOOPS */
+
+ /* align (0 mod 4) */
+.Lprobeq:
+ /* Words are probably equal, but check for sure.
+ If not, loop over the rest of string using normal algorithm. */
+
+ bnone a8, a4, .Leq /* if byte 0 is zero */
+ l32r a5, .Lmask1 /* mask for byte 1 */
+ l32r a6, .Lmask2 /* mask for byte 2 */
+ bnone a8, a5, .Leq /* if byte 1 is zero */
+ l32r a7, .Lmask3 /* mask for byte 3 */
+ bnone a8, a6, .Leq /* if byte 2 is zero */
+ bnone a8, a7, .Leq /* if byte 3 is zero */
+ addi.n a2, a2, 4 /* advance s1 pointer */
+ addi.n a3, a3, 4 /* advance s2 pointer */
+#if XCHAL_HAVE_LOOPS
+
+ /* align (1 mod 4) */
+ loop a4, .Leq /* loop forever (a4 is bigger than max iters) */
+ .end no-transform
+
+ l32i a8, a2, 0 /* get word from s1 */
+ l32i a9, a3, 0 /* get word from s2 */
+ addi a2, a2, 4 /* advance s1 pointer */
+ bne a8, a9, .Lwne
+ bnone a8, a4, .Leq /* if byte 0 is zero */
+ bnone a8, a5, .Leq /* if byte 1 is zero */
+ bnone a8, a6, .Leq /* if byte 2 is zero */
+ bnone a8, a7, .Leq /* if byte 3 is zero */
+ addi a3, a3, 4 /* advance s2 pointer */
+
+#else /* !XCHAL_HAVE_LOOPS */
+
+ j .Lfirstword2
+.Lnextword2:
+ addi a3, a3, 4 /* advance s2 pointer */
+.Lfirstword2:
+ l32i a8, a2, 0 /* get word from s1 */
+ l32i a9, a3, 0 /* get word from s2 */
+ addi a2, a2, 4 /* advance s1 pointer */
+ bne a8, a9, .Lwne
+ bnone a8, a4, .Leq /* if byte 0 is zero */
+ bnone a8, a5, .Leq /* if byte 1 is zero */
+ bnone a8, a6, .Leq /* if byte 2 is zero */
+ bany a8, a7, .Lnextword2 /* if byte 3 is zero */
+#endif /* !XCHAL_HAVE_LOOPS */
+
+ /* Words are equal; some byte is zero. */
+.Leq: movi a2, 0 /* return equal */
+ retw
+
+.Lwne2: /* Words are not equal. On big-endian processors, if none of the
+ bytes are zero, the return value can be determined by a simple
+ comparison. */
+#ifdef __XTENSA_EB__
+ or a10, a8, a5
+ bnall a10, a7, .Lsomezero
+ bgeu a8, a9, .Lposreturn
+ movi a2, -1
+ retw
+.Lposreturn:
+ movi a2, 1
+ retw
+.Lsomezero: /* There is probably some zero byte. */
+#endif /* __XTENSA_EB__ */
+.Lwne: /* Words are not equal. */
+ xor a2, a8, a9 /* get word with nonzero in byte that differs */
+ bany a2, a4, .Ldiff0 /* if byte 0 differs */
+ movi a5, MASK1 /* mask for byte 1 */
+ bnone a8, a4, .Leq /* if byte 0 is zero */
+ bany a2, a5, .Ldiff1 /* if byte 1 differs */
+ movi a6, MASK2 /* mask for byte 2 */
+ bnone a8, a5, .Leq /* if byte 1 is zero */
+ bany a2, a6, .Ldiff2 /* if byte 2 differs */
+ bnone a8, a6, .Leq /* if byte 2 is zero */
+#ifdef __XTENSA_EB__
+.Ldiff3:
+.Ldiff2:
+.Ldiff1:
+ /* Byte 0 is equal (at least) and there is a difference before a zero
+ byte. Just subtract words to get the return value.
+ The high order equal bytes cancel, leaving room for the sign. */
+ sub a2, a8, a9
+ retw
+
+.Ldiff0:
+ /* Need to make room for the sign, so can't subtract whole words. */
+ extui a10, a8, 24, 8
+ extui a11, a9, 24, 8
+ sub a2, a10, a11
+ retw
+
+#else /* !__XTENSA_EB__ */
+ /* Little-endian is a little more difficult because can't subtract
+ whole words. */
+.Ldiff3:
+ /* Bytes 0-2 are equal; byte 3 is different.
+ For little-endian need to have a sign bit for the difference. */
+ extui a10, a8, 24, 8
+ extui a11, a9, 24, 8
+ sub a2, a10, a11
+ retw
+
+.Ldiff0:
+ /* Byte 0 is different. */
+ extui a10, a8, 0, 8
+ extui a11, a9, 0, 8
+ sub a2, a10, a11
+ retw
+
+.Ldiff1:
+ /* Byte 0 is equal; byte 1 is different. */
+ extui a10, a8, 8, 8
+ extui a11, a9, 8, 8
+ sub a2, a10, a11
+ retw
+
+.Ldiff2:
+ /* Bytes 0-1 are equal; byte 2 is different. */
+ extui a10, a8, 16, 8
+ extui a11, a9, 16, 8
+ sub a2, a10, a11
+ retw
+
+#endif /* !__XTENSA_EB */
+
+libc_hidden_def (strcmp)
+
+#ifndef __UCLIBC_HAS_LOCALE__
+strong_alias (strcmp, strcoll)
+libc_hidden_def (strcoll)
+#endif
diff --git a/ap/build/uClibc/libc/string/xtensa/strcpy.S b/ap/build/uClibc/libc/string/xtensa/strcpy.S
new file mode 100644
index 0000000..dc0a151
--- /dev/null
+++ b/ap/build/uClibc/libc/string/xtensa/strcpy.S
@@ -0,0 +1,150 @@
+/* Optimized strcpy for Xtensa.
+ Copyright (C) 2001, 2007 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., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+#include "../../sysdeps/linux/xtensa/sysdep.h"
+#include <bits/xtensa-config.h>
+
+#ifdef __XTENSA_EB__
+#define MASK0 0xff000000
+#define MASK1 0x00ff0000
+#define MASK2 0x0000ff00
+#define MASK3 0x000000ff
+#else
+#define MASK0 0x000000ff
+#define MASK1 0x0000ff00
+#define MASK2 0x00ff0000
+#define MASK3 0xff000000
+#endif
+
+ .text
+ENTRY (strcpy)
+ /* a2 = dst, a3 = src */
+
+ mov a10, a2 /* leave dst in return value register */
+ movi a4, MASK0
+ movi a5, MASK1
+ movi a6, MASK2
+ movi a7, MASK3
+ bbsi.l a3, 0, .Lsrc1mod2
+ bbsi.l a3, 1, .Lsrc2mod4
+.Lsrcaligned:
+
+ /* Check if the destination is aligned. */
+ movi a8, 3
+ bnone a10, a8, .Laligned
+
+ j .Ldstunaligned
+
+.Lsrc1mod2: /* src address is odd */
+ l8ui a8, a3, 0 /* get byte 0 */
+ addi a3, a3, 1 /* advance src pointer */
+ s8i a8, a10, 0 /* store byte 0 */
+ beqz a8, 1f /* if byte 0 is zero */
+ addi a10, a10, 1 /* advance dst pointer */
+ bbci.l a3, 1, .Lsrcaligned /* if src is now word-aligned */
+
+.Lsrc2mod4: /* src address is 2 mod 4 */
+ l8ui a8, a3, 0 /* get byte 0 */
+ /* 1-cycle interlock */
+ s8i a8, a10, 0 /* store byte 0 */
+ beqz a8, 1f /* if byte 0 is zero */
+ l8ui a8, a3, 1 /* get byte 0 */
+ addi a3, a3, 2 /* advance src pointer */
+ s8i a8, a10, 1 /* store byte 0 */
+ addi a10, a10, 2 /* advance dst pointer */
+ bnez a8, .Lsrcaligned
+1: retw
+
+
+/* dst is word-aligned; src is word-aligned. */
+
+ .align 4
+#if XCHAL_HAVE_LOOPS
+ /* (2 mod 4) alignment for loop instruction */
+.Laligned:
+ _movi.n a8, 0 /* set up for the maximum loop count */
+ loop a8, .Lz3 /* loop forever (almost anyway) */
+ l32i a8, a3, 0 /* get word from src */
+ addi a3, a3, 4 /* advance src pointer */
+ bnone a8, a4, .Lz0 /* if byte 0 is zero */
+ bnone a8, a5, .Lz1 /* if byte 1 is zero */
+ bnone a8, a6, .Lz2 /* if byte 2 is zero */
+ s32i a8, a10, 0 /* store word to dst */
+ bnone a8, a7, .Lz3 /* if byte 3 is zero */
+ addi a10, a10, 4 /* advance dst pointer */
+
+#else /* !XCHAL_HAVE_LOOPS */
+
+1: addi a10, a10, 4 /* advance dst pointer */
+.Laligned:
+ l32i a8, a3, 0 /* get word from src */
+ addi a3, a3, 4 /* advance src pointer */
+ bnone a8, a4, .Lz0 /* if byte 0 is zero */
+ bnone a8, a5, .Lz1 /* if byte 1 is zero */
+ bnone a8, a6, .Lz2 /* if byte 2 is zero */
+ s32i a8, a10, 0 /* store word to dst */
+ bany a8, a7, 1b /* if byte 3 is zero */
+#endif /* !XCHAL_HAVE_LOOPS */
+
+.Lz3: /* Byte 3 is zero. */
+ retw
+
+.Lz0: /* Byte 0 is zero. */
+#ifdef __XTENSA_EB__
+ movi a8, 0
+#endif
+ s8i a8, a10, 0
+ retw
+
+.Lz1: /* Byte 1 is zero. */
+#ifdef __XTENSA_EB__
+ extui a8, a8, 16, 16
+#endif
+ s16i a8, a10, 0
+ retw
+
+.Lz2: /* Byte 2 is zero. */
+#ifdef __XTENSA_EB__
+ extui a8, a8, 16, 16
+#endif
+ s16i a8, a10, 0
+ movi a8, 0
+ s8i a8, a10, 2
+ retw
+
+ .align 4
+ /* (2 mod 4) alignment for loop instruction */
+.Ldstunaligned:
+
+#if XCHAL_HAVE_LOOPS
+ _movi.n a8, 0 /* set up for the maximum loop count */
+ loop a8, 2f /* loop forever (almost anyway) */
+#endif
+1: l8ui a8, a3, 0
+ addi a3, a3, 1
+ s8i a8, a10, 0
+ addi a10, a10, 1
+#if XCHAL_HAVE_LOOPS
+ beqz a8, 2f
+#else
+ bnez a8, 1b
+#endif
+2: retw
+
+libc_hidden_def (strcpy)
diff --git a/ap/build/uClibc/libc/string/xtensa/strlen.S b/ap/build/uClibc/libc/string/xtensa/strlen.S
new file mode 100644
index 0000000..9ee4995
--- /dev/null
+++ b/ap/build/uClibc/libc/string/xtensa/strlen.S
@@ -0,0 +1,104 @@
+/* Optimized strlen for Xtensa.
+ Copyright (C) 2001, 2007 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., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+#include "../../sysdeps/linux/xtensa/sysdep.h"
+#include <bits/xtensa-config.h>
+
+#ifdef __XTENSA_EB__
+#define MASK0 0xff000000
+#define MASK1 0x00ff0000
+#define MASK2 0x0000ff00
+#define MASK3 0x000000ff
+#else
+#define MASK0 0x000000ff
+#define MASK1 0x0000ff00
+#define MASK2 0x00ff0000
+#define MASK3 0xff000000
+#endif
+
+ .text
+ENTRY (strlen)
+ /* a2 = s */
+
+ addi a3, a2, -4 /* because we overincrement at the end */
+ movi a4, MASK0
+ movi a5, MASK1
+ movi a6, MASK2
+ movi a7, MASK3
+ bbsi.l a2, 0, .L1mod2
+ bbsi.l a2, 1, .L2mod4
+ j .Laligned
+
+.L1mod2: /* address is odd */
+ l8ui a8, a3, 4 /* get byte 0 */
+ addi a3, a3, 1 /* advance string pointer */
+ beqz a8, .Lz3 /* if byte 0 is zero */
+ bbci.l a3, 1, .Laligned /* if string pointer is now word-aligned */
+
+.L2mod4: /* address is 2 mod 4 */
+ addi a3, a3, 2 /* advance ptr for aligned access */
+ l32i a8, a3, 0 /* get word with first two bytes of string */
+ bnone a8, a6, .Lz2 /* if byte 2 (of word, not string) is zero */
+ bany a8, a7, .Laligned /* if byte 3 (of word, not string) is nonzero */
+
+ /* Byte 3 is zero. */
+ addi a3, a3, 3 /* point to zero byte */
+ sub a2, a3, a2 /* subtract to get length */
+ retw
+
+
+/* String is word-aligned. */
+
+ .align 4
+ /* (2 mod 4) alignment for loop instruction */
+.Laligned:
+#if XCHAL_HAVE_LOOPS
+ _movi.n a8, 0 /* set up for the maximum loop count */
+ loop a8, .Lz3 /* loop forever (almost anyway) */
+#endif
+1: l32i a8, a3, 4 /* get next word of string */
+ addi a3, a3, 4 /* advance string pointer */
+ bnone a8, a4, .Lz0 /* if byte 0 is zero */
+ bnone a8, a5, .Lz1 /* if byte 1 is zero */
+ bnone a8, a6, .Lz2 /* if byte 2 is zero */
+#if XCHAL_HAVE_LOOPS
+ bnone a8, a7, .Lz3 /* if byte 3 is zero */
+#else
+ bany a8, a7, 1b /* repeat if byte 3 is non-zero */
+#endif
+
+.Lz3: /* Byte 3 is zero. */
+ addi a3, a3, 3 /* point to zero byte */
+ /* Fall through.... */
+
+.Lz0: /* Byte 0 is zero. */
+ sub a2, a3, a2 /* subtract to get length */
+ retw
+
+.Lz1: /* Byte 1 is zero. */
+ addi a3, a3, 1 /* point to zero byte */
+ sub a2, a3, a2 /* subtract to get length */
+ retw
+
+.Lz2: /* Byte 2 is zero. */
+ addi a3, a3, 2 /* point to zero byte */
+ sub a2, a3, a2 /* subtract to get length */
+ retw
+
+libc_hidden_def (strlen)
diff --git a/ap/build/uClibc/libc/string/xtensa/strncpy.S b/ap/build/uClibc/libc/string/xtensa/strncpy.S
new file mode 100644
index 0000000..fe3ec89
--- /dev/null
+++ b/ap/build/uClibc/libc/string/xtensa/strncpy.S
@@ -0,0 +1,241 @@
+/* Optimized strcpy for Xtensa.
+ Copyright (C) 2001, 2007 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., 51 Franklin Street - Fifth Floor,
+ Boston, MA 02110-1301, USA. */
+
+#include "../../sysdeps/linux/xtensa/sysdep.h"
+#include <bits/xtensa-config.h>
+
+#ifdef __XTENSA_EB__
+#define MASK0 0xff000000
+#define MASK1 0x00ff0000
+#define MASK2 0x0000ff00
+#define MASK3 0x000000ff
+#else
+#define MASK0 0x000000ff
+#define MASK1 0x0000ff00
+#define MASK2 0x00ff0000
+#define MASK3 0xff000000
+#endif
+
+/* Do not use .literal_position in the ENTRY macro. */
+#undef LITERAL_POSITION
+#define LITERAL_POSITION
+
+ .text
+ .align 4
+ .literal_position
+__strncpy_aux:
+
+.Lsrc1mod2: /* src address is odd */
+ l8ui a8, a3, 0 /* get byte 0 */
+ addi a3, a3, 1 /* advance src pointer */
+ s8i a8, a10, 0 /* store byte 0 */
+ addi a4, a4, -1 /* decrement n */
+ beqz a4, .Lret /* if n is zero */
+ addi a10, a10, 1 /* advance dst pointer */
+ beqz a8, .Lfill /* if byte 0 is zero */
+ bbci.l a3, 1, .Lsrcaligned /* if src is now word-aligned */
+
+.Lsrc2mod4: /* src address is 2 mod 4 */
+ l8ui a8, a3, 0 /* get byte 0 */
+ addi a4, a4, -1 /* decrement n */
+ s8i a8, a10, 0 /* store byte 0 */
+ beqz a4, .Lret /* if n is zero */
+ addi a10, a10, 1 /* advance dst pointer */
+ beqz a8, .Lfill /* if byte 0 is zero */
+ l8ui a8, a3, 1 /* get byte 0 */
+ addi a3, a3, 2 /* advance src pointer */
+ s8i a8, a10, 0 /* store byte 0 */
+ addi a4, a4, -1 /* decrement n */
+ beqz a4, .Lret /* if n is zero */
+ addi a10, a10, 1 /* advance dst pointer */
+ bnez a8, .Lsrcaligned
+ j .Lfill
+
+.Lret:
+ retw
+
+
+ENTRY (strncpy)
+ /* a2 = dst, a3 = src */
+
+ mov a10, a2 /* leave dst in return value register */
+ beqz a4, .Lret /* if n is zero */
+
+ movi a11, MASK0
+ movi a5, MASK1
+ movi a6, MASK2
+ movi a7, MASK3
+ bbsi.l a3, 0, .Lsrc1mod2
+ bbsi.l a3, 1, .Lsrc2mod4
+.Lsrcaligned:
+
+ /* Check if the destination is aligned. */
+ movi a8, 3
+ bnone a10, a8, .Laligned
+
+ j .Ldstunaligned
+
+
+/* Fill the dst with zeros -- n is at least 1. */
+
+.Lfill:
+ movi a9, 0
+ bbsi.l a10, 0, .Lfill1mod2
+ bbsi.l a10, 1, .Lfill2mod4
+.Lfillaligned:
+ blti a4, 4, .Lfillcleanup
+
+ /* Loop filling complete words with zero. */
+#if XCHAL_HAVE_LOOPS
+
+ srai a8, a4, 2
+ loop a8, 1f
+ s32i a9, a10, 0
+ addi a10, a10, 4
+
+1: slli a8, a8, 2
+ sub a4, a4, a8
+
+#else /* !XCHAL_HAVE_LOOPS */
+
+1: s32i a9, a10, 0
+ addi a10, a10, 4
+ addi a4, a4, -4
+ bgei a4, 4, 1b
+
+#endif /* !XCHAL_HAVE_LOOPS */
+
+ beqz a4, 2f
+
+.Lfillcleanup:
+ /* Fill leftover (1 to 3) bytes with zero. */
+ s8i a9, a10, 0 /* store byte 0 */
+ addi a4, a4, -1 /* decrement n */
+ addi a10, a10, 1
+ bnez a4, .Lfillcleanup
+
+2: retw
+
+.Lfill1mod2: /* dst address is odd */
+ s8i a9, a10, 0 /* store byte 0 */
+ addi a4, a4, -1 /* decrement n */
+ beqz a4, 2b /* if n is zero */
+ addi a10, a10, 1 /* advance dst pointer */
+ bbci.l a10, 1, .Lfillaligned /* if dst is now word-aligned */
+
+.Lfill2mod4: /* dst address is 2 mod 4 */
+ s8i a9, a10, 0 /* store byte 0 */
+ addi a4, a4, -1 /* decrement n */
+ beqz a4, 2b /* if n is zero */
+ s8i a9, a10, 1 /* store byte 1 */
+ addi a4, a4, -1 /* decrement n */
+ beqz a4, 2b /* if n is zero */
+ addi a10, a10, 2 /* advance dst pointer */
+ j .Lfillaligned
+
+
+/* dst is word-aligned; src is word-aligned; n is at least 1. */
+
+ .align 4
+ /* (2 mod 4) alignment for loop instruction */
+.Laligned:
+#if XCHAL_HAVE_LOOPS
+ _movi.n a8, 0 /* set up for the maximum loop count */
+ loop a8, 1f /* loop forever (almost anyway) */
+ blti a4, 5, .Ldstunaligned /* n is near limit; do one at a time */
+ l32i a8, a3, 0 /* get word from src */
+ addi a3, a3, 4 /* advance src pointer */
+ bnone a8, a11, .Lz0 /* if byte 0 is zero */
+ bnone a8, a5, .Lz1 /* if byte 1 is zero */
+ bnone a8, a6, .Lz2 /* if byte 2 is zero */
+ s32i a8, a10, 0 /* store word to dst */
+ addi a4, a4, -4 /* decrement n */
+ addi a10, a10, 4 /* advance dst pointer */
+ bnone a8, a7, .Lfill /* if byte 3 is zero */
+1:
+
+#else /* !XCHAL_HAVE_LOOPS */
+
+1: blti a4, 5, .Ldstunaligned /* n is near limit; do one at a time */
+ l32i a8, a3, 0 /* get word from src */
+ addi a3, a3, 4 /* advance src pointer */
+ bnone a8, a11, .Lz0 /* if byte 0 is zero */
+ bnone a8, a5, .Lz1 /* if byte 1 is zero */
+ bnone a8, a6, .Lz2 /* if byte 2 is zero */
+ s32i a8, a10, 0 /* store word to dst */
+ addi a4, a4, -4 /* decrement n */
+ addi a10, a10, 4 /* advance dst pointer */
+ bany a8, a7, 1b /* no zeroes */
+#endif /* !XCHAL_HAVE_LOOPS */
+
+ j .Lfill
+
+.Lz0: /* Byte 0 is zero. */
+#ifdef __XTENSA_EB__
+ movi a8, 0
+#endif
+ s8i a8, a10, 0
+ addi a4, a4, -1 /* decrement n */
+ addi a10, a10, 1 /* advance dst pointer */
+ j .Lfill
+
+.Lz1: /* Byte 1 is zero. */
+#ifdef __XTENSA_EB__
+ extui a8, a8, 16, 16
+#endif
+ s16i a8, a10, 0
+ addi a4, a4, -2 /* decrement n */
+ addi a10, a10, 2 /* advance dst pointer */
+ j .Lfill
+
+.Lz2: /* Byte 2 is zero. */
+#ifdef __XTENSA_EB__
+ extui a8, a8, 16, 16
+#endif
+ s16i a8, a10, 0
+ movi a8, 0
+ s8i a8, a10, 2
+ addi a4, a4, -3 /* decrement n */
+ addi a10, a10, 3 /* advance dst pointer */
+ j .Lfill
+
+ .align 4
+ /* (2 mod 4) alignment for loop instruction */
+.Ldstunaligned:
+
+#if XCHAL_HAVE_LOOPS
+ _movi.n a8, 0 /* set up for the maximum loop count */
+ loop a8, 2f /* loop forever (almost anyway) */
+#endif
+1: l8ui a8, a3, 0
+ addi a3, a3, 1
+ s8i a8, a10, 0
+ addi a4, a4, -1
+ beqz a4, 3f
+ addi a10, a10, 1
+#if XCHAL_HAVE_LOOPS
+ beqz a8, 2f
+#else
+ bnez a8, 1b
+#endif
+2: j .Lfill
+
+3: retw
+
+libc_hidden_def (strncpy)