summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorFlorian Boor <florian.boor@kernelconcepts.de>2008-01-24 14:19:31 +0000
committerFlorian Boor <florian.boor@kernelconcepts.de>2008-01-24 14:19:31 +0000
commitf1b48b3a26ab80e3f18edead4d7bfd1d0addf4b2 (patch)
treee2f306c370337c045fd3891a4686702a13b09299 /packages
parentdf8c1b2fc46ccae1e517768b56317ffdb2150409 (diff)
dummy ci
Diffstat (limited to 'packages')
-rw-r--r--packages/avahi/avahi_0.6.21.bb1
-rw-r--r--packages/avahi/files/avr32-ipv6-fix.patch42
-rw-r--r--packages/binutils/binutils_2.17.bb3
-rw-r--r--packages/busybox/busybox-1.2.1/avr32/.mtn2git_empty0
-rw-r--r--packages/busybox/busybox-1.7.2/angstrom/defconfig30
-rw-r--r--packages/busybox/busybox_1.2.1.bb1
-rw-r--r--packages/fuse/gmailfs.inc23
-rw-r--r--packages/gcc/gcc-cross_4.1.2.bb2
-rw-r--r--packages/gcc/gcc-package-cross.inc10
-rw-r--r--packages/gcc/gcc-package.inc6
-rw-r--r--packages/gcc/gcc_4.1.2.bb19
-rw-r--r--packages/gcc/gcc_4.2.1.bb31
-rw-r--r--packages/gpephone/libmsgenabler2_svn.bb2
-rw-r--r--packages/gtk+/gtk+_2.10.14.bb1
-rw-r--r--packages/gtk+/gtk+_2.12.0.bb5
-rw-r--r--packages/hwdata/hwdata_0.191.bb6
-rw-r--r--packages/libmad/libmad_0.15.1b.bb3
-rw-r--r--packages/linux/linux_2.6.23.bb5
-rw-r--r--packages/linux/mainstone-kernel/mainstone_defconfig1277
-rw-r--r--packages/linux/mainstone-kernel_2.6.18.bb1
-rw-r--r--packages/mplayer/files/mplayer-1.0rc1-atmel.2.patch6444
-rw-r--r--packages/mplayer/mplayer_0.0+1.0rc1.bb8
-rw-r--r--packages/tasks/task-gpephone.bb19
-rw-r--r--packages/tasks/task-sdk-base.bb3
-rw-r--r--packages/tasks/task-sdk-gpephone.bb24
-rw-r--r--packages/tea/tea_17.3.5.bb2
-rw-r--r--packages/tinymail/libtinymail-0.0.1/no-iconv-detect.patch76
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/avr32-arch-2.patch2135
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/avr32-linkrelax-option.patch40
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/avr32-string-ops.patch1139
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/fix-__libc_fcntl64-varargs-prototype.patch24
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/fix-broken-__libc_open-declaration.patch30
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/fix-getrusage-argument-type.patch19
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/ldd-avr32-support.patch25
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/ldso-always-inline-_dl_memcpy.patch24
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/ldso-always-inline-syscalls.patch107
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-2.patch526
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-needs-CONSTANT_STRING_GOT_FIXUP.patch23
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-startup-hack.patch40
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/ldso-define-MAP_FAILED.patch23
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/let-optimized-stringops-override-default-ones.patch28
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/libpthread-avr32.patch105
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/no-create_module-on-avr32.patch27
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/remove-bogus-version-hack-and-just-use-asm-generic-if-it-exists.patch48
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/sync-fcntl-h-with-linux-kernel.patch54
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/uClibc-0.9.28-avr32-20060621.patch4322
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/uClibc-0.9.28-avr32-20061019.patch4080
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/uClibc.config31
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/uclibc-avr32-kernheaders.spec41
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/uclibc-avr32-no-msoft-float.patch14
-rw-r--r--packages/uclibc/uclibc-0.9.28/avr32/uclibc-makefile.patch16
-rw-r--r--packages/uclibc/uclibc.inc15
-rw-r--r--packages/uclibc/uclibc_0.9.28.bb30
-rw-r--r--packages/util-linux/files/fdiskbsdlabel-avr32.patch11
-rw-r--r--packages/util-linux/util-linux_2.12r.bb3
-rw-r--r--packages/xorg-font/xfonts-xorg_6.8.bb5
-rw-r--r--packages/xorg-lib/libx11-native_1.0.1.bb3
-rw-r--r--packages/xorg-xserver/xorg-xserver-common.inc1
-rw-r--r--packages/xorg-xserver/xserver-kdrive_1.3.0.0.bb4
-rw-r--r--packages/xorg-xserver/xserver-kdrive_1.4.bb3
60 files changed, 19581 insertions, 1459 deletions
diff --git a/packages/avahi/avahi_0.6.21.bb b/packages/avahi/avahi_0.6.21.bb
index fa3fef039e..2c30fbc2c8 100644
--- a/packages/avahi/avahi_0.6.21.bb
+++ b/packages/avahi/avahi_0.6.21.bb
@@ -2,3 +2,4 @@ require avahi.inc
PR = "r1"
SRC_URI += "file://dbus-pre-1.1.1-support.patch;patch=1"
+SRC_URI += "file://avr32-ipv6-fix.patch;patch=1"
diff --git a/packages/avahi/files/avr32-ipv6-fix.patch b/packages/avahi/files/avr32-ipv6-fix.patch
new file mode 100644
index 0000000000..f0710a1002
--- /dev/null
+++ b/packages/avahi/files/avr32-ipv6-fix.patch
@@ -0,0 +1,42 @@
+--- /tmp/socket.c 2007-09-14 14:03:01.395330465 +0200
++++ avahi-0.6.21/avahi-core/socket.c 2007-09-14 14:08:42.081140297 +0200
+@@ -66,6 +66,39 @@
+ #endif
+ #endif
+
++#define IPV6_ADDRFORM 1
++#define IPV6_2292PKTINFO 2
++#define IPV6_2292HOPOPTS 3
++#define IPV6_2292DSTOPTS 4
++#define IPV6_2292RTHDR 5
++#define IPV6_2292PKTOPTIONS 6
++#define IPV6_CHECKSUM 7
++#define IPV6_2292HOPLIMIT 8
++#define IPV6_NEXTHOP 9
++#define IPV6_AUTHHDR 10 /* obsolete */
++#define IPV6_FLOWINFO 11
++
++#define IPV6_UNICAST_HOPS 16
++#define IPV6_MULTICAST_IF 17
++#define IPV6_MULTICAST_HOPS 18
++#define IPV6_MULTICAST_LOOP 19
++#define IPV6_ADD_MEMBERSHIP 20
++#define IPV6_DROP_MEMBERSHIP 21
++#define IPV6_ROUTER_ALERT 22
++#define IPV6_MTU_DISCOVER 23
++#define IPV6_MTU 24
++#define IPV6_RECVERR 25
++#define IPV6_V6ONLY 26
++#define IPV6_JOIN_ANYCAST 27
++#define IPV6_LEAVE_ANYCAST 28
++
++/* IPV6_MTU_DISCOVER values */
++#define IPV6_PMTUDISC_DONT 0
++#define IPV6_PMTUDISC_WANT 1
++#define IPV6_PMTUDISC_DO 2
++#define IPV6_PMTUDISC_PROBE 3
++
++
+ static void mdns_mcast_group_ipv4(struct sockaddr_in *ret_sa) {
+ assert(ret_sa);
+
diff --git a/packages/binutils/binutils_2.17.bb b/packages/binutils/binutils_2.17.bb
index 8d38f3a459..69e11497c2 100644
--- a/packages/binutils/binutils_2.17.bb
+++ b/packages/binutils/binutils_2.17.bb
@@ -1,6 +1,6 @@
require binutils.inc
-PR = "r1"
+PR = "r2"
SRC_URI = \
"http://ftp.gnu.org/gnu/binutils/binutils-${PV}.tar.bz2 \
@@ -21,6 +21,7 @@ SRC_URI += "\
http://avr32linux.org/twiki/pub/Main/DevelopmentTools/500-avr32.patch.gz;patch=1 \
http://avr32linux.org/twiki/pub/Main/DevelopmentTools/501-avr32-sreldyn-fix.patch.gz;patch=1 \
http://avr32linux.org/twiki/pub/Main/DevelopmentTools/502-avr32-bfd-dont-allow-direct-refs-to-bss.patch.gz;patch=1 \
+ file://503-avr32-fix-got-offset-init.patch;patch=1 \
"
# Zecke's OSX fixes
diff --git a/packages/busybox/busybox-1.2.1/avr32/.mtn2git_empty b/packages/busybox/busybox-1.2.1/avr32/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/busybox/busybox-1.2.1/avr32/.mtn2git_empty
diff --git a/packages/busybox/busybox-1.7.2/angstrom/defconfig b/packages/busybox/busybox-1.7.2/angstrom/defconfig
index 30e71e8ffe..29ae0e541c 100644
--- a/packages/busybox/busybox-1.7.2/angstrom/defconfig
+++ b/packages/busybox/busybox-1.7.2/angstrom/defconfig
@@ -353,15 +353,15 @@ CONFIG_XARGS=y
#
# Init Utilities
#
-# CONFIG_INIT is not set
+CONFIG_INIT=y
# CONFIG_DEBUG_INIT is not set
-# CONFIG_FEATURE_USE_INITTAB is not set
-# CONFIG_FEATURE_INIT_SCTTY is not set
+CONFIG_FEATURE_USE_INITTAB=y
+CONFIG_FEATURE_INIT_SCTTY=y
# CONFIG_FEATURE_INIT_SYSLOG is not set
# CONFIG_FEATURE_EXTRA_QUIET is not set
# CONFIG_FEATURE_INIT_COREDUMPS is not set
# CONFIG_FEATURE_INITRD is not set
-# CONFIG_HALT is not set
+CONFIG_HALT=y
# CONFIG_MESG is not set
#
@@ -376,10 +376,10 @@ CONFIG_XARGS=y
# CONFIG_FEATURE_DEL_USER_FROM_GROUP is not set
# CONFIG_ADDUSER is not set
# CONFIG_DELUSER is not set
-# CONFIG_GETTY is not set
+CONFIG_GETTY=y
CONFIG_FEATURE_UTMP=y
# CONFIG_FEATURE_WTMP is not set
-# CONFIG_LOGIN is not set
+CONFIG_LOGIN=y
# CONFIG_PAM is not set
# CONFIG_LOGIN_SCRIPTS is not set
# CONFIG_FEATURE_NOLOGIN is not set
@@ -479,7 +479,7 @@ CONFIG_RDATE=y
CONFIG_SWAPONOFF=y
CONFIG_SWITCH_ROOT=y
CONFIG_UMOUNT=y
-# CONFIG_FEATURE_UMOUNT_ALL is not set
+CONFIG_FEATURE_UMOUNT_ALL=y
#
# Common options for mount/umount
@@ -522,7 +522,7 @@ CONFIG_FEATURE_LESS_FLAGS=y
# CONFIG_MAKEDEVS is not set
# CONFIG_FEATURE_MAKEDEVS_LEAF is not set
# CONFIG_FEATURE_MAKEDEVS_TABLE is not set
-# CONFIG_MOUNTPOINT is not set
+CONFIG_MOUNTPOINT=y
# CONFIG_MT is not set
# CONFIG_RAIDAUTORUN is not set
# CONFIG_READAHEAD is not set
@@ -577,12 +577,12 @@ CONFIG_FEATURE_IFUPDOWN_IPV4=y
CONFIG_FEATURE_IFUPDOWN_IPV6=y
CONFIG_FEATURE_IFUPDOWN_MAPPING=y
# CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set
-# CONFIG_INETD is not set
-# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set
-# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set
-# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set
-# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set
-# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set
+CONFIG_INETD=y
+CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO=y
+CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD=y
+CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME=y
+CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME=y
+CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y
# CONFIG_FEATURE_INETD_RPC is not set
CONFIG_IP=y
CONFIG_FEATURE_IP_ADDRESS=y
@@ -615,7 +615,7 @@ CONFIG_ROUTE=y
CONFIG_TELNET=y
# CONFIG_FEATURE_TELNET_TTYPE is not set
CONFIG_FEATURE_TELNET_AUTOLOGIN=y
-# CONFIG_TELNETD is not set
+CONFIG_TELNETD=y
# CONFIG_FEATURE_TELNETD_STANDALONE is not set
CONFIG_TFTP=y
CONFIG_FEATURE_TFTP_GET=y
diff --git a/packages/busybox/busybox_1.2.1.bb b/packages/busybox/busybox_1.2.1.bb
index 325111c22f..3b7016a42c 100644
--- a/packages/busybox/busybox_1.2.1.bb
+++ b/packages/busybox/busybox_1.2.1.bb
@@ -5,6 +5,7 @@ PR = "r15"
SRC_URI += "file://wget-long-options.patch;patch=1 \
file://df_rootfs.patch;patch=1 \
file://defconfig"
+SRC_URI_append_avr32 = " file://install-should-unlink-dest-if-it-exists.patch;patch=1"
do_configure () {
install -m 0644 ${WORKDIR}/defconfig ${S}/.config.oe
diff --git a/packages/fuse/gmailfs.inc b/packages/fuse/gmailfs.inc
index 9f1c676c87..de4ea18089 100644
--- a/packages/fuse/gmailfs.inc
+++ b/packages/fuse/gmailfs.inc
@@ -1,22 +1 @@
-DESCRIPTION = "GmailFS provides a mountable Linux filesystem which uses your Gmail account as its storage medium."
-HOMEPAGE = "http://richard.jones.name/google-hacks/gmail-filesystem/gmail-filesystem.html"
-LICENSE = "GPLv2"
-
-DEPENDS = "fuse python-libgmail python-fuse"
-RDEPENDS = "fuse python-libgmail python-fuse python-unixadmin python-lang python-textutils python-core"
-
-SRC_URI = "http://richard.jones.name/google-hacks/gmail-filesystem/${PN}-${PV}.tar.gz"
-
-
-do_install() {
-
-install -d ${D}${datadir}/gmailfs
-install -d ${D}${bindir}
-install -d ${D}${sysconfdir}
-
-install -m 755 ${S}/gmailfs.py ${D}${datadir}/gmailfs/
-install -m 755 ${S}/mount.gmailfs ${D}${bindir}
-install -m 644 ${S}/*.conf ${D}${sysconfdir}
-
-}
-
+require gmailfs.inc
diff --git a/packages/gcc/gcc-cross_4.1.2.bb b/packages/gcc/gcc-cross_4.1.2.bb
index 0f63487f2c..306cf9539c 100644
--- a/packages/gcc/gcc-cross_4.1.2.bb
+++ b/packages/gcc/gcc-cross_4.1.2.bb
@@ -17,4 +17,6 @@ require gcc-package-cross.inc
SRC_URI_append_fail-fast = " file://zecke-no-host-includes.patch;patch=1 "
+EXTRA_OECONF_append_avr32= " --disable-libmudflap "
+
EXTRA_OECONF += "--disable-libunwind-exceptions --with-mpfr=${STAGING_DIR_NATIVE}${layout_exec_prefix}"
diff --git a/packages/gcc/gcc-package-cross.inc b/packages/gcc/gcc-package-cross.inc
index 5c6b370d82..51a45cd633 100644
--- a/packages/gcc/gcc-package-cross.inc
+++ b/packages/gcc/gcc-package-cross.inc
@@ -43,12 +43,12 @@ do_install () {
# Already in the right location
:
elif [ -f ${D}${prefix}/lib/libgcc_s.so.? ]; then
- mv -f ${D}${prefix}/lib/libgcc_s.so* ${D}${target_base_libdir}
+ mv -f ${D}${prefix}/lib/libgcc_s.so* ${D}${target_base_libdir} || true
elif [ -f ${D}${prefix}/*/lib/nof/libgcc_s.so.? ]; then
mv -f ${D}${prefix}/*/lib/nof/libgcc_s.so* ${D}${target_base_libdir}
else
- mv -f ${D}${prefix}/*/lib/libgcc_s.so* ${D}${target_base_libdir}
+ mv -f ${D}${prefix}/*/lib/libgcc_s.so* ${D}${target_base_libdir} || true
fi
@@ -58,12 +58,12 @@ do_install () {
if [ -f ${D}${prefix}/*/lib/nof/libstdc++.so ]; then
- mv -f ${D}${prefix}/*/lib/nof/libstdc++.so* ${D}${target_libdir}
+ mv -f ${D}${prefix}/*/lib/nof/libstdc++.so* ${D}${target_libdir} || true
mv -f ${D}${prefix}/*/lib/nof/libg2c.so* ${D}${target_libdir} || true
mv -f ${D}${prefix}/*/lib/nof/libgfortran*.so* ${D}${target_libdir} || true
else
- mv -f ${D}${prefix}/*/lib/libstdc++.so* ${D}${target_libdir}
+ mv -f ${D}${prefix}/*/lib/libstdc++.so* ${D}${target_libdir} || true
mv -f ${D}${prefix}/*/lib/libg2c.so* ${D}${target_libdir} || true
mv -f ${D}${prefix}/*/lib/libgfortran*.so* ${D}${target_libdir} || true
fi
@@ -75,7 +75,7 @@ do_install () {
if [ "x${OLD_INHIBIT_PACKAGE_STRIP}" != "x1" ]; then
${TARGET_PREFIX}strip ${D}${target_libdir}/libstdc++.so.*
${TARGET_PREFIX}strip ${D}${target_libdir}/libg2c.so.* || true
- ${TARGET_PREFIX}strip ${D}${target_base_libdir}/libgcc_s.so.*
+ ${TARGET_PREFIX}strip ${D}${target_base_libdir}/libgcc_s.so.* || true
${TARGET_PREFIX}strip ${D}${target_libdir}/libgfortran*.so* || true
fi
diff --git a/packages/gcc/gcc-package.inc b/packages/gcc/gcc-package.inc
index d1b4607de5..96f1604997 100644
--- a/packages/gcc/gcc-package.inc
+++ b/packages/gcc/gcc-package.inc
@@ -92,11 +92,7 @@ do_install () {
# Move libgcc_s into /lib
mkdir -p ${D}${base_libdir}
- if [ -f ${D}${libdir}/nof/libgcc_s.so ]; then
- mv ${D}${libdir}/nof/libgcc_s.so.* ${D}${base_libdir}
- else
- mv ${D}${libdir}/libgcc_s.so.* ${D}${base_libdir}
- fi
+ mv ${D}${libdir}/libgcc_s.so.* ${D}${base_libdir}
rm -f ${D}${libdir}/libgcc_s.so
ln -sf `echo ${libdir}/gcc/${TARGET_SYS}/${BINV} \
| tr -s / \
diff --git a/packages/gcc/gcc_4.1.2.bb b/packages/gcc/gcc_4.1.2.bb
index e0801d3c7f..b3eb0100e8 100644
--- a/packages/gcc/gcc_4.1.2.bb
+++ b/packages/gcc/gcc_4.1.2.bb
@@ -39,6 +39,25 @@ SRC_URI = "ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.1.2/gcc-4.1.2.tar.bz2 \
SRC_URI_append_sh3 = " file://sh3-installfix-fixheaders.patch;patch=1 "
+SRC_URI_avr32 = "http://www.angstrom-distribution.org/unstable/sources/gcc-4.1.2-atmel.1.1.0.tar.gz \
+# file://100-uclibc-conf.patch;patch=1 \
+# file://200-uclibc-locale.patch;patch=1 \
+# file://300-libstdc++-pic.patch;patch=1 \
+ file://301-missing-execinfo_h.patch;patch=1 \
+ file://302-c99-snprintf.patch;patch=1 \
+ file://303-c99-complex-ugly-hack.patch;patch=1 \
+ file://304-index_macro.patch;patch=1 \
+ file://602-sdk-libstdc++-includes.patch;patch=1 \
+ file://gcc41-configure.in.patch;patch=1 \
+ file://ldflags.patch;patch=1 \
+ file://zecke-xgcc-cpp.patch;patch=1 \
+ file://cache-amnesia.patch;patch=1 \
+ "
+
+do_compile_prepend_avr32() {
+ ln -sf ${S}/libstdc++-v3/config/os/uclibc/ ${S}/libstdc++-v3/config/os/uclibc-linux
+}
+
#Set the fortran bits
# ',fortran' or '', not 'f77' like gcc3 had
FORTRAN = ""
diff --git a/packages/gcc/gcc_4.2.1.bb b/packages/gcc/gcc_4.2.1.bb
index 5d049398e4..4df5f4cc4a 100644
--- a/packages/gcc/gcc_4.2.1.bb
+++ b/packages/gcc/gcc_4.2.1.bb
@@ -39,7 +39,34 @@ SRC_URI = "ftp://ftp.gnu.org/pub/gnu/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
file://fix-ICE-in-arm_unwind_emit_set.diff;patch=1 \
file://cache-amnesia.patch;patch=1 \
file://gfortran.patch;patch=1 \
- file://pr34130.patch;patch=1 \
+ file://pr34130.patch;patch=1 \
+"
+
+
+SRC_URI_avr32 = " http://ewi546.ewi.utwente.nl/tmp/avr32-gcc-4.2.1-atmel.1.0.1.tar.gz \
+ file://100-uclibc-conf.patch;patch=1 \
+ file://103-uclibc-conf-noupstream.patch;patch=1 \
+ file://200-uclibc-locale.patch;patch=1 \
+ file://203-uclibc-locale-no__x.patch;patch=1 \
+ file://204-uclibc-locale-wchar_fix.patch;patch=1 \
+ file://205-uclibc-locale-update.patch;patch=1 \
+ file://300-libstdc++-pic.patch;patch=1 \
+ file://301-missing-execinfo_h.patch;patch=1 \
+ file://302-c99-snprintf.patch;patch=1 \
+ file://303-c99-complex-ugly-hack.patch;patch=1 \
+ file://304-index_macro.patch;patch=1 \
+ file://305-libmudflap-susv3-legacy.patch;patch=1 \
+ file://306-libstdc++-namespace.patch;patch=1 \
+ file://307-locale_facets.patch;patch=1 \
+ file://402-libbackend_dep_gcov-iov.h.patch;patch=1 \
+ file://602-sdk-libstdc++-includes.patch;patch=1 \
+ file://740-sh-pr24836.patch;patch=1 \
+ file://904-flatten-switch-stmt-00.patch;patch=1 \
+ file://gcc41-configure.in.patch;patch=1 \
+ file://ldflags.patch;patch=1 \
+ file://zecke-xgcc-cpp.patch;patch=1 \
+ file://cache-amnesia.patch;patch=1 \
+ file://gfortran.patch;patch=1 \
"
SRC_URI_append_ep93xx = " \
@@ -80,5 +107,5 @@ require gcc3-build.inc
ARCH_FLAGS_FOR_TARGET=-isystem${STAGING_INCDIR}
-EXTRA_OECONF += " --disable-libssp --disable-bootstrap "
+EXTRA_OECONF += " --disable-libgomp --disable-libssp --disable-bootstrap "
diff --git a/packages/gpephone/libmsgenabler2_svn.bb b/packages/gpephone/libmsgenabler2_svn.bb
index a294dc93b7..b105211bde 100644
--- a/packages/gpephone/libmsgenabler2_svn.bb
+++ b/packages/gpephone/libmsgenabler2_svn.bb
@@ -2,7 +2,7 @@ LICENSE = "LiPS"
DESCRIPTION = "LiPS message backend library."
SECTION = "gpe/libs"
PRIORITY = "optional"
-DEPENDS = "glib-2.0 dbus-glib librecord2 liblipsevent2 telepathy-mission-control libgsmd-lips"
+DEPENDS = "glib-2.0 dbus-glib librecord2 liblipsevent2 telepathy-mission-control libgsmd libtapi"
PV = "0.0+svnr-${SRCREV}"
PR = "r2"
diff --git a/packages/gtk+/gtk+_2.10.14.bb b/packages/gtk+/gtk+_2.10.14.bb
index d8ae8ae9ba..ff6f195fa0 100644
--- a/packages/gtk+/gtk+_2.10.14.bb
+++ b/packages/gtk+/gtk+_2.10.14.bb
@@ -25,6 +25,7 @@ SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.10/gtk+-${PV}.tar.bz2 \
file://scrolled-placement.patch;patch=1;pnum=0 \
file://treeview-checkbox-size.patch;patch=1;pnum=0 \
file://cell-renderer-edit-focus.patch;patch=1;pnum=0 \
+ file://iconview-touchscreen.patch;patch=1 \
"
# check for TARGET_FPU=soft and inform configure of the result so it can disable some floating points
diff --git a/packages/gtk+/gtk+_2.12.0.bb b/packages/gtk+/gtk+_2.12.0.bb
index 57ba24e796..e18effba38 100644
--- a/packages/gtk+/gtk+_2.12.0.bb
+++ b/packages/gtk+/gtk+_2.12.0.bb
@@ -1,6 +1,6 @@
require gtk+.inc
-PR = "r1"
+PR = "r2"
DEPENDS += "cairo"
@@ -16,7 +16,8 @@ SRC_URI = "http://download.gnome.org/sources/gtk+/2.12/gtk+-${PV}.tar.bz2 \
file://cellrenderer-cairo.patch;patch=1;pnum=0 \
file://entry-cairo.patch;patch=1;pnum=0 \
file://toggle-font.diff;patch=1;pnum=0 \
- file://scrolled-placement.patch;patch=1;pnum=0"
+ file://scrolled-placement.patch;patch=1;pnum=0 \
+ file://iconview-touchscreen.patch;patch=1"
# temporary
# file://gtklabel-resize-patch;patch=1 \
# file://menu-deactivate.patch;patch=1 \
diff --git a/packages/hwdata/hwdata_0.191.bb b/packages/hwdata/hwdata_0.191.bb
index 5d607ddc1a..2dfe1433bf 100644
--- a/packages/hwdata/hwdata_0.191.bb
+++ b/packages/hwdata/hwdata_0.191.bb
@@ -1,16 +1,14 @@
DESCRIPTION = "This package contains various hardware identification and configuration data, such as the pci.ids database, or the XFree86/xorg Cards database. It's needed for the kudzu hardware detection."
LICENSE = "GPL + X11"
-PR = "r1"
-
SRC_URI = "http://archive.ubuntu.com/ubuntu/pool/main/h/hwdata/hwdata_0.191.orig.tar.gz \
http://archive.ubuntu.com/ubuntu/pool/main/h/hwdata/hwdata_0.191-1.diff.gz;patch=1 \
"
PACKAGE_ARCH = "all"
-FILES_${PN} = "${datadir}"
+
do_install() {
mkdir -p ${D}${datadir}/hwdata
- install -m 644 MonitorsDB pci* usb.ids video* upgradelist ${D}${datadir}/hwdata
+ install -m644 MonitorsDB pci* usb.ids video* upgradelist ${D}${datadir}/hwdata
}
diff --git a/packages/libmad/libmad_0.15.1b.bb b/packages/libmad/libmad_0.15.1b.bb
index 4e486236cd..b2a3be36ca 100644
--- a/packages/libmad/libmad_0.15.1b.bb
+++ b/packages/libmad/libmad_0.15.1b.bb
@@ -3,8 +3,11 @@ SECTION = "libs"
PRIORITY = "optional"
DEPENDS = "libid3tag"
LICENSE = "GPL"
+PR = "r1"
SRC_URI = "${SOURCEFORGE_MIRROR}/mad/libmad-${PV}.tar.gz"
+SRC_URI_append_avr32 = " file://libmad-0.15.1b-avr32-optimization.patch;patch=1"
+
S = "${WORKDIR}/libmad-${PV}"
inherit autotools
diff --git a/packages/linux/linux_2.6.23.bb b/packages/linux/linux_2.6.23.bb
index c143e1dbf9..10c5242582 100644
--- a/packages/linux/linux_2.6.23.bb
+++ b/packages/linux/linux_2.6.23.bb
@@ -5,6 +5,7 @@ DEFAULT_PREFERENCE = "-1"
DEFAULT_PREFERENCE_cm-x270 = "1"
DEFAULT_PREFERENCE_mpc8313e-rdb = "1"
DEFAULT_PREFERENCE_mpc8323e-rdb = "1"
+DEFAULT_PREFERENCE_avr32 = "1"
DEPENDS_append_mpc8313e-rdb = " dtc-native"
DEPENDS_append_mpc8323e-rdb = " dtc-native"
@@ -26,6 +27,10 @@ SRC_URI += "http://people.redhat.com/mingo/cfs-scheduler/sched-cfs-v2.6.23.12-v2
# Add support for squashfs-lzma (a highly compressed read-only filesystem)
SRC_URI += "http://kamikaze.waninkoko.info/patches/2.6.23/klight1/broken-out/squashfs-lzma-2.6.23.patch;patch=1"
+SRC_URI_append_avr32 = " \
+ file://linux-2.6.23.atmel.3.patch;patch=1 \
+ "
+
SRC_URI_append_cm-x270 = "\
file://0001-cm-x270-base2.patch;patch=1 \
file://0002-cm-x270-match-type.patch;patch=1 \
diff --git a/packages/linux/mainstone-kernel/mainstone_defconfig b/packages/linux/mainstone-kernel/mainstone_defconfig
deleted file mode 100644
index 41abfbfeac..0000000000
--- a/packages/linux/mainstone-kernel/mainstone_defconfig
+++ /dev/null
@@ -1,1277 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18
-# Wed Dec 19 15:51:05 2007
-#
-CONFIG_ARM=y
-CONFIG_MMU=y
-CONFIG_GENERIC_HARDIRQS=y
-CONFIG_HARDIRQS_SW_RESEND=y
-CONFIG_GENERIC_IRQ_PROBE=y
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_ARCH_MTD_XIP=y
-CONFIG_VECTORS_BASE=0xffff0000
-CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_BROKEN_ON_SMP=y
-CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
-CONFIG_LOCALVERSION_AUTO=y
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-# CONFIG_POSIX_MQUEUE is not set
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_TASKSTATS is not set
-# CONFIG_AUDIT is not set
-# CONFIG_IKCONFIG is not set
-# CONFIG_RELAY is not set
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
-# CONFIG_EMBEDDED is not set
-CONFIG_UID16=y
-CONFIG_SYSCTL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_ALL is not set
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
-CONFIG_HOTPLUG=y
-CONFIG_PRINTK=y
-CONFIG_BUG=y
-CONFIG_ELF_CORE=y
-CONFIG_BASE_FULL=y
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_SHMEM=y
-CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
-CONFIG_MODULES=y
-# CONFIG_MODULE_UNLOAD is not set
-# CONFIG_MODVERSIONS is not set
-# CONFIG_MODULE_SRCVERSION_ALL is not set
-CONFIG_KMOD=y
-
-#
-# Block layer
-#
-# CONFIG_BLK_DEV_IO_TRACE is not set
-
-#
-# IO Schedulers
-#
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-# CONFIG_DEFAULT_AS is not set
-# CONFIG_DEFAULT_DEADLINE is not set
-CONFIG_DEFAULT_CFQ=y
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="cfq"
-
-#
-# System Type
-#
-# CONFIG_ARCH_AAEC2000 is not set
-# CONFIG_ARCH_INTEGRATOR is not set
-# CONFIG_ARCH_REALVIEW is not set
-# CONFIG_ARCH_VERSATILE is not set
-# CONFIG_ARCH_AT91 is not set
-# CONFIG_ARCH_CLPS7500 is not set
-# CONFIG_ARCH_CLPS711X is not set
-# CONFIG_ARCH_CO285 is not set
-# CONFIG_ARCH_EBSA110 is not set
-# CONFIG_ARCH_EP93XX is not set
-# CONFIG_ARCH_FOOTBRIDGE is not set
-# CONFIG_ARCH_NETX is not set
-# CONFIG_ARCH_H720X is not set
-# CONFIG_ARCH_IMX is not set
-# CONFIG_ARCH_IOP3XX is not set
-# CONFIG_ARCH_IXP4XX is not set
-# CONFIG_ARCH_IXP2000 is not set
-# CONFIG_ARCH_IXP23XX is not set
-# CONFIG_ARCH_L7200 is not set
-# CONFIG_ARCH_PNX4008 is not set
-CONFIG_ARCH_PXA=y
-# CONFIG_ARCH_RPC is not set
-# CONFIG_ARCH_SA1100 is not set
-# CONFIG_ARCH_S3C2410 is not set
-# CONFIG_ARCH_SHARK is not set
-# CONFIG_ARCH_LH7A40X is not set
-# CONFIG_ARCH_OMAP is not set
-
-#
-# Intel PXA2xx Implementations
-#
-# CONFIG_ARCH_LUBBOCK is not set
-# CONFIG_MACH_LOGICPD_PXA270 is not set
-CONFIG_MACH_MAINSTONE=y
-# CONFIG_ARCH_PXA_IDP is not set
-# CONFIG_PXA_SHARPSL is not set
-# CONFIG_MACH_TRIZEPS4 is not set
-CONFIG_PXA27x=y
-CONFIG_IWMMXT=y
-
-#
-# Processor Type
-#
-CONFIG_CPU_32=y
-CONFIG_CPU_XSCALE=y
-CONFIG_CPU_32v5=y
-CONFIG_CPU_ABRT_EV5T=y
-CONFIG_CPU_CACHE_VIVT=y
-CONFIG_CPU_TLB_V4WBI=y
-
-#
-# Processor Features
-#
-# CONFIG_ARM_THUMB is not set
-CONFIG_XSCALE_PMU=y
-
-#
-# Bus support
-#
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-CONFIG_PCCARD=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_PCMCIA=m
-CONFIG_PCMCIA_LOAD_CIS=y
-CONFIG_PCMCIA_IOCTL=y
-
-#
-# PC-card bridges
-#
-CONFIG_PCMCIA_PXA2XX=m
-
-#
-# Kernel Features
-#
-# CONFIG_PREEMPT is not set
-# CONFIG_NO_IDLE_HZ is not set
-CONFIG_HZ=100
-# CONFIG_AEABI is not set
-# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
-CONFIG_SELECT_MEMORY_MODEL=y
-CONFIG_FLATMEM_MANUAL=y
-# CONFIG_DISCONTIGMEM_MANUAL is not set
-# CONFIG_SPARSEMEM_MANUAL is not set
-CONFIG_FLATMEM=y
-CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
-CONFIG_SPLIT_PTLOCK_CPUS=4096
-# CONFIG_RESOURCES_64BIT is not set
-CONFIG_LEDS=y
-CONFIG_LEDS_TIMER=y
-CONFIG_LEDS_CPU=y
-CONFIG_ALIGNMENT_TRAP=y
-
-#
-# Boot options
-#
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=jffs2 console=ttyS0,115200 mem=64M"
-# CONFIG_XIP_KERNEL is not set
-
-#
-# Floating point emulation
-#
-
-#
-# At least one emulation must be selected
-#
-CONFIG_FPE_NWFPE=y
-# CONFIG_FPE_NWFPE_XP is not set
-# CONFIG_FPE_FASTFPE is not set
-
-#
-# Userspace binary formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_AOUT is not set
-# CONFIG_BINFMT_MISC is not set
-# CONFIG_ARTHUR is not set
-
-#
-# Power management options
-#
-CONFIG_PM=y
-CONFIG_PM_LEGACY=y
-# CONFIG_PM_DEBUG is not set
-CONFIG_APM=y
-
-#
-# Networking
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-# CONFIG_NETDEBUG is not set
-# CONFIG_PACKET is not set
-CONFIG_UNIX=y
-CONFIG_XFRM=y
-# CONFIG_XFRM_USER is not set
-# CONFIG_NET_KEY is not set
-CONFIG_INET=y
-# CONFIG_IP_MULTICAST is not set
-# CONFIG_IP_ADVANCED_ROUTER is not set
-CONFIG_IP_FIB_HASH=y
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
-CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_IPGRE is not set
-# CONFIG_ARPD is not set
-# CONFIG_SYN_COOKIES is not set
-# CONFIG_INET_AH is not set
-# CONFIG_INET_ESP is not set
-# CONFIG_INET_IPCOMP is not set
-# CONFIG_INET_XFRM_TUNNEL is not set
-# CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=y
-CONFIG_INET_XFRM_MODE_TUNNEL=y
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
-# CONFIG_TCP_CONG_ADVANCED is not set
-CONFIG_TCP_CONG_BIC=y
-# CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-# CONFIG_NETWORK_SECMARK is not set
-# CONFIG_NETFILTER is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
-# CONFIG_TIPC is not set
-# CONFIG_ATM is not set
-# CONFIG_BRIDGE is not set
-# CONFIG_VLAN_8021Q is not set
-# CONFIG_DECNET is not set
-# CONFIG_LLC2 is not set
-# CONFIG_IPX is not set
-# CONFIG_ATALK is not set
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-# CONFIG_ECONET is not set
-# CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
-# CONFIG_NET_SCHED is not set
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-# CONFIG_HAMRADIO is not set
-CONFIG_IRDA=m
-
-#
-# IrDA protocols
-#
-# CONFIG_IRLAN is not set
-# CONFIG_IRNET is not set
-# CONFIG_IRCOMM is not set
-# CONFIG_IRDA_ULTRA is not set
-
-#
-# IrDA options
-#
-# CONFIG_IRDA_CACHE_LAST_LSAP is not set
-# CONFIG_IRDA_FAST_RR is not set
-# CONFIG_IRDA_DEBUG is not set
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-# CONFIG_IRTTY_SIR is not set
-
-#
-# Dongle support
-#
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-# CONFIG_USB_IRDA is not set
-# CONFIG_SIGMATEL_FIR is not set
-# CONFIG_PXA_FICP is not set
-# CONFIG_MCS_FIR is not set
-CONFIG_BT=m
-# CONFIG_BT_L2CAP is not set
-# CONFIG_BT_SCO is not set
-
-#
-# Bluetooth device drivers
-#
-# CONFIG_BT_HCIUSB is not set
-# CONFIG_BT_HCIUART is not set
-# CONFIG_BT_HCIBCM203X is not set
-# CONFIG_BT_HCIBPA10X is not set
-# CONFIG_BT_HCIBFUSB is not set
-# CONFIG_BT_HCIDTL1 is not set
-# CONFIG_BT_HCIBT3C is not set
-# CONFIG_BT_HCIBLUECARD is not set
-# CONFIG_BT_HCIBTUART is not set
-# CONFIG_BT_HCIVHCI is not set
-CONFIG_IEEE80211=m
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=m
-# CONFIG_IEEE80211_CRYPT_CCMP is not set
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-CONFIG_WIRELESS_EXT=y
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_STANDALONE=y
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=m
-# CONFIG_DEBUG_DRIVER is not set
-# CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-# CONFIG_CONNECTOR is not set
-
-#
-# Memory Technology Devices (MTD)
-#
-CONFIG_MTD=y
-# CONFIG_MTD_DEBUG is not set
-# CONFIG_MTD_CONCAT is not set
-CONFIG_MTD_PARTITIONS=y
-CONFIG_MTD_REDBOOT_PARTS=y
-CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
-# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
-# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
-
-#
-# User Modules And Translation Layers
-#
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLOCK=y
-# CONFIG_FTL is not set
-# CONFIG_NFTL is not set
-# CONFIG_INFTL is not set
-# CONFIG_RFD_FTL is not set
-
-#
-# RAM/ROM/Flash chip drivers
-#
-CONFIG_MTD_CFI=y
-# CONFIG_MTD_JEDECPROBE is not set
-CONFIG_MTD_GEN_PROBE=y
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-CONFIG_MTD_CFI_NOSWAP=y
-# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
-# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
-CONFIG_MTD_CFI_GEOMETRY=y
-CONFIG_MTD_MAP_BANK_WIDTH_1=y
-CONFIG_MTD_MAP_BANK_WIDTH_2=y
-CONFIG_MTD_MAP_BANK_WIDTH_4=y
-# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
-# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
-# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
-# CONFIG_MTD_CFI_I1 is not set
-CONFIG_MTD_CFI_I2=y
-# CONFIG_MTD_CFI_I4 is not set
-# CONFIG_MTD_CFI_I8 is not set
-# CONFIG_MTD_OTP is not set
-CONFIG_MTD_CFI_INTELEXT=y
-# CONFIG_MTD_CFI_AMDSTD is not set
-# CONFIG_MTD_CFI_STAA is not set
-CONFIG_MTD_CFI_UTIL=y
-# CONFIG_MTD_RAM is not set
-# CONFIG_MTD_ROM is not set
-# CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
-# CONFIG_MTD_XIP is not set
-
-#
-# Mapping drivers for chip access
-#
-# CONFIG_MTD_COMPLEX_MAPPINGS is not set
-# CONFIG_MTD_PHYSMAP is not set
-CONFIG_MTD_MAINSTONE=y
-# CONFIG_MTD_ARM_INTEGRATOR is not set
-# CONFIG_MTD_SHARP_SL is not set
-# CONFIG_MTD_PLATRAM is not set
-
-#
-# Self-contained MTD device drivers
-#
-# CONFIG_MTD_SLRAM is not set
-# CONFIG_MTD_PHRAM is not set
-# CONFIG_MTD_MTDRAM is not set
-# CONFIG_MTD_BLOCK2MTD is not set
-
-#
-# Disk-On-Chip Device Drivers
-#
-# CONFIG_MTD_DOC2000 is not set
-# CONFIG_MTD_DOC2001 is not set
-# CONFIG_MTD_DOC2001PLUS is not set
-
-#
-# NAND Flash Device Drivers
-#
-# CONFIG_MTD_NAND is not set
-
-#
-# OneNAND Flash Device Drivers
-#
-# CONFIG_MTD_ONENAND is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
-# CONFIG_BLK_DEV_COW_COMMON is not set
-CONFIG_BLK_DEV_LOOP=m
-CONFIG_BLK_DEV_CRYPTOLOOP=m
-# CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_UB is not set
-# CONFIG_BLK_DEV_RAM is not set
-CONFIG_BLK_DEV_INITRD=y
-# CONFIG_CDROM_PKTCDVD is not set
-# CONFIG_ATA_OVER_ETH is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-CONFIG_IDE=y
-CONFIG_BLK_DEV_IDE=y
-
-#
-# Please see Documentation/ide.txt for help/info on IDE drives
-#
-# CONFIG_BLK_DEV_IDE_SATA is not set
-CONFIG_BLK_DEV_IDEDISK=y
-# CONFIG_IDEDISK_MULTI_MODE is not set
-CONFIG_BLK_DEV_IDECS=m
-# CONFIG_BLK_DEV_IDECD is not set
-# CONFIG_BLK_DEV_IDETAPE is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_IDE_TASK_IOCTL is not set
-
-#
-# IDE chipset support/bugfixes
-#
-# CONFIG_IDE_GENERIC is not set
-# CONFIG_IDE_ARM is not set
-# CONFIG_BLK_DEV_IDEDMA is not set
-# CONFIG_IDEDMA_AUTO is not set
-# CONFIG_BLK_DEV_HD is not set
-
-#
-# SCSI device support
-#
-# CONFIG_RAID_ATTRS is not set
-CONFIG_SCSI=m
-CONFIG_SCSI_PROC_FS=y
-
-#
-# SCSI support type (disk, tape, CD-ROM)
-#
-# CONFIG_BLK_DEV_SD is not set
-# CONFIG_CHR_DEV_ST is not set
-# CONFIG_CHR_DEV_OSST is not set
-# CONFIG_BLK_DEV_SR is not set
-# CONFIG_CHR_DEV_SG is not set
-# CONFIG_CHR_DEV_SCH is not set
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
-# CONFIG_SCSI_MULTI_LUN is not set
-# CONFIG_SCSI_CONSTANTS is not set
-# CONFIG_SCSI_LOGGING is not set
-
-#
-# SCSI Transport Attributes
-#
-# CONFIG_SCSI_SPI_ATTRS is not set
-# CONFIG_SCSI_FC_ATTRS is not set
-# CONFIG_SCSI_ISCSI_ATTRS is not set
-# CONFIG_SCSI_SAS_ATTRS is not set
-
-#
-# SCSI low-level drivers
-#
-# CONFIG_ISCSI_TCP is not set
-# CONFIG_SCSI_SATA is not set
-# CONFIG_SCSI_DEBUG is not set
-
-#
-# PCMCIA SCSI adapter support
-#
-# CONFIG_PCMCIA_AHA152X is not set
-# CONFIG_PCMCIA_FDOMAIN is not set
-# CONFIG_PCMCIA_NINJA_SCSI is not set
-# CONFIG_PCMCIA_QLOGIC is not set
-# CONFIG_PCMCIA_SYM53C500 is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
-# Fusion MPT device support
-#
-# CONFIG_FUSION is not set
-
-#
-# IEEE 1394 (FireWire) support
-#
-
-#
-# I2O device support
-#
-
-#
-# Network device support
-#
-CONFIG_NETDEVICES=y
-# CONFIG_DUMMY is not set
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
-
-#
-# PHY device support
-#
-# CONFIG_PHYLIB is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-CONFIG_MII=y
-CONFIG_SMC91X=y
-# CONFIG_DM9000 is not set
-# CONFIG_SMC911X is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-
-#
-# Ethernet (10000 Mbit)
-#
-
-#
-# Token Ring devices
-#
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# PCMCIA network device support
-#
-# CONFIG_NET_PCMCIA is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-CONFIG_PPP_FILTER=y
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-CONFIG_PPP_BSDCOMP=m
-CONFIG_PPP_MPPE=m
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-
-#
-# ISDN subsystem
-#
-# CONFIG_ISDN is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
-CONFIG_INPUT_EVDEV=y
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input Device Drivers
-#
-CONFIG_INPUT_KEYBOARD=y
-CONFIG_KEYBOARD_ATKBD=y
-# CONFIG_KEYBOARD_SUNKBD is not set
-# CONFIG_KEYBOARD_LKKBD is not set
-# CONFIG_KEYBOARD_XTKBD is not set
-# CONFIG_KEYBOARD_NEWTON is not set
-# CONFIG_INPUT_MOUSE is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
-
-#
-# Hardware I/O ports
-#
-CONFIG_SERIO=y
-# CONFIG_SERIO_SERPORT is not set
-CONFIG_SERIO_LIBPS2=y
-# CONFIG_SERIO_RAW is not set
-# CONFIG_GAMEPORT is not set
-
-#
-# Character devices
-#
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-# CONFIG_VT_HW_CONSOLE_BINDING is not set
-# CONFIG_SERIAL_NONSTANDARD is not set
-
-#
-# Serial drivers
-#
-# CONFIG_SERIAL_8250 is not set
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_PXA=y
-CONFIG_SERIAL_PXA_CONSOLE=y
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-CONFIG_UNIX98_PTYS=y
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=16
-
-#
-# IPMI
-#
-# CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
-CONFIG_HW_RANDOM=y
-# CONFIG_NVRAM is not set
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-
-#
-# Ftape, the floppy tape device driver
-#
-
-#
-# PCMCIA character devices
-#
-# CONFIG_SYNCLINK_CS is not set
-# CONFIG_CARDMAN_4000 is not set
-# CONFIG_CARDMAN_4040 is not set
-# CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
-# CONFIG_TCG_TPM is not set
-# CONFIG_TELCLOCK is not set
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# SPI support
-#
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
-
-#
-# Hardware Monitoring support
-#
-CONFIG_HWMON=y
-# CONFIG_HWMON_VID is not set
-# CONFIG_SENSORS_ABITUGURU is not set
-# CONFIG_SENSORS_F71805F is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
-
-#
-# Misc devices
-#
-
-#
-# LED devices
-#
-# CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-CONFIG_VIDEO_V4L2=y
-
-#
-# Digital Video Broadcasting Devices
-#
-# CONFIG_DVB is not set
-# CONFIG_USB_DABUSB is not set
-
-#
-# Graphics support
-#
-CONFIG_FIRMWARE_EDID=y
-CONFIG_FB=y
-CONFIG_FB_CFB_FILLRECT=y
-CONFIG_FB_CFB_COPYAREA=y
-CONFIG_FB_CFB_IMAGEBLIT=y
-# CONFIG_FB_MACMODES is not set
-# CONFIG_FB_BACKLIGHT is not set
-# CONFIG_FB_MODE_HELPERS is not set
-# CONFIG_FB_TILEBLITTING is not set
-# CONFIG_FB_S1D13XXX is not set
-CONFIG_FB_PXA=y
-# CONFIG_FB_PXA_PARAMETERS is not set
-# CONFIG_FB_MBX is not set
-# CONFIG_FB_VIRTUAL is not set
-
-#
-# Console display driver support
-#
-# CONFIG_VGA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
-# CONFIG_FONTS is not set
-CONFIG_FONT_8x8=y
-CONFIG_FONT_8x16=y
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-CONFIG_LOGO_LINUX_MONO=y
-CONFIG_LOGO_LINUX_VGA16=y
-CONFIG_LOGO_LINUX_CLUT224=y
-CONFIG_BACKLIGHT_LCD_SUPPORT=y
-CONFIG_BACKLIGHT_CLASS_DEVICE=m
-CONFIG_BACKLIGHT_DEVICE=y
-CONFIG_LCD_CLASS_DEVICE=m
-CONFIG_LCD_DEVICE=y
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-CONFIG_USB_ARCH_HAS_HCD=y
-CONFIG_USB_ARCH_HAS_OHCI=y
-# CONFIG_USB_ARCH_HAS_EHCI is not set
-CONFIG_USB=m
-# CONFIG_USB_DEBUG is not set
-
-#
-# Miscellaneous USB options
-#
-CONFIG_USB_DEVICEFS=y
-# CONFIG_USB_BANDWIDTH is not set
-# CONFIG_USB_DYNAMIC_MINORS is not set
-# CONFIG_USB_SUSPEND is not set
-# CONFIG_USB_OTG is not set
-
-#
-# USB Host Controller Drivers
-#
-# CONFIG_USB_ISP116X_HCD is not set
-# CONFIG_USB_OHCI_HCD is not set
-# CONFIG_USB_SL811_HCD is not set
-
-#
-# USB Device Class drivers
-#
-# CONFIG_USB_ACM is not set
-# CONFIG_USB_PRINTER is not set
-
-#
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
-#
-
-#
-# may also be needed; see USB_STORAGE Help for more information
-#
-CONFIG_USB_STORAGE=m
-# CONFIG_USB_STORAGE_DEBUG is not set
-# CONFIG_USB_STORAGE_DATAFAB is not set
-# CONFIG_USB_STORAGE_FREECOM is not set
-# CONFIG_USB_STORAGE_ISD200 is not set
-# CONFIG_USB_STORAGE_DPCM is not set
-# CONFIG_USB_STORAGE_USBAT is not set
-# CONFIG_USB_STORAGE_SDDR09 is not set
-# CONFIG_USB_STORAGE_SDDR55 is not set
-# CONFIG_USB_STORAGE_JUMPSHOT is not set
-# CONFIG_USB_STORAGE_ALAUDA is not set
-# CONFIG_USB_LIBUSUAL is not set
-
-#
-# USB Input Devices
-#
-CONFIG_USB_HID=m
-CONFIG_USB_HIDINPUT=y
-# CONFIG_USB_HIDINPUT_POWERBOOK is not set
-# CONFIG_HID_FF is not set
-# CONFIG_USB_HIDDEV is not set
-
-#
-# USB HID Boot Protocol drivers
-#
-# CONFIG_USB_KBD is not set
-# CONFIG_USB_MOUSE is not set
-# CONFIG_USB_AIPTEK is not set
-# CONFIG_USB_WACOM is not set
-# CONFIG_USB_ACECAD is not set
-# CONFIG_USB_KBTAB is not set
-# CONFIG_USB_POWERMATE is not set
-# CONFIG_USB_TOUCHSCREEN is not set
-# CONFIG_USB_YEALINK is not set
-# CONFIG_USB_XPAD is not set
-# CONFIG_USB_ATI_REMOTE is not set
-# CONFIG_USB_ATI_REMOTE2 is not set
-# CONFIG_USB_KEYSPAN_REMOTE is not set
-# CONFIG_USB_APPLETOUCH is not set
-
-#
-# USB Imaging devices
-#
-# CONFIG_USB_MDC800 is not set
-# CONFIG_USB_MICROTEK is not set
-
-#
-# USB Network Adapters
-#
-# CONFIG_USB_CATC is not set
-# CONFIG_USB_KAWETH is not set
-# CONFIG_USB_PEGASUS is not set
-# CONFIG_USB_RTL8150 is not set
-# CONFIG_USB_USBNET is not set
-CONFIG_USB_MON=y
-
-#
-# USB port drivers
-#
-
-#
-# USB Serial Converter support
-#
-# CONFIG_USB_SERIAL is not set
-
-#
-# USB Miscellaneous drivers
-#
-# CONFIG_USB_EMI62 is not set
-# CONFIG_USB_EMI26 is not set
-# CONFIG_USB_AUERSWALD is not set
-# CONFIG_USB_RIO500 is not set
-# CONFIG_USB_LEGOTOWER is not set
-# CONFIG_USB_LCD is not set
-# CONFIG_USB_LED is not set
-# CONFIG_USB_CYPRESS_CY7C63 is not set
-# CONFIG_USB_CYTHERM is not set
-# CONFIG_USB_PHIDGETKIT is not set
-# CONFIG_USB_PHIDGETSERVO is not set
-# CONFIG_USB_IDMOUSE is not set
-# CONFIG_USB_APPLEDISPLAY is not set
-# CONFIG_USB_LD is not set
-# CONFIG_USB_TEST is not set
-
-#
-# USB DSL modem support
-#
-
-#
-# USB Gadget Support
-#
-CONFIG_USB_GADGET=m
-# CONFIG_USB_GADGET_DEBUG_FILES is not set
-CONFIG_USB_GADGET_SELECTED=y
-# CONFIG_USB_GADGET_NET2280 is not set
-# CONFIG_USB_GADGET_PXA2XX is not set
-# CONFIG_USB_GADGET_GOKU is not set
-# CONFIG_USB_GADGET_LH7A40X is not set
-# CONFIG_USB_GADGET_OMAP is not set
-# CONFIG_USB_GADGET_AT91 is not set
-CONFIG_USB_GADGET_DUMMY_HCD=y
-CONFIG_USB_DUMMY_HCD=m
-CONFIG_USB_GADGET_DUALSPEED=y
-# CONFIG_USB_ZERO is not set
-CONFIG_USB_ETH=m
-CONFIG_USB_ETH_RNDIS=y
-# CONFIG_USB_GADGETFS is not set
-CONFIG_USB_FILE_STORAGE=m
-# CONFIG_USB_FILE_STORAGE_TEST is not set
-# CONFIG_USB_G_SERIAL is not set
-
-#
-# MMC/SD Card support
-#
-CONFIG_MMC=m
-# CONFIG_MMC_DEBUG is not set
-CONFIG_MMC_BLOCK=m
-CONFIG_MMC_PXA=m
-
-#
-# Real Time Clock
-#
-CONFIG_RTC_LIB=y
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_HCTOSYS=y
-CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
-
-#
-# RTC interfaces
-#
-CONFIG_RTC_INTF_SYSFS=y
-CONFIG_RTC_INTF_PROC=y
-CONFIG_RTC_INTF_DEV=y
-# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
-
-#
-# RTC drivers
-#
-# CONFIG_RTC_DRV_DS1553 is not set
-# CONFIG_RTC_DRV_DS1742 is not set
-# CONFIG_RTC_DRV_M48T86 is not set
-CONFIG_RTC_DRV_SA1100=y
-# CONFIG_RTC_DRV_TEST is not set
-# CONFIG_RTC_DRV_V3020 is not set
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT2_FS_XIP is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_FS_POSIX_ACL is not set
-# CONFIG_XFS_FS is not set
-# CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_INOTIFY=y
-CONFIG_INOTIFY_USER=y
-# CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUTOFS4_FS is not set
-# CONFIG_FUSE_FS is not set
-
-#
-# CD-ROM/DVD Filesystems
-#
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-CONFIG_FAT_FS=y
-CONFIG_MSDOS_FS=y
-# CONFIG_VFAT_FS is not set
-CONFIG_FAT_DEFAULT_CODEPAGE=437
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_SYSFS=y
-# CONFIG_TMPFS is not set
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-# CONFIG_CONFIGFS_FS is not set
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
-# CONFIG_BEFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_EFS_FS is not set
-# CONFIG_JFFS_FS is not set
-CONFIG_JFFS2_FS=y
-CONFIG_JFFS2_FS_DEBUG=0
-CONFIG_JFFS2_FS_WRITEBUFFER=y
-CONFIG_JFFS2_SUMMARY=y
-# CONFIG_JFFS2_FS_XATTR is not set
-# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
-CONFIG_JFFS2_ZLIB=y
-CONFIG_JFFS2_RTIME=y
-# CONFIG_JFFS2_RUBIN is not set
-CONFIG_CRAMFS=m
-# CONFIG_VXFS_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_SYSV_FS is not set
-# CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
-# CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
-# CONFIG_NFSD is not set
-CONFIG_ROOT_NFS=y
-CONFIG_LOCKD=y
-CONFIG_NFS_COMMON=y
-CONFIG_SUNRPC=y
-# CONFIG_RPCSEC_GSS_KRB5 is not set
-# CONFIG_RPCSEC_GSS_SPKM3 is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_CIFS is not set
-# CONFIG_NCP_FS is not set
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
-
-#
-# Partition Types
-#
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
-CONFIG_NLS=y
-CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
-# CONFIG_NLS_CODEPAGE_737 is not set
-# CONFIG_NLS_CODEPAGE_775 is not set
-# CONFIG_NLS_CODEPAGE_850 is not set
-# CONFIG_NLS_CODEPAGE_852 is not set
-# CONFIG_NLS_CODEPAGE_855 is not set
-# CONFIG_NLS_CODEPAGE_857 is not set
-# CONFIG_NLS_CODEPAGE_860 is not set
-# CONFIG_NLS_CODEPAGE_861 is not set
-# CONFIG_NLS_CODEPAGE_862 is not set
-# CONFIG_NLS_CODEPAGE_863 is not set
-# CONFIG_NLS_CODEPAGE_864 is not set
-# CONFIG_NLS_CODEPAGE_865 is not set
-# CONFIG_NLS_CODEPAGE_866 is not set
-# CONFIG_NLS_CODEPAGE_869 is not set
-# CONFIG_NLS_CODEPAGE_936 is not set
-# CONFIG_NLS_CODEPAGE_950 is not set
-# CONFIG_NLS_CODEPAGE_932 is not set
-# CONFIG_NLS_CODEPAGE_949 is not set
-# CONFIG_NLS_CODEPAGE_874 is not set
-# CONFIG_NLS_ISO8859_8 is not set
-# CONFIG_NLS_CODEPAGE_1250 is not set
-# CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
-CONFIG_NLS_ISO8859_1=y
-# CONFIG_NLS_ISO8859_2 is not set
-# CONFIG_NLS_ISO8859_3 is not set
-# CONFIG_NLS_ISO8859_4 is not set
-# CONFIG_NLS_ISO8859_5 is not set
-# CONFIG_NLS_ISO8859_6 is not set
-# CONFIG_NLS_ISO8859_7 is not set
-# CONFIG_NLS_ISO8859_9 is not set
-# CONFIG_NLS_ISO8859_13 is not set
-# CONFIG_NLS_ISO8859_14 is not set
-# CONFIG_NLS_ISO8859_15 is not set
-# CONFIG_NLS_KOI8_R is not set
-# CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
-
-#
-# Kernel hacking
-#
-# CONFIG_PRINTK_TIME is not set
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_UNUSED_SYMBOLS is not set
-CONFIG_DEBUG_KERNEL=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_DETECT_SOFTLOCKUP=y
-# CONFIG_SCHEDSTATS is not set
-# CONFIG_DEBUG_SLAB is not set
-# CONFIG_DEBUG_RT_MUTEXES is not set
-# CONFIG_RT_MUTEX_TESTER is not set
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_MUTEXES is not set
-# CONFIG_DEBUG_RWSEMS is not set
-# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
-# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
-# CONFIG_DEBUG_KOBJECT is not set
-CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_INFO=y
-# CONFIG_DEBUG_FS is not set
-# CONFIG_DEBUG_VM is not set
-CONFIG_FRAME_POINTER=y
-# CONFIG_UNWIND_INFO is not set
-CONFIG_FORCED_INLINING=y
-# CONFIG_RCU_TORTURE_TEST is not set
-CONFIG_DEBUG_USER=y
-# CONFIG_DEBUG_WAITQ is not set
-CONFIG_DEBUG_ERRORS=y
-CONFIG_DEBUG_LL=y
-# CONFIG_DEBUG_ICEDCC is not set
-
-#
-# Security options
-#
-# CONFIG_KEYS is not set
-# CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-# CONFIG_CRYPTO_HMAC is not set
-# CONFIG_CRYPTO_NULL is not set
-# CONFIG_CRYPTO_MD4 is not set
-# CONFIG_CRYPTO_MD5 is not set
-CONFIG_CRYPTO_SHA1=m
-# CONFIG_CRYPTO_SHA256 is not set
-# CONFIG_CRYPTO_SHA512 is not set
-# CONFIG_CRYPTO_WP512 is not set
-# CONFIG_CRYPTO_TGR192 is not set
-# CONFIG_CRYPTO_DES is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-# CONFIG_CRYPTO_SERPENT is not set
-# CONFIG_CRYPTO_AES is not set
-# CONFIG_CRYPTO_CAST5 is not set
-# CONFIG_CRYPTO_CAST6 is not set
-# CONFIG_CRYPTO_TEA is not set
-CONFIG_CRYPTO_ARC4=m
-# CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_DEFLATE is not set
-# CONFIG_CRYPTO_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_CRC32C is not set
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
-
-#
-# Library routines
-#
-CONFIG_CRC_CCITT=m
-# CONFIG_CRC16 is not set
-CONFIG_CRC32=y
-# CONFIG_LIBCRC32C is not set
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_PLIST=y
diff --git a/packages/linux/mainstone-kernel_2.6.18.bb b/packages/linux/mainstone-kernel_2.6.18.bb
index 290bb5911d..2785baa227 100644
--- a/packages/linux/mainstone-kernel_2.6.18.bb
+++ b/packages/linux/mainstone-kernel_2.6.18.bb
@@ -11,6 +11,7 @@ SRC_URI = "${KERNELORG_MIRROR}/pub/linux/kernel/v2.6/linux-2.6.18.tar.bz2 \
S = "${WORKDIR}/linux-2.6.18"
+
COMPATIBLE_HOST = 'arm.*-linux'
ARCH = "arm"
diff --git a/packages/mplayer/files/mplayer-1.0rc1-atmel.2.patch b/packages/mplayer/files/mplayer-1.0rc1-atmel.2.patch
new file mode 100644
index 0000000000..800f43e8eb
--- /dev/null
+++ b/packages/mplayer/files/mplayer-1.0rc1-atmel.2.patch
@@ -0,0 +1,6444 @@
+ cfg-common.h | 4 +
+ cfg-mencoder.h | 4 +
+ cfg-mplayer.h | 4 +
+ configure | 13 +-
+ libaf/af_format.c | 7 +
+ libavcodec/Makefile | 7 +
+ libavcodec/avr32/dsputil_avr32.c | 2678 ++++++++++++++++++++++++++++++++++++++
+ libavcodec/avr32/fdct.S | 541 ++++++++
+ libavcodec/avr32/h264idct.S | 451 +++++++
+ libavcodec/avr32/idct.S | 829 ++++++++++++
+ libavcodec/avr32/mc.S | 434 ++++++
+ libavcodec/avr32/pico.h | 260 ++++
+ libavcodec/bitstream.h | 77 +-
+ libavcodec/dsputil.c | 3 +
+ libavcodec/h264.c | 15 +
+ libavutil/common.h | 16 +
+ libavutil/internal.h | 9 +
+ libfaad2/common.h | 2 +-
+ libmpcodecs/ad_libmad.c | 5 +
+ libswscale/pico-avr32.h | 137 ++
+ libswscale/swscale_internal.h | 2 +-
+ libswscale/yuv2rgb.c | 14 +
+ libswscale/yuv2rgb_avr32.c | 416 ++++++
+ libvo/vo_fbdev2.c | 101 ++-
+ version.sh | 2 +-
+ 25 files changed, 6011 insertions(+), 20 deletions(-)
+ create mode 100644 libavcodec/avr32/dsputil_avr32.c
+ create mode 100644 libavcodec/avr32/fdct.S
+ create mode 100644 libavcodec/avr32/h264idct.S
+ create mode 100644 libavcodec/avr32/idct.S
+ create mode 100644 libavcodec/avr32/mc.S
+ create mode 100644 libavcodec/avr32/pico.h
+ create mode 100644 libswscale/pico-avr32.h
+ create mode 100644 libswscale/yuv2rgb_avr32.c
+
+diff --git a/cfg-common.h b/cfg-common.h
+index 780df38..7d878a8 100644
+--- a/cfg-common.h
++++ b/cfg-common.h
+@@ -235,6 +235,10 @@
+ {"tsprobe", &ts_probe, CONF_TYPE_POSITION, 0, 0, TS_MAX_PROBE_SIZE, NULL},
+ {"tskeepbroken", &ts_keep_broken, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+
++#ifdef ARCH_AVR32
++ {"use-pico", &avr32_use_pico, CONF_TYPE_FLAG, 0, 0, 1, NULL},
++ {"nouse-pico", &avr32_use_pico, CONF_TYPE_FLAG, 0, 1, 0, NULL},
++#endif
+ // draw by slices or whole frame (useful with libmpeg2/libavcodec)
+ {"slices", &vd_use_slices, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+ {"noslices", &vd_use_slices, CONF_TYPE_FLAG, 0, 1, 0, NULL},
+diff --git a/cfg-mencoder.h b/cfg-mencoder.h
+index 411b748..addf791 100644
+--- a/cfg-mencoder.h
++++ b/cfg-mencoder.h
+@@ -5,6 +5,10 @@
+
+ #include "cfg-common.h"
+
++#ifdef ARCH_AVR32
++extern int avr32_use_pico;
++#endif
++
+ #ifdef USE_FAKE_MONO
+ extern int fakemono; // defined in dec_audio.c
+ #endif
+diff --git a/cfg-mplayer.h b/cfg-mplayer.h
+index 62b6eac..31499c2 100644
+--- a/cfg-mplayer.h
++++ b/cfg-mplayer.h
+@@ -4,6 +4,10 @@
+
+ #include "cfg-common.h"
+
++#ifdef ARCH_AVR32
++extern int avr32_use_pico;
++#endif
++
+ extern int noconsolecontrols;
+
+ #if defined(HAVE_FBDEV)||defined(HAVE_VESA)
+diff --git a/configure b/configure
+index 29002c8..56c6fe4 100755
+--- a/configure
++++ b/configure
+@@ -1203,6 +1203,15 @@ EOF
+ _optimizing="$proc"
+ ;;
+
++ avr32)
++ _def_arch='#define ARCH_AVR32'
++ _target_arch='TARGET_ARCH_AVR32 = yes'
++ iproc='avr32'
++ proc=''
++ _march=''
++ _mcpu=''
++ _optimizing=''
++ ;;
+ arm|armv4l|armv5tel)
+ _def_arch='#define ARCH_ARMV4L 1'
+ _target_arch='TARGET_ARCH_ARMV4L = yes'
+@@ -1533,7 +1542,7 @@ echores $_named_asm_args
+ # Checking for CFLAGS
+ _stripbinaries=yes
+ if test "$_profile" != "" || test "$_debug" != "" ; then
+- CFLAGS="-W -Wall -O2 $_march $_mcpu $_debug $_profile"
++ CFLAGS="-W -Wall -O4 $_march $_mcpu $_debug $_profile"
+ if test "$_cc_major" -ge "3" ; then
+ CFLAGS=`echo "$CFLAGS" | sed -e 's/\(-Wall\)/\1 -Wno-unused-parameter/'`
+ fi
+@@ -3794,7 +3803,7 @@ fi
+
+
+ echocheck "X11 headers presence"
+- for I in `echo $_inc_extra | sed s/-I//g` /usr/X11/include /usr/X11R6/include /usr/include/X11R6 /usr/include /usr/openwin/include ; do
++ for I in `echo $_inc_extra | sed s/-I//g`; do
+ if test -f "$I/X11/Xlib.h" ; then
+ _inc_x11="-I$I"
+ _x11_headers="yes"
+diff --git a/libaf/af_format.c b/libaf/af_format.c
+index e5b7cc9..5d7ea6d 100644
+--- a/libaf/af_format.c
++++ b/libaf/af_format.c
+@@ -20,7 +20,14 @@
+ // Integer to float conversion through lrintf()
+ #ifdef HAVE_LRINTF
+ #include <math.h>
++
++#ifdef ARCH_AVR32
++#define lrintf(x) rint(x)
++#define llrint(x) (long long)rint(x)
++#else
+ long int lrintf(float);
++#endif
++
+ #else
+ #define lrintf(x) ((int)(x))
+ #endif
+diff --git a/libavcodec/Makefile b/libavcodec/Makefile
+index 17b6c45..8e1dc96 100644
+--- a/libavcodec/Makefile
++++ b/libavcodec/Makefile
+@@ -360,6 +360,12 @@ OBJS-$(TARGET_ARCH_SPARC) += sparc/dsputil_vis.o \
+
+ sparc/dsputil_vis.o: CFLAGS += -mcpu=ultrasparc -mtune=ultrasparc
+
++# avr32 specific stuff
++ifeq ($(TARGET_ARCH_AVR32),yes)
++ASM_OBJS += avr32/idct.o avr32/fdct.o avr32/mc.o avr32/h264idct.o
++OBJS += avr32/dsputil_avr32.o
++endif
++
+ # sun mediaLib specific stuff
+ OBJS-$(HAVE_MLIB) += mlib/dsputil_mlib.o \
+
+@@ -419,6 +425,7 @@ tests: apiexample $(TESTS)
+ clean::
+ rm -f \
+ i386/*.o i386/*~ \
++ avr32/*.o avr32/*~ \
+ armv4l/*.o armv4l/*~ \
+ mlib/*.o mlib/*~ \
+ alpha/*.o alpha/*~ \
+diff --git a/libavcodec/avr32/dsputil_avr32.c b/libavcodec/avr32/dsputil_avr32.c
+new file mode 100644
+index 0000000..200284d
+--- /dev/null
++++ b/libavcodec/avr32/dsputil_avr32.c
+@@ -0,0 +1,2678 @@
++/*
++ * Copyright (c) 2007 Atmel Corporation. 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 ATMEL may not be used to endorse or promote products
++ * derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL
++ * 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 "../dsputil.h"
++#include "pico.h"
++
++int avr32_use_pico = 1;
++
++//#define CHECK_DSP_FUNCS_AGAINST_C
++
++#ifdef CHECK_DSP_FUNCS_AGAINST_C
++#define DSP_FUNC_NAME(name) test_ ## name
++#else
++#define DSP_FUNC_NAME(name) name
++#endif
++
++union doubleword {
++ int64_t doubleword;
++ struct {
++ int32_t top;
++ int32_t bottom;
++ } words;
++};
++
++#undef LD16
++#undef LD32
++#undef LD64
++
++#define LD16(a) (*((uint16_t*)(a)))
++#define LD32(a) (*((uint32_t*)(a)))
++#define LD64(a) (*((uint64_t*)(a)))
++#define LD64_UNALIGNED(a) \
++ ({ union doubleword __tmp__; \
++ __tmp__.words.top = LD32(a); \
++ __tmp__.words.bottom = LD32(a + 4); \
++ __tmp__.doubleword; })
++
++#undef ST32
++#undef ST16
++
++#define ST16(a, b) *((uint16_t*)(a)) = (b)
++#define ST32(a, b) *((uint32_t*)(a)) = (b)
++
++#undef rnd_avg32
++#define rnd_avg32(a, b) \
++ ({ uint32_t __tmp__;\
++ asm("pavg.ub\t%0, %1, %2" : "=r"(__tmp__) : "r"(a), "r"(b));\
++ __tmp__;})
++
++void idct_avr32(DCTELEM *data);
++void fdct_avr32(DCTELEM *data);
++
++void idct_put_avr32(uint8_t *dest, int line_size, DCTELEM *data);
++void idct_add_avr32(uint8_t *dest, int line_size, DCTELEM *data);
++
++void h264_idct_add_avr32(uint8_t *dest, DCTELEM *data, int stride);
++void h264_idct8_add_avr32(uint8_t *dest, DCTELEM *data, int stride);
++
++#define extern_dspfunc(PFX, NUM) \
++ void PFX ## _pixels ## NUM ## _avr32(uint8_t *dst, const uint8_t *pixels, int line_size, int h ); \
++ void PFX ## _pixels ## NUM ## _h_avr32(uint8_t *dst, const uint8_t *pixels, int line_size, int h ); \
++ void PFX ## _pixels ## NUM ## _v_avr32(uint8_t *dst, const uint8_t *pixels, int line_size, int h ); \
++ void PFX ## _pixels ## NUM ## _hv_avr32(uint8_t *dst, const uint8_t *pixels, int line_size, int h )
++
++extern_dspfunc(put, 8);
++extern_dspfunc(put_no_rnd, 8);
++extern_dspfunc(avg, 8);
++extern_dspfunc(avg_no_rnd, 8);
++#undef extern_dspfunc
++
++#ifdef CHECK_DSP_FUNCS_AGAINST_C
++#define extern_dspfunc(PFX, NUM) \
++ void PFX ## _pixels ## NUM ## _c(uint8_t *dst, const uint8_t *pixels, int line_size, int h ); \
++ void PFX ## _pixels ## NUM ## _x2_c(uint8_t *dst, const uint8_t *pixels, int line_size, int h ); \
++ void PFX ## _pixels ## NUM ## _y2_c(uint8_t *dst, const uint8_t *pixels, int line_size, int h ); \
++ void PFX ## _pixels ## NUM ## _xy2_c(uint8_t *dst, const uint8_t *pixels, int line_size, int h )
++
++extern_dspfunc(put, 4);
++extern_dspfunc(put_no_rnd, 4);
++extern_dspfunc(put, 8);
++extern_dspfunc(put_no_rnd, 8);
++extern_dspfunc(put, 16);
++extern_dspfunc(put_no_rnd, 16);
++extern_dspfunc(avg, 8);
++extern_dspfunc(avg_no_rnd, 8);
++extern_dspfunc(avg, 16);
++extern_dspfunc(avg_no_rnd, 16);
++
++
++#undef extern_dspfunc
++#define extern_dspfunc(PFX, NUM) \
++void PFX ## NUM ## _mc00_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc10_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc20_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc30_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc01_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc11_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc21_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc31_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc02_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc12_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc22_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc32_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc03_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc13_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc23_c(uint8_t *dst, uint8_t *src, int stride); \
++void PFX ## NUM ## _mc33_c(uint8_t *dst, uint8_t *src, int stride); \
++
++extern_dspfunc(put_h264_qpel, 16);
++extern_dspfunc(put_h264_qpel, 8);
++extern_dspfunc(put_h264_qpel, 4);
++extern_dspfunc(avg_h264_qpel, 16);
++extern_dspfunc(avg_h264_qpel, 8);
++extern_dspfunc(avg_h264_qpel, 4);
++
++#undef extern_dspfunc
++
++void put_h264_chroma_mc2_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y);
++void put_h264_chroma_mc4_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y);
++void put_h264_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y);
++
++void avg_h264_chroma_mc2_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y);
++void avg_h264_chroma_mc4_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y);
++void avg_h264_chroma_mc8_c(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y);
++
++
++void dump_block8(uint8_t *block, int line_size, int h);
++void dump_block4(uint8_t *block, int line_size, int h);
++void dump_block(uint8_t *block, int line_size, int h, int w);
++
++void check_block8(uint8_t *test, uint8_t *correct, int line_size_test, int line_size_correct,
++ int h, char *name, int max_dev);
++void check_block4(uint8_t *test, uint8_t *correct, int line_size_test, int line_size_correct,
++ int h, char *name, int max_dev);
++void check_block(uint8_t *test, uint8_t *correct, int line_size_test, int line_size_correct,
++ int h, int width, char *name, int max_dev);
++
++#define PIXOP2( OPNAME, OP ) \
++void OPNAME ## _pixels4_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
++ int i;\
++ for(i=0; i<h; i++){\
++ OP(*((uint32_t*)(block )), LD32(pixels ));\
++ pixels+=line_size;\
++ block +=line_size;\
++ }\
++}\
++void OPNAME ## _pixels8_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
++ int src_stride1, int src_stride2, int h){\
++ int i;\
++ for(i=0; i<h; i++){\
++ uint32_t a,b;\
++ a= LD32(&src1[i*src_stride1 ]);\
++ b= LD32(&src2[i*src_stride2 ]);\
++ OP(*((uint32_t*)&dst[i*dst_stride ]), rnd_avg32(a, b));\
++ a= LD32(&src1[i*src_stride1+4]);\
++ b= LD32(&src2[i*src_stride2+4]);\
++ OP(*((uint32_t*)&dst[i*dst_stride+4]), rnd_avg32(a, b));\
++ }\
++}\
++\
++void OPNAME ## _pixels4_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
++ int src_stride1, int src_stride2, int h){\
++ int i;\
++ for(i=0; i<h; i++){\
++ uint32_t a,b;\
++ a= LD32(&src1[i*src_stride1 ]);\
++ b= LD32(&src2[i*src_stride2 ]);\
++ OP(*((uint32_t*)&dst[i*dst_stride ]), rnd_avg32(a, b));\
++ }\
++}\
++\
++void OPNAME ## _pixels16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
++ int src_stride1, int src_stride2, int h){\
++ OPNAME ## _pixels8_l2(dst , src1 , src2 , dst_stride, src_stride1, src_stride2, h);\
++ OPNAME ## _pixels8_l2(dst+8, src1+8, src2+8, dst_stride, src_stride1, src_stride2, h);\
++}\
++
++#else
++#define PIXOP2( OPNAME, OP ) \
++static void OPNAME ## _pixels4_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
++ int i;\
++ for(i=0; i<h; i++){\
++ OP(*((uint32_t*)(block )), LD32(pixels ));\
++ pixels+=line_size;\
++ block +=line_size;\
++ }\
++}\
++static void OPNAME ## _pixels8_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
++ int i;\
++ for(i=0; i<h; i++){\
++ OP(*((uint32_t*)(block )), LD32(pixels ));\
++ OP(*((uint32_t*)(block+4)), LD32(pixels+4));\
++ pixels+=line_size;\
++ block +=line_size;\
++ }\
++}\
++static void OPNAME ## _pixels16_c(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
++ int i;\
++ for(i=0; i<h; i++){\
++ OP(*((uint32_t*)(block )), LD32(pixels ));\
++ OP(*((uint32_t*)(block+4)), LD32(pixels+4));\
++ OP(*((uint32_t*)(block+8)), LD32(pixels+8));\
++ OP(*((uint32_t*)(block+12)), LD32(pixels+12));\
++ pixels+=line_size;\
++ block +=line_size;\
++ }\
++}\
++static void OPNAME ## _pixels8_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
++ int src_stride1, int src_stride2, int h){\
++ int i;\
++ for(i=0; i<h; i++){\
++ uint32_t a,b;\
++ a= LD32(&src1[i*src_stride1 ]);\
++ b= LD32(&src2[i*src_stride2 ]);\
++ OP(*((uint32_t*)&dst[i*dst_stride ]), rnd_avg32(a, b));\
++ a= LD32(&src1[i*src_stride1+4]);\
++ b= LD32(&src2[i*src_stride2+4]);\
++ OP(*((uint32_t*)&dst[i*dst_stride+4]), rnd_avg32(a, b));\
++ }\
++}\
++\
++static void OPNAME ## _pixels4_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
++ int src_stride1, int src_stride2, int h){\
++ int i;\
++ for(i=0; i<h; i++){\
++ uint32_t a,b;\
++ a= LD32(&src1[i*src_stride1 ]);\
++ b= LD32(&src2[i*src_stride2 ]);\
++ OP(*((uint32_t*)&dst[i*dst_stride ]), rnd_avg32(a, b));\
++ }\
++}\
++\
++static void OPNAME ## _pixels16_l2(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \
++ int src_stride1, int src_stride2, int h){\
++ OPNAME ## _pixels8_l2(dst , src1 , src2 , dst_stride, src_stride1, src_stride2, h);\
++ OPNAME ## _pixels8_l2(dst+8, src1+8, src2+8, dst_stride, src_stride1, src_stride2, h);\
++}\
++
++#endif
++
++#define op_avg(a, b) a = rnd_avg32(a, b)
++#define op_put(a, b) a = b
++
++PIXOP2(avg, op_avg)
++PIXOP2(put, op_put)
++#undef op_avg
++#undef op_put
++
++
++
++static inline void copy_block4(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
++{
++ int i;
++ for(i=0; i<h; i++)
++ {
++ ST32(dst , LD32(src ));
++ dst+=dstStride;
++ src+=srcStride;
++ }
++}
++
++static void clear_blocks_avr32(DCTELEM *blocks)
++{
++ int n = 12;
++ uint64_t tmp1, tmp2;
++ blocks += 6*64;
++ asm volatile ( "mov\t%1, 0\n"
++ "mov\t%m1, 0\n"
++ "mov\t%2, 0\n"
++ "mov\t%m2, 0\n"
++ "0:\n"
++ "stm\t--%3, %1, %m1, %2, %m2\n"
++ "stm\t--%3, %1, %m1, %2, %m2\n"
++ "stm\t--%3, %1, %m1, %2, %m2\n"
++ "stm\t--%3, %1, %m1, %2, %m2\n"
++ "sub\t%0, 1\n"
++ "brne\t0b\n"
++ : "+r"(n), "=&r"(tmp1), "=&r"(tmp2),
++ "+r"(blocks));
++}
++
++
++static inline void copy_block8(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
++{
++ int i;
++ for(i=0; i<h; i++)
++ {
++ ST32(dst , LD32(src ));
++ ST32(dst+4 , LD32(src+4 ));
++ dst+=dstStride;
++ src+=srcStride;
++ }
++}
++
++static inline void copy_block16(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h)
++{
++ int i;
++ for(i=0; i<h; i++)
++ {
++ ST32(dst , LD32(src ));
++ ST32(dst+4 , LD32(src+4 ));
++ ST32(dst+8 , LD32(src+8 ));
++ ST32(dst+12, LD32(src+12));
++ dst+=dstStride;
++ src+=srcStride;
++ }
++}
++
++
++static void put_h264_chroma_mc2_pico(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
++ const int A=(8-x)*(8-y);
++ const int B=( x)*(8-y);
++ const int C=(8-x)*( y);
++ const int D=( x)*( y);
++ int i;
++
++ PICO_PUT_W(PICO_COEFF0_A, (A << 16) | (B & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF0_B, 32);
++ PICO_PUT_W(PICO_COEFF1_A, (C << 16) | (D & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF1_B, 0);
++ PICO_PUT_W(PICO_COEFF2_A, 0);
++ PICO_PUT_W(PICO_COEFF2_B, 0);
++ PICO_PUT_W(PICO_CONFIG,
++ PICO_OUTPUT_MODE(PICO_PLANAR_MODE)
++ | PICO_INPUT_MODE(PICO_HOR_FILTER_MODE)
++ | PICO_COEFF_FRAC_BITS(6)
++ | PICO_OFFSET_FRAC_BITS(6));
++
++ for(i=0; i<h; i++)
++ {
++
++ int src0 = LD32(src);
++ int src1 = LD32(src + stride);
++
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 0, 4, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 1, 5, 0);
++ src += stride;
++ ST16(dst,(short)PICO_GET_W(PICO_OUTPIX0));
++ dst += stride;
++ }
++}
++
++
++static void put_h264_chroma_mc4_pico(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
++ const int A=(8-x)*(8-y);\
++ const int B=( x)*(8-y);
++ const int C=(8-x)*( y);
++ const int D=( x)*( y);
++ int i;
++
++ PICO_PUT_W(PICO_COEFF0_A, (A << 16) | (B & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF0_B, 32);
++ PICO_PUT_W(PICO_COEFF1_A, (C << 16) | (D & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF1_B, 0);
++ PICO_PUT_W(PICO_COEFF2_A, 0);
++ PICO_PUT_W(PICO_COEFF2_B, 0);
++ PICO_PUT_W(PICO_CONFIG,
++ PICO_OUTPUT_MODE(PICO_PLANAR_MODE)
++ | PICO_INPUT_MODE(PICO_HOR_FILTER_MODE)
++ | PICO_COEFF_FRAC_BITS(6)
++ | PICO_OFFSET_FRAC_BITS(6));
++
++ for(i=0; i<h; i++)
++ {
++ /*
++ OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));
++ OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));
++ OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));
++ OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));
++ dst+= stride;
++ src+= stride;
++ */
++
++ int src0 = LD32(src);
++ int src1 = (((int)src[4] << 24) | (int)src[stride]);
++ int src2 = LD32(src + stride + 1);
++
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_SINGLE_VECTOR, 0, 0, 7, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 1, 1, 8, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 2, 9, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 3, 10, 0);
++ src += stride;
++ ST32(dst, PICO_GET_W(PICO_OUTPIX0));
++
++ dst += stride;
++ }
++}
++
++static void put_h264_chroma_mc8_pico(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
++ const int A=(8-x)*(8-y);
++ const int B=( x)*(8-y);
++ const int C=(8-x)*( y);
++ const int D=( x)*( y);
++ int i;
++
++ PICO_PUT_W(PICO_COEFF0_A, (A << 16) | (B & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF0_B, 32);
++ PICO_PUT_W(PICO_COEFF1_A, (C << 16) | (D & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF1_B, 0);
++ PICO_PUT_W(PICO_COEFF2_A, 0);
++ PICO_PUT_W(PICO_COEFF2_B, 0);
++ PICO_PUT_W(PICO_CONFIG,
++ PICO_OUTPUT_MODE(PICO_PLANAR_MODE)
++ | PICO_INPUT_MODE(PICO_HOR_FILTER_MODE)
++ | PICO_COEFF_FRAC_BITS(6)
++ | PICO_OFFSET_FRAC_BITS(6));
++
++ for(i=0; i<h; i++)
++ {
++ /*
++ OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));
++ OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));
++ OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));
++ OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));
++ OP(dst[4], (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5]));
++ OP(dst[5], (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6]));
++ OP(dst[6], (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7]));
++ OP(dst[7], (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8]));
++ dst+= stride;
++ src+= stride;
++ */
++ int src0 = LD32(src);
++ int src1 = (((int)src[4] << 24) | (int)src[stride]);
++ int src2 = LD32(src + stride + 1);
++
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_SINGLE_VECTOR, 0, 0, 7, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 1, 1, 8, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 2, 9, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 3, 10, 0);
++ ST32(dst, PICO_GET_W(PICO_OUTPIX0));
++
++ src0 = LD32(src + 4);
++ src1 = (src[8] << 24) | src[stride + 4];
++ src2 = LD32(src + stride + 5);
++
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_SINGLE_VECTOR, 0, 0, 7, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 1, 1, 8, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 2, 9, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 3, 10, 0);
++ src += stride;
++ ST32(dst + 4, PICO_GET_W(PICO_OUTPIX0));
++
++ dst += stride;
++ }
++}
++
++
++static void avg_h264_chroma_mc2_pico(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
++ const int A=(8-x)*(8-y);
++ const int B=( x)*(8-y);
++ const int C=(8-x)*( y);
++ const int D=( x)*( y);
++ int i;
++
++ PICO_PUT_W(PICO_COEFF0_A, (A << 16) | (B & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF0_B, 32);
++ PICO_PUT_W(PICO_COEFF1_A, (C << 16) | (D & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF1_B, 0);
++ PICO_PUT_W(PICO_COEFF2_A, 0);
++ PICO_PUT_W(PICO_COEFF2_B, 0);
++ PICO_PUT_W(PICO_CONFIG,
++ PICO_OUTPUT_MODE(PICO_PLANAR_MODE)
++ | PICO_INPUT_MODE(PICO_HOR_FILTER_MODE)
++ | PICO_COEFF_FRAC_BITS(6)
++ | PICO_OFFSET_FRAC_BITS(6));
++
++ for(i=0; i<h; i++)
++ {
++ int src0 = LD32(src);
++ int src1 = LD32(src + stride);
++
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 0, 4, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 1, 5, 0);
++ src += stride;
++ ST16(dst, rnd_avg32(LD16(dst), PICO_GET_W(PICO_OUTPIX0)));
++ dst += stride;
++ }
++}
++
++
++static void avg_h264_chroma_mc4_pico(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
++ const int A=(8-x)*(8-y);\
++ const int B=( x)*(8-y);
++ const int C=(8-x)*( y);
++ const int D=( x)*( y);
++ int i;
++
++ PICO_PUT_W(PICO_COEFF0_A, (A << 16) | (B & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF0_B, 32);
++ PICO_PUT_W(PICO_COEFF1_A, (C << 16) | (D & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF1_B, 0);
++ PICO_PUT_W(PICO_COEFF2_A, 0);
++ PICO_PUT_W(PICO_COEFF2_B, 0);
++ PICO_PUT_W(PICO_CONFIG,
++ PICO_OUTPUT_MODE(PICO_PLANAR_MODE)
++ | PICO_INPUT_MODE(PICO_HOR_FILTER_MODE)
++ | PICO_COEFF_FRAC_BITS(6)
++ | PICO_OFFSET_FRAC_BITS(6));
++
++ for(i=0; i<h; i++)
++ {
++ /*
++ OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));
++ OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));
++ OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));
++ OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));
++ dst+= stride;
++ src+= stride;
++ */
++
++ int src0 = *((int *)src);
++ int src1 = (int)((src[4] << 24) | src[stride]);
++ int src2 = *((int *)(src + stride + 1));
++
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_SINGLE_VECTOR, 0, 0, 7, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 1, 1, 8, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 2, 9, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 3, 10, 0);
++ src += stride;
++ ST32(dst, rnd_avg32(LD32(dst), PICO_GET_W(PICO_OUTPIX0)));
++ dst += stride;
++ }
++}
++
++static void avg_h264_chroma_mc8_pico(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int x, int y){
++ const int A=(8-x)*(8-y);
++ const int B=( x)*(8-y);
++ const int C=(8-x)*( y);
++ const int D=( x)*( y);
++ int i;
++
++ PICO_PUT_W(PICO_COEFF0_A, (A << 16) | (B & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF0_B, 32);
++ PICO_PUT_W(PICO_COEFF1_A, (C << 16) | (D & 0xFFFF));
++ PICO_PUT_W(PICO_COEFF1_B, 0);
++ PICO_PUT_W(PICO_COEFF2_A, 0);
++ PICO_PUT_W(PICO_COEFF2_B, 0);
++ PICO_PUT_W(PICO_CONFIG,
++ PICO_OUTPUT_MODE(PICO_PLANAR_MODE)
++ | PICO_INPUT_MODE(PICO_HOR_FILTER_MODE)
++ | PICO_COEFF_FRAC_BITS(6)
++ | PICO_OFFSET_FRAC_BITS(6));
++
++ for(i=0; i<h; i++)
++ {
++ /*
++ OP(dst[0], (A*src[0] + B*src[1] + C*src[stride+0] + D*src[stride+1]));
++ OP(dst[1], (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2]));
++ OP(dst[2], (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3]));
++ OP(dst[3], (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4]));
++ OP(dst[4], (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5]));
++ OP(dst[5], (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6]));
++ OP(dst[6], (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7]));
++ OP(dst[7], (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8]));
++ dst+= stride;
++ src+= stride;
++ */
++ int src0 = *((int *)src);
++ int src1 = (volatile int)((src[4] << 24) | src[stride]);
++ int src2 = *((int *)(src + stride + 1));
++
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_SINGLE_VECTOR, 0, 0, 7, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 1, 1, 8, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 2, 9, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 3, 10, 0);
++ ST32(dst, rnd_avg32(LD32(dst), PICO_GET_W(PICO_OUTPIX0)));
++
++ src0 = *((int *)(src + 4));
++ src1 = (int)((src[8] << 24) | src[stride + 4]);
++ src2 = *((int *)(src + stride + 5));
++
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_SINGLE_VECTOR, 0, 0, 7, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 1, 1, 8, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 2, 9, 0);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 3, 10, 0);
++ src += stride;
++ ST32(dst + 4, rnd_avg32(LD32(dst + 4), PICO_GET_W(PICO_OUTPIX0)));
++ dst += stride;
++ }
++}
++
++static struct pico_config_t h264_qpel4_h_lowpass_config = {
++ .input_mode = PICO_HOR_FILTER_MODE,
++ .output_mode = PICO_PLANAR_MODE,
++ .coeff_frac_bits = 5,
++ .offset_frac_bits = 5,
++ .coeff0_0 = 1,
++ .coeff0_1 = -5,
++ .coeff0_2 = 20,
++ .coeff0_3 = 16,
++ .coeff1_0 = 20,
++ .coeff1_1 = -5,
++ .coeff1_2 = 1,
++ .coeff1_3 = 0,
++ .coeff2_0 = 0,
++ .coeff2_1 = 0,
++ .coeff2_2 = 0,
++ .coeff2_3 = 0
++};
++
++
++
++static void put_h264_qpel4_h_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ const int h=4;
++ int i;
++
++ set_pico_config(&h264_qpel4_h_lowpass_config);
++
++ for(i=0; i<h; i++){
++
++ /*
++ OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\
++ OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\
++ OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]));\
++ OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]));\
++ dst+=dstStride;\
++ src+=srcStride;\ */
++ PICO_MVRC_W(PICO_INPIX0, LD32(src - 2));
++ PICO_MVRC_D(PICO_INPIX2, LD64_UNALIGNED(src + 2));
++ PICO_OP(PICO_SINGLE_VECTOR, 0, 0, 3, 6);
++ PICO_OP(PICO_SINGLE_VECTOR, 1, 1, 4, 7);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 2, 5, 8);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 3, 6, 9);
++ src += srcStride;
++ ST32(dst, PICO_GET_W(PICO_OUTPIX0));
++ dst += dstStride;
++ }
++}
++
++static void avg_h264_qpel4_h_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ const int h=4;
++ int i;
++
++ set_pico_config(&h264_qpel4_h_lowpass_config);
++
++ for(i=0; i<h; i++){
++
++ /*
++ OP(dst[0], (src[0]+src[1])*20 - (src[-1]+src[2])*5 + (src[-2]+src[3]));\
++ OP(dst[1], (src[1]+src[2])*20 - (src[0 ]+src[3])*5 + (src[-1]+src[4]));\
++ OP(dst[2], (src[2]+src[3])*20 - (src[1 ]+src[4])*5 + (src[0 ]+src[5]));\
++ OP(dst[3], (src[3]+src[4])*20 - (src[2 ]+src[5])*5 + (src[1 ]+src[6]));\
++ dst+=dstStride;\
++ src+=srcStride;\ */
++
++ PICO_MVRC_W(PICO_INPIX0, LD32(src - 2));
++ PICO_MVRC_D(PICO_INPIX2, LD64_UNALIGNED(src + 2));
++ PICO_OP(PICO_SINGLE_VECTOR, 0, 0, 3, 6);
++ PICO_OP(PICO_SINGLE_VECTOR, 1, 1, 4, 7);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 2, 5, 8);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 3, 6, 9);
++ src += srcStride;
++ ST32(dst, rnd_avg32(LD32(dst), PICO_GET_W(PICO_OUTPIX0)));
++ dst += dstStride;
++ }
++}
++
++static struct pico_config_t h264_qpel4_v_lowpass_config1 = {
++ .input_mode = PICO_VERT_FILTER_MODE,
++ .output_mode = PICO_PACKED_MODE,
++ .coeff_frac_bits = 5,
++ .offset_frac_bits = 5,
++ .coeff0_0 = 1,
++ .coeff0_1 = -5,
++ .coeff0_2 = 20,
++ .coeff0_3 = 16,
++ .coeff1_0 = 1,
++ .coeff1_1 = -5,
++ .coeff1_2 = 20,
++ .coeff1_3 = 16,
++ .coeff2_0 = 1,
++ .coeff2_1 = -5,
++ .coeff2_2 = 20,
++ .coeff2_3 = 16
++};
++
++
++
++static struct pico_config_t h264_qpel4_v_lowpass_config2 = {
++ .input_mode = PICO_VERT_FILTER_MODE,
++ .output_mode = PICO_PLANAR_MODE,
++ .coeff_frac_bits = 5,
++ .offset_frac_bits = 5,
++ .coeff0_0 = 1,
++ .coeff0_1 = -5,
++ .coeff0_2 = 20,
++ .coeff0_3 = 16,
++ .coeff1_0 = 20,
++ .coeff1_1 = -5,
++ .coeff1_2 = 1,
++ .coeff1_3 = 0,
++ .coeff2_0 = 0,
++ .coeff2_1 = 0,
++ .coeff2_2 = 0,
++ .coeff2_3 = 0
++};
++
++static void put_h264_qpel4_v_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++
++ /*
++ const int w=4;
++ uint8_t *cm = cropTbl + MAX_NEG_CROP;
++ int i;
++ for(i=0; i<w; i++)
++ {
++ const int srcB= src[-2*srcStride];\
++ const int srcA= src[-1*srcStride];\
++ const int src0= src[0 *srcStride];\
++ const int src1= src[1 *srcStride];\
++ const int src2= src[2 *srcStride];\
++ const int src3= src[3 *srcStride];\
++ const int src4= src[4 *srcStride];\
++ const int src5= src[5 *srcStride];\
++ const int src6= src[6 *srcStride];\
++ OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
++ OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
++ OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
++ OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
++ dst++;\
++ src++;\
++ */
++
++ set_pico_config(&h264_qpel4_v_lowpass_config1);
++
++ {
++ int srcB= LD32(src - 2*srcStride);
++ int srcA= LD32(src - 1*srcStride);
++ int src0= LD32(src + 0 *srcStride);
++ int src1= LD32(src + 1 *srcStride);
++ int src2= LD32(src + 2 *srcStride);
++ int src3= LD32(src + 3 *srcStride);
++ int src4= LD32(src + 4 *srcStride);
++ int src5= LD32(src + 5 *srcStride);
++ int src6= LD32(src + 6 *srcStride);
++
++ /* First compute the leftmost three colums */
++ PICO_MVRC_W(PICO_INPIX0, srcB);
++ PICO_MVRC_W(PICO_INPIX1, srcA);
++ PICO_MVRC_W(PICO_INPIX2, src0);
++ PICO_OP(0, 0, 0, 3, 6);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX0, src3);
++ PICO_OP(PICO_USE_ACC, 0, 0, 3, 6);
++ ST32(dst, PICO_GET_W(PICO_OUTPIX0));
++ dst += dstStride;
++ PICO_MVRC_W(PICO_INPIX0, srcA);
++ PICO_MVRC_W(PICO_INPIX1, src0);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_OP(0, 0, 0, 3, 6);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_MVRC_W(PICO_INPIX1, src3);
++ PICO_MVRC_W(PICO_INPIX0, src4);
++ PICO_OP(PICO_USE_ACC, 0, 0, 3, 6);
++ ST32(dst, PICO_GET_W(PICO_OUTPIX0));
++ dst += dstStride;
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(0, 0, 0, 3, 6);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_MVRC_W(PICO_INPIX1, src4);
++ PICO_MVRC_W(PICO_INPIX0, src5);
++ PICO_OP(PICO_USE_ACC, 0, 0, 3, 6);
++ ST32(dst, PICO_GET_W(PICO_OUTPIX0));
++ dst += dstStride;
++ PICO_MVRC_W(PICO_INPIX0, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_OP(0, 0, 0, 3, 6);
++ PICO_MVRC_W(PICO_INPIX2, src4);
++ PICO_MVRC_W(PICO_INPIX1, src5);
++ PICO_MVRC_W(PICO_INPIX0, src6);
++ PICO_OP(PICO_USE_ACC, 0, 0, 3, 6);
++ ST32(dst, PICO_GET_W(PICO_OUTPIX0));
++ /* Now compute the last column */
++
++ union wordbytes {
++ int word;
++ struct {
++ unsigned int t:8;
++ unsigned int u:8;
++ unsigned int l:8;
++ unsigned int b:8;
++ } bytes; } tmp1, tmp2, tmp3;
++
++
++ tmp1.bytes.t = srcB;
++ tmp1.bytes.u = src1;
++ tmp1.bytes.l = src4;
++
++ tmp2.bytes.t = srcA;
++ tmp2.bytes.u = src2;
++ tmp2.bytes.l = src5;
++
++ tmp3.bytes.t = src0;
++ tmp3.bytes.u = src3;
++ tmp3.bytes.l = src6;
++
++ PICO_MVRC_W(PICO_INPIX0, tmp1.word);
++ PICO_MVRC_W(PICO_INPIX1, tmp2.word);
++ PICO_MVRC_W(PICO_INPIX2, tmp3.word);
++ set_pico_config(&h264_qpel4_v_lowpass_config2);
++
++
++ PICO_OP(PICO_SINGLE_VECTOR, 0, 0, 3, 6);
++ PICO_OP(PICO_SINGLE_VECTOR, 1, 1, 4, 7);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 2, 5, 8);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 3, 6, 9);
++
++ PICO_MVCR_W(tmp1.word, PICO_OUTPIX0);
++ dst[3] = (char)(tmp1.bytes.b);
++ dst[3 - dstStride] = (char)(tmp1.bytes.l);
++ dst[3 - 2*dstStride] = (char)(tmp1.bytes.u);
++ dst[3 - 3*dstStride] = (char)(tmp1.bytes.t);
++
++ }
++ /*}
++
++
++ }*/
++}
++
++static void avg_h264_qpel4_v_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++
++ /*
++ const int w=4;
++ uint8_t *cm = cropTbl + MAX_NEG_CROP;
++ int i;
++ for(i=0; i<w; i++)
++ {
++ const int srcB= src[-2*srcStride];\
++ const int srcA= src[-1*srcStride];\
++ const int src0= src[0 *srcStride];\
++ const int src1= src[1 *srcStride];\
++ const int src2= src[2 *srcStride];\
++ const int src3= src[3 *srcStride];\
++ const int src4= src[4 *srcStride];\
++ const int src5= src[5 *srcStride];\
++ const int src6= src[6 *srcStride];\
++ OP(dst[0*dstStride], (src0+src1)*20 - (srcA+src2)*5 + (srcB+src3));\
++ OP(dst[1*dstStride], (src1+src2)*20 - (src0+src3)*5 + (srcA+src4));\
++ OP(dst[2*dstStride], (src2+src3)*20 - (src1+src4)*5 + (src0+src5));\
++ OP(dst[3*dstStride], (src3+src4)*20 - (src2+src5)*5 + (src1+src6));\
++ dst++;\
++ src++;\
++ */
++ uint8_t tmp_block[4*4];
++
++ set_pico_config(&h264_qpel4_v_lowpass_config1);
++
++ {
++ int srcB= LD32(src - 2*srcStride);
++ int srcA= LD32(src - 1*srcStride);
++ int src0= LD32(src + 0 *srcStride);
++ int src1= LD32(src + 1 *srcStride);
++ int src2= LD32(src + 2 *srcStride);
++ int src3= LD32(src + 3 *srcStride);
++ int src4= LD32(src + 4 *srcStride);
++ int src5= LD32(src + 5 *srcStride);
++ int src6= LD32(src + 6 *srcStride);
++
++ /* First compute the leftmost three colums */
++ PICO_MVRC_W(PICO_INPIX0, srcB);
++ PICO_MVRC_W(PICO_INPIX1, srcA);
++ PICO_MVRC_W(PICO_INPIX2, src0);
++ PICO_OP(0, 0, 0, 3, 6);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX0, src3);
++ PICO_OP(PICO_USE_ACC, 0, 0, 3, 6);
++ ST32(tmp_block, PICO_GET_W(PICO_OUTPIX0));
++ PICO_MVRC_W(PICO_INPIX0, srcA);
++ PICO_MVRC_W(PICO_INPIX1, src0);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_OP(0, 0, 0, 3, 6);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_MVRC_W(PICO_INPIX1, src3);
++ PICO_MVRC_W(PICO_INPIX0, src4);
++ PICO_OP(PICO_USE_ACC, 0, 0, 3, 6);
++ ST32(tmp_block + 4, PICO_GET_W(PICO_OUTPIX0));
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(0, 0, 0, 3, 6);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_MVRC_W(PICO_INPIX1, src4);
++ PICO_MVRC_W(PICO_INPIX0, src5);
++ PICO_OP(PICO_USE_ACC, 0, 0, 3, 6);
++ ST32(tmp_block + 8, PICO_GET_W(PICO_OUTPIX0));
++ PICO_MVRC_W(PICO_INPIX0, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_OP(0, 0, 0, 3, 6);
++ PICO_MVRC_W(PICO_INPIX2, src4);
++ PICO_MVRC_W(PICO_INPIX1, src5);
++ PICO_MVRC_W(PICO_INPIX0, src6);
++ PICO_OP(PICO_USE_ACC, 0, 0, 3, 6);
++ ST32(tmp_block + 12, PICO_GET_W(PICO_OUTPIX0));
++ /* Now compute the last column */
++
++ union wordbytes {
++ int word;
++ struct {
++ unsigned int t:8;
++ unsigned int u:8;
++ unsigned int l:8;
++ unsigned int b:8;
++ } bytes; } tmp1, tmp2, tmp3;
++
++
++ tmp1.bytes.t = srcB;
++ tmp1.bytes.u = src1;
++ tmp1.bytes.l = src4;
++
++ tmp2.bytes.t = srcA;
++ tmp2.bytes.u = src2;
++ tmp2.bytes.l = src5;
++
++ tmp3.bytes.t = src0;
++ tmp3.bytes.u = src3;
++ tmp3.bytes.l = src6;
++
++ PICO_MVRC_W(PICO_INPIX0, tmp1.word);
++ PICO_MVRC_W(PICO_INPIX1, tmp2.word);
++ PICO_MVRC_W(PICO_INPIX2, tmp3.word);
++ set_pico_config(&h264_qpel4_v_lowpass_config2);
++
++
++ PICO_OP(PICO_SINGLE_VECTOR, 0, 0, 3, 6);
++ PICO_OP(PICO_SINGLE_VECTOR, 1, 1, 4, 7);
++ PICO_OP(PICO_SINGLE_VECTOR, 2, 2, 5, 8);
++ PICO_OP(PICO_SINGLE_VECTOR, 3, 3, 6, 9);
++
++ PICO_MVCR_W(tmp1.word, PICO_OUTPIX0);
++ tmp_block[3 + 3*4] = (char)(tmp1.bytes.b);
++ tmp_block[3 + 2*4] = (char)(tmp1.bytes.l);
++ tmp_block[3 + 1*4] = (char)(tmp1.bytes.u);
++ tmp_block[3] = (char)(tmp1.bytes.t);
++
++ /* Compute the average */
++ srcB= LD32(dst);
++ srcA= LD32(dst + dstStride);
++ src0= LD32(dst + dstStride*2);
++ src1= LD32(dst + dstStride*3);
++
++ src2= LD32(tmp_block);
++ src3= LD32(tmp_block + 4);
++ src4= LD32(tmp_block + 8);
++ src5= LD32(tmp_block + 12);
++
++ ST32(dst, rnd_avg32(srcB, src2));
++ ST32(dst + dstStride, rnd_avg32(srcA, src3));
++ ST32(dst + 2*dstStride, rnd_avg32(src0, src4));
++ ST32(dst + 3*dstStride, rnd_avg32(src1, src5));
++ }
++}
++
++static struct pico_config_t h264_qpel4_hv_lowpass_config = {
++ .input_mode = PICO_HOR_FILTER_MODE,
++ .output_mode = PICO_PACKED_MODE,
++ .coeff_frac_bits = 10,
++ .offset_frac_bits = 10,
++ .coeff0_0 = 1,
++ .coeff0_1 = -5,
++ .coeff0_2 = 20,
++ .coeff0_3 = 512,
++ .coeff1_0 = -5,
++ .coeff1_1 = 25,
++ .coeff1_2 = -100,
++ .coeff1_3 = 0,
++ .coeff2_0 = 20,
++ .coeff2_1 = -100,
++ .coeff2_2 = 400,
++ .coeff2_3 = 0
++};
++
++static void put_h264_qpel4_hv_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++
++ int32_t tmp_block[48];
++ int32_t *tmp = tmp_block;
++ int i;
++
++ set_pico_config(&h264_qpel4_hv_lowpass_config);
++
++ src -= 2;
++ for ( i = 0; i < 2; i++ ){
++ int srcB= LD32(src - 2*srcStride);
++ int srcA= LD32(src - 1*srcStride);
++ int src0= LD32(src + 0 *srcStride);
++ int src1= LD32(src + 1 *srcStride);
++ int src2= LD32(src + 2 *srcStride);
++ int src3= LD32(src + 3 *srcStride);
++ int src4= LD32(src + 4 *srcStride);
++ int src5= LD32(src + 5 *srcStride);
++ int src6= LD32(src + 6 *srcStride);
++
++ PICO_MVRC_W(PICO_INPIX0, srcB);
++ PICO_MVRC_W(PICO_INPIX1, srcA);
++ PICO_MVRC_W(PICO_INPIX2, src0);
++ PICO_OP(0, 0, 0, 4, 8);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX0, src3);
++ PICO_OP(PICO_USE_ACC, 0, 0, 4, 8);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_OP(0, 0, 1, 5, 9);
++ PICO_MVRC_W(PICO_INPIX0, srcB);
++ PICO_MVRC_W(PICO_INPIX1, srcA);
++ PICO_MVRC_W(PICO_INPIX2, src0);
++ PICO_OP(PICO_USE_ACC, 0, 1, 5, 9);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_MVRC_W(PICO_INPIX0, src1);
++ PICO_OP(0, 0, 4, 8, 0);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_MVRC_W(PICO_INPIX1, src3);
++ PICO_MVRC_W(PICO_INPIX0, src4);
++ PICO_OP(PICO_USE_ACC, 0, 0, 4, 8);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_OP(0, 0, 1, 5, 9);
++ PICO_MVRC_W(PICO_INPIX0, srcA);
++ PICO_MVRC_W(PICO_INPIX1, src0);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_OP(PICO_USE_ACC, 0, 1, 5, 9);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_MVRC_W(PICO_INPIX0, src2);
++ PICO_OP(0, 0, 4, 8, 0);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_MVRC_W(PICO_INPIX1, src4);
++ PICO_MVRC_W(PICO_INPIX0, src5);
++ PICO_OP(PICO_USE_ACC, 0, 0, 4, 8);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_OP(0, 0, 1, 5, 9);
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_USE_ACC, 0, 1, 5, 9);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_MVRC_W(PICO_INPIX0, src3);
++ PICO_OP(0, 0, 4, 8, 0);
++ PICO_MVRC_W(PICO_INPIX2, src4);
++ PICO_MVRC_W(PICO_INPIX1, src5);
++ PICO_MVRC_W(PICO_INPIX0, src6);
++ PICO_OP(PICO_USE_ACC, 0, 0, 4, 8);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_OP(0, 0, 1, 5, 9);
++ PICO_MVRC_W(PICO_INPIX0, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_OP(PICO_USE_ACC, 0, 1, 5, 9);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++ src += 2;
++ }
++
++ src -= 1;
++ tmp -= 48;
++
++
++ PICO_PUT_W(PICO_CONFIG,
++ PICO_OUTPUT_MODE(PICO_PLANAR_MODE)
++ | PICO_INPUT_MODE(PICO_VERT_FILTER_MODE)
++ | PICO_COEFF_FRAC_BITS(10)
++ | PICO_OFFSET_FRAC_BITS(10));
++
++ for ( i = 0; i < 2; i++ ){
++ int srcB= LD32(src - 2*srcStride);
++ int srcA= LD32(src - 1*srcStride);
++ int src0= LD32(src + 0 *srcStride);
++ int src1= LD32(src + 1 *srcStride);
++ int src2= LD32(src + 2 *srcStride);
++ int src3= LD32(src + 3 *srcStride);
++ int src4= LD32(src + 4 *srcStride);
++ int src5= LD32(src + 5 *srcStride);
++ int src6= LD32(src + 6 *srcStride);
++
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_MVRC_W(PICO_INPIX0, srcB);
++ PICO_MVRC_W(PICO_INPIX1, srcA);
++ PICO_MVRC_W(PICO_INPIX2, src0);
++ PICO_OP(PICO_USE_ACC, 0, 6, 3, 0);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX0, src3);
++ PICO_OP(PICO_USE_ACC | PICO_SINGLE_VECTOR, 0, 6, 3, 0);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_OP(PICO_USE_ACC, 1, 9, 6, 3);
++ PICO_MVRC_W(PICO_INPIX0, srcB);
++ PICO_MVRC_W(PICO_INPIX1, srcA);
++ PICO_MVRC_W(PICO_INPIX2, src0);
++ PICO_OP(PICO_USE_ACC | PICO_SINGLE_VECTOR, 1, 9, 6, 3);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_MVRC_W(PICO_INPIX0, srcA);
++ PICO_MVRC_W(PICO_INPIX1, src0);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_OP(PICO_USE_ACC, 2, 6, 3, 0);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_MVRC_W(PICO_INPIX1, src3);
++ PICO_MVRC_W(PICO_INPIX0, src4);
++ PICO_OP(PICO_USE_ACC | PICO_SINGLE_VECTOR, 2, 6, 3, 0);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_OP(PICO_USE_ACC, 3, 9, 6, 3);
++ PICO_MVRC_W(PICO_INPIX0, srcA);
++ PICO_MVRC_W(PICO_INPIX1, src0);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_OP(PICO_USE_ACC | PICO_SINGLE_VECTOR, 3, 9, 6, 3);
++
++ ST16(dst + 0*dstStride, (short)(PICO_GET_W(PICO_OUTPIX0) >> 16));
++ ST16(dst + 1*dstStride, (short)PICO_GET_W(PICO_OUTPIX0));
++
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_USE_ACC, 0, 6, 3, 0);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_MVRC_W(PICO_INPIX1, src4);
++ PICO_MVRC_W(PICO_INPIX0, src5);
++ PICO_OP(PICO_USE_ACC| PICO_SINGLE_VECTOR, 0, 6, 3, 0);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_OP(PICO_USE_ACC, 1, 9, 6, 3);
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_USE_ACC| PICO_SINGLE_VECTOR, 1, 9, 6, 3);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_MVRC_W(PICO_INPIX0, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_OP(PICO_USE_ACC, 2, 6, 3, 0);
++ PICO_MVRC_W(PICO_INPIX2, src4);
++ PICO_MVRC_W(PICO_INPIX1, src5);
++ PICO_MVRC_W(PICO_INPIX0, src6);
++ PICO_OP(PICO_USE_ACC| PICO_SINGLE_VECTOR, 2, 6, 3, 0);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_OP(PICO_USE_ACC, 3, 9, 6, 3);
++ PICO_MVRC_W(PICO_INPIX0, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_OP(PICO_USE_ACC| PICO_SINGLE_VECTOR, 3, 9, 6, 3);
++
++ ST16(dst + 2*dstStride, (short)(PICO_GET_W(PICO_OUTPIX0) >> 16));
++ ST16(dst + 3*dstStride, (short)PICO_GET_W(PICO_OUTPIX0));
++
++ dst += 2;
++ src += 2;
++ }
++}
++
++
++
++
++static void avg_h264_qpel4_hv_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++
++ int32_t tmp_block[48];
++ int32_t *tmp = tmp_block;
++ int i;
++
++ set_pico_config(&h264_qpel4_hv_lowpass_config);
++
++ src -= 2;
++ for ( i = 0; i < 2; i++ ){
++ int srcB= LD32(src - 2*srcStride);
++ int srcA= LD32(src - 1*srcStride);
++ int src0= LD32(src + 0 *srcStride);
++ int src1= LD32(src + 1 *srcStride);
++ int src2= LD32(src + 2 *srcStride);
++ int src3= LD32(src + 3 *srcStride);
++ int src4= LD32(src + 4 *srcStride);
++ int src5= LD32(src + 5 *srcStride);
++ int src6= LD32(src + 6 *srcStride);
++
++ PICO_MVRC_W(PICO_INPIX0, srcB);
++ PICO_MVRC_W(PICO_INPIX1, srcA);
++ PICO_MVRC_W(PICO_INPIX2, src0);
++ PICO_OP(0, 0, 0, 4, 8);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX0, src3);
++ PICO_OP(PICO_USE_ACC, 0, 0, 4, 8);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_OP(0, 0, 1, 5, 9);
++ PICO_MVRC_W(PICO_INPIX0, srcB);
++ PICO_MVRC_W(PICO_INPIX1, srcA);
++ PICO_MVRC_W(PICO_INPIX2, src0);
++ PICO_OP(PICO_USE_ACC, 0, 1, 5, 9);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_MVRC_W(PICO_INPIX0, src1);
++ PICO_OP(0, 0, 4, 8, 0);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_MVRC_W(PICO_INPIX1, src3);
++ PICO_MVRC_W(PICO_INPIX0, src4);
++ PICO_OP(PICO_USE_ACC, 0, 0, 4, 8);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_OP(0, 0, 1, 5, 9);
++ PICO_MVRC_W(PICO_INPIX0, srcA);
++ PICO_MVRC_W(PICO_INPIX1, src0);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_OP(PICO_USE_ACC, 0, 1, 5, 9);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_MVRC_W(PICO_INPIX0, src2);
++ PICO_OP(0, 0, 4, 8, 0);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_MVRC_W(PICO_INPIX1, src4);
++ PICO_MVRC_W(PICO_INPIX0, src5);
++ PICO_OP(PICO_USE_ACC, 0, 0, 4, 8);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_OP(0, 0, 1, 5, 9);
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_USE_ACC, 0, 1, 5, 9);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_MVRC_W(PICO_INPIX0, src3);
++ PICO_OP(0, 0, 4, 8, 0);
++ PICO_MVRC_W(PICO_INPIX2, src4);
++ PICO_MVRC_W(PICO_INPIX1, src5);
++ PICO_MVRC_W(PICO_INPIX0, src6);
++ PICO_OP(PICO_USE_ACC, 0, 0, 4, 8);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++
++ PICO_OP(0, 0, 1, 5, 9);
++ PICO_MVRC_W(PICO_INPIX0, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_OP(PICO_USE_ACC, 0, 1, 5, 9);
++ PICO_STCM_W(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ tmp += 3;
++ src += 2;
++ }
++
++ src -= 1;
++ tmp -= 48;
++
++
++ PICO_PUT_W(PICO_CONFIG,
++ PICO_OUTPUT_MODE(PICO_PLANAR_MODE)
++ | PICO_INPUT_MODE(PICO_VERT_FILTER_MODE)
++ | PICO_COEFF_FRAC_BITS(10)
++ | PICO_OFFSET_FRAC_BITS(10));
++
++ for ( i = 0; i < 2; i++ ){
++ int srcB= LD32(src - 2*srcStride);
++ int srcA= LD32(src - 1*srcStride);
++ int src0= LD32(src + 0 *srcStride);
++ int src1= LD32(src + 1 *srcStride);
++ int src2= LD32(src + 2 *srcStride);
++ int src3= LD32(src + 3 *srcStride);
++ int src4= LD32(src + 4 *srcStride);
++ int src5= LD32(src + 5 *srcStride);
++ int src6= LD32(src + 6 *srcStride);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_MVRC_W(PICO_INPIX0, srcB);
++ PICO_MVRC_W(PICO_INPIX1, srcA);
++ PICO_MVRC_W(PICO_INPIX2, src0);
++ PICO_OP(PICO_USE_ACC, 0, 6, 3, 0);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX0, src3);
++ PICO_OP(PICO_USE_ACC | PICO_SINGLE_VECTOR, 0, 6, 3, 0);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_OP(PICO_USE_ACC, 1, 9, 6, 3);
++ PICO_MVRC_W(PICO_INPIX0, srcB);
++ PICO_MVRC_W(PICO_INPIX1, srcA);
++ PICO_MVRC_W(PICO_INPIX2, src0);
++ PICO_OP(PICO_USE_ACC | PICO_SINGLE_VECTOR, 1, 9, 6, 3);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_MVRC_W(PICO_INPIX0, srcA);
++ PICO_MVRC_W(PICO_INPIX1, src0);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_OP(PICO_USE_ACC, 2, 6, 3, 0);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_MVRC_W(PICO_INPIX1, src3);
++ PICO_MVRC_W(PICO_INPIX0, src4);
++ PICO_OP(PICO_USE_ACC | PICO_SINGLE_VECTOR, 2, 6, 3, 0);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_OP(PICO_USE_ACC, 3, 9, 6, 3);
++ PICO_MVRC_W(PICO_INPIX0, srcA);
++ PICO_MVRC_W(PICO_INPIX1, src0);
++ PICO_MVRC_W(PICO_INPIX2, src1);
++ PICO_OP(PICO_USE_ACC | PICO_SINGLE_VECTOR, 3, 9, 6, 3);
++
++ ST16(dst + 0*dstStride, rnd_avg32(LD16(dst + 0*dstStride), PICO_GET_W(PICO_OUTPIX0) >> 16));
++ ST16(dst + 1*dstStride, rnd_avg32(LD16(dst + 1*dstStride), PICO_GET_W(PICO_OUTPIX0)));
++
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_USE_ACC, 0, 6, 3, 0);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_MVRC_W(PICO_INPIX1, src4);
++ PICO_MVRC_W(PICO_INPIX0, src5);
++ PICO_OP(PICO_USE_ACC| PICO_SINGLE_VECTOR, 0, 6, 3, 0);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_OP(PICO_USE_ACC, 1, 9, 6, 3);
++ PICO_MVRC_W(PICO_INPIX0, src0);
++ PICO_MVRC_W(PICO_INPIX1, src1);
++ PICO_MVRC_W(PICO_INPIX2, src2);
++ PICO_OP(PICO_USE_ACC| PICO_SINGLE_VECTOR, 1, 9, 6, 3);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_MVRC_W(PICO_INPIX0, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_OP(PICO_USE_ACC, 2, 6, 3, 0);
++ PICO_MVRC_W(PICO_INPIX2, src4);
++ PICO_MVRC_W(PICO_INPIX1, src5);
++ PICO_MVRC_W(PICO_INPIX0, src6);
++ PICO_OP(PICO_USE_ACC| PICO_SINGLE_VECTOR, 2, 6, 3, 0);
++
++ PICO_LDCM_W_INC(tmp,
++ PICO_REGVECT_VMU0_OUT,
++ PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT);
++ PICO_OP(PICO_USE_ACC, 3, 9, 6, 3);
++ PICO_MVRC_W(PICO_INPIX0, src1);
++ PICO_MVRC_W(PICO_INPIX1, src2);
++ PICO_MVRC_W(PICO_INPIX2, src3);
++ PICO_OP(PICO_USE_ACC| PICO_SINGLE_VECTOR, 3, 9, 6, 3);
++
++ ST16(dst + 2*dstStride, rnd_avg32(LD16(dst + 2*dstStride), PICO_GET_W(PICO_OUTPIX0) >> 16));
++ ST16(dst + 3*dstStride, rnd_avg32(LD16(dst + 3*dstStride), PICO_GET_W(PICO_OUTPIX0)));
++
++ dst += 2;
++ src += 2;
++ }
++}
++
++
++static void put_h264_qpel8_v_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ put_h264_qpel4_v_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel4_v_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++ src += 4*srcStride;
++ dst += 4*dstStride;
++ put_h264_qpel4_v_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel4_v_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++}
++
++static void avg_h264_qpel8_v_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ avg_h264_qpel4_v_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel4_v_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++ src += 4*srcStride;
++ dst += 4*dstStride;
++ avg_h264_qpel4_v_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel4_v_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++}
++
++static void put_h264_qpel8_h_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ put_h264_qpel4_h_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel4_h_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++ src += 4*srcStride;
++ dst += 4*dstStride;
++ put_h264_qpel4_h_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel4_h_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++}
++
++static void avg_h264_qpel8_h_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ avg_h264_qpel4_h_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel4_h_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++ src += 4*srcStride;
++ dst += 4*dstStride;
++ avg_h264_qpel4_h_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel4_h_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++}
++
++static void put_h264_qpel8_hv_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ put_h264_qpel4_hv_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel4_hv_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++ src += 4*srcStride;
++ dst += 4*dstStride;
++ put_h264_qpel4_hv_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel4_hv_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++}
++
++static void avg_h264_qpel8_hv_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ avg_h264_qpel4_hv_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel4_hv_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++ src += 4*srcStride;
++ dst += 4*dstStride;
++ avg_h264_qpel4_hv_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel4_hv_lowpass_pico(dst+4, src+4, dstStride, srcStride);
++}
++
++static void put_h264_qpel16_v_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ put_h264_qpel8_v_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel8_v_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++ src += 8*srcStride;
++ dst += 8*dstStride;
++ put_h264_qpel8_v_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel8_v_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++}
++
++static void avg_h264_qpel16_v_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ avg_h264_qpel8_v_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel8_v_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++ src += 8*srcStride;
++ dst += 8*dstStride;
++ avg_h264_qpel8_v_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel8_v_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++}
++
++static void put_h264_qpel16_h_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ put_h264_qpel8_h_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel8_h_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++ src += 8*srcStride;
++ dst += 8*dstStride;
++ put_h264_qpel8_h_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel8_h_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++}
++
++static void avg_h264_qpel16_h_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ avg_h264_qpel8_h_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel8_h_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++ src += 8*srcStride;
++ dst += 8*dstStride;
++ avg_h264_qpel8_h_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel8_h_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++}
++
++static void put_h264_qpel16_hv_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ put_h264_qpel8_hv_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel8_hv_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++ src += 8*srcStride;
++ dst += 8*dstStride;
++ put_h264_qpel8_hv_lowpass_pico(dst , src , dstStride, srcStride);
++ put_h264_qpel8_hv_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++}
++
++static void avg_h264_qpel16_hv_lowpass_pico(uint8_t *dst, uint8_t *src, int dstStride, int srcStride){
++ avg_h264_qpel8_hv_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel8_hv_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++ src += 8*srcStride;
++ dst += 8*dstStride;
++ avg_h264_qpel8_hv_lowpass_pico(dst , src , dstStride, srcStride);
++ avg_h264_qpel8_hv_lowpass_pico(dst+8, src+8, dstStride, srcStride);
++}
++
++
++#define H264_MC(OPNAME, SIZE) \
++static void OPNAME ## h264_qpel ## SIZE ## _mc00_pico (uint8_t *dst, uint8_t *src, int stride){\
++ OPNAME ## pixels ## SIZE ## _c(dst, src, stride, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc10_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t half[SIZE*SIZE];\
++ put_h264_qpel ## SIZE ## _h_lowpass_pico(half, src, SIZE, stride);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, src, half, stride, stride, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc20_pico(uint8_t *dst, uint8_t *src, int stride){\
++ OPNAME ## h264_qpel ## SIZE ## _h_lowpass_pico(dst, src, stride, stride);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc30_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t half[SIZE*SIZE];\
++ put_h264_qpel ## SIZE ## _h_lowpass_pico(half, src, SIZE, stride);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, src+1, half, stride, stride, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc01_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t full[SIZE*(SIZE+5)];\
++ uint8_t * const full_mid= full + SIZE*2;\
++ uint8_t half[SIZE*SIZE];\
++ copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
++ put_h264_qpel ## SIZE ## _v_lowpass_pico(half, full_mid, SIZE, SIZE);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, full_mid, half, stride, SIZE, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc02_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t full[SIZE*(SIZE+5)];\
++ uint8_t * const full_mid= full + SIZE*2;\
++ copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
++ OPNAME ## h264_qpel ## SIZE ## _v_lowpass_pico(dst, full_mid, stride, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc03_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t full[SIZE*(SIZE+5)];\
++ uint8_t * const full_mid= full + SIZE*2;\
++ uint8_t half[SIZE*SIZE];\
++ copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
++ put_h264_qpel ## SIZE ## _v_lowpass_pico(half, full_mid, SIZE, SIZE);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, full_mid+SIZE, half, stride, SIZE, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc11_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t full[SIZE*(SIZE+5)];\
++ uint8_t * const full_mid= full + SIZE*2;\
++ uint8_t halfH[SIZE*SIZE];\
++ uint8_t halfV[SIZE*SIZE];\
++ put_h264_qpel ## SIZE ## _h_lowpass_pico(halfH, src, SIZE, stride);\
++ copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
++ put_h264_qpel ## SIZE ## _v_lowpass_pico(halfV, full_mid, SIZE, SIZE);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc31_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t full[SIZE*(SIZE+5)];\
++ uint8_t * const full_mid= full + SIZE*2;\
++ uint8_t halfH[SIZE*SIZE];\
++ uint8_t halfV[SIZE*SIZE];\
++ put_h264_qpel ## SIZE ## _h_lowpass_pico(halfH, src, SIZE, stride);\
++ copy_block ## SIZE (full, src - stride*2 + 1, SIZE, stride, SIZE + 5);\
++ put_h264_qpel ## SIZE ## _v_lowpass_pico(halfV, full_mid, SIZE, SIZE);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc13_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t full[SIZE*(SIZE+5)];\
++ uint8_t * const full_mid= full + SIZE*2;\
++ uint8_t halfH[SIZE*SIZE];\
++ uint8_t halfV[SIZE*SIZE];\
++ put_h264_qpel ## SIZE ## _h_lowpass_pico(halfH, src + stride, SIZE, stride);\
++ copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
++ put_h264_qpel ## SIZE ## _v_lowpass_pico(halfV, full_mid, SIZE, SIZE);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc33_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t full[SIZE*(SIZE+5)];\
++ uint8_t * const full_mid= full + SIZE*2;\
++ uint8_t halfH[SIZE*SIZE];\
++ uint8_t halfV[SIZE*SIZE];\
++ put_h264_qpel ## SIZE ## _h_lowpass_pico(halfH, src + stride, SIZE, stride);\
++ copy_block ## SIZE (full, src - stride*2 + 1, SIZE, stride, SIZE + 5);\
++ put_h264_qpel ## SIZE ## _v_lowpass_pico(halfV, full_mid, SIZE, SIZE);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfV, stride, SIZE, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc22_pico(uint8_t *dst, uint8_t *src, int stride){\
++ OPNAME ## h264_qpel ## SIZE ## _hv_lowpass_pico(dst, src, stride, stride);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc21_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t halfH[SIZE*SIZE];\
++ uint8_t halfHV[SIZE*SIZE];\
++ put_h264_qpel ## SIZE ## _h_lowpass_pico(halfH, src, SIZE, stride);\
++ put_h264_qpel ## SIZE ## _hv_lowpass_pico(halfHV, src, SIZE, stride);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfHV, stride, SIZE, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc23_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t halfH[SIZE*SIZE];\
++ uint8_t halfHV[SIZE*SIZE];\
++ put_h264_qpel ## SIZE ## _h_lowpass_pico(halfH, src + stride, SIZE, stride);\
++ put_h264_qpel ## SIZE ## _hv_lowpass_pico(halfHV, src, SIZE, stride);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, halfH, halfHV, stride, SIZE, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc12_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t full[SIZE*(SIZE+5)];\
++ uint8_t * const full_mid= full + SIZE*2;\
++ uint8_t halfV[SIZE*SIZE];\
++ uint8_t halfHV[SIZE*SIZE];\
++ copy_block ## SIZE (full, src - stride*2, SIZE, stride, SIZE + 5);\
++ put_h264_qpel ## SIZE ## _v_lowpass_pico(halfV, full_mid, SIZE, SIZE);\
++ put_h264_qpel ## SIZE ## _hv_lowpass_pico(halfHV, src, SIZE, stride);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\
++}\
++\
++static void OPNAME ## h264_qpel ## SIZE ## _mc32_pico(uint8_t *dst, uint8_t *src, int stride){\
++ uint8_t full[SIZE*(SIZE+5)];\
++ uint8_t * const full_mid= full + SIZE*2;\
++ uint8_t halfV[SIZE*SIZE];\
++ uint8_t halfHV[SIZE*SIZE];\
++ copy_block ## SIZE (full, src - stride*2 + 1, SIZE, stride, SIZE + 5);\
++ put_h264_qpel ## SIZE ## _v_lowpass_pico(halfV, full_mid, SIZE, SIZE);\
++ put_h264_qpel ## SIZE ## _hv_lowpass_pico(halfHV, src, SIZE, stride);\
++ OPNAME ## pixels ## SIZE ## _l2(dst, halfV, halfHV, stride, SIZE, SIZE, SIZE);\
++}\
++
++H264_MC(put_, 4)
++H264_MC(put_, 8)
++H264_MC(put_, 16)
++H264_MC(avg_, 4)
++H264_MC(avg_, 8)
++H264_MC(avg_, 16)
++
++
++
++#define dspfunc16(PFX) \
++ void PFX ## _pixels16_avr32(uint8_t *dst, const uint8_t *pixels, int line_size, int h ){ \
++ PFX ## _pixels8_avr32(dst, pixels, line_size, h);\
++ PFX ## _pixels8_avr32(dst + 8, pixels + 8, line_size, h);\
++ }\
++ void PFX ## _pixels16_h_avr32(uint8_t *dst, const uint8_t *pixels, int line_size, int h ){ \
++ PFX ## _pixels8_h_avr32(dst, pixels, line_size, h);\
++ PFX ## _pixels8_h_avr32(dst + 8, pixels + 8, line_size, h);\
++ }\
++ void PFX ## _pixels16_v_avr32(uint8_t *dst, const uint8_t *pixels, int line_size, int h ){ \
++ PFX ## _pixels8_v_avr32(dst, pixels, line_size, h);\
++ PFX ## _pixels8_v_avr32(dst + 8, pixels + 8, line_size, h);\
++ }\
++ void PFX ## _pixels16_hv_avr32(uint8_t *dst, const uint8_t *pixels, int line_size, int h ){ \
++ PFX ## _pixels8_hv_avr32(dst, pixels, line_size, h);\
++ PFX ## _pixels8_hv_avr32(dst + 8, pixels + 8, line_size, h);\
++ }\
++
++
++dspfunc16(put)
++dspfunc16(put_no_rnd)
++dspfunc16(avg)
++dspfunc16(avg_no_rnd)
++#undef dspfunc16
++
++static int pix_sum_avr32(uint8_t * pix, int line_size)
++{
++ int s, i;
++
++ s = 0;
++ for (i = 0; i < 16; i++) {
++ int tmp1,tmp2,tmp3,tmp4,tmp5;
++ __asm__ volatile ( "ld.w\t%0, %6[0]\n\t"
++ "ld.w\t%1, %6[4]\n\t"
++ "ld.w\t%2, %6[8]\n\t"
++ "ld.w\t%3, %6[12]\n\t"
++ "punpckub.h\t%4, %0:t\n\t"
++ "padd.h\t%5, %5, %4\n\t"
++ "punpckub.h\t%4, %0:b\n\t"
++ "padd.h\t%5, %5, %4\n\t"
++ "punpckub.h\t%4, %1:t\n\t"
++ "padd.h\t%5, %5, %4\n\t"
++ "punpckub.h\t%4, %1:b\n\t"
++ "padd.h\t%5, %5, %4\n\t"
++ "punpckub.h\t%4, %2:t\n\t"
++ "padd.h\t%5, %5, %4\n\t"
++ "punpckub.h\t%4, %2:b\n\t"
++ "padd.h\t%5, %5, %4\n\t"
++ "punpckub.h\t%4, %3:t\n\t"
++ "padd.h\t%5, %5, %4\n\t"
++ "punpckub.h\t%4, %3:b\n\t"
++ "padd.h\t%5, %5, %4\n\t"
++ : "=&r"(tmp1),"=&r"(tmp2),"=&r"(tmp3),"=&r"(tmp4),"=&r"(tmp5),"=&r"(s)
++ : "r"(pix));
++ pix += line_size;
++ }
++ __asm__ volatile ( "addhh.w\t%0, %0:t, %0:b" : "=&r" (s) );
++
++ return s;
++}
++
++
++//#define op_scale1(x) block[x] = clip_uint8( (block[x]*weight + offset) >> log2_denom )
++//#define op_scale2(x) dst[x] = clip_uint8( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1))
++//#define H264_WEIGHT(W,H) \
++//static void weight_h264_pixels ## W ## x ## H ## _c(uint8_t *block, int stride, int log2_denom, int weight, int offset){ \
++// int attribute_unused x, y; \
++// offset <<= log2_denom; \
++// if(log2_denom) offset += 1<<(log2_denom-1); \
++// for(y=0; y<H; y++, block += stride){ \
++// uint32_t tmp0, tmp1;
++// if(W==2) { \
++// asm volatile ( "ld.ub\t%[tmp0], %[block][0]\n" \
++// "ld.ub\t%[tmp1], %[block][1]\n" \
++// "mulhh.w\t%[tmp0], %[tmp0]:b, %[weight]:b\n" \
++// "mulhh.w\t%[tmp1], %[tmp1]:b, %[weight]:b\n" \
++// "asr\t%[tmp0], %[log2_denom]\n" \
++// "asr\t%[tmp1], %[log2_denom]\n" \
++// "satu\t%[tmp0] >> 0, 8\n" \
++// "satu\t%[tmp1] >> 0, 8\n" \
++// "st.b\t%[block][0], %[tmp0]\n" \
++// "st.b\t%[block][1], %[tmp1]\n" \
++// : [tmp0] "=&r"(tmp0), [tmp1] "=&r"(tmp1) \
++// : [block] "r"(block), [weight]"r"(weight), [log2_denom]"r"(log2denom) ); \
++// } else if ( W==4 ) { \
++// asm volatile ( "ld.w\t%[tmp0], %[block][0]\n" \
++// "punpckub.h\t%[tmp1], %[tmp0]:t\n" \
++// "punpckub.h\t%[tmp0], %[tmp0]:b\n" \
++// "mulhh.w\t%[tmp2], %[tmp1]:t, %[weight]:b\n" \
++// "mulhh.w\t%[tmp1], %[tmp1]:b, %[weight]:b\n" \
++// "asr\t%[tmp0], %[log2_denom]\n" \
++// "asr\t%[tmp1], %[log2_denom]\n" \
++// "satu\t%[tmp0] >> 0, 8\n" \
++// "satu\t%[tmp1] >> 0, 8\n" \
++// "st.b\t%[block][0], %[tmp0]\n" \
++// "st.b\t%[block][1], %[tmp1]\n" \
++// : [tmp0] "=&r"(tmp0), [tmp1] "=&r"(tmp1) \
++// : [block] "r"(block), [weight]"r"(weight), [log2_denom]"r"(log2denom) ); \
++//
++//
++//
++// if(W==4) continue; \
++// op_scale1(4); \
++// op_scale1(5); \
++// op_scale1(6); \
++// op_scale1(7); \
++// if(W==8) continue; \
++// op_scale1(8); \
++// op_scale1(9); \
++// op_scale1(10); \
++// op_scale1(11); \
++// op_scale1(12); \
++// op_scale1(13); \
++// op_scale1(14); \
++// op_scale1(15); \
++// } \
++//} \
++//static void biweight_h264_pixels ## W ## x ## H ## _c(uint8_t *dst, uint8_t *src, int stride, int log2_denom, int weightd, int weights, int offsetd, int offsets){ \
++// int attribute_unused x, y; \
++// int offset = (offsets + offsetd + 1) >> 1; \
++// offset = ((offset << 1) + 1) << log2_denom; \
++// for(y=0; y<H; y++, dst += stride, src += stride){ \
++// op_scale2(0); \
++// op_scale2(1); \
++// if(W==2) continue; \
++// op_scale2(2); \
++// op_scale2(3); \
++// if(W==4) continue; \
++// op_scale2(4); \
++// op_scale2(5); \
++// op_scale2(6); \
++// op_scale2(7); \
++// if(W==8) continue; \
++// op_scale2(8); \
++// op_scale2(9); \
++// op_scale2(10); \
++// op_scale2(11); \
++// op_scale2(12); \
++// op_scale2(13); \
++// op_scale2(14); \
++// op_scale2(15); \
++// } \
++//}
++
++
++
++/* Returns zero in each byte where the absolute difference between <a> and <b>
++ is not less than <compare> */
++#define PABS_DIFF_LESS_THAN( a, b, compare) \
++ ({ uint32_t __tmp__, __tmp2__, __mask__; \
++ asm ( \
++ /* Check ABS( a - b ) < compare */ \
++ "psubs.ub\t%[tmp], %[opa], %[opb]\n" \
++ "psubs.ub\t%[tmp2], %[opb], %[opa]\n" \
++ "or\t%[tmp], %[tmp2]\n" /* ABS ( a - b ) */ \
++ /* This produces 0 for all bytes where the comparison is not true */ \
++ "psubs.ub\t%[mask], %[cmp], %[tmp]\n" \
++ : [tmp] "=&r"(__tmp__), [tmp2] "=&r"(__tmp2__), [mask] "=&r"(__mask__) \
++ : [opa] "r"(a), [opb] "r"(b), [cmp] "r"(compare) ); \
++ __mask__; })
++
++/*
++ Set all bytes containing zero in <value> to 255 and the rest to zero.
++
++ Add with saturation 254 to all bytes making all bytes different from
++ zero become 255. Then add one without saturation to make all bytes
++ originally containing zero 255 and the rest 0. */
++#define SET_ALL_BITS_IN_ZERO_BYTES(value) \
++ ({ uint32_t __tmp__; \
++ asm ( \
++ "padds.ub\t%[tmp], %[val], %[max_minus_one]\n" \
++ "padd.b\t%[tmp], %[tmp], %[all_ones]\n" \
++ : [tmp] "=r"(__tmp__) \
++ : [val] "r"(value), [max_minus_one] "r"(0xFEFEFEFE), [all_ones] "r"(0x01010101) ); \
++ __tmp__; })
++
++#define PACKW_SH(upper, lower) \
++ ({ uint32_t __tmp__; \
++ asm ( \
++ "packw.sh\t%[tmp], %[u], %[l]\n" \
++ : [tmp] "=r"(__tmp__) \
++ : [u] "r"(upper), [l] "r"(lower) ); \
++ __tmp__; })
++
++#define PACKSH_UB(upper, lower) \
++ ({ uint32_t __tmp__; \
++ asm ( \
++ "packsh.sb\t%[tmp], %[u], %[l]\n" \
++ : [tmp] "=r"(__tmp__) \
++ : [u] "r"(upper), [l] "r"(lower) ); \
++ __tmp__; })
++
++static void h264_v_loop_filter_luma_avr32(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
++{
++ int i;
++
++ if ( alpha == 0 )
++ return;
++
++ alpha = PACKW_SH(alpha, alpha);
++ alpha = PACKSH_UB(alpha, alpha);
++ beta = PACKW_SH(beta, beta);
++ beta = PACKSH_UB(beta, beta);
++
++ for( i = 0; i < 4; i++ ) {
++ uint32_t p0, p1, p2, q0, q1, q2;
++ uint32_t mask, mask2;
++ uint32_t tmp, tmp2, tmp3, tmp4;
++
++ if( tc0[i] < 0 ) {
++ pix += 4;
++ continue;
++ }
++
++/* for( d = 0; d < 4; d++ ) {
++ const int p0 = pix[-1*stride];
++ const int p1 = pix[-2*stride];
++ const int p2 = pix[-3*stride];
++ const int q0 = pix[0];
++ const int q1 = pix[1*stride];
++ const int q2 = pix[2*stride];
++
++ if( ABS( p0 - q0 ) < alpha &&
++ ABS( p1 - p0 ) < beta &&
++ ABS( q1 - q0 ) < beta ) { */
++
++ p0 = LD32(pix - stride);
++ p1 = LD32(pix - 2*stride);
++ q0 = LD32(pix);
++ q1 = LD32(pix + stride);
++
++ /* Check which of the columns should be filtered, if any. */
++ mask = PABS_DIFF_LESS_THAN(p0, q0, alpha);
++ mask |= PABS_DIFF_LESS_THAN(p1, p0, beta);
++ mask |= PABS_DIFF_LESS_THAN(q1, q0, beta);
++
++ if ( !mask )
++ continue;
++
++ mask = SET_ALL_BITS_IN_ZERO_BYTES(mask);
++
++
++ int tc = PACKW_SH(tc0[i], tc0[i]);
++ int tc0_p = tc;
++ int tc0_m = PACKW_SH(-tc0[i], -tc0[i]);
++
++ /*
++ int i_delta;
++ if( ABS( p2 - p0 ) < beta ) {
++ pix[-2*stride] = p1 + clip( (( p2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - p1, -tc0[i], tc0[i] );
++ tc++;
++ }*/
++
++ p2 = LD32(pix - 3*stride);
++ mask2 = PABS_DIFF_LESS_THAN(p2, p0, beta) & ~mask;
++
++ if ( mask2 ){
++ mask2 = SET_ALL_BITS_IN_ZERO_BYTES(mask2);
++ asm ("pavg.ub\t%[tmp], %[p0], %[q0]\n"
++ "paddh.ub\t%[tmp], %[tmp], %[p2]\n"
++ "punpckub.h\t%[tmp2], %[tmp]:t\n"
++ "punpckub.h\t%[tmp], %[tmp]:b\n"
++ "punpckub.h\t%[tmp3], %[p1]:t\n"
++ "punpckub.h\t%[tmp4], %[p1]:b\n"
++ "psub.h\t%[tmp2], %[tmp2], %[tmp3]\n"
++ "psub.h\t%[tmp], %[tmp], %[tmp4]\n"
++ "pmin.sh\t%[tmp2], %[tmp2], %[tc0_p]\n"
++ "pmin.sh\t%[tmp], %[tmp], %[tc0_p]\n"
++ "pmax.sh\t%[tmp2], %[tmp2], %[tc0_m]\n"
++ "pmax.sh\t%[tmp], %[tmp], %[tc0_m]\n"
++ "padd.h\t%[tmp2], %[tmp2], %[tmp3]\n"
++ "padd.h\t%[tmp], %[tmp], %[tmp4]\n"
++ "packsh.ub\t%[tmp], %[tmp2], %[tmp]\n"
++ "andn\t%[tmp], %[mask2]\n"
++ "and\t%[tmp2], %[q1], %[mask2]\n"
++ "or\t%[tmp], %[tmp2]\n"
++ : [tmp]"=&r"(tmp), [tmp2]"=&r"(tmp2), [tmp3]"=&r"(tmp3),
++ [tmp4]"=&r"(tmp4)
++ : [q0]"r"(q0), [p2]"r"(p2), [p1]"r"(p1), [p0]"r"(p0), [q1]"r"(q1), [tc0_p]"r"(tc0_p),
++ [tc0_m]"r"(tc0_m), [mask2]"r"(mask2));
++ ST32(pix - 2*stride, tmp);
++ tc += 0x00010001;
++ }
++
++
++ q2 = LD32(pix + 2*stride);
++
++ /*
++ if( ABS( q2 - q0 ) < beta ) {
++ pix[ stride] = q1 + clip( (( q2 + ( ( p0 + q0 + 1 ) >> 1 ) ) >> 1) - q1, -tc0[i], tc0[i] );
++ tc++;
++ }
++ */
++ mask2 = PABS_DIFF_LESS_THAN(q2, q0, beta) & ~mask;
++
++ if ( mask2 ){
++ mask2 = SET_ALL_BITS_IN_ZERO_BYTES(mask2);
++ asm ("pavg.ub\t%[tmp], %[p0], %[q0]\n"
++ "paddh.ub\t%[tmp], %[tmp], %[q2]\n"
++ "punpckub.h\t%[tmp2], %[tmp]:t\n"
++ "punpckub.h\t%[tmp], %[tmp]:b\n"
++ "punpckub.h\t%[tmp3], %[q1]:t\n"
++ "punpckub.h\t%[tmp4], %[q1]:b\n"
++ "psub.h\t%[tmp2], %[tmp2], %[tmp3]\n"
++ "psub.h\t%[tmp], %[tmp], %[tmp4]\n"
++ "pmin.sh\t%[tmp2], %[tmp2], %[tc0_p]\n"
++ "pmin.sh\t%[tmp], %[tmp], %[tc0_p]\n"
++ "pmax.sh\t%[tmp2], %[tmp2], %[tc0_m]\n"
++ "pmax.sh\t%[tmp], %[tmp], %[tc0_m]\n"
++ "padd.h\t%[tmp2], %[tmp2], %[tmp3]\n"
++ "padd.h\t%[tmp], %[tmp], %[tmp4]\n"
++ "packsh.ub\t%[tmp], %[tmp2], %[tmp]\n"
++ "andn\t%[tmp], %[mask2]\n"
++ "and\t%[tmp2], %[q1], %[mask2]\n"
++ "or\t%[tmp], %[tmp2]\n"
++ : [tmp]"=&r"(tmp), [tmp2]"=&r"(tmp2), [tmp3]"=&r"(tmp3),
++ [tmp4]"=&r"(tmp4)
++ : [q0]"r"(q0), [q2]"r"(q2), [q1]"r"(q1), [p0]"r"(p0), [tc0_p]"r"(tc0_p),
++ [tc0_m]"r"(tc0_m), [mask2]"r"(mask2));
++ ST32(pix + stride, tmp);
++ tc += 0x00010001;
++ }
++
++ uint32_t old_p0 = p0;
++ uint32_t old_q0 = q0;
++
++ /* i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
++ pix[-stride] = clip_uint8( p0 + i_delta );
++ pix[0] = clip_uint8( q0 - i_delta ); */
++
++ asm (
++ /* Check if the two upper pixels should be filtered */
++ "lsr\t%[tmp], %[inv_mask], 16\n"
++ "breq\t0f\n"
++
++ "punpckub.h\t%[tmp], %[p1]:t\n"
++ "punpckub.h\t%[tmp2], %[q1]:t\n"
++
++ /* p1 - q1 */
++ "psub.h\t%[tmp], %[tmp], %[tmp2]\n"
++
++ "punpckub.h\t%[tmp3], %[q0]:t\n"
++ "punpckub.h\t%[tmp4], %[p0]:t\n"
++
++ /* q0 - p0 */
++ "psub.h\t%[tmp2], %[tmp3], %[tmp4]\n"
++
++ /* (q0 - p0) << 2 */
++ "plsl.h\t%[tmp2], %[tmp2], 2\n"
++
++ /* ((q0 - p0) << 2) + (p1 - q1) */
++ "padd.h\t%[tmp2], %[tmp2], %[tmp]\n"
++
++ "mov\t%[tmp], 0x00040004\n"
++ /* ((q0 - p0) << 2) + (p1 - q1) + 4*/
++ "padd.h\t%[tmp2], %[tmp2], %[tmp]\n"
++
++ /* (((q0 - p0) << 2) + (p1 - q1) + 4) >> 3*/
++ "pasr.h\t%[tmp2], %[tmp2], 3\n"
++
++ "mov\t%[tmp], 0\n"
++ "psub.h\t%[tmp], %[tmp], %[tc]\n"
++
++ /* i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); */
++ "pmin.sh\t%[tmp2], %[tmp2], %[tc]\n"
++ "pmax.sh\t%[tmp2], %[tmp2], %[tmp]\n"
++
++
++ /* pix[-stride] = clip_uint8( p0 + i_delta ); */
++ "padd.h\t%[tmp4], %[tmp4], %[tmp2]\n"
++
++
++ /* pix[0] = clip_uint8( q0 - i_delta ); */
++ "psub.h\t%[tmp3], %[tmp3], %[tmp2]\n"
++
++ /* Check if the two lower pixels should be filtered */
++ "lsl\t%[tmp2], %[inv_mask], 16\n"
++ "breq\t1f\n"
++
++ "0:\n"
++ "punpckub.h\t%[p1], %[p1]:b\n"
++ "punpckub.h\t%[q1], %[q1]:b\n"
++
++ /* p1 - q1 */
++ "psub.h\t%[p1], %[p1], %[q1]\n"
++
++ "punpckub.h\t%[q0], %[q0]:b\n"
++ "punpckub.h\t%[p0], %[p0]:b\n"
++
++ /* q0 - p0 */
++ "psub.h\t%[tmp2], %[q0], %[p0]\n"
++
++ /* (q0 - p0) << 2 */
++ "plsl.h\t%[tmp2], %[tmp2], 2\n"
++
++ /* ((q0 - p0) << 2) + (p1 - q1) */
++ "padd.h\t%[tmp2], %[tmp2], %[p1]\n"
++
++ "mov\t%[q1], 0x00040004\n"
++ /* ((q0 - p0) << 2) + (p1 - q1) + 4*/
++ "padd.h\t%[tmp2], %[tmp2], %[q1]\n"
++
++ /* (((q0 - p0) << 2) + (p1 - q1) + 4) >> 3*/
++ "pasr.h\t%[tmp2], %[tmp2], 3\n"
++
++ /* i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); */
++ "pmin.sh\t%[tmp2], %[tmp2], %[tc]\n"
++ "pmax.sh\t%[tmp2], %[tmp2], %[tmp]\n"
++
++ /* pix[-stride] = clip_uint8( p0 + i_delta ); */
++ "padd.h\t%[p0], %[p0], %[tmp2]\n"
++
++ /* pix[0] = clip_uint8( q0 - i_delta ); */
++ "psub.h\t%[q0], %[q0], %[tmp2]\n"
++
++ "1:\n"
++ "packsh.ub\t%[p0], %[tmp4], %[p0]\n"
++ "packsh.ub\t%[q0], %[tmp3], %[tmp4]\n"
++
++ : [tmp]"=&r"(tmp), [tmp2]"=&r"(tmp2), [tmp3]"=&r"(tmp3),
++ [tmp4]"=&r"(tmp4), [q0]"=&r"(q0), [q1]"=&r"(q1), [p0]"=&r"(p0), [p1]"=&r"(p1)
++ : [tc]"r"(tc), [inv_mask]"r"(~mask));
++
++ ST32(pix - stride, (mask & old_p0) | (p0 & ~mask));
++ ST32(pix, (mask & old_q0) | (q0 & ~mask));
++
++ }
++ pix += 1;
++}
++
++
++
++
++#ifdef CHECK_DSP_FUNCS_AGAINST_C
++
++void dump_block8(uint8_t *block, int line_size, int h){
++ int i, j;
++
++ for ( i = 0; i < h ; i++ ){
++ av_log(NULL, AV_LOG_ERROR, "\t");
++ for ( j = 0; j < 8 ; j++ ){
++ av_log(NULL, AV_LOG_ERROR, "%d ", block[j + i*line_size]);
++ }
++ av_log(NULL, AV_LOG_ERROR, "\n");
++ }
++}
++
++void dump_block4(uint8_t *block, int line_size, int h){
++ int i, j;
++
++ for ( i = 0; i < h ; i++ ){
++ av_log(NULL, AV_LOG_ERROR, "\t");
++ for ( j = 0; j < 4 ; j++ ){
++ av_log(NULL, AV_LOG_ERROR, "%d ", block[j + i*line_size]);
++ }
++ av_log(NULL, AV_LOG_ERROR, "\n");
++ }
++}
++
++void dump_block(uint8_t *block, int line_size, int h, int w){
++ int i, j;
++
++ for ( i = 0; i < h ; i++ ){
++ av_log(NULL, AV_LOG_ERROR, "\t");
++ for ( j = 0; j < w ; j++ ){
++ av_log(NULL, AV_LOG_ERROR, "%d ", block[j + i*line_size]);
++ }
++ av_log(NULL, AV_LOG_ERROR, "\n");
++ }
++}
++
++void check_block8(uint8_t *test, uint8_t *correct, int line_size_test, int line_size_correct,
++ int h, char *name, int max_dev){
++ int i,j;
++ for ( i = 0; i < 8 ; i++ ){
++ for ( j = 0; j < h ; j++ ){
++ int diff = test[i + line_size_test*j] - correct[i + line_size_correct*j];
++ diff = diff < 0 ? -diff : diff;
++ if ( diff > max_dev ){
++ av_log(NULL, AV_LOG_ERROR, "Error pixel x=%i, y=%i differs. Is 0x%x should be 0x%x\n",
++ i, j, test[i + line_size_test*j], correct[i + j*line_size_correct]);
++ av_log(NULL, AV_LOG_ERROR, "Error resulting block from %s is:\n", name);
++ dump_block8(test, line_size_test, h);
++ av_log(NULL, AV_LOG_ERROR, "But should be equal to:\n");
++ dump_block8(correct, line_size_correct, h);
++ exit(1);
++ }
++ }
++ }
++}
++
++void check_block4(uint8_t *test, uint8_t *correct, int line_size_test, int line_size_correct,
++ int h, char *name, int max_dev){
++ int i,j;
++ for ( i = 0; i < 4 ; i++ ){
++ for ( j = 0; j < h ; j++ ){
++ int diff = test[i + line_size_test*j] - correct[i + line_size_correct*j];
++ diff = diff < 0 ? -diff : diff;
++ if ( diff > max_dev ){
++ av_log(NULL, AV_LOG_ERROR, "Error pixel x=%i, y=%i differs. Is 0x%x should be 0x%x\n",
++ i, j, test[i + line_size_test*j], correct[i + j*line_size_correct]);
++ av_log(NULL, AV_LOG_ERROR, "Error resulting block from %s is:\n", name);
++ dump_block8(test, line_size_test, h);
++ av_log(NULL, AV_LOG_ERROR, "But should be equal to:\n");
++ dump_block4(correct, line_size_correct, h);
++ exit(1);
++ }
++ }
++ }
++}
++
++void check_block(uint8_t *test, uint8_t *correct, int line_size_test, int line_size_correct,
++ int h, int width, char *name, int max_dev){
++ int i,j;
++ for ( i = 0; i < width ; i++ ){
++ for ( j = 0; j < h ; j++ ){
++ int diff = test[i + line_size_test*j] - correct[i + line_size_correct*j];
++ diff = diff < 0 ? -diff : diff;
++ if ( diff > max_dev ){
++ av_log(NULL, AV_LOG_ERROR, "Error pixel x=%i, y=%i differs. Is 0x%x should be 0x%x\n",
++ i, j, test[i + line_size_test*j], correct[i + j*line_size_correct]);
++ av_log(NULL, AV_LOG_ERROR, "Error resulting block from %s is:\n", name);
++ dump_block(test, line_size_test, h, width);
++ av_log(NULL, AV_LOG_ERROR, "But should be equal to:\n");
++ dump_block(correct, line_size_correct, h, width);
++ exit(1);
++ }
++ }
++ }
++}
++
++void dump_dct_block(DCTELEM *block){
++ int i, j;
++
++ for ( i = 0; i < 8 ; i++ ){
++ av_log(NULL, AV_LOG_ERROR, "\t");
++ for ( j = 0; j < 8 ; j++ ){
++ av_log(NULL, AV_LOG_ERROR, "0x%x ", block[j + i*8]);
++ }
++ av_log(NULL, AV_LOG_ERROR, "\n");
++ }
++}
++
++void test_idct_avr32(DCTELEM *block){
++ DCTELEM testBlock[64];
++ int i, j;
++
++ /* Copy transposed block to testBlock */
++ for ( i = 0; i < 8 ; i++ ){
++ for ( j = 0; j < 8 ; j++ ){
++ testBlock[i + 8*j] = block[j + i*8];
++ }
++ }
++
++ idct_avr32(block);
++ simple_idct(&testBlock);
++
++ for ( i = 0; i < 64 ; i++ ){
++ if ( block[i] != testBlock[i] ){
++ av_log(NULL, AV_LOG_ERROR, "Error resulting block from idct is:\n");
++ dump_dct_block(block);
++ av_log(NULL, AV_LOG_ERROR, "But should be equal to the transposed of:\n");
++ dump_dct_block(testBlock);
++ exit(1);
++ }
++ }
++}
++
++void test_idct_put_avr32(uint8_t *dest, int line_size, DCTELEM *block){
++ uint8_t testBlock[64];
++ DCTELEM blockCopy[64];
++ int i, j;
++
++ /* Copy transposed block to blockCopy */
++ for ( i = 0; i < 8 ; i++ ){
++ for ( j = 0; j < 8 ; j++ ){
++ blockCopy[i + 8*j] = block[j + i*8];
++ }
++ }
++
++ idct_put_avr32(dest, line_size, block);
++ simple_idct_put(&testBlock, 8, blockCopy);
++
++ check_block8(dest, testBlock, line_size, 8, 8, "idct_put", 1);
++}
++
++
++void test_idct_add_avr32(uint8_t *dest, int line_size, DCTELEM *block){
++ uint8_t testBlock[64];
++ DCTELEM blockCopy[64];
++ int i, j;
++
++ /* Copy dest to testBlock */
++ for ( i = 0; i < 8 ; i++ ){
++ for ( j = 0; j < 8 ; j++ ){
++ testBlock[i + 8*j] = dest[i + j*line_size];
++ }
++ }
++
++ /* Copy transposed block to blockCopy */
++ for ( i = 0; i < 8 ; i++ ){
++ for ( j = 0; j < 8 ; j++ ){
++ blockCopy[i + 8*j] = block[j + i*8];
++ }
++ }
++
++ idct_add_avr32(dest, line_size, block);
++ simple_idct_add(&testBlock, 8, blockCopy);
++
++ check_block8(dest, testBlock, line_size, 8, 8, "idct_add", 1);
++}
++
++void test_h264_idct_add_avr32(uint8_t *dest, DCTELEM *block, int stride){
++ uint8_t testBlock[16];
++ DCTELEM blockCopy[16];
++ int i, j;
++
++ /* Copy dest to testBlock */
++ for ( i = 0; i < 4 ; i++ ){
++ for ( j = 0; j < 4 ; j++ ){
++ testBlock[i + 4*j] = dest[i + j*stride];
++ }
++ }
++
++ /* Copy transposed block to blockCopy */
++ for ( i = 0; i < 16 ; i++ ){
++ blockCopy[i] = block[i];
++ }
++
++ ff_h264_idct_add_c(dest, block, stride);
++
++ h264_idct_add_avr32(testBlock, blockCopy, 4);
++
++ check_block(dest, testBlock, stride, 4, 4, 4, "h264_idct_add", 0);
++}
++
++void test_h264_idct8_add_avr32(uint8_t *dest, DCTELEM *block, int stride){
++ uint8_t testBlock[8*8];
++ DCTELEM blockCopy[8*8];
++ int i, j;
++
++ /* Copy dest to testBlock */
++ for ( i = 0; i < 8 ; i++ ){
++ for ( j = 0; j < 8 ; j++ ){
++ testBlock[i + 8*j] = dest[i + j*stride];
++ }
++ }
++
++ /* Copy source block to blockCopy */
++ for ( i = 0; i < 8*8 ; i++ ){
++ blockCopy[i] = block[i];
++ }
++
++ ff_h264_idct8_add_c(dest, block, stride);
++ h264_idct8_add_avr32(testBlock, blockCopy, 8);
++
++ check_block(dest, testBlock, stride, 8, 8, 8, "h264_idct8_add", 0);
++}
++
++void test_put_pixels_funcs8(op_pixels_func test, op_pixels_func correct, uint8_t *block,
++ const uint8_t *pixels, int line_size, int h, char *name, int in_h_size, int in_v_size){
++ uint8_t *testBlock, *testBlock2;
++ int i, j;
++ int input_v_size = h + in_v_size;
++ int input_h_size = 8 + in_h_size;
++
++ testBlock = alloca(input_h_size*input_v_size);
++ testBlock2 = alloca(input_h_size*input_v_size);
++
++ for ( i = 0; i < input_h_size ; i++ ){
++ for ( j = 0; j < input_v_size ; j++ ){
++ testBlock[i + input_h_size*j] = pixels[i + j*line_size];
++ }
++ }
++
++ test(block, pixels, line_size, h);
++ correct(testBlock2, testBlock, input_h_size, h);
++
++ check_block8(block, testBlock2, line_size, input_h_size, h, name, 0);
++
++}
++
++void test_h264_chroma_mc_funcs(h264_chroma_mc_func test, h264_chroma_mc_func correct, uint8_t *dst,
++ uint8_t *src, int stride, int h, int w, int x, int y, char *name){
++ uint8_t *testBlock, *testBlock2;
++ int i, j;
++ int input_v_size = h + 1;
++ int input_h_size = ((w + 1) + 3) & ~3;
++
++ testBlock = alloca(input_h_size*input_v_size);
++ testBlock2 = alloca(input_h_size*input_v_size);
++
++ for ( i = 0; i < w + 1 ; i++ ){
++ for ( j = 0; j < h + 1 ; j++ ){
++ testBlock[i + input_h_size*j] = src[i + j*stride];
++ }
++ }
++
++ for ( i = 0; i < w ; i++ ){
++ for ( j = 0; j < h ; j++ ){
++ testBlock2[i + input_h_size*j] = dst[i + j*stride];
++ }
++ }
++
++ test(dst, src, stride, h, x, y);
++ correct(testBlock2, testBlock, input_h_size, h, x, y);
++
++ check_block(dst, testBlock2, stride, input_h_size, h, w, name, 0);
++
++}
++
++void test_qpel_mc_funcs(qpel_mc_func test, qpel_mc_func correct, uint8_t *dst,
++ uint8_t *src, int stride, int size, char *name){
++ uint8_t *testBlock, *testBlock2;
++ int i, j;
++ int test_stride = size + 8;
++
++ testBlock = alloca(test_stride*(size+8)) + 4 + test_stride*4;
++ testBlock2 = alloca(test_stride*size);
++
++ for ( i = -4; i < size+4 ; i++ ){
++ for ( j = -4; j < size+4 ; j++ ){
++ testBlock[i + test_stride*j] = src[i + j*stride];
++ }
++ }
++
++ for ( i = 0; i < size ; i++ ){
++ for ( j = 0; j < size ; j++ ){
++ testBlock2[i + test_stride*j] = dst[i + j*stride];
++ }
++ }
++
++ correct(dst, src, stride);
++ test(testBlock2, testBlock, test_stride);
++
++ check_block(testBlock2, dst, test_stride, stride, size, size, name, 0);
++
++}
++
++
++#define test_pixels_funcs(PFX, NUM ) \
++void test_ ## PFX ## _pixels ## NUM ## _avr32( uint8_t *block, const uint8_t *pixels, int line_size, int h){ \
++ test_put_pixels_funcs8(PFX ## _pixels ## NUM ## _avr32, PFX ## _pixels ## NUM ## _c, \
++ block, pixels, line_size, h, "test_" #PFX "_pixels", 0, 0); } \
++void test_ ## PFX ## _pixels ## NUM ## _h_avr32( uint8_t *block, const uint8_t *pixels, int line_size, int h){ \
++ test_put_pixels_funcs8(PFX ## _pixels ## NUM ## _h_avr32, PFX ## _pixels ## NUM ## _x2_c, \
++ block, pixels, line_size, h, "test_" #PFX "_pixels_h", 1, 0); } \
++void test_ ## PFX ## _pixels ## NUM ## _v_avr32( uint8_t *block, const uint8_t *pixels, int line_size, int h){ \
++ test_put_pixels_funcs8(PFX ## _pixels ## NUM ## _v_avr32, PFX ## _pixels ## NUM ## _y2_c, \
++ block, pixels, line_size, h, "test_" #PFX "_pixels_v", 0, 1); } \
++void test_ ## PFX ## _pixels ## NUM ## _hv_avr32( uint8_t *block, const uint8_t *pixels, int line_size, int h){ \
++ test_put_pixels_funcs8(PFX ## _pixels ## NUM ## _hv_avr32, PFX ## _pixels ## NUM ## _xy2_c, \
++ block, pixels, line_size, h, "test_" #PFX "_pixels_hv", 1, 1); }
++
++test_pixels_funcs(put, 8);
++test_pixels_funcs(put_no_rnd, 8);
++test_pixels_funcs(put, 16);
++test_pixels_funcs(put_no_rnd, 16);
++
++test_pixels_funcs(avg, 8);
++test_pixels_funcs(avg_no_rnd, 8);
++test_pixels_funcs(avg, 16);
++test_pixels_funcs(avg_no_rnd, 16);
++
++#define test_h264_chroma_mc_funcs(PFX, NUM ) \
++void test_ ## PFX ## _h264_chroma_mc ## NUM ## _pico( uint8_t *dst, uint8_t *src, int stride, int h, int x, int y){ \
++ test_h264_chroma_mc_funcs(PFX ## _h264_chroma_mc ## NUM ## _pico, PFX ## _h264_chroma_mc ## NUM ## _c, \
++ dst, src, stride, h, NUM, x, y, "test_" #PFX "_h264_chroma_mc" #NUM "_pico"); } \
++
++test_h264_chroma_mc_funcs(put, 2);
++test_h264_chroma_mc_funcs(put, 4);
++test_h264_chroma_mc_funcs(put, 8);
++test_h264_chroma_mc_funcs(avg, 2);
++test_h264_chroma_mc_funcs(avg, 4);
++test_h264_chroma_mc_funcs(avg, 8);
++
++#define test_qpel_mc_funcs_type(PFX, NUM, TYPE ) \
++void test_ ## PFX ## NUM ## _ ## TYPE ## _pico( uint8_t *dst, uint8_t *src, int stride){ \
++ test_qpel_mc_funcs(PFX ## NUM ## _ ## TYPE ## _pico, PFX ## NUM ## _ ## TYPE ## _c, \
++ dst, src, stride, NUM, "test_" #PFX #NUM "_" #TYPE "_pico"); }
++
++#define test_qpel_mc_funcs(PFX, NUM) \
++ test_qpel_mc_funcs_type(PFX, NUM, mc00);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc10);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc20);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc30);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc01);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc11);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc21);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc31);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc02);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc12);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc22);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc32);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc03);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc13);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc23);\
++ test_qpel_mc_funcs_type(PFX, NUM, mc33)
++
++test_qpel_mc_funcs(put_h264_qpel, 4);
++test_qpel_mc_funcs(put_h264_qpel, 8);
++test_qpel_mc_funcs(put_h264_qpel, 16);
++test_qpel_mc_funcs(avg_h264_qpel, 4);
++test_qpel_mc_funcs(avg_h264_qpel, 8);
++test_qpel_mc_funcs(avg_h264_qpel, 16);
++
++
++#define dspfunc(PFX, IDX, NUM) \
++ c->PFX ## _pixels_tab[IDX][ 0] = DSP_FUNC_NAME( PFX ## NUM ## _mc00_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 1] = DSP_FUNC_NAME( PFX ## NUM ## _mc10_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 2] = DSP_FUNC_NAME( PFX ## NUM ## _mc20_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 3] = DSP_FUNC_NAME( PFX ## NUM ## _mc30_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 4] = DSP_FUNC_NAME( PFX ## NUM ## _mc01_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 5] = DSP_FUNC_NAME( PFX ## NUM ## _mc11_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 6] = DSP_FUNC_NAME( PFX ## NUM ## _mc21_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 7] = DSP_FUNC_NAME( PFX ## NUM ## _mc31_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 8] = DSP_FUNC_NAME( PFX ## NUM ## _mc02_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 9] = DSP_FUNC_NAME( PFX ## NUM ## _mc12_pico ); \
++ c->PFX ## _pixels_tab[IDX][10] = DSP_FUNC_NAME( PFX ## NUM ## _mc22_pico ); \
++ c->PFX ## _pixels_tab[IDX][11] = DSP_FUNC_NAME( PFX ## NUM ## _mc32_pico ); \
++ c->PFX ## _pixels_tab[IDX][12] = DSP_FUNC_NAME( PFX ## NUM ## _mc03_pico ); \
++ c->PFX ## _pixels_tab[IDX][13] = DSP_FUNC_NAME( PFX ## NUM ## _mc13_pico ); \
++ c->PFX ## _pixels_tab[IDX][14] = DSP_FUNC_NAME( PFX ## NUM ## _mc23_pico ); \
++ c->PFX ## _pixels_tab[IDX][15] = DSP_FUNC_NAME( PFX ## NUM ## _mc33_pico )
++
++#endif
++
++void dsputil_init_avr32(DSPContext* c, AVCodecContext *avctx)
++{
++
++ /* H264 */
++
++ if ( 0 /*avr32_use_pico*/ ){
++ c->put_h264_chroma_pixels_tab[0]= DSP_FUNC_NAME(put_h264_chroma_mc8_pico);
++ c->put_h264_chroma_pixels_tab[1]= DSP_FUNC_NAME(put_h264_chroma_mc4_pico);
++ c->put_h264_chroma_pixels_tab[2]= DSP_FUNC_NAME(put_h264_chroma_mc2_pico);
++
++ c->avg_h264_chroma_pixels_tab[0]= DSP_FUNC_NAME(avg_h264_chroma_mc8_pico);
++ c->avg_h264_chroma_pixels_tab[1]= DSP_FUNC_NAME(avg_h264_chroma_mc4_pico);
++ c->avg_h264_chroma_pixels_tab[2]= DSP_FUNC_NAME(avg_h264_chroma_mc2_pico);
++ }
++
++#define dspfunc(PFX, IDX, NUM) \
++ c->PFX ## _pixels_tab[IDX][ 0] = DSP_FUNC_NAME( PFX ## NUM ## _mc00_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 1] = DSP_FUNC_NAME( PFX ## NUM ## _mc10_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 2] = DSP_FUNC_NAME( PFX ## NUM ## _mc20_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 3] = DSP_FUNC_NAME( PFX ## NUM ## _mc30_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 4] = DSP_FUNC_NAME( PFX ## NUM ## _mc01_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 5] = DSP_FUNC_NAME( PFX ## NUM ## _mc11_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 6] = DSP_FUNC_NAME( PFX ## NUM ## _mc21_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 7] = DSP_FUNC_NAME( PFX ## NUM ## _mc31_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 8] = DSP_FUNC_NAME( PFX ## NUM ## _mc02_pico ); \
++ c->PFX ## _pixels_tab[IDX][ 9] = DSP_FUNC_NAME( PFX ## NUM ## _mc12_pico ); \
++ c->PFX ## _pixels_tab[IDX][10] = DSP_FUNC_NAME( PFX ## NUM ## _mc22_pico ); \
++ c->PFX ## _pixels_tab[IDX][11] = DSP_FUNC_NAME( PFX ## NUM ## _mc32_pico ); \
++ c->PFX ## _pixels_tab[IDX][12] = DSP_FUNC_NAME( PFX ## NUM ## _mc03_pico ); \
++ c->PFX ## _pixels_tab[IDX][13] = DSP_FUNC_NAME( PFX ## NUM ## _mc13_pico ); \
++ c->PFX ## _pixels_tab[IDX][14] = DSP_FUNC_NAME( PFX ## NUM ## _mc23_pico ); \
++ c->PFX ## _pixels_tab[IDX][15] = DSP_FUNC_NAME( PFX ## NUM ## _mc33_pico )
++
++ if ( avr32_use_pico ){
++ dspfunc(put_h264_qpel, 0, 16);
++ dspfunc(put_h264_qpel, 1, 8);
++ dspfunc(put_h264_qpel, 2, 4);
++ dspfunc(avg_h264_qpel, 0, 16);
++ dspfunc(avg_h264_qpel, 1, 8);
++ dspfunc(avg_h264_qpel, 2, 4);
++ }
++
++ c->idct_put= DSP_FUNC_NAME(idct_put_avr32);
++ c->idct_add= DSP_FUNC_NAME(idct_add_avr32);
++ c->idct = DSP_FUNC_NAME(idct_avr32);
++ c->h264_idct_add = DSP_FUNC_NAME(h264_idct_add_avr32);
++ c->h264_idct8_add = DSP_FUNC_NAME(h264_idct8_add_avr32);
++
++ /*c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_avr32;*/
++
++ c->idct_permutation_type= FF_TRANSPOSE_IDCT_PERM;
++
++ c->fdct = fdct_avr32;
++
++ c->clear_blocks = clear_blocks_avr32;
++
++#undef dspfunc
++#define dspfunc(PFX, IDX, NUM) \
++ c->PFX ## _pixels_tab[IDX][0] = DSP_FUNC_NAME( PFX ## _pixels ## NUM ## _avr32 ); \
++ c->PFX ## _pixels_tab[IDX][1] = DSP_FUNC_NAME( PFX ## _pixels ## NUM ## _h_avr32); \
++ c->PFX ## _pixels_tab[IDX][2] = DSP_FUNC_NAME( PFX ## _pixels ## NUM ## _v_avr32); \
++ c->PFX ## _pixels_tab[IDX][3] = DSP_FUNC_NAME( PFX ## _pixels ## NUM ## _hv_avr32)
++
++ dspfunc(put, 0, 16);
++ dspfunc(put_no_rnd, 0, 16);
++ dspfunc(put, 1, 8);
++ dspfunc(put_no_rnd, 1, 8);
++
++ dspfunc(avg, 1, 8);
++ dspfunc(avg_no_rnd, 1, 8);
++ dspfunc(avg, 0, 16);
++ dspfunc(avg_no_rnd, 0, 16);
++#undef dspfunc
++
++}
++
++
++
++#if 0
++int main(int argc, char *argv[]){
++
++
++}
++#endif
++
+diff --git a/libavcodec/avr32/fdct.S b/libavcodec/avr32/fdct.S
+new file mode 100644
+index 0000000..be45b86
+--- /dev/null
++++ b/libavcodec/avr32/fdct.S
+@@ -0,0 +1,541 @@
++/*
++ * Copyright (c) 2007 Atmel Corporation. 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 ATMEL may not be used to endorse or promote products
++ * derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL
++ * 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.
++ */
++
++//**********************************************************
++//* 2-D fDCT, Based on: *
++//* C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical *
++//* Fast 1-D DCT Algorithms with 11 Multiplications", *
++//* Proc. Int'l. Conf. on Acoustics, Speech, and Signal *
++//* Processing 1989 (ICASSP '89), pp. 988-991. *
++//* *
++//* Fixed point implementation optimized for the AVR-II *
++//* instruction set. If a table is used for the *
++//* coeffisients we can load two and two of them from *
++//* This will give a reduction of
++//* *
++//* *
++//**********************************************************
++
++
++/* This routine is a slow-but-accurate integer implementation of the
++ * forward DCT (Discrete Cosine Transform). Taken from the IJG software
++ *
++ * A 2-D DCT can be done by 1-D DCT on each row followed by 1-D DCT
++ * on each column. Direct algorithms are also available, but they are
++ * much more complex and seem not to be any faster when reduced to code.
++ *
++ * This implementation is based on an algorithm described in
++ * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT
++ * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics,
++ * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991.
++ * The primary algorithm described there uses 11 multiplies and 29 adds.
++ * We use their alternate method with 12 multiplies and 32 adds.
++ * The advantage of this method is that no data path contains more than one
++ * multiplication; this allows a very simple and accurate implementation in
++ * scaled fixed-point arithmetic, with a minimal number of shifts.
++ *
++ * The poop on this scaling stuff is as follows:
++ *
++ * Each 1-D DCT step produces outputs which are a factor of sqrt(N)
++ * larger than the true DCT outputs. The final outputs are therefore
++ * a factor of N larger than desired; since N=8 this can be cured by
++ * a simple right shift at the end of the algorithm. The advantage of
++ * this arrangement is that we save two multiplications per 1-D DCT,
++ * because the y0 and y4 outputs need not be divided by sqrt(N).
++ * In the IJG code, this factor of 8 is removed by the quantization step
++ * (in jcdctmgr.c), here it is removed.
++ *
++ * We have to do addition and subtraction of the integer inputs, which
++ * is no problem, and multiplication by fractional constants, which is
++ * a problem to do in integer arithmetic. We multiply all the constants
++ * by CONST_SCALE and convert them to integer constants (thus retaining
++ * CONST_BITS bits of precision in the constants). After doing a
++ * multiplication we have to divide the product by CONST_SCALE, with proper
++ * rounding, to produce the correct output. This division can be done
++ * cheaply as a right shift of CONST_BITS bits. We postpone shifting
++ * as long as possible so that partial sums can be added together with
++ * full fractional precision.
++ *
++ * The outputs of the first pass are scaled up by PASS1_BITS bits so that
++ * they are represented to better-than-integral precision. These outputs
++ * require 8 + PASS1_BITS + 3 bits; this fits in a 16-bit word
++ * with the recommended scaling. (For 12-bit sample data, the intermediate
++ * array is INT32 anyway.)
++ *
++ * To avoid overflow of the 32-bit intermediate results in pass 2, we must
++ * have 8 + CONST_BITS + PASS1_BITS <= 26. Error analysis
++ * shows that the values given below are the most effective.
++ *
++ * We can gain a little more speed, with a further compromise in accuracy,
++ * by omitting the addition in a descaling shift. This yields an incorrectly
++ * rounded result half the time...
++ */
++
++ .global fdct_avr32
++
++
++
++#define CONST_BITS 13
++#define PASS1_BITS 2
++
++#define FIX_0_298631336 2446 /* FIX(0.298631336) */
++#define FIX_0_390180644 3196 /* FIX(0.390180644) */
++#define FIX_0_541196100 4433 /* FIX(0.541196100) */
++#define FIX_0_765366865 6270 /* FIX(0.765366865) */
++#define FIX_0_899976223 7373 /* FIX(0.899976223) */
++#define FIX_1_175875602 9633 /* FIX(1.175875602) */
++#define FIX_1_501321110 12299 /* FIX(1.501321110) */
++#define FIX_1_847759065 15137 /* FIX(1.847759065) */
++#define FIX_1_961570560 16069 /* FIX(1.961570560) */
++#define FIX_2_053119869 16819 /* FIX(2.053119869) */
++#define FIX_2_562915447 20995 /* FIX(2.562915447) */
++#define FIX_3_072711026 25172 /* FIX(3.072711026) */
++
++
++/*
++ * Perform an integer forward DCT on one block of samples.
++ */
++
++//void
++//fdct_int32(short *const block)
++//{
++// int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
++// int tmp10, tmp11, tmp12, tmp13;
++// int z1, z2, z3, z4, z5;
++// short *blkptr;
++// int *dataptr;
++// int data[64];
++// int i;
++//
++// /* Pass 1: process rows. */
++// /* Note results are scaled up by sqrt(8) compared to a true DCT; */
++// /* furthermore, we scale the results by 2**PASS1_BITS. */
++//
++// dataptr = data;
++// blkptr = block;
++
++ .text
++fdct_avr32:
++ pushm r0-r3, r4-r7, lr
++#define loop_ctr r0
++#define blkptr r12
++#define x0 r1
++#define x1 r2
++#define x2 r3
++#define x3 r4
++#define x4 r5
++#define x5 r6
++#define x6 r7
++#define x7 r8
++#define tmp0 r5
++#define tmp7 r2
++#define tmp1 r3
++#define tmp6 r4
++#define tmp2 r9
++#define tmp5 r8
++#define tmp3 r7
++#define tmp4 r6
++
++
++ mov loop_ctr, 8
++// for (i = 0; i < 8; i++) {
++ROW_LOOP:
++
++ ldm blkptr, r1, r2, r3, r4
++
++// tmp2 = blkptr[2] + blkptr[5];
++// tmp3 = blkptr[3] + blkptr[4];
++ paddx.h r5, r3, r2
++// tmp5 = blkptr[2] - blkptr[5];
++// tmp4 = blkptr[3] - blkptr[4];
++ psubx.h r6, r3, r2
++// tmp0 = blkptr[0] + blkptr[7];
++// tmp1 = blkptr[1] + blkptr[6];
++ paddx.h r2, r4, r1
++// tmp7 = blkptr[0] - blkptr[7];
++// tmp6 = blkptr[1] - blkptr[6];
++ psubx.h r3, r4, r1
++
++// /* Even part per LL&M figure 1 --- note that published figure is faulty;
++// * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
++// */
++
++#define tmp10 r1
++#define tmp13 r5
++#define tmp11 r7
++#define tmp12 r3
++#define z1 r9
++
++// tmp10 = tmp0 + tmp3;
++// tmp13 = tmp0 - tmp3;
++ paddsub.h r1, r2:t, r5:b
++// tmp11 = tmp1 + tmp2;
++// tmp12 = tmp1 - tmp2;
++ paddsub.h r4, r2:b, r5:t
++
++
++// dataptr[0] = (tmp10 + tmp11) << PASS1_BITS;
++// dataptr[4] = (tmp10 - tmp11) << PASS1_BITS;
++ paddsub.h r7, r1:t, r4:t
++ ld.w r10, pc[const_table - .]
++ plsl.h r7, r7, PASS1_BITS
++
++// z1 = (tmp12 + tmp13) * FIX_0_541196100;
++ addhh.w r8, r4:b, r1:b
++ mulhh.w r8, r8:b, r10:t
++
++// dataptr[2] =
++// DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS - PASS1_BITS);
++// dataptr[6] =
++// DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS - PASS1_BITS);
++ mulhh.w r9, r1:b, r10:b
++ ld.w r10, pc[const_table - . + 4]
++ add r1, r8, r9
++ satrnds r1 >> (CONST_BITS - PASS1_BITS), 31
++
++ mulhh.w r9, r4:b, r10:t
++ add r4, r8, r9
++ satrnds r4 >> (CONST_BITS - PASS1_BITS), 31
++
++
++// /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
++// * cK represents cos(K*pi/16).
++// * i0..i3 in the paper are tmp4..tmp7 here.
++// */
++
++#define z2 r5
++#define z3 r6
++#define z4 r7
++#define z5 r8
++
++// z4 = tmp5 + tmp7;
++// z3 = tmp4 + tmp6;
++ padd.h r2, r6, r3
++// z2 = tmp5 + tmp6;
++// z1 = tmp4 + tmp7;
++ paddx.h r5, r6, r3
++
++ lddpc r9, pc[const_table - . + 8]
++// z5 = (z3 + z4) * FIX_1_175875602; /* sqrt(2) * c3 */
++ addhh.w r8, r2:t, r2:b
++ mulhh.w r8, r8:b, r10:b
++ lddpc r10, pc[const_table - . + 12]
++
++
++// tmp4 *= FIX_0_298631336; /* sqrt(2) * (-c1+c3+c5-c7) */
++ mulhh.w r11, r6:b, r9:t
++
++// tmp5 *= FIX_2_053119869; /* sqrt(2) * ( c1+c3-c5+c7) */
++ mulhh.w r6, r6:t, r9:b
++
++// tmp6 *= FIX_3_072711026; /* sqrt(2) * ( c1+c3+c5-c7) */
++ lddpc r9, pc[const_table - . + 20]
++ mulhh.w lr, r3:b, r10:t
++
++// tmp7 *= FIX_1_501321110; /* sqrt(2) * ( c1+c3-c5-c7) */
++ mulhh.w r3, r3:t, r10:b
++
++// z3 *= -FIX_1_961570560; /* sqrt(2) * (-c3-c5) */
++ mulhh.w r10, r2:b, r9:t
++
++// z4 *= -FIX_0_390180644; /* sqrt(2) * (c5-c3) */
++ mulhh.w r2, r2:t, r9:b
++ lddpc r9, pc[const_table - . + 16]
++// z3 += z5;
++// z4 += z5;
++ add r10, r8
++ add r2, r8
++
++// z1 *= -FIX_0_899976223; /* sqrt(2) * (c7-c3) */
++ mulhh.w r8, r5:b, r9:t
++
++// z2 *= -FIX_2_562915447; /* sqrt(2) * (-c1-c3) */
++ mulhh.w r5, r5:t, r9:b
++
++// dataptr[7] = DESCALE(tmp4 + z1 + z3, CONST_BITS - PASS1_BITS);
++ add r11, r8
++ add r11, r10
++ satrnds r11 >> (CONST_BITS - PASS1_BITS), 31
++
++// dataptr[5] = DESCALE(tmp5 + z2 + z4, CONST_BITS - PASS1_BITS);
++ add r6, r5
++
++ sthh.w blkptr[6*2], r4:b, r11:b
++ add r6, r2
++ satrnds r6 >> (CONST_BITS - PASS1_BITS), 31
++
++// dataptr[3] = DESCALE(tmp6 + z2 + z3, CONST_BITS - PASS1_BITS);
++ add lr, r5
++ sthh.w blkptr[4*2], r7:b, r6:b
++ add lr, r10
++ satrnds lr >> (CONST_BITS - PASS1_BITS), 31
++
++// dataptr[1] = DESCALE(tmp7 + z1 + z4, CONST_BITS - PASS1_BITS);
++ add r3, r8
++ sthh.w blkptr[2*2], r1:b, lr:b
++ add r3, r2
++ satrnds r3 >> (CONST_BITS - PASS1_BITS), 31
++
++
++
++// dataptr += 8; /* advance pointer to next row */
++// blkptr += 8;
++ sthh.w blkptr[0], r7:t, r3:b
++ sub blkptr, -16
++ sub loop_ctr, 1
++ brne ROW_LOOP
++
++// }
++
++ /* Pass 2: process columns.
++ * We remove the PASS1_BITS scaling, but leave the results scaled up
++ * by an overall factor of 8.
++ */
++
++// dataptr = data;
++ sub blkptr, 128
++
++ mov loop_ctr, 4
++// for (i = 0; i < 8; i++) {
++COLOUMN_LOOP:
++ ld.w r1, blkptr[0]
++ ld.w r2, blkptr[1*8*2]
++ ld.w r3, blkptr[2*8*2]
++ ld.w r4, blkptr[3*8*2]
++ ld.w r5, blkptr[4*8*2]
++ ld.w r6, blkptr[5*8*2]
++ ld.w r7, blkptr[6*8*2]
++ ld.w r8, blkptr[7*8*2]
++
++// tmp0 = blkptr[0] + blkptr[7*8];
++ padds.sh r9, r1, r8
++// tmp7 = blkptr[0] - blkptr[7*8];
++ psubs.sh r1, r1, r8
++// tmp1 = blkptr[1*8] + blkptr[6*8];
++ padds.sh r8, r2, r7
++// tmp6 = blkptr[1*8] - blkptr[6*8];
++ psubs.sh r2, r2, r7
++// tmp2 = blkptr[2*8] + blkptr[5*8];
++ padds.sh r7, r3, r6
++// tmp5 = blkptr[2*8] - blkptr[5*8];
++ psubs.sh r3, r3, r6
++// tmp3 = blkptr[3*8] + blkptr[4*8];
++ padds.sh r6, r4, r5
++// tmp4 = blkptr[3*8] - blkptr[4*8];
++ psubs.sh r4, r4, r5
++
++// /* even part per ll&m figure 1 --- note that published figure is faulty;
++// * rotator "sqrt(2)*c1" should be "sqrt(2)*c6".
++// */
++//
++// tmp10 = tmp0 + tmp3;
++ padds.sh r5, r9, r6
++// tmp13 = tmp0 - tmp3;
++ psubs.sh r9, r9, r6
++// tmp11 = tmp1 + tmp2;
++ padds.sh r6, r8, r7
++// tmp12 = tmp1 - tmp2;
++ psubs.sh r8, r8, r7
++
++// dataptr[0] = DESCALE(tmp10 + tmp11, PASS1_BITS);
++// dataptr[32] = DESCALE(tmp10 - tmp11, PASS1_BITS);
++//Might get an overflow here
++ padds.sh r7, r5, r6
++ psubs.sh r5, r5, r6
++
++ //Rounding
++ mov lr, (1 << (PASS1_BITS + 2))
++ orh lr, hi(1 << (16 + PASS1_BITS + 2))
++ padds.sh r7, r7, lr
++ padds.sh r5, r5, lr
++
++ pasr.h r7, r7, PASS1_BITS + 3
++ pasr.h r5, r5, PASS1_BITS + 3
++ st.w r12[0], r7
++ st.w r12[4*8*2], r5
++
++ lddpc r10, const_table2
++
++
++// z1 = (tmp12 + tmp13) * FIX_0_541196100;
++ padds.sh r5, r8, r9
++ mulhh.w r6, r5:t, r10:t
++ mulhh.w r7, r5:b, r10:t
++
++// dataptr[16] =
++// DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS + PASS1_BITS);
++ lddpc r11, const_table2 + 4
++ mulhh.w lr, r9:t, r10:b
++ mulhh.w r9, r9:b, r10:b
++ add lr, r6
++ add r9, r7
++ satrnds lr >> (CONST_BITS + PASS1_BITS + 3), 31
++ satrnds r9 >> (CONST_BITS + PASS1_BITS + 3), 31
++ sthh.w r12[2*8*2], lr:b, r9:b
++
++// dataptr[48] =
++// DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS + PASS1_BITS);
++ mulhh.w lr, r8:t, r11:t
++ mulhh.w r8, r8:b, r11:t
++ add lr, r6
++ add r8, r7
++ satrnds lr >> (CONST_BITS + PASS1_BITS + 3), 31
++ satrnds r8 >> (CONST_BITS + PASS1_BITS + 3), 31
++ sthh.w r12[6*8*2], lr:b, r8:b
++
++// /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
++// * cK represents cos(K*pi/16).
++// * i0..i3 in the paper are tmp4..tmp7 here.
++// */
++//
++// z2 = tmp5 + tmp6;
++// z3 = tmp4 + tmp6;
++// z4 = tmp5 + tmp7;
++ padds.sh r5, r3, r2
++ padds.sh r6, r4, r2
++ padds.sh r7, r3, r1
++
++// z5 = (z3 + z4) * FIX_1_175875602; /* sqrt(2) * c3 */
++ padds.sh r8, r6, r7
++ mulhh.w r9, r8:t, r11:b
++ mulhh.w r8, r8:b, r11:b
++
++// z3 *= -FIX_1_961570560; /* sqrt(2) * (-c3-c5) */
++// z3 += z5;
++ lddpc r11, const_table2 + 8
++ mulhh.w r10, r6:t, r11:t
++ mulhh.w r6, r6:b, r11:t
++ add r10, r9
++ add r6, r8
++
++// z4 *= -FIX_0_390180644; /* sqrt(2) * (c5-c3) */
++// z4 += z5;
++ mulhh.w lr, r7:t, r11:b
++ mulhh.w r7, r7:b, r11:b
++ lddpc r11, const_table2 + 12
++ st.w --sp,r0
++ add lr, r9
++ add r7, r8
++
++// tmp6 *= FIX_3_072711026; /* sqrt(2) * ( c1+c3+c5-c7) */
++ mulhh.w r0, r2:t, r11:t
++ machh.w r0, r5:t, r11:b
++ mulhh.w r2, r2:b, r11:t
++ machh.w r2, r5:b, r11:b
++
++// z2 *= -FIX_2_562915447; /* sqrt(2) * (-c1-c3) */
++// dataptr[24] = DESCALE(tmp6 + z2 + z3, CONST_BITS + PASS1_BITS);
++ add r0, r10
++ lddpc r11, const_table2 + 16
++ add r2, r6
++ satrnds r0 >> (CONST_BITS + PASS1_BITS + 3), 31
++ satrnds r2 >> (CONST_BITS + PASS1_BITS + 3), 31
++ sthh.w r12[3*8*2], r0:b, r2:b
++// tmp5 *= FIX_2_053119869; /* sqrt(2) * ( c1+c3-c5+c7) */
++ mulhh.w r0, r3:t, r11:t
++ machh.w r0, r5:t, r11:b
++ mulhh.w r2, r3:b, r11:t
++ machh.w r2, r5:b, r11:b
++ add r0, lr
++ lddpc r11, const_table2 + 20
++ add r2, r7
++
++// dataptr[40] = DESCALE(tmp5 + z2 + z4, CONST_BITS + PASS1_BITS);
++ satrnds r0 >> (CONST_BITS + PASS1_BITS + 3), 31
++ satrnds r2 >> (CONST_BITS + PASS1_BITS + 3), 31
++ sthh.w r12[5*8*2], r0:b, r2:b
++
++
++// z1 = tmp4 + tmp7;
++ padds.sh r2, r4, r1
++
++// tmp4 *= FIX_0_298631336; /* sqrt(2) * (-c1+c3+c5-c7) */
++ mulhh.w r3, r4:t, r11:t
++ machh.w r3, r2:t, r11:b
++ mulhh.w r4, r4:b, r11:t
++ machh.w r4, r2:b, r11:b
++ add r3, r10
++ lddpc r11, const_table2 + 24
++ add r4, r6
++
++// z1 *= -FIX_0_899976223; /* sqrt(2) * (c7-c3) */
++// dataptr[56] = DESCALE(tmp4 + z1 + z3, CONST_BITS + PASS1_BITS);
++ satrnds r3 >> (CONST_BITS + PASS1_BITS + 3), 31
++ satrnds r4 >> (CONST_BITS + PASS1_BITS + 3), 31
++ sthh.w r12[7*8*2], r3:b, r4:b
++
++
++// tmp7 *= FIX_1_501321110; /* sqrt(2) * ( c1+c3-c5-c7) */
++ mulhh.w r3, r1:t, r11:t
++ machh.w r3, r2:t, r11:b
++ mulhh.w r4, r1:b, r11:t
++ machh.w r4, r2:b, r11:b
++ add r3, lr
++ add r4, r7
++
++// dataptr[8] = DESCALE(tmp7 + z1 + z4, CONST_BITS + PASS1_BITS);
++ satrnds r3 >> (CONST_BITS + PASS1_BITS + 3), 31
++ satrnds r4 >> (CONST_BITS + PASS1_BITS + 3), 31
++ sthh.w r12[1*8*2], r3:b, r4:b
++ ld.w r0, sp++
++
++// dataptr++; /* advance pointer to next column */
++ sub blkptr, -4
++ sub loop_ctr, 1
++ brne COLOUMN_LOOP
++
++// }
++
++ popm r0-r3, r4-r7, pc
++
++// /* descale */
++// for (i = 0; i < 64; i++)
++// block[i] = (short int) DESCALE(data[i], 3);
++
++
++//}
++
++
++ .align 2
++const_table: .short FIX_0_541196100, FIX_0_765366865, -FIX_1_847759065, FIX_1_175875602
++ .short FIX_0_298631336, FIX_2_053119869, FIX_3_072711026, FIX_1_501321110
++ .short -FIX_0_899976223,-FIX_2_562915447, -FIX_1_961570560, -FIX_0_390180644
++
++const_table2: .short FIX_0_541196100, FIX_0_765366865, -FIX_1_847759065, FIX_1_175875602
++ .short -FIX_1_961570560, -FIX_0_390180644, FIX_3_072711026, -FIX_2_562915447
++ .short FIX_2_053119869, -FIX_2_562915447, FIX_0_298631336, -FIX_0_899976223
++ .short FIX_1_501321110, -FIX_0_899976223
++
++
++
++
+diff --git a/libavcodec/avr32/h264idct.S b/libavcodec/avr32/h264idct.S
+new file mode 100644
+index 0000000..4b23e2d
+--- /dev/null
++++ b/libavcodec/avr32/h264idct.S
+@@ -0,0 +1,451 @@
++/*
++ * Copyright (c) 2007 Atmel Corporation. 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 ATMEL may not be used to endorse or promote products
++ * derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL
++ * 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.
++ */
++
++ .global h264_idct_add_avr32
++
++ /* Macro for performing the 1-D transform on one row line.
++
++ The register 'w01' should contain the first two pixels,
++ and the register 'w23' should contain the last two pixels
++ in the line. The resulting line is placed in p01 and p23
++ so that { w01, w23 } = { x0, x1, x3, x2 }.
++ 'tmp' and 'tmp2' should be scratchpad registers. */
++ .macro transform_row w01, w23, tmp, tmp2
++ add \tmp, \w23, \w01 << 1 /* tmp = { xxxx, 2*w1 + w3 } */
++ sub \tmp2, \w01, \w23 << 1 /* tmp2 = { xxxx, w1 - 2*w3 } */
++ bfins \tmp2, \tmp, 16, 16 /* tmp2 = { 2*w1 + w3, w1 - 2*w3 } */
++ pasr.h \tmp2, \tmp2, 1 /* tmp2 = { w1 + w3/2, w1/2 - w3 } */
++ paddsub.h \tmp, \w01:t, \w23:t /* tmp = { w0 + w2, w0 - w2 } */
++ padd.h \w01, \tmp, \tmp2 /* w01 = { w0 + w2 + w1 + w3/2, w0 - w2 + w1/2 - w3 } */
++ psub.h \w23, \tmp, \tmp2 /* w23 = { w0 + w2 - w1 - w3/2, w0 - w2 - w1/2 + w3 } */
++ .endm
++
++ /* Macro for performing the 1-D transform on two columns.
++
++ The registers w0, w1, w2, w3 should each contain two
++ packed samples from the two colomns to transform.
++ tmp and tmp2 are scratchpad registers.
++
++ The resulting transformed columns are placed in the
++ same positions as the input columns.
++ */
++ .macro transform_2columns w0, w1, w2, w3, tmp, tmp2
++ padd.h \tmp, \w0, \w2 /* tmp = z0 = w0 + w2 */
++ psub.h \w0, \w0, \w2 /* w0 = z1 = w0 - w2 */
++ pasr.h \w2, \w1, 1 /* w2 = w1/2 */
++ pasr.h \tmp2, \w3, 1 /* tmp2 = w3/2 */
++ psub.h \w3, \w2, \w3 /* w3 = z2 = w1/2 - w3 */
++ padd.h \tmp2, \w1, \tmp2/* tmp2 = z3 = w1 + w3/2 */
++ padd.h \w1, \w0, \w3 /* w1 = x1 = z1 + z2 */
++ psub.h \w2, \w0, \w3 /* w2 = x2 = z1 - z2 */
++ padd.h \w0, \tmp, \tmp2/* w0 = x0 = z0 + z3 */
++ psub.h \w3, \tmp, \tmp2/* w3 = x3 = z0 - z3 */
++ /* Scale down result. */
++ pasr.h \w0, \w0, 6
++ pasr.h \w1, \w1, 6
++ pasr.h \w2, \w2, 6
++ pasr.h \w3, \w3, 6
++ .endm
++
++/*void h264_idct_add_avr32(uint8_t *dst, DCTELEM *block, int stride)*/
++
++h264_idct_add_avr32:
++
++ stm --sp,r0-r3,r4-r7, lr
++
++ /* Setup rounding factor. */
++ mov r0, (1 << 5)
++ lsl r0, 16
++
++ /* Load block */
++ ldm r11,r2-r9
++ /* r9 = { w00, w01 },
++ r8 = { w02, w03 },
++ r7 = { w10, w11 },
++ r6 = { w12, w13 },
++ r5 = { w20, w21 },
++ r4 = { w22, w23 },
++ r3 = { w30, w31 },
++ r2 = { w32, w33 } */
++
++
++ /* Add the rounding factor to w00. */
++ add r9, r0
++
++ /* Transform rows */
++ transform_row r9, r8, r0, r1
++ transform_row r7, r6, r0, r1
++ transform_row r5, r4, r0, r1
++ transform_row r3, r2, r0, r1
++
++ /* Transform columns */
++ transform_2columns r9, r7, r5, r3, r0, r1
++ transform_2columns r8, r6, r4, r2, r0, r1
++
++ /* Load predicted pixels.*/
++ ld.w lr, r12[0]
++ ld.w r11, r12[r10]
++
++ /* Unpack to halwords. */
++ punpckub.h r0, lr:t
++ punpckub.h r1, lr:b
++
++ /* Add with transformed row. */
++ padd.h r0, r0, r9
++ paddx.h r1, r1, r8
++ /* Pack and saturate back to 8-bit pixels. */
++ packsh.ub r0, r0, r1
++
++ /* Unpack to halwords. */
++ punpckub.h lr, r11:t
++ punpckub.h r11, r11:b
++
++ /* Add with transformed row. */
++ padd.h lr, lr, r7
++ paddx.h r11, r11, r6
++ /* Pack and saturate back to 8-bit pixels. */
++ packsh.ub r1, lr, r11
++
++ /* Store back to frame. */
++ st.w r12[0], r0
++ st.w r12[r10], r1
++
++ add r12, r12, r10 << 1
++
++ /* Load predicted pixels.*/
++ ld.w lr, r12[0]
++ ld.w r11, r12[r10]
++
++ /* Unpack to halwords. */
++ punpckub.h r0, lr:t
++ punpckub.h r1, lr:b
++
++ /* Add with transformed row. */
++ padd.h r0, r0, r5
++ paddx.h r1, r1, r4
++ /* Pack and saturate back to 8-bit pixels. */
++ packsh.ub r0, r0, r1
++
++ /* Unpack to halwords. */
++ punpckub.h lr, r11:t
++ punpckub.h r11, r11:b
++
++ /* Add with transformed row. */
++ padd.h lr, lr, r3
++ paddx.h r11, r11, r2
++ /* Pack and saturate back to 8-bit pixels. */
++ packsh.ub r1, lr, r11
++
++ /* Store back to frame. */
++ st.w r12[0], r0
++ st.w r12[r10], r1
++
++ ldm sp++,r0-r3,r4-r7, pc
++
++
++ .global h264_idct8_add_avr32
++//void ff_h264_idct8_add_c(uint8_t *dst, DCTELEM *block, int stride){
++
++h264_idct8_add_avr32:
++ stm --sp,r0-r3,r4-r7, lr
++
++ /* Push dst and stride on stack */
++ stm --sp,r10,r12
++
++// int i;
++// DCTELEM (*src)[8] = (DCTELEM(*)[8])block;
++// uint8_t *cm = cropTbl + MAX_NEG_CROP;
++
++// block[0] += 32;
++
++
++// for( i = 0; i < 8; i++ )
++// {
++ mov lr, 4
++0:
++ ld.w r7, r11[0*(8*2)]
++ ld.w r6, r11[1*(8*2)]
++ ld.w r5, r11[2*(8*2)]
++ ld.w r4, r11[3*(8*2)]
++ ld.w r3, r11[4*(8*2)]
++ ld.w r2, r11[5*(8*2)]
++ ld.w r1, r11[6*(8*2)]
++ ld.w r0, r11[7*(8*2)]
++
++/*
++
++ const int a0 = src[0][i] + src[4][i];
++ const int a2 = src[0][i] - src[4][i];
++ const int a4 = (src[2][i]>>1) - src[6][i];
++ const int a6 = (src[6][i]>>1) + src[2][i];
++*/
++ padd.h r8, r7, r3 /* r8 = a0 */
++ psub.h r7, r7, r3 /* r7 = a2 */
++ pasr.h r3, r5, 1 /* r3 = src[2][i] >> 1 */
++ pasr.h r9, r1, 1 /* r9 = src[6][i] >> 1 */
++ psub.h r3, r3, r1 /* r3 = a4 */
++ padd.h r9, r9, r5 /* r9 = a6 */
++
++/*
++ const int b0 = a0 + a6;
++ const int b2 = a2 + a4;
++ const int b4 = a2 - a4;
++ const int b6 = a0 - a6;
++*/
++ padd.h r1, r8, r9 /* r1 = b0 */
++ psub.h r8, r8, r9 /* r8 = b6 */
++ padd.h r5, r7, r3 /* r5 = b2 */
++ psub.h r7, r7, r3 /* r7 = b4 */
++
++/*
++ const int a1 = -src[3][i] + src[5][i] - src[7][i] - (src[7][i]>>1);
++ const int a3 = src[1][i] + src[7][i] - src[3][i] - (src[3][i]>>1);
++ const int a5 = -src[1][i] + src[7][i] + src[5][i] + (src[5][i]>>1);
++ const int a7 = src[3][i] + src[5][i] + src[1][i] + (src[1][i]>>1);
++*/
++ pasr.h r3, r0, 1
++ padd.h r3, r3, r0
++ psub.h r3, r2, r3
++ psub.h r3, r3, r4 /* r3 = a1 */
++
++ pasr.h r9, r4, 1
++ padd.h r9, r9, r4
++ psub.h r9, r0, r9
++ padd.h r9, r6, r9 /* r9 = a3 */
++
++ pasr.h r10, r2, 1
++ padd.h r10, r10, r2
++ padd.h r10, r10, r0
++ psub.h r10, r10, r6 /* r10 = a5 */
++
++ pasr.h r0, r6, 1
++ padd.h r0, r0, r6
++ padd.h r0, r0, r2
++ padd.h r0, r0, r4 /* r0 = a7 */
++/*
++ const int b1 = (a7>>2) + a1;
++ const int b3 = a3 + (a5>>2);
++ const int b5 = (a3>>2) - a5;
++ const int b7 = a7 - (a1>>2);
++*/
++ pasr.h r2, r0, 2
++ padd.h r2, r2, r3 /* r2 = b1 */
++ pasr.h r3, r3, 2
++ psub.h r3, r0, r3 /* r3 = b7 */
++
++ pasr.h r0, r10, 2
++ padd.h r0, r0, r9 /* r0 = b3 */
++ pasr.h r9, r9, 2
++ psub.h r9, r9, r10 /* r9 = b5 */
++
++
++/*
++ src[0][i] = b0 + b7;
++ src[7][i] = b0 - b7;
++ src[1][i] = b2 + b5;
++ src[6][i] = b2 - b5;
++ src[2][i] = b4 + b3;
++ src[5][i] = b4 - b3;
++ src[3][i] = b6 + b1;
++ src[4][i] = b6 - b1; */
++
++ padd.h r4, r1, r3
++ psub.h r1, r1, r3
++ st.w r11[0*(8*2)], r4
++ st.w r11[7*(8*2)], r1
++
++ padd.h r3, r5, r9
++ psub.h r5, r5, r9
++ st.w r11[1*(8*2)], r3
++ st.w r11[6*(8*2)], r5
++
++ padd.h r9, r7, r0
++ psub.h r7, r7, r0
++ st.w r11[2*(8*2)], r9
++ st.w r11[5*(8*2)], r7
++
++ padd.h r0, r8, r2
++ psub.h r8, r8, r2
++ st.w r11[3*(8*2)], r0
++ st.w r11[4*(8*2)], r8
++
++ sub r11, -4
++ sub lr, 1
++ brne 0b
++
++// }
++
++ lddsp r12, sp[0] /* r12 = dst */
++ sub r11, 4*4
++ ldm r11++, r4-r7
++ mov lr, 8
++ /* Push dst and stride on stack */
++
++1:
++// for( i = 0; i < 8; i++ )
++// {
++
++ /* r7 = {src[i][0], src[i][1]}
++ r6 = {src[i][2], src[i][3]}
++ r5 = {src[i][4], src[i][5]}
++ r4 = {src[i][6], src[i][7]} */
++
++/*
++ const int a0 = src[i][0] + src[i][4];
++ const int a2 = src[i][0] - src[i][4];
++ const int a4 = (src[i][2]>>1) - src[i][6];
++ const int a6 = (src[i][6]>>1) + src[i][2];
++*/
++ pasr.h r8, r6, 1
++ pasr.h r9, r4, 1
++ addhh.w r0, r7:t, r5:t /* r0 = a0 */
++ subhh.w r1, r7:t, r5:t /* r1 = a2 */
++ subhh.w r2, r8:t, r4:t /* r2 = a4 */
++ addhh.w r3, r9:t, r6:t /* r3 = a6 */
++
++/*
++ const int b0 = a0 + a6;
++ const int b2 = a2 + a4;
++ const int b4 = a2 - a4;
++ const int b6 = a0 - a6;
++*/
++ add r10, r0, r3 /* r10 = b0 */
++ sub r0, r3 /* r0 = b6 */
++ add r3, r1, r2 /* r3 = b2 */
++ sub r1, r2 /* r1 = b4 */
++/*
++
++
++ const int a7 = src[i][5] + src[i][3] + src[i][1] + (src[i][1]>>1);
++ const int a1 = src[i][5] - src[i][3] - src[i][7] - (src[i][7]>>1);
++ const int a3 = src[i][7] + src[i][1] - src[i][3] - (src[i][3]>>1);
++ const int a5 = src[i][7] - src[i][1] + src[i][5] + (src[i][5]>>1); */
++ addhh.w r8, r8:b, r6:b
++ addhh.w r2, r4:b, r7:b
++ sub r2, r8 /* r2 = a3 */
++
++ addhh.w r9, r9:b, r4:b
++ subhh.w r8, r5:b, r6:b
++ sub r8, r9 /* r8 = a1 */
++
++ pasr.h r9, r7, 1
++ addhh.w r9, r9:b, r7:b
++ addhh.w r6, r5:b, r6:b
++ add r6, r9 /* r6 = a7 */
++
++ pasr.h r9, r5, 1
++ addhh.w r9, r9:b, r5:b
++ subhh.w r5, r4:b, r7:b
++ add r5, r9 /* r5 = a5 */
++
++/* const int b1 = (a7>>2) + a1;
++ const int b3 = (a5>>2) + a3;
++ const int b5 = (a3>>2) - a5;
++ const int b7 = -(a1>>2) + a7 ; */
++ asr r4, r6, 2
++ add r4, r8 /* r4 = b1 */
++ asr r8, 2
++ rsub r8, r6 /* r8 = b7 */
++
++ asr r6, r5, 2
++ add r6, r2 /* r6 = b3 */
++ asr r2, 2
++ sub r2, r5 /* r2 = b5 */
++
++/*
++ dst[i*stride + 0] = cm[ dst[i*stride + 0] + ((b0 + b7) >> 6) ];
++ dst[i*stride + 1] = cm[ dst[i*stride + 1] + ((b2 + b5) >> 6) ];
++ dst[i*stride + 2] = cm[ dst[i*stride + 2] + ((b4 + b3) >> 6) ];
++ dst[i*stride + 3] = cm[ dst[i*stride + 3] + ((b6 + b1) >> 6) ];
++ dst[i*stride + 4] = cm[ dst[i*stride + 4] + ((b6 - b1) >> 6) ];
++ dst[i*stride + 5] = cm[ dst[i*stride + 5] + ((b4 - b3) >> 6) ];
++ dst[i*stride + 6] = cm[ dst[i*stride + 6] + ((b2 - b5) >> 6) ];
++ dst[i*stride + 7] = cm[ dst[i*stride + 7] + ((b0 - b7) >> 6) ];
++*/
++ add r5, r10, r8
++ satrnds r5 >> 6, 0 /* r5 = (b0 + b7) >> 6 */
++ sub r10, r8
++ satrnds r10 >> 6, 0 /* r10 = (b0 - b7) >> 6 */
++ add r8, r3, r2
++ satrnds r8 >> 6, 0 /* r8 = (b2 + b5) >> 6 */
++ sub r3, r2
++ satrnds r3 >> 6, 0 /* r3 = (b2 - b5) >> 6 */
++
++ add r2, r1, r6
++ satrnds r2 >> 6, 0 /* r2 = (b4 + b3) >> 6 */
++ sub r1, r6
++ satrnds r1 >> 6, 0 /* r1 = (b4 - b3) >> 6 */
++
++ add r6, r0, r4
++ satrnds r6 >> 6, 0 /* r6 = (b6 + b1) >> 6 */
++ sub r0, r4
++ satrnds r0 >> 6, 0 /* r0 = (b6 - b1) >> 6 */
++
++ ld.w r4, r12[0]
++
++ packw.sh r8, r5, r8
++ packw.sh r7, r2, r6
++ ld.w r9, r12[4]
++ packw.sh r6, r0, r1
++ packw.sh r5, r3, r10
++
++ punpckub.h r10, r4:t
++ punpckub.h r4, r4:b
++ punpckub.h r3, r9:t
++ punpckub.h r9, r9:b
++
++ padd.h r8, r8, r10
++ padd.h r7, r7, r4
++ padd.h r6, r6, r3
++ padd.h r5, r5, r9
++
++ lddsp r10, sp[4] /* r10 = stride */
++ packsh.ub r0, r8, r7
++ packsh.ub r1, r6, r5
++
++ st.w r12[0], r0
++ st.w r12[4], r1
++
++ ldm r11++, r4-r7
++ add r12, r10 /* dst += stride */
++
++ sub lr, 1
++ brne 1b
++
++ sub sp, -8
++ ldm sp++,r0-r3,r4-r7, pc
++
++
++
++// }
++//}
+diff --git a/libavcodec/avr32/idct.S b/libavcodec/avr32/idct.S
+new file mode 100644
+index 0000000..e7551ec
+--- /dev/null
++++ b/libavcodec/avr32/idct.S
+@@ -0,0 +1,829 @@
++/*
++ * Copyright (c) 2007 Atmel Corporation. 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 ATMEL may not be used to endorse or promote products
++ * derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL
++ * 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.
++ */
++
++ .global idct_add_avr32
++ .global idct_put_avr32
++ .global idct_avr32
++
++
++#define CONST_BITS 13
++#define PASS1_BITS 2
++
++#define ONE ((INT32) 1)
++
++#define CONST_SCALE (ONE << CONST_BITS)
++
++#define LINE_SIZE 32
++
++#define FIX_0_298631336 (2446) /* FIX(0.298631336) */
++#define FIX_0_390180644 (3196) /* FIX(0.390180644) */
++#define FIX_0_541196100 (4433) /* FIX(0.541196100) */
++#define FIX_0_765366865 (6270) /* FIX(0.765366865) */
++#define FIX_0_899976223 (7373) /* FIX(0.899976223) */
++#define FIX_1_175875602 (9633) /* FIX(1.175875602) */
++#define FIX_1_501321110 (12299)/* FIX(1.501321110) */
++#define FIX_1_847759065 (15137)/* FIX(1.847759065) */
++#define FIX_1_961570560 (16069)/* FIX(1.961570560) */
++#define FIX_2_053119869 (16819)/* FIX(2.053119869) */
++#define FIX_2_562915447 (20995)/* FIX(2.562915447) */
++#define FIX_3_072711026 (25172)/* FIX(3.072711026) */
++
++
++#define loop_cnt r11
++
++ .text
++
++idct_add_avr32:
++ pushm r0-r3, r4-r7, lr //Free up registers to use for local variables
++
++ // Give room for some variables on the stack
++ sub sp, 8
++ stdsp SP[0], r12 // rfp
++ stdsp SP[4], r11 // iinc
++
++ mov loop_cnt, 8 //Initialize loop counter
++
++FOR_ROW:
++
++ ldm r10, r0, r1, r2, r3 //Load 8 DCT-coeffisients from the current row in the DCT-block
++ mov r6, 0
++#ifdef USE_PREFETCH
++ pref r10[LINE_SIZE] //Prefetch next line
++#endif
++ or r4, r2, r3 << 16
++ or r4, r1 //Check if all DCT-coeffisients except the DC is zero
++ or r4, r0
++ brne AC_ROW //If there are non-zero AC coeffisients perform row-transform
++
++ paddsub.h r5, r3:t, r6:b //Extract the DC-coeff from r5
++ plsl.h r5, r5, PASS1_BITS
++ mov r4, r5
++ st.d r10++, r4
++ st.d r10++, r4
++
++ sub loop_cnt, 1 //Decrement loop counter
++ brne FOR_ROW //Perform loop one more time if loop_cnt is not zero
++
++ bral COLOUMN_TRANSFORM //Perform coloumn transform after row transform is computed
++
++
++AC_ROW:
++
++
++ ld.w r12, pc[coef_table - .]
++ ld.w r9, pc[coef_table - . + 4]
++
++ padd.h r4, r2, r0 // r4:t = dataptr[2] + dataptr[6],r4:b = dataptr[3] + dataptr[7]
++ mulhh.w r5, r4:t, r12:t
++ mulhh.w r6, r0:t, r12:b
++ ld.w r12, pc[coef_table - . + 8]
++ mulhh.w r7, r2:t, r9:t
++ add r6, r5 // tmp2
++ satrnds r6 >> (CONST_BITS - PASS1_BITS), 31
++ add r7, r5 // tmp3
++ satrnds r7 >> (CONST_BITS - PASS1_BITS), 31
++
++ paddsub.h r5, r3:t, r1:t
++ plsl.h r5, r5, PASS1_BITS // r5:t = tmp0, r5:b = tmp1
++
++ paddsub.h r7, r5:t, r7:b // r7:t = tmp10, r7:b = tmp13
++ paddsub.h r6, r5:b, r6:b // r6:t = tmp11, r6:b = tmp12
++
++
++ addhh.w lr, r3:b, r1:b // lr = z4
++ addhh.w r5, r4:b, lr:b
++ mulhh.w r5, r5:b, r9:b // r5 = z5
++
++ ld.w r9, pc[coef_table - . + 12]
++ mulhh.w r4, r4:b, r12:t // r4 = z3
++ mulhh.w lr, lr:b, r12:b // lr = z4
++
++ add r4, r5
++ add lr, r5
++
++ addhh.w r5, r2:b, r1:b // r5 = z2
++ addhh.w r8, r3:b, r0:b // r8 = z1
++
++
++ mulhh.w r0, r0:b, r9:t // r0 = tmp0
++ ld.w r12, pc[coef_table - . + 16]
++ mulhh.w r1, r1:b, r9:b // r1 = tmp1
++ ld.w r9, pc[coef_table - . + 20]
++ mulhh.w r2, r2:b, r12:t // r2 = tmp2
++ mulhh.w r3, r3:b, r12:b // r3 = tmp3
++ mulhh.w r8, r8:b, r9:t // r8 = z1
++ mulhh.w r5, r5:b, r9:b // r5 = z2
++
++
++ add r0, r8
++ add r0, r4
++ add r1, r5
++ add r1, lr
++ add r2, r5
++ add r2, r4
++ add r3, r8
++ add r3, lr
++
++ satrnds r0 >> (CONST_BITS - PASS1_BITS), 31
++ satrnds r1 >> (CONST_BITS - PASS1_BITS), 31
++ satrnds r2 >> (CONST_BITS - PASS1_BITS), 31
++ satrnds r3 >> (CONST_BITS - PASS1_BITS), 31
++
++ paddsub.h r5, r6:t, r2:b // r5:t = dataptr[1], r5:b = dataptr[6]
++ paddsub.h r4, r7:t, r3:b // r4:t = dataptr[0], r4:b = dataptr[7]
++ paddsub.h r3, r6:b, r1:b // r3:t = dataptr[2], r3:b = dataptr[5]
++ paddsub.h r2, r7:b, r0:b // r2:t = dataptr[3], r2:b = dataptr[4]
++
++ sthh.w r10[0], r4:t, r5:t
++ sthh.w r10[4], r3:t, r2:t
++ sthh.w r10[8], r2:b, r3:b
++ sthh.w r10[12], r5:b, r4:b
++
++
++
++ sub r10, -16
++ sub loop_cnt, 1
++ brne FOR_ROW, e
++
++COLOUMN_TRANSFORM:
++
++ sub r10, 128 //Set pointer to start of DCT block
++
++
++ mov loop_cnt, 8
++FOR_COLOUMN:
++ ldins.h r3:t,r10[0] // r3:t = dataptr[0]
++ ldins.h r1:t,r10[1*8*2]// r1:t = dataptr[1]
++ ldins.h r2:t,r10[2*8*2]// r2:t = dataptr[2]
++ ldins.h r0:t,r10[5*8*2]// r0:t = dataptr[5]
++ ldins.h r3:b,r10[4*8*2]// r3:b = dataptr[4]
++ ldins.h r1:b,r10[3*8*2]// r1:b = dataptr[3]
++ ldins.h r2:b,r10[6*8*2]// r2:b = dataptr[6]
++ ldins.h r0:b,r10[7*8*2]// r0:b = dataptr[7]
++
++ or r4, r1, r3 << 16
++ or r4, r2
++ or r4, r0
++ brne AC_COLOUMN //If there are non-zero AC coeffisients perform row-transform
++
++ lddsp r12, SP[0] // rfp
++ lddsp r9, SP[4] // iinc
++ satrnds r3 >> ( PASS1_BITS + 3 + 16 ), 9
++ ld.d r0, r12[0]
++ sub r10, -2 // Increment the dataptr
++ bfins r3, r3, 16, 16
++ punpckub.h r2, r1:t
++ padd.h r2, r2, r3
++ punpckub.h r1, r1:b
++ padd.h r1, r1, r3
++ packsh.ub r1, r2, r1
++ punpckub.h r2, r0:t
++ padd.h r2, r2, r3
++ punpckub.h r0, r0:b
++ padd.h r0, r0, r3
++ packsh.ub r0, r2, r0
++ st.d r12[0], r0
++ add r12, r9 // increment rfp
++ stdsp SP[0], r12
++
++ sub loop_cnt, 1//Decrement loop counter
++ brne FOR_COLOUMN//Perform loop one more time if loop_cnt is not zero
++
++ sub sp, -8
++ popm r0-r3, r4-r7, pc//Pop back registers and PC
++
++AC_COLOUMN:
++
++ ld.w r12, pc[coef_table - .]
++ ld.w r9, pc[coef_table - . + 4]
++
++ addhh.w r4, r2:t, r2:b
++ mulhh.w r4, r4:b, r12:t // r4 = z1
++ mulhh.w r5, r2:b, r12:b
++ ld.w r12, pc[coef_table - . + 8]
++ mulhh.w r6, r2:t, r9:t
++ add r5, r4 // r5 = tmp2
++ add r6, r4 // r6 = tmp3
++
++ addhh.w r7, r3:t, r3:b
++ subhh.w r8, r3:t, r3:b
++
++ lsl r7, CONST_BITS
++ lsl r8, CONST_BITS
++
++ add r2, r7, r6 // r2 = tmp10
++ sub r3, r7, r6 // r3 = tmp13
++ add r4, r8, r5 // r4 = tmp11
++ sub r5, r8, r5 // r5 = tmp12
++
++ padd.h r6, r0, r1 // r6:t = z4, r6:b = z3
++ addhh.w r7, r6:t, r6:b
++ mulhh.w r7, r7:b, r9:b // r7 = z5
++
++ ld.w r9, pc[coef_table - . + 12]
++ mulhh.w r8, r6:b, r12:t // r8 = z3
++ mulhh.w r6, r6:t, r12:b // r6 = z4
++
++ add r8, r7
++ add r6, r7
++
++ paddx.h r7, r0, r1 // r7:t = z2, r7:b = z1
++
++ mulhh.w r12, r0:b, r9:t // r12 = tmp0
++ mulhh.w r0, r0:t, r9:b // r0 = tmp1
++ ld.w r9, pc[coef_table - . + 16]
++ add r12, r8
++ add r0, r6
++
++ ld.w lr, pc[coef_table - . + 20]
++ machh.w r8, r1:b, r9:t // r8 = tmp2
++ machh.w r6, r1:t, r9:b // r6 = tmp3
++ mulhh.w r9, r7:b, lr:t // r9 = z1
++ mulhh.w r7, r7:t, lr:b // r7 = z2
++
++
++ add r12, r9
++ add r0, r7
++ add r8, r7
++ add r6, r9
++
++ add r1, r2, r6 // r1 = dataptr[DCTSIZE*0]
++ sub r2, r2, r6 // r2 = dataptr[DCTSIZE*7]
++ add r6, r4, r8 // r6 = dataptr[DCTSIZE*1]
++ sub r4, r4, r8 // r4 = dataptr[DCTSIZE*6]
++ add r8, r5, r0 // r8 = dataptr[DCTSIZE*2]
++ sub r5, r5, r0 // r5 = dataptr[DCTSIZE*5]
++ add r0, r3, r12 // r0 = dataptr[DCTSIZE*3]
++ sub r3, r3, r12 // r3 = dataptr[DCTSIZE*4]
++
++ satrnds r1 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r2 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r6 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r4 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r8 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r5 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r0 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r3 >> (CONST_BITS+PASS1_BITS+3), 9
++
++ packw.sh r1, r1, r6
++ packw.sh r8, r8, r0
++ packw.sh r3, r3, r5
++ packw.sh r4, r4, r2
++
++ lddsp r12, SP[0] // rfp
++ lddsp r9, SP[4] // iinc
++ ld.d r6, r12[0]
++ sub r10, -2 // Increment the dataptr
++ punpckub.h r0, r7:t
++ padd.h r1, r1, r0
++ punpckub.h r0, r7:b
++ padd.h r8, r8, r0
++ packsh.ub r7, r1, r8
++ punpckub.h r0, r6:t
++ padd.h r3, r3, r0
++ punpckub.h r0, r6:b
++ padd.h r4, r4, r0
++ packsh.ub r6, r3, r4
++ st.d r12[0], r6
++ add r12, r9 // increment rfp
++ stdsp SP[0], r12
++
++ sub loop_cnt, 1 //Decrement loop counter
++ brne FOR_COLOUMN //Perform loop one more time if loop_cnt is not zero
++
++ sub sp, -8
++ popm r0-r3, r4-r7, pc //Pop back registers and PC
++
++
++
++//Coeffisient Table:
++ .align 2
++coef_table:
++ .short FIX_0_541196100, -FIX_1_847759065, FIX_0_765366865, FIX_1_175875602
++ .short - FIX_1_961570560, - FIX_0_390180644, FIX_0_298631336, FIX_2_053119869
++ .short FIX_3_072711026, FIX_1_501321110, - FIX_0_899976223, - FIX_2_562915447
++
++
++idct_put_avr32:
++ pushm r0-r3, r4-r7, lr //Free up registers to use for local variables
++
++ //; Give room for some variables on the stack
++ sub sp, 8
++ stdsp SP[0], r12 // rfp
++ stdsp SP[4], r11 // iinc
++
++ mov loop_cnt, 8 //Initialize loop counter
++
++0:
++
++ ldm r10, r0, r1, r2, r3 //Load 8 DCT-coeffisients from the current row in the DCT-block
++ mov r6, 0
++#ifdef USE_PREFETCH
++ pref r10[LINE_SIZE] //Prefetch next line
++#endif
++ or r4, r2, r3 << 16
++ or r4, r1 //Check if all DCT-coeffisients except the DC is zero
++ or r4, r0
++ brne 1f //If there are non-zero AC coeffisients perform row-transform
++
++ paddsub.h r5, r3:t, r6:b //Extract the DC-coeff from r5
++ plsl.h r5, r5, PASS1_BITS
++ mov r4, r5
++ st.d r10++, r4
++ st.d r10++, r4
++
++ sub loop_cnt, 1 //Decrement loop counter
++ brne 0b //Perform loop one more time if loop_cnt is not zero
++
++ bral 2f //Perform coloumn transform after row transform is computed
++
++1:
++
++ ld.w r12, pc[coef_table_copy - .]
++ ld.w r9, pc[coef_table_copy - . + 4]
++
++ padd.h r4, r2, r0 // r4:t = dataptr[2] + dataptr[6],r4:b = dataptr[3] + dataptr[7]
++ mulhh.w r5, r4:t, r12:t
++ mulhh.w r6, r0:t, r12:b
++ ld.w r12, pc[coef_table_copy - . + 8]
++ mulhh.w r7, r2:t, r9:t
++ add r6, r5 // tmp2
++ satrnds r6 >> (CONST_BITS - PASS1_BITS), 31
++ add r7, r5 // tmp3
++ satrnds r7 >> (CONST_BITS - PASS1_BITS), 31
++
++ paddsub.h r5, r3:t, r1:t
++ plsl.h r5, r5, PASS1_BITS // r5:t = tmp0, r5:b = tmp1
++
++ paddsub.h r7, r5:t, r7:b // r7:t = tmp10, r7:b = tmp13
++ paddsub.h r6, r5:b, r6:b // r6:t = tmp11, r6:b = tmp12
++
++
++
++ addhh.w lr, r3:b, r1:b // lr = z4
++ addhh.w r5, r4:b, lr:b
++ mulhh.w r5, r5:b, r9:b // r5 = z5
++
++ ld.w r9, pc[coef_table_copy - . + 12]
++ mulhh.w r4, r4:b, r12:t // r4 = z3
++ mulhh.w lr, lr:b, r12:b // lr = z4
++
++ add r4, r5
++ add lr, r5
++
++ addhh.w r5, r2:b, r1:b // r5 = z2
++ addhh.w r8, r3:b, r0:b // r8 = z1
++
++
++ mulhh.w r0, r0:b, r9:t // r0 = tmp0
++ ld.w r12, pc[coef_table_copy - . + 16]
++ mulhh.w r1, r1:b, r9:b // r1 = tmp1
++ ld.w r9, pc[coef_table_copy - . + 20]
++ mulhh.w r2, r2:b, r12:t // r2 = tmp2
++ mulhh.w r3, r3:b, r12:b // r3 = tmp3
++ mulhh.w r8, r8:b, r9:t // r8 = z1
++ mulhh.w r5, r5:b, r9:b // r5 = z2
++
++
++ add r0, r8
++ add r0, r4
++ add r1, r5
++ add r1, lr
++ add r2, r5
++ add r2, r4
++ add r3, r8
++ add r3, lr
++
++ satrnds r0 >> (CONST_BITS - PASS1_BITS), 31
++ satrnds r1 >> (CONST_BITS - PASS1_BITS), 31
++ satrnds r2 >> (CONST_BITS - PASS1_BITS), 31
++ satrnds r3 >> (CONST_BITS - PASS1_BITS), 31
++
++ paddsub.h r5, r6:t, r2:b // r5:t = dataptr[1], r5:b = dataptr[6]
++ paddsub.h r4, r7:t, r3:b // r4:t = dataptr[0], r4:b = dataptr[7]
++ paddsub.h r3, r6:b, r1:b // r3:t = dataptr[2], r3:b = dataptr[5]
++ paddsub.h r2, r7:b, r0:b // r2:t = dataptr[3], r2:b = dataptr[4]
++
++ sthh.w r10[0], r4:t, r5:t
++ sthh.w r10[4], r3:t, r2:t
++ sthh.w r10[8], r2:b, r3:b
++ sthh.w r10[12], r5:b, r4:b
++
++
++
++ sub r10, -16
++ sub loop_cnt, 1
++ brne 0b
++
++2:
++
++ sub r10, 128 //Set pointer to start of DCT block
++
++ mov loop_cnt, 8
++
++0:
++ ldins.h r3:t,r10[0] // r3:t = dataptr[0]
++ ldins.h r1:t,r10[1*8*2]// r1:t = dataptr[1]
++ ldins.h r2:t,r10[2*8*2]// r2:t = dataptr[2]
++ ldins.h r0:t,r10[5*8*2]// r0:t = dataptr[5]
++ ldins.h r3:b,r10[4*8*2]// r3:b = dataptr[4]
++ ldins.h r1:b,r10[3*8*2]// r1:b = dataptr[3]
++ ldins.h r2:b,r10[6*8*2]// r2:b = dataptr[6]
++ ldins.h r0:b,r10[7*8*2]// r0:b = dataptr[7]
++
++ or r4, r1, r3 << 16
++ or r4, r2
++ or r4, r0
++ brne 1f //If there are non-zero AC coeffisients perform row-transform
++
++ lddsp r12, SP[0] // rfp
++ lddsp r9, SP[4] // iinc
++ satrnds r3 >> ( PASS1_BITS + 3 + 16 ), 31
++ packw.sh r3, r3, r3
++ packsh.ub r3, r3, r3
++ mov r2, r3
++ st.d r12[0], r2
++ add r12, r9 // increment rfp
++ sub r10, -2 // Increment the dataptr
++ stdsp SP[0], r12
++
++ sub loop_cnt, 1//Decrement loop counter
++ brne 0b //Perform loop one more time if loop_cnt is not zero
++
++ sub sp, -8
++ popm r0-r3, r4-r7, pc//Pop back registers and PC
++
++1:
++
++ ld.w r12, pc[coef_table_copy - .]
++ ld.w r9, pc[coef_table_copy - . + 4]
++
++ addhh.w r4, r2:t, r2:b
++ mulhh.w r4, r4:b, r12:t // r4 = z1
++ mulhh.w r5, r2:b, r12:b
++ ld.w r12, pc[coef_table_copy - . + 8]
++ mulhh.w r6, r2:t, r9:t
++ add r5, r4 // r5 = tmp2
++ add r6, r4 // r6 = tmp3
++
++ addhh.w r7, r3:t, r3:b
++ subhh.w r8, r3:t, r3:b
++
++ lsl r7, CONST_BITS
++ lsl r8, CONST_BITS
++
++ add r2, r7, r6 // r2 = tmp10
++ sub r3, r7, r6 // r3 = tmp13
++ add r4, r8, r5 // r4 = tmp11
++ sub r5, r8, r5 // r5 = tmp12
++
++
++ padd.h r6, r0, r1 // r6:t = z4, r6:b = z3
++ addhh.w r7, r6:t, r6:b
++ mulhh.w r7, r7:b, r9:b // r7 = z5
++
++ ld.w r9, pc[coef_table_copy - . + 12]
++ mulhh.w r8, r6:b, r12:t // r8 = z3
++ mulhh.w r6, r6:t, r12:b // r6 = z4
++
++ add r8, r7
++ add r6, r7
++
++ paddx.h r7, r0, r1 // r7:t = z2, r7:b = z1
++
++ mulhh.w r12, r0:b, r9:t // r12 = tmp0
++ mulhh.w r0, r0:t, r9:b // r0 = tmp1
++ ld.w r9, pc[coef_table_copy - . + 16]
++ add r12, r8
++ add r0, r6
++
++ ld.w lr, pc[coef_table_copy - . + 20]
++ machh.w r8, r1:b, r9:t // r8 = tmp2
++ machh.w r6, r1:t, r9:b // r6 = tmp3
++ mulhh.w r9, r7:b, lr:t // r9 = z1
++ mulhh.w r7, r7:t, lr:b // r7 = z2
++
++
++ add r12, r9
++ add r0, r7
++ add r8, r7
++ add r6, r9
++
++ add r1, r2, r6 // r1 = dataptr[DCTSIZE*0]
++ sub r2, r2, r6 // r2 = dataptr[DCTSIZE*7]
++ add r6, r4, r8 // r6 = dataptr[DCTSIZE*1]
++ sub r4, r4, r8 // r4 = dataptr[DCTSIZE*6]
++ add r8, r5, r0 // r8 = dataptr[DCTSIZE*2]
++ sub r5, r5, r0 // r5 = dataptr[DCTSIZE*5]
++ add r0, r3, r12 // r0 = dataptr[DCTSIZE*3]
++ sub r3, r3, r12 // r3 = dataptr[DCTSIZE*4]
++
++ satrnds r1 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r2 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r6 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r4 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r8 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r5 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r0 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r3 >> (CONST_BITS+PASS1_BITS+3), 9
++
++ packw.sh r1, r1, r6
++ packw.sh r8, r8, r0
++ packw.sh r3, r3, r5
++ packw.sh r4, r4, r2
++
++ packsh.ub r1, r1, r8
++ packsh.ub r0, r3, r4
++ lddsp r12, SP[0] // rfp
++ lddsp r9, SP[4] // iinc
++ st.d r12[0], r0
++ sub r10, -2 // Increment the dataptr
++ add r12, r9 // increment rfp
++ stdsp SP[0], r12
++
++ sub loop_cnt, 1 //Decrement loop counter
++ brne 0b //Perform loop one more time if loop_cnt is not zero
++
++ sub sp, -8
++ popm r0-r3, r4-r7, pc //Pop back registers and PC
++
++
++
++ .align 2
++coef_table_copy:
++ .short FIX_0_541196100, -FIX_1_847759065, FIX_0_765366865, FIX_1_175875602
++ .short - FIX_1_961570560, - FIX_0_390180644, FIX_0_298631336, FIX_2_053119869
++ .short FIX_3_072711026, FIX_1_501321110, - FIX_0_899976223, - FIX_2_562915447
++
++
++idct_avr32:
++ pushm r0-r3, r4-r7, lr //Free up registers to use for local variables
++
++ //; Give room for a temporary block on the stack
++ sub sp, 8*8*2
++
++ mov loop_cnt, 8 //Initialize loop counter
++
++0:
++
++ ldm r12++, r0, r1, r2, r3 //Load 8 DCT-coeffisients from the current row in the DCT-block
++ mov r6, 0
++#ifdef USE_PREFETCH
++ pref r12[LINE_SIZE] //Prefetch next line
++#endif
++ or r4, r2, r3 << 16
++ or r4, r1 //Check if all DCT-coeffisients except the DC is zero
++ or r4, r0
++ brne 1f //If there are non-zero AC coeffisients perform row-transform
++
++ paddsub.h r5, r3:t, r6:b //Extract the DC-coeff from r5
++ plsl.h r5, r5, PASS1_BITS
++ mov r4, r5
++ st.d sp++, r4
++ st.d sp++, r4
++
++ sub loop_cnt, 1 //Decrement loop counter
++ brne 0b //Perform loop one more time if loop_cnt is not zero
++
++ bral 2f //Perform coloumn transform after row transform is computed
++
++1:
++
++ ld.w r10, pc[coef_table_idct - .]
++ ld.w r9, pc[coef_table_idct - . + 4]
++
++ padd.h r4, r2, r0 // r4:t = dataptr[2] + dataptr[6],r4:b = dataptr[3] + dataptr[7]
++ mulhh.w r5, r4:t, r10:t
++ mulhh.w r6, r0:t, r10:b
++ ld.w r10, pc[coef_table_idct - . + 8]
++ mulhh.w r7, r2:t, r9:t
++ add r6, r5 // tmp2
++ satrnds r6 >> (CONST_BITS - PASS1_BITS), 31
++ add r7, r5 // tmp3
++ satrnds r7 >> (CONST_BITS - PASS1_BITS), 31
++
++ paddsub.h r5, r3:t, r1:t
++ plsl.h r5, r5, PASS1_BITS // r5:t = tmp0, r5:b = tmp1
++
++ paddsub.h r7, r5:t, r7:b // r7:t = tmp10, r7:b = tmp13
++ paddsub.h r6, r5:b, r6:b // r6:t = tmp11, r6:b = tmp12
++
++
++
++ addhh.w lr, r3:b, r1:b // lr = z4
++ addhh.w r5, r4:b, lr:b
++ mulhh.w r5, r5:b, r9:b // r5 = z5
++
++ ld.w r9, pc[coef_table_idct - . + 12]
++ mulhh.w r4, r4:b, r10:t // r4 = z3
++ mulhh.w lr, lr:b, r10:b // lr = z4
++
++ add r4, r5
++ add lr, r5
++
++ addhh.w r5, r2:b, r1:b // r5 = z2
++ addhh.w r8, r3:b, r0:b // r8 = z1
++
++
++ mulhh.w r0, r0:b, r9:t // r0 = tmp0
++ ld.w r10, pc[coef_table_idct - . + 16]
++ mulhh.w r1, r1:b, r9:b // r1 = tmp1
++ ld.w r9, pc[coef_table_idct - . + 20]
++ mulhh.w r2, r2:b, r10:t // r2 = tmp2
++ mulhh.w r3, r3:b, r10:b // r3 = tmp3
++ mulhh.w r8, r8:b, r9:t // r8 = z1
++ mulhh.w r5, r5:b, r9:b // r5 = z2
++
++
++ add r0, r8
++ add r0, r4
++ add r1, r5
++ add r1, lr
++ add r2, r5
++ add r2, r4
++ add r3, r8
++ add r3, lr
++
++ satrnds r0 >> (CONST_BITS - PASS1_BITS), 31
++ satrnds r1 >> (CONST_BITS - PASS1_BITS), 31
++ satrnds r2 >> (CONST_BITS - PASS1_BITS), 31
++ satrnds r3 >> (CONST_BITS - PASS1_BITS), 31
++
++ paddsub.h r5, r6:t, r2:b // r5:t = dataptr[1], r5:b = dataptr[6]
++ paddsub.h r4, r7:t, r3:b // r4:t = dataptr[0], r4:b = dataptr[7]
++ paddsub.h r3, r6:b, r1:b // r3:t = dataptr[2], r3:b = dataptr[5]
++ paddsub.h r2, r7:b, r0:b // r2:t = dataptr[3], r2:b = dataptr[4]
++
++ sthh.w sp[0], r4:t, r5:t
++ sthh.w sp[4], r3:t, r2:t
++ sthh.w sp[8], r2:b, r3:b
++ sthh.w sp[12], r5:b, r4:b
++
++
++
++ sub sp, -16
++ sub loop_cnt, 1
++ brne 0b
++
++2:
++
++ sub sp, 8*8*2 //Set pointer to start of DCT block
++ sub r12, 8*8*2 //Set pointer to start of DCT block
++
++ mov loop_cnt, 8
++
++0:
++ ldins.h r3:t,sp[0] // r3:t = dataptr[0]
++ ldins.h r1:t,sp[1*8*2]// r1:t = dataptr[1]
++ ldins.h r2:t,sp[2*8*2]// r2:t = dataptr[2]
++ ldins.h r0:t,sp[5*8*2]// r0:t = dataptr[5]
++ ldins.h r3:b,sp[4*8*2]// r3:b = dataptr[4]
++ ldins.h r1:b,sp[3*8*2]// r1:b = dataptr[3]
++ ldins.h r2:b,sp[6*8*2]// r2:b = dataptr[6]
++ ldins.h r0:b,sp[7*8*2]// r0:b = dataptr[7]
++
++ or r4, r1, r3 << 16
++ or r4, r2
++ or r4, r0
++ brne 1f //If there are non-zero AC coeffisients perform row-transform
++
++ satrnds r3 >> ( PASS1_BITS + 3 + 16 ), 31
++ packw.sh r3, r3, r3
++ mov r2, r3
++ st.d r12++, r2
++ st.d r12++, r2
++ sub sp, -2 // Increment the dataptr
++
++ sub loop_cnt, 1//Decrement loop counter
++ brne 0b //Perform loop one more time if loop_cnt is not zero
++
++ sub sp, -(8*8*2 - 8)
++ popm r0-r3, r4-r7, pc//Pop back registers and PC
++
++1:
++
++ ld.w r10, pc[coef_table_idct - .]
++ ld.w r9, pc[coef_table_idct - . + 4]
++
++ addhh.w r4, r2:t, r2:b
++ mulhh.w r4, r4:b, r10:t // r4 = z1
++ mulhh.w r5, r2:b, r10:b
++ ld.w r10, pc[coef_table_idct - . + 8]
++ mulhh.w r6, r2:t, r9:t
++ add r5, r4 // r5 = tmp2
++ add r6, r4 // r6 = tmp3
++
++ addhh.w r7, r3:t, r3:b
++ subhh.w r8, r3:t, r3:b
++
++ lsl r7, CONST_BITS
++ lsl r8, CONST_BITS
++
++ add r2, r7, r6 // r2 = tmp10
++ sub r3, r7, r6 // r3 = tmp13
++ add r4, r8, r5 // r4 = tmp11
++ sub r5, r8, r5 // r5 = tmp12
++
++
++ padd.h r6, r0, r1 // r6:t = z4, r6:b = z3
++ addhh.w r7, r6:t, r6:b
++ mulhh.w r7, r7:b, r9:b // r7 = z5
++
++ ld.w r9, pc[coef_table_idct - . + 12]
++ mulhh.w r8, r6:b, r10:t // r8 = z3
++ mulhh.w r6, r6:t, r10:b // r6 = z4
++
++ add r8, r7
++ add r6, r7
++
++ paddx.h r7, r0, r1 // r7:t = z2, r7:b = z1
++
++ mulhh.w r10, r0:b, r9:t // r10 = tmp0
++ mulhh.w r0, r0:t, r9:b // r0 = tmp1
++ ld.w r9, pc[coef_table_idct - . + 16]
++ add r10, r8
++ add r0, r6
++
++ ld.w lr, pc[coef_table_idct - . + 20]
++ machh.w r8, r1:b, r9:t // r8 = tmp2
++ machh.w r6, r1:t, r9:b // r6 = tmp3
++ mulhh.w r9, r7:b, lr:t // r9 = z1
++ mulhh.w r7, r7:t, lr:b // r7 = z2
++
++
++ add r10, r9
++ add r0, r7
++ add r8, r7
++ add r6, r9
++
++ add r1, r2, r6 // r1 = dataptr[DCTSIZE*0]
++ sub r2, r2, r6 // r2 = dataptr[DCTSIZE*7]
++ add r6, r4, r8 // r6 = dataptr[DCTSIZE*1]
++ sub r4, r4, r8 // r4 = dataptr[DCTSIZE*6]
++ add r8, r5, r0 // r8 = dataptr[DCTSIZE*2]
++ sub r5, r5, r0 // r5 = dataptr[DCTSIZE*5]
++ add r0, r3, r10 // r0 = dataptr[DCTSIZE*3]
++ sub r3, r3, r10 // r3 = dataptr[DCTSIZE*4]
++
++ satrnds r1 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r2 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r6 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r4 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r8 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r5 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r0 >> (CONST_BITS+PASS1_BITS+3), 9
++ satrnds r3 >> (CONST_BITS+PASS1_BITS+3), 9
++
++ packw.sh r7, r1, r6
++ packw.sh r6, r8, r0
++ packw.sh r5, r3, r5
++ packw.sh r4, r4, r2
++
++ stm r12, r4-r7
++ sub sp, -2 // Increment the dataptr
++ sub r12, -16
++
++ sub loop_cnt, 1 //Decrement loop counter
++ brne 0b //Perform loop one more time if loop_cnt is not zero
++
++ sub sp, -(8*8*2 - 8)
++ popm r0-r3, r4-r7, pc //Pop back registers and PC
++
++
++
++ .align 2
++coef_table_idct:
++ .short FIX_0_541196100, -FIX_1_847759065, FIX_0_765366865, FIX_1_175875602
++ .short - FIX_1_961570560, - FIX_0_390180644, FIX_0_298631336, FIX_2_053119869
++ .short FIX_3_072711026, FIX_1_501321110, - FIX_0_899976223, - FIX_2_562915447
++
+diff --git a/libavcodec/avr32/mc.S b/libavcodec/avr32/mc.S
+new file mode 100644
+index 0000000..07a002d
+--- /dev/null
++++ b/libavcodec/avr32/mc.S
+@@ -0,0 +1,434 @@
++/*
++ * Copyright (c) 2007 Atmel Corporation. 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 ATMEL may not be used to endorse or promote products
++ * derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL
++ * 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.
++ */
++
++
++ /* Macro for masking the lowest bit of each byte in a
++ packed word */
++ .macro packedmask1 reg, round
++ .if \round
++ and \reg, \reg, r8 >> 1
++ .else
++ and \reg, r8
++ .endif
++ .endm
++
++ /* Macro for 8 pixel wide horizontal and vertical interpolation functions */
++ .macro pixels8_hv round, put
++
++
++ pushm r0-r7, lr
++
++ /* R12 = uint8_t *block, R11 = uint8_t pixels, R10 = int line_size, R9 = int h */
++
++ /* Rounding immediate */
++ .if \round
++ mov r8, lo(0x02020202)
++ orh r8, hi(0x02020202)
++ .else
++ mov r8, lo(0x01010101)
++ orh r8, hi(0x01010101)
++ .endif
++ mov r7, 2
++
++ /* Pixel naming convention :
++
++ |-----------------------------------------------------|
++ | s00 | s01 | s02 | s03 | s04 | s05 | s06 | s07 | s08 |
++ |----d00---d01---d02---d03---d04---d05---d06---d07----|
++ | s10 | s11 | s12 | s13 | s14 | s15 | s16 | s17 | s18 |
++ |-----------------------------------------------------|
++ */
++1:
++ ld.w r0, r11[0] // r0 = { s00, s01, s02, s03 }
++ ld.w r1, r11[1] // r1 = { s01, s02, s03, s04 }
++ mov lr, r9
++ eor r2, r0, r1
++ packedmask1 r2, \round
++ add r2, r8
++
++ paddh.ub r0, r0, r1 // r0 = {(s00+s01)/2,(s01+s02)/2,(s02+s03)/2,(s03+s04)/2}
++
++ add r11, r10 // pixels += line_size
++ ld.w r1, r11[0] // r1 = { s10, s11, s12, s13 }
++ ld.w r3, r11[1] // r3 = { s11, s12, s13, s14 }
++0:
++ eor r5, r1, r3
++ packedmask1 r5, \round
++ add r2, r5
++
++ paddh.ub r1, r1, r3 // r1 = {(s10+s11)/2,(s11+s12)/2,(s12+s13)/2,(s13+s14)/2}
++ eor r6, r0, r1
++ packedmask1 r6, \round
++ add r2, r2, r6 << 1
++
++ ld.w r3, r11[r10] // r3 = { s00, s01, s02, s03 }
++ add r11, r10 // pixels += line_size
++ ld.w r4, r11[1] // r4 = { s01, s02, s03, s04 }
++
++ paddh.ub r0, r0, r1
++ plsr.b r2, r2, 2
++ padd.b r0, r0, r2 // r0 = { d00, d01, d02, d03 }
++
++ /* Next row */
++ .if \put
++ eor r2, r3, r4
++ packedmask1 r2, \round
++ add r2, r8
++ .else
++ ld.w r6, r12[0]
++ eor r2, r3, r4
++ packedmask1 r2, \round
++ add r2, r8
++ pavg.ub r0, r0, r6
++ .endif
++ st.w r12[0], r0 // Put data into the block
++
++ add r5, r2
++ paddh.ub r0, r3, r4 // r0 = {(s00+s01)/2,(s01+s02)/2,(s02+s03)/2,(s03+s04)/2}
++
++ eor r6, r0, r1
++ packedmask1 r6, \round
++ add r5, r5, r6 << 1
++
++ .if \put
++ paddh.ub r1, r0, r1
++ plsr.b r5, r5, 2
++ padd.b r1, r1, r5 // r1 = { d10, d11, d12, d13 }
++ .else
++ ld.w r3, r12[r10]
++ paddh.ub r1, r0, r1
++ plsr.b r5, r5, 2
++ padd.b r1, r1, r5 // r1 = { d10, d11, d12, d13 }
++ pavg.ub r1, r1, r3
++ .endif
++
++ st.w r12[r10], r1 // Put data into the block
++
++
++ ld.w r1, r11[r10] // r1 = { s10, s11, s12, s13 }
++ add r11, r10 // pixels += line_size
++ ld.w r3, r11[1] // r3 = { s11, s12, s13, s14 }
++ add r12, r12, r10 << 1 // block += 2*line_size
++ sub lr, 2
++ brne 0b
++
++ mul r0, r10, r9 // r0 = line_size * h
++ rsub r0, r0, 4 // r0 = 4 - (line_size * h)
++ add r11, r0
++ sub r11, r10 // pixels += 4 - (line_size * (h+1))
++ add r12, r0 // pixels += 4 - (line_size * (h))
++ sub r7, 1
++ brne 1b
++
++ popm r0-r7, pc
++ .endm
++
++
++ /* Macro for 8 pixel wide vertical interpolation functions */
++
++ .macro pixels8_v round, put
++ pushm r4-r7,lr
++ /* R12 = uint8_t *block, R11 = uint8_t pixels, R10 = int line_size, R9 = int h */
++
++ /*
++ Pixel Naming Convention :
++ |-----------------------------------------------|
++ | s00 | s01 | s02 | s03 | s04 | s05 | s06 | s07 |
++ |-d00---d01---d02---d03---d04---d05---d06---d07-|
++ | s10 | s11 | s12 | s13 | s14 | s15 | s16 | s17 |
++ |-----------------------------------------------|
++ */
++ ld.w r8, r11[r10] // r8 = { s10, s11, s12, s13 }
++ ld.w lr, r11++ // lr = { s00, s01, s02, s03 }, src += 4
++ ld.w r7, r11[0] // r7 = { s04, s05, s06, s07 }
++ ld.w r6, r11[r10] // r6 = { s14, s15, s16, s17 }
++ sub r10, 4 // stride -= 4
++ add r11, r11, r10 << 1 // src += 2*stride
++ sub r11, -4 // src += 4
++
++0:
++ .if \round
++ pavg.ub r5, r8, lr // r5 = {(s10+s00)/2,(s11+s01)/2,(s12+s02)/2,(s13+s03)/2}
++ pavg.ub r4, r6, r7 // r4 = {(s14+s04)/2,(s15+s05)/2,(s16+s06)/2,(s17+s07)/2}
++ .else
++ paddh.ub r5, r8, lr // r5 = {(s10+s00)/2,(s11+s01)/2,(s12+s02)/2,(s13+s03)/2}
++ paddh.ub r4, r6, r7 // r4 = {(s14+s04)/2,(s15+s05)/2,(s16+s06)/2,(s17+s07)/2}
++ .endif
++
++ .if \put
++ st.w r12++, r5 // *dst++ = { d00, d01, d02, d03 }
++ ld.w lr, r11++ // lr = { s10, s11, s12, s13 }, src += 4
++ st.w r12[0], r4 // *dst = { d04, d05, d06, d07 }
++ ld.w r7, r11[0] // r7 = { s14, s15, s16, s17 }
++ .else
++ ld.w lr, r12[0]
++ ld.w r7, r12[4]
++ pavg.ub r5, r5, lr
++ pavg.ub r4, r4, r7
++ st.w r12++, r5 // *dst++ = { d00, d01, d02, d03 }
++ ld.w lr, r11++ // lr = { s10, s11, s12, s13 }, src += 4
++ st.w r12[0], r4 // *dst = { d04, d05, d06, d07 }
++ ld.w r7, r11[0] // r7 = { s14, s15, s16, s17 }
++ .endif
++ add r11, r10 // src += stride
++#ifdef USE_PREFETCH
++ pref r11[0]
++#endif
++ add r12, r10 // dst += stride
++
++ .if \round
++ pavg.ub r5, r8, lr // r5 = {(s10+s00)/2,(s11+s01)/2,(s12+s02)/2,(s13+s03)/2}
++ pavg.ub r4, r6, r7 // r4 = {(s14+s04)/2,(s15+s05)/2,(s16+s06)/2,(s17+s07)/2}
++ .else
++ paddh.ub r5, r8, lr // r5 = {(s10+s00)/2,(s11+s01)/2,(s12+s02)/2,(s13+s03)/2}
++ paddh.ub r4, r6, r7 // r4 = {(s14+s04)/2,(s15+s05)/2,(s16+s06)/2,(s17+s07)/2}
++ .endif
++ .if \put
++ st.w r12++, r5 // *dst++ = { d00, d01, d02, d03 }
++ ld.w r8, r11++ // r8 = { s10, s11, s12, s13 }, src += 4
++ st.w r12[0], r4 // *dst = { d04, d05, d06, d07 }
++ ld.w r6, r11[0] // r6 = { s14, s15, s16, s17 }
++ .else
++ ld.w r8, r12[0]
++ ld.w r6, r12[4]
++ pavg.ub r5, r5, r8
++ pavg.ub r4, r4, r6
++ st.w r12++, r5 // *dst++ = { d00, d01, d02, d03 }
++ ld.w r8, r11++ // r8 = { s10, s11, s12, s13 }, src += 4
++ st.w r12[0], r4 // *dst = { d04, d05, d06, d07 }
++ ld.w r6, r11[0] // r6 = { s14, s15, s16, s17 }
++ .endif
++
++ add r11, r10 // src += stride
++#ifdef USE_PREFETCH
++ pref r11[0]
++#endif
++ add r12, r10 // dst += stride
++ sub r9, 2
++ brne 0b
++
++ popm r4-r7,pc
++ .endm
++
++ /* Macro for 8 pixel wide horizontal interpolation functions */
++
++ .macro pixels8_h round, put
++ pushm r4-r7, lr
++
++ /* R12 = uint8_t *block, R11 = uint8_t pixels, R10 = int line_size, R9 = int h */
++ /*
++ Pixel Naming Convention:
++ |--------------------------------------------------------------------|
++ | s00 d00 s01 d01 s02 d02 s03 d03 s04 d04 s05 d05 s06 d06 s07 d07 s08|
++ |------|-------|-------|-------|-------|-------|-------|-------|-----|
++ | s10 d10 s11 d11 s12 d12 s13 d13 s14 d14 s15 d15 s16 d16 s17 d17 s18|
++ |--------------------------------------------------------------------|
++ */
++
++ ld.w lr, r11[0] // lr = { s00, s01, s02, s03 }
++ ld.w r8, r11[1] // r8 = { s01, s02, s03, s04 }
++ ld.w r7, r11[4] // r7 = { s04, s05, s06, s07 }
++ ld.w r6, r11[5] // r6 = { s05, s06, s07, s08 }
++ add r11, r10 // src += stride
++
++0:
++ .if \round
++ pavg.ub lr, r8, lr // lr = {(s00+s01)/2,(s01+s02)/2,(s02+s03)/2,(s03+s04)/2}
++ pavg.ub r7, r6, r7 // r7 = {(s04+s05)/2,(s05+s06)/2,(s06+s07)/2,(s07+s08)/2}
++ .else
++ paddh.ub lr, r8, lr // lr = {(s00+s01)/2,(s01+s02)/2,(s02+s03)/2,(s03+s04)/2}
++ paddh.ub r7, r6, r7 // r7 = {(s04+s05)/2,(s05+s06)/2,(s06+s07)/2,(s07+s08)/2}
++ .endif
++ .if \put
++ ld.w r5, r11[0] // r5 = { s00, s01, s02, s03 }
++ ld.w r4, r11[1] // r4 = { s01, s02, s03, s04 }
++ .else
++ ld.w r8, r12[0]
++ ld.w r6, r12[4]
++ ld.w r5, r11[0] // r5 = { s00, s01, s02, s03 }
++ ld.w r4, r11[1] // r4 = { s01, s02, s03, s04 }
++ pavg.ub lr, lr, r8
++ pavg.ub r7, r7, r6
++ .endif
++ st.w r12[0], lr // dst = { d00, d01, d02, d03 }
++ st.w r12[4], r7 // dst = { d04, d05, d06, d07 }
++ ld.w r8, r11[4] // r8 = { s04, s05, s06, s07 }
++ ld.w r6, r11[5] // r6 = { s05, s06, s07, s08 }
++ add r11, r10 // src += stride
++#ifdef USE_PREFETCH
++ pref r11[0]
++#endif
++ add r12, r10 // dst += stride
++
++ .if \round
++ pavg.ub r5, r4, r5 // r5 = {(s00+s01)/2,(s01+s02)/2,(s02+s03)/2,(s03+s04)/2}
++ pavg.ub r4, r6, r8 // r4 = {(s04+s05)/2,(s05+s06)/2,(s06+s07)/2,(s07+s08)/2}
++ .else
++ paddh.ub r5, r4, r5 // r5 = {(s00+s01)/2,(s01+s02)/2,(s02+s03)/2,(s03+s04)/2}
++ paddh.ub r4, r6, r8 // r4 = {(s04+s05)/2,(s05+s06)/2,(s06+s07)/2,(s07+s08)/2}
++ .endif
++ .if \put
++ ld.w lr, r11[0] // lr = { s00, s01, s02, s03 }
++ ld.w r8, r11[1] // r8 = { s01, s02, s03, s04 }
++ .else
++ ld.w r7, r12[0]
++ ld.w r6, r12[4]
++ ld.w lr, r11[0] // lr = { s00, s01, s02, s03 }
++ ld.w r8, r11[1] // r8 = { s01, s02, s03, s04 }
++ pavg.ub r5, r5, r7
++ pavg.ub r4, r4, r6
++ .endif
++ st.w r12[0], r5 // dst = { d00, d01, d02, d03 }
++ st.w r12[4], r4 // dst = { d04, d05, d06, d07 }
++ ld.w r7, r11[4] // r7 = { s04, s05, s06, s07 }
++ ld.w r6, r11[5] // r6 = { s05, s06, s07, s08 }
++ add r11, r10 // src += stride
++#ifdef USE_PREFETCH
++ pref r11[0]
++#endif
++ add r12, r10 // dst += stride
++ sub r9, 2
++ brne 0b
++
++ popm r4-r7, pc
++ .endm
++
++ /* Macro for 8 pixel wide copy functions */
++ .macro pixels8 put
++ stm --sp, r3-r7,lr
++ /* R12 = uint8_t *block, R11 = uint8_t pixels, R10 = int line_size, R9 = int h */
++ mov lr, r9
++ sub r3, r10, 2 // stride2 = stride - 2
++0:
++ .if \put
++ ld.w r9, r11[r10] // r9 = { s10, s11, s12, s13 }
++ ld.w r7, r11++ // r7 = { s00, s01, s02, s03 }, src += 4
++ ld.w r6, r11[0] // r6 = { s04, s05, s06, s07 }
++ ld.w r8, r11[r10] // r8 = { s14, s15, s16, s17 }
++ .else
++ ld.w r9, r11[r10] // r9 = { s10, s11, s12, s13 }
++ ld.d r4, r12[0]
++ ld.w r7, r11++ // r7 = { s00, s01, s02, s03 }, src += 4
++ ld.w r6, r11[0] // r6 = { s04, s05, s06, s07 }
++ ld.w r8, r11[r10] // r8 = { s14, s15, s16, s17 }
++ pavg.ub r6, r6, r4
++ pavg.ub r7, r7, r5
++ ld.d r4, r12[r10]
++ .endif
++ st.d r12, r6 // *dst = { s00, s01, s02, s03, s04, s05, s06, s07 }
++ add r11, r11, r3 << 1 // src += stride2 * 2
++ .ifeq \put
++ pavg.ub r8, r8, r4
++ pavg.ub r9, r9, r5
++ .endif
++ st.d r12[r10 << 0], r8 // *(dst + stride) = { s10, s11, s12, s13, s14, s15, s16, s17 }
++ add r12, r12, r10 << 1 // dst += 2*stride
++ sub lr, 2
++ brne 0b
++ ldm sp++, r3-r7,pc
++
++ .endm
++
++ .global put_no_rnd_pixels8_hv_avr32
++ .text
++put_no_rnd_pixels8_hv_avr32:
++ pixels8_hv 0, 1
++
++ .global put_pixels8_hv_avr32
++ .text
++put_pixels8_hv_avr32:
++ pixels8_hv 1, 1
++
++ .global avg_no_rnd_pixels8_hv_avr32
++ .text
++avg_no_rnd_pixels8_hv_avr32:
++ pixels8_hv 0, 0
++
++ .global avg_pixels8_hv_avr32
++ .text
++avg_pixels8_hv_avr32:
++ pixels8_hv 1, 0
++
++ .global put_no_rnd_pixels8_v_avr32
++ .text
++put_no_rnd_pixels8_v_avr32:
++ pixels8_v 0, 1
++
++ .global put_pixels8_v_avr32
++ .text
++put_pixels8_v_avr32:
++ pixels8_v 1, 1
++
++ .global avg_no_rnd_pixels8_v_avr32
++ .text
++avg_no_rnd_pixels8_v_avr32:
++ pixels8_v 0, 0
++
++ .global avg_pixels8_v_avr32
++ .text
++avg_pixels8_v_avr32:
++ pixels8_v 1, 0
++
++ .global put_no_rnd_pixels8_h_avr32
++ .text
++put_no_rnd_pixels8_h_avr32:
++ pixels8_h 0, 1
++
++ .global put_pixels8_h_avr32
++ .text
++put_pixels8_h_avr32:
++ pixels8_h 1, 1
++
++ .global avg_no_rnd_pixels8_h_avr32
++ .text
++avg_no_rnd_pixels8_h_avr32:
++ pixels8_h 0, 0
++
++ .global avg_pixels8_h_avr32
++ .text
++avg_pixels8_h_avr32:
++ pixels8_h 1, 0
++
++ .global put_pixels8_avr32
++ .global put_no_rnd_pixels8_avr32
++ .text
++put_pixels8_avr32:
++put_no_rnd_pixels8_avr32:
++ pixels8 1
++
++ .global avg_no_rnd_pixels8_avr32
++ .global avg_pixels8_avr32
++ .text
++avg_pixels8_avr32:
++avg_no_rnd_pixels8_avr32:
++ pixels8 0
+diff --git a/libavcodec/avr32/pico.h b/libavcodec/avr32/pico.h
+new file mode 100644
+index 0000000..32201ba
+--- /dev/null
++++ b/libavcodec/avr32/pico.h
+@@ -0,0 +1,260 @@
++/*
++ * Copyright (c) 2007 Atmel Corporation. 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 ATMEL may not be used to endorse or promote products
++ * derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL
++ * 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.
++ */
++#ifndef __PICO_H__
++#define __PICO_H__
++
++
++
++/* Coprocessor Number */
++#define PICO_CPNO 1
++
++/* Pixel Coprocessor Register file */
++#define PICO_REGVECT_INPIX2 cr0
++#define PICO_REGVECT_INPIX1 cr1
++#define PICO_REGVECT_INPIX0 cr2
++#define PICO_REGVECT_OUTPIX2 cr3
++#define PICO_REGVECT_OUTPIX1 cr4
++#define PICO_REGVECT_OUTPIX0 cr5
++#define PICO_REGVECT_COEFF0_A cr6
++#define PICO_REGVECT_COEFF0_B cr7
++#define PICO_REGVECT_COEFF1_A cr8
++#define PICO_REGVECT_COEFF1_B cr9
++#define PICO_REGVECT_COEFF2_A cr10
++#define PICO_REGVECT_COEFF2_B cr11
++#define PICO_REGVECT_VMU0_OUT cr12
++#define PICO_REGVECT_VMU1_OUT cr13
++#define PICO_REGVECT_VMU2_OUT cr14
++#define PICO_REGVECT_CONFIG cr15
++
++#define PICO_INPIX2 0
++#define PICO_INPIX1 1
++#define PICO_INPIX0 2
++#define PICO_OUTPIX2 3
++#define PICO_OUTPIX1 4
++#define PICO_OUTPIX0 5
++#define PICO_COEFF0_A 6
++#define PICO_COEFF0_B 7
++#define PICO_COEFF1_A 8
++#define PICO_COEFF1_B 9
++#define PICO_COEFF2_A 10
++#define PICO_COEFF2_B 11
++#define PICO_VMU0_OUT 12
++#define PICO_VMU1_OUT 13
++#define PICO_VMU2_OUT 14
++#define PICO_CONFIG 15
++
++/* Config Register */
++#define PICO_COEFF_FRAC_BITS_OFFSET 0
++#define PICO_COEFF_FRAC_BITS_SIZE 4
++#define PICO_OFFSET_FRAC_BITS_OFFSET 4
++#define PICO_OFFSET_FRAC_BITS_SIZE 4
++#define PICO_INPUT_MODE_OFFSET 8
++#define PICO_INPUT_MODE_SIZE 2
++#define PICO_OUTPUT_MODE_OFFSET 10
++#define PICO_OUTPUT_MODE_SIZE 1
++
++struct pico_config_t {
++ unsigned int : 32 - PICO_OUTPUT_MODE_OFFSET - PICO_OUTPUT_MODE_SIZE;
++ unsigned int output_mode : PICO_OUTPUT_MODE_SIZE;
++ unsigned int input_mode : PICO_INPUT_MODE_SIZE;
++ unsigned int offset_frac_bits : PICO_OFFSET_FRAC_BITS_SIZE;
++ unsigned int coeff_frac_bits : PICO_COEFF_FRAC_BITS_SIZE;
++ int vmu2_out;
++ int vmu1_out;
++ int vmu0_out;
++ short coeff2_2;
++ short coeff2_3;
++ short coeff2_0;
++ short coeff2_1;
++ short coeff1_2;
++ short coeff1_3;
++ short coeff1_0;
++ short coeff1_1;
++ short coeff0_2;
++ short coeff0_3;
++ short coeff0_0;
++ short coeff0_1;
++};
++
++
++#define PICO_COEFF_FRAC_BITS(x) (x << PICO_COEFF_FRAC_BITS_OFFSET)
++#define PICO_OFFSET_FRAC_BITS(x) (x << PICO_OFFSET_FRAC_BITS_OFFSET)
++#define PICO_INPUT_MODE(x) (x << PICO_INPUT_MODE_OFFSET)
++#define PICO_OUTPUT_MODE(x) (x << PICO_OUTPUT_MODE_OFFSET)
++
++#define GET_PICO_COEFF_FRAC_BITS(x) ((x >> PICO_COEFF_FRAC_BITS_OFFSET)&((1 << PICO_COEFF_FRAC_BITS_SIZE)-1))
++#define GET_PICO_OFFSET_FRAC_BITS(x) ((x >> PICO_OFFSET_FRAC_BITS_OFFSET)&((1 << PICO_OFFSET_FRAC_BITS_SIZE)-1))
++#define GET_PICO_INPUT_MODE(x) ((x >> PICO_INPUT_MODE_OFFSET)&((1 << PICO_INPUT_MODE_SIZE)-1))
++#define GET_PICO_OUTPUT_MODE(x) ((x >> PICO_OUTPUT_MODE_OFFSET)&((1 << PICO_OUTPUT_MODE_SIZE)-1))
++
++enum pico_input_mode { PICO_TRANSFORMATION_MODE,
++ PICO_HOR_FILTER_MODE,
++ PICO_VERT_FILTER_MODE };
++
++enum pico_output_mode { PICO_PACKED_MODE,
++ PICO_PLANAR_MODE };
++
++/* Bits in coefficients */
++#define PICO_COEFF_BITS 12
++
++/* Operation bits */
++#define PICO_MATRIX (0)
++#define PICO_USE_ACC (1 << 2)
++#define PICO_SINGLE_VECTOR (1 << 3)
++
++
++#define __str(x...) #x
++#define __xstr(x...) __str(x)
++
++#define PICO_PUT_W(pico_reg, x) \
++ __builtin_mvrc_w(PICO_CPNO, pico_reg, x);
++#define PICO_GET_W(pico_reg) \
++ __builtin_mvcr_w(PICO_CPNO, pico_reg)
++
++#define PICO_MVCR_W(x, pico_reg) \
++ asm ("mvcr.w\tcp" __xstr(PICO_CPNO) ", %0, cr" __xstr(pico_reg) : "=r"(x));
++
++#define PICO_MVRC_W(pico_reg, x) \
++ asm ("mvrc.w\tcp" __xstr(PICO_CPNO) ", cr" __xstr(pico_reg) ", %0" :: "r"(x));
++
++#define PICO_PUT_D(pico_reg, x) \
++ __builtin_mvrc_d(PICO_CPNO, pico_reg, x);
++#define PICO_GET_D(pico_reg) \
++ __builtin_mvcr_d(PICO_CPNO, pico_reg)
++
++#define PICO_MVCR_D(x, pico_reg) \
++ asm volatile ("mvcr.d\tcp" __xstr(PICO_CPNO) ", %0, cr" __xstr(pico_reg) : "=r"(x));
++#define PICO_MVRC_D(pico_reg, x) \
++ asm volatile ("mvrc.d\tcp" __xstr(PICO_CPNO) ", cr" __xstr(pico_reg) ", %0" :: "r"(x));
++
++#define PICO_STCM_W(ptr, pico_regs...) \
++ asm volatile ("stcm.w\tcp" __xstr(PICO_CPNO) ", %0," __xstr(pico_regs) :: "r"(ptr));
++#define PICO_STCM_D(ptr, pico_regs...) \
++ asm volatile ("stcm.d\tcp" __xstr(PICO_CPNO) ", %0," __xstr(pico_regs) :: "r"(ptr));
++
++#define PICO_STCM_W_DEC(ptr, pico_regs...) \
++ asm volatile ("stcm.w\tcp" __xstr(PICO_CPNO) ", --%0," __xstr(pico_regs) : "+r"(ptr));
++#define PICO_STCM_D_DEC(ptr, pico_regs...) \
++ asm volatile ("stcm.d\tcp" __xstr(PICO_CPNO) ", --%0," __xstr(pico_regs) : "+r"(ptr));
++
++#define PICO_LDCM_W(ptr, pico_regs...) \
++ asm volatile ("ldcm.w\tcp" __xstr(PICO_CPNO) ", %0," __xstr(pico_regs) :: "r"(ptr));
++#define PICO_LDCM_D(ptr, pico_regs...) \
++ asm volatile ("ldcm.d\tcp" __xstr(PICO_CPNO) ", %0," __xstr(pico_regs) :: "r"(ptr));
++
++#define PICO_LDCM_W_INC(ptr, pico_regs...) \
++ asm volatile ("ldcm.w\tcp" __xstr(PICO_CPNO) ", %0++," __xstr(pico_regs) : "+r"(ptr));
++#define PICO_LDCM_D_INC(ptr, pico_regs...) \
++ asm volatile ("ldcm.d\tcp" __xstr(PICO_CPNO) ", %0++," __xstr(pico_regs) : "+r"(ptr));
++
++#define PICO_OP(op, dst_addr, addr0, addr1, addr2) \
++ __builtin_cop(PICO_CPNO, addr0, addr1, addr2, op | dst_addr);
++
++static inline void set_pico_config(struct pico_config_t *config){
++ PICO_LDCM_D(config,
++ PICO_REGVECT_COEFF0_A, PICO_REGVECT_COEFF0_B,
++ PICO_REGVECT_COEFF1_A, PICO_REGVECT_COEFF1_B,
++ PICO_REGVECT_COEFF2_A, PICO_REGVECT_COEFF2_B,
++ PICO_REGVECT_VMU0_OUT, PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT, PICO_REGVECT_CONFIG);
++}
++
++static inline void get_pico_config(struct pico_config_t *config){
++ PICO_STCM_D(config,
++ PICO_REGVECT_COEFF0_A, PICO_REGVECT_COEFF0_B,
++ PICO_REGVECT_COEFF1_A, PICO_REGVECT_COEFF1_B,
++ PICO_REGVECT_COEFF2_A, PICO_REGVECT_COEFF2_B,
++ PICO_REGVECT_VMU0_OUT, PICO_REGVECT_VMU1_OUT,
++ PICO_REGVECT_VMU2_OUT, PICO_REGVECT_CONFIG);
++}
++
++static inline void dump_pico_config(){
++ struct pico_config_t pico_config;
++ char *input_mode, *output_mode;
++ get_pico_config(&pico_config);
++
++
++ av_log(NULL, AV_LOG_INFO, "Dumping pico configuration:\n\n");
++ av_log(NULL, AV_LOG_INFO, "\tcoeff_frac_bits = %d\n", pico_config.coeff_frac_bits);
++ av_log(NULL, AV_LOG_INFO, "\toffset_frac_bits = %d\n", pico_config.offset_frac_bits);
++
++ switch ( pico_config.input_mode ){
++ case PICO_TRANSFORMATION_MODE:
++ input_mode = "Transformation Mode";
++ break;
++ case PICO_HOR_FILTER_MODE:
++ input_mode = "Horisontal Filter Mode";
++ break;
++ case PICO_VERT_FILTER_MODE:
++ input_mode = "Vertical Filter Mode";
++ break;
++ default:
++ input_mode = "Unknown Mode!!";
++ break;
++ }
++ av_log(NULL, AV_LOG_INFO, "\tinput_mode = %s\n", input_mode);
++
++ switch ( pico_config.output_mode ){
++ case PICO_PLANAR_MODE:
++ output_mode = "Planar Mode";
++ break;
++ case PICO_PACKED_MODE:
++ output_mode = "Packed Mode";
++ break;
++ default:
++ output_mode = "Unknown Mode!!";
++ break;
++ }
++
++ av_log(NULL, AV_LOG_INFO, "\toutput_mode = %s\n", output_mode);
++
++ av_log(NULL, AV_LOG_INFO, "\tCoeff0_0 = %f\n", (float)pico_config.coeff0_0/(float)(1 << pico_config.coeff_frac_bits));
++ av_log(NULL, AV_LOG_INFO, "\tCoeff0_1 = %f\n", (float)pico_config.coeff0_1/(float)(1 << pico_config.coeff_frac_bits));
++ av_log(NULL, AV_LOG_INFO, "\tCoeff0_2 = %f\n", (float)pico_config.coeff0_2/(float)(1 << pico_config.coeff_frac_bits));
++ av_log(NULL, AV_LOG_INFO, "\tCoeff0_3 = %f\n", (float)pico_config.coeff0_3/(float)(1 << pico_config.offset_frac_bits));
++
++ av_log(NULL, AV_LOG_INFO, "\tCoeff1_0 = %f\n", (float)pico_config.coeff1_0/(float)(1 << pico_config.coeff_frac_bits));
++ av_log(NULL, AV_LOG_INFO, "\tCoeff1_1 = %f\n", (float)pico_config.coeff1_1/(float)(1 << pico_config.coeff_frac_bits));
++ av_log(NULL, AV_LOG_INFO, "\tCoeff1_2 = %f\n", (float)pico_config.coeff1_2/(float)(1 << pico_config.coeff_frac_bits));
++ av_log(NULL, AV_LOG_INFO, "\tCoeff1_3 = %f\n", (float)pico_config.coeff1_3/(float)(1 << pico_config.offset_frac_bits));
++
++ av_log(NULL, AV_LOG_INFO, "\tCoeff2_0 = %f\n", (float)pico_config.coeff2_0/(float)(1 << pico_config.coeff_frac_bits));
++ av_log(NULL, AV_LOG_INFO, "\tCoeff2_1 = %f\n", (float)pico_config.coeff2_1/(float)(1 << pico_config.coeff_frac_bits));
++ av_log(NULL, AV_LOG_INFO, "\tCoeff2_2 = %f\n", (float)pico_config.coeff2_2/(float)(1 << pico_config.coeff_frac_bits));
++ av_log(NULL, AV_LOG_INFO, "\tCoeff2_3 = %f\n", (float)pico_config.coeff2_3/(float)(1 << pico_config.offset_frac_bits));
++}
++
++
++
++#endif
++
+diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h
+index 26b4f8d..1f8fabf 100644
+--- a/libavcodec/bitstream.h
++++ b/libavcodec/bitstream.h
+@@ -171,7 +171,7 @@ typedef struct RL_VLC_ELEM {
+ #endif
+
+ /* used to avoid missaligned exceptions on some archs (alpha, ...) */
+-#if defined(ARCH_X86) || defined(ARCH_X86_64)
++#if defined(ARCH_X86) || defined(ARCH_X86_64) || defined(ARCH_AVR32)
+ # define unaligned16(a) (*(const uint16_t*)(a))
+ # define unaligned32(a) (*(const uint32_t*)(a))
+ # define unaligned64(a) (*(const uint64_t*)(a))
+@@ -813,6 +813,44 @@ void free_vlc(VLC *vlc);
+ * if the vlc code is invalid and max_depth>1 than the number of bits removed
+ * is undefined
+ */
++
++#if defined(ARCH_AVR32)
++#define GET_VLC(code, name, gb, table, bits, max_depth)\
++{\
++ int n, index, nb_bits;\
++ union { VLC_TYPE vlc[2];\
++ uint32_t u32; } table_elem;\
++\
++ index= SHOW_UBITS(name, gb, bits);\
++ table_elem.u32 = unaligned32(&table[index]); \
++ code = table_elem.vlc[0];\
++ n = table_elem.vlc[1];\
++\
++ if(max_depth > 1 && n < 0 ){\
++ LAST_SKIP_BITS(name, gb, bits)\
++ UPDATE_CACHE(name, gb)\
++\
++ nb_bits = -n;\
++\
++ index= SHOW_UBITS(name, gb, nb_bits) + code;\
++ table_elem.u32 = unaligned32(&table[index]); \
++ code = table_elem.vlc[0];\
++ n = table_elem.vlc[1];\
++ if(max_depth > 2 && n < 0){\
++ LAST_SKIP_BITS(name, gb, nb_bits)\
++ UPDATE_CACHE(name, gb)\
++\
++ nb_bits = -n;\
++\
++ index= SHOW_UBITS(name, gb, nb_bits) + code;\
++ code = table[index][0];\
++ n = table[index][1];\
++ }\
++ }\
++ SKIP_BITS(name, gb, n)\
++}
++
++#else
+ #define GET_VLC(code, name, gb, table, bits, max_depth)\
+ {\
+ int n, index, nb_bits;\
+@@ -821,7 +859,7 @@ void free_vlc(VLC *vlc);
+ code = table[index][0];\
+ n = table[index][1];\
+ \
+- if(max_depth > 1 && n < 0){\
++ if(max_depth > 1 && n < 0 ){\
+ LAST_SKIP_BITS(name, gb, bits)\
+ UPDATE_CACHE(name, gb)\
+ \
+@@ -843,7 +881,38 @@ void free_vlc(VLC *vlc);
+ }\
+ SKIP_BITS(name, gb, n)\
+ }
++#endif
+
++#if defined(ARCH_AVR32)
++#define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)\
++{\
++ int n, index, nb_bits;\
++ union { RL_VLC_ELEM vlc;\
++ uint32_t u32; } table_elem;\
++\
++ index= SHOW_UBITS(name, gb, bits);\
++ table_elem.u32 = unaligned32(&table[index]); \
++ level = table_elem.vlc.level;\
++ n = table_elem.vlc.len;\
++\
++ if(max_depth > 1 && n < 0 ){\
++ SKIP_BITS(name, gb, bits)\
++ if(need_update){\
++ UPDATE_CACHE(name, gb)\
++ }\
++\
++ nb_bits = -n;\
++\
++ index= SHOW_UBITS(name, gb, nb_bits) + level;\
++ table_elem.u32 = unaligned32(&table[index]); \
++ level = table_elem.vlc.level;\
++ n = table_elem.vlc.len;\
++ }\
++ run= table_elem.vlc.run;\
++ SKIP_BITS(name, gb, n)\
++}
++
++#else
+ #define GET_RL_VLC(level, run, name, gb, table, bits, max_depth, need_update)\
+ {\
+ int n, index, nb_bits;\
+@@ -852,7 +921,7 @@ void free_vlc(VLC *vlc);
+ level = table[index].level;\
+ n = table[index].len;\
+ \
+- if(max_depth > 1 && n < 0){\
++ if(max_depth > 1 && n < 0 ){\
+ SKIP_BITS(name, gb, bits)\
+ if(need_update){\
+ UPDATE_CACHE(name, gb)\
+@@ -867,7 +936,7 @@ void free_vlc(VLC *vlc);
+ run= table[index].run;\
+ SKIP_BITS(name, gb, n)\
+ }
+-
++#endif
+
+ /**
+ * parses a vlc code, faster then get_vlc()
+diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
+index 56c42b9..8fc10c6 100644
+--- a/libavcodec/dsputil.c
++++ b/libavcodec/dsputil.c
+@@ -4197,6 +4197,9 @@ void dsputil_init(DSPContext* c, AVCodecContext *avctx)
+ #ifdef ARCH_BFIN
+ dsputil_init_bfin(c,avctx);
+ #endif
++#ifdef ARCH_AVR32
++ dsputil_init_avr32(c,avctx);
++#endif
+
+ for(i=0; i<64; i++){
+ if(!c->put_2tap_qpel_pixels_tab[0][i])
+diff --git a/libavcodec/h264.c b/libavcodec/h264.c
+index 865e80a..8f7c3f1 100644
+--- a/libavcodec/h264.c
++++ b/libavcodec/h264.c
+@@ -3258,7 +3258,12 @@ static void free_tables(H264Context *h){
+
+ static void init_dequant8_coeff_table(H264Context *h){
+ int i,q,x;
++#ifdef ARCH_AVR32
++ const int transpose = 0;
++#else
+ const int transpose = (h->s.dsp.h264_idct8_add != ff_h264_idct8_add_c); //FIXME ugly
++#endif
++
+ h->dequant8_coeff[0] = h->dequant8_buffer[0];
+ h->dequant8_coeff[1] = h->dequant8_buffer[1];
+
+@@ -3281,7 +3286,13 @@ static void init_dequant8_coeff_table(H264Context *h){
+
+ static void init_dequant4_coeff_table(H264Context *h){
+ int i,j,q,x;
++ // Yes this is ugly as hell....
++#ifdef ARCH_AVR32
++ const int transpose = 0;
++#else
+ const int transpose = (h->s.dsp.h264_idct_add != ff_h264_idct_add_c); //FIXME ugly
++#endif
++
+ for(i=0; i<6; i++ ){
+ h->dequant4_coeff[i] = h->dequant4_buffer[i];
+ for(j=0; j<i; j++){
+@@ -4663,7 +4674,11 @@ static int decode_slice_header(H264Context *h){
+ if (MPV_common_init(s) < 0)
+ return -1;
+
++#ifdef ARCH_AVR32
++ if ( 1 ){
++#else
+ if(s->dsp.h264_idct_add == ff_h264_idct_add_c){ //FIXME little ugly
++#endif
+ memcpy(h->zigzag_scan, zigzag_scan, 16*sizeof(uint8_t));
+ memcpy(h-> field_scan, field_scan, 16*sizeof(uint8_t));
+ }else{
+diff --git a/libavutil/common.h b/libavutil/common.h
+index 3ae5971..7e52b90 100644
+--- a/libavutil/common.h
++++ b/libavutil/common.h
+@@ -283,23 +283,39 @@ static inline int mid_pred(int a, int b, int c)
+ * @param amax maximum value of the clip range
+ * @return cliped value
+ */
++#if defined(ARCH_AVR32)
++#define clip(a, amin, amax) \
++ ({ int __tmp__; \
++ asm ("min\t%0, %1, %2\n" \
++ "max\t%0, %0, %3\n" \
++ : "=&r"(__tmp__) : "r"(a), "r"(amax), "r"(amin)); \
++ __tmp__; })
++#else
+ static inline int clip(int a, int amin, int amax)
+ {
+ if (a < amin) return amin;
+ else if (a > amax) return amax;
+ else return a;
+ }
++#endif
+
+ /**
+ * clip a signed integer value into the 0-255 range
+ * @param a value to clip
+ * @return cliped value
+ */
++#if defined(ARCH_AVR32)
++#define clip_uint8(a) \
++ ({ int __tmp__ = a; \
++ asm ("satu\t%0 >> 0, 8" : "+r"(__tmp__)); \
++ __tmp__; })
++#else
+ static inline uint8_t clip_uint8(int a)
+ {
+ if (a&(~255)) return (-a)>>31;
+ else return a;
+ }
++#endif
+
+ /* math */
+ int64_t ff_gcd(int64_t a, int64_t b);
+diff --git a/libavutil/internal.h b/libavutil/internal.h
+index 285d304..a8b0718 100644
+--- a/libavutil/internal.h
++++ b/libavutil/internal.h
+@@ -210,6 +210,15 @@ if((y)<(x)){\
+ }\
+ }
+
++/* XXX: Hack for uclibc which declares lrintf but does not implement it... */
++#ifdef ARCH_AVR32
++#undef HAVE_LRINTF
++#define HAVE_LRINTF 1
++#define lrintf(x) rint(x)
++#define llrint(x) (long long)rint(x)
++#endif
++
++
+ #ifndef HAVE_LRINTF
+ /* XXX: add ISOC specific test to avoid specific BSD testing. */
+ /* better than nothing implementation. */
+diff --git a/libfaad2/common.h b/libfaad2/common.h
+index f809042..6c5fb21 100644
+--- a/libfaad2/common.h
++++ b/libfaad2/common.h
+@@ -67,7 +67,7 @@ extern "C" {
+ /* Use if target platform has address generators with autoincrement */
+ //#define PREFER_POINTERS
+
+-#if defined(_WIN32_WCE) || defined(__arm__)
++#if defined(_WIN32_WCE) || defined(__arm__) || defined(__avr32__)
+ #define FIXED_POINT
+ #endif
+
+diff --git a/libmpcodecs/ad_libmad.c b/libmpcodecs/ad_libmad.c
+index 076359a..51b77fe 100644
+--- a/libmpcodecs/ad_libmad.c
++++ b/libmpcodecs/ad_libmad.c
+@@ -86,6 +86,11 @@ static int init(sh_audio_t *sh){
+ sh->channels=(this->frame.header.mode == MAD_MODE_SINGLE_CHANNEL) ? 1 : 2;
+ sh->samplerate=this->frame.header.samplerate;
+ sh->i_bps=this->frame.header.bitrate/8;
++#ifdef WORDS_BIGENDIAN
++ sh->sample_format = AF_FORMAT_S16_BE;
++#else
++ sh->sample_format = AF_FORMAT_S16_LE;
++#endif
+ sh->samplesize=2;
+
+ return 1;
+diff --git a/libswscale/pico-avr32.h b/libswscale/pico-avr32.h
+new file mode 100644
+index 0000000..7ac6200
+--- /dev/null
++++ b/libswscale/pico-avr32.h
+@@ -0,0 +1,137 @@
++/*
++ * Copyright (c) 2007 Atmel Corporation. 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 ATMEL may not be used to endorse or promote products
++ * derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL
++ * 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.
++ */
++#ifndef __PICO_H__
++#define __PICO_H__
++
++/* Coprocessor Number */
++#define PICO_CPNO 1
++
++/* Pixel Coprocessor Register file */
++#define PICO_REGVECT_INPIX2 cr0
++#define PICO_REGVECT_INPIX1 cr1
++#define PICO_REGVECT_INPIX0 cr2
++#define PICO_REGVECT_OUTPIX2 cr3
++#define PICO_REGVECT_OUTPIX1 cr4
++#define PICO_REGVECT_OUTPIX0 cr5
++#define PICO_REGVECT_COEFF0_A cr6
++#define PICO_REGVECT_COEFF0_B cr7
++#define PICO_REGVECT_COEFF1_A cr8
++#define PICO_REGVECT_COEFF1_B cr9
++#define PICO_REGVECT_COEFF2_A cr10
++#define PICO_REGVECT_COEFF2_B cr11
++#define PICO_REGVECT_VMU0_OUT cr12
++#define PICO_REGVECT_VMU1_OUT cr13
++#define PICO_REGVECT_VMU2_OUT cr14
++#define PICO_REGVECT_CONFIG cr15
++
++#define PICO_INPIX2 0
++#define PICO_INPIX1 1
++#define PICO_INPIX0 2
++#define PICO_OUTPIX2 3
++#define PICO_OUTPIX1 4
++#define PICO_OUTPIX0 5
++#define PICO_COEFF0_A 6
++#define PICO_COEFF0_B 7
++#define PICO_COEFF1_A 8
++#define PICO_COEFF1_B 9
++#define PICO_COEFF2_A 10
++#define PICO_COEFF2_B 11
++#define PICO_VMU0_OUT 12
++#define PICO_VMU1_OUT 13
++#define PICO_VMU2_OUT 14
++#define PICO_CONFIG 15
++
++/* Config Register */
++#define PICO_COEFF_FRAC_BITS 0
++#define PICO_COEFF_FRAC_BITS_WIDTH 4
++#define PICO_OFFSET_FRAC_BITS 4
++#define PICO_OFFSET_FRAC_BITS_WIDTH 4
++#define PICO_INPUT_MODE 8
++#define PICO_INPUT_MODE_WIDTH 2
++#define PICO_OUTPUT_MODE 10
++
++#define PICO_TRANSFORMATION_MODE 0
++#define PICO_HOR_FILTER_MODE 1
++#define PICO_VERT_FILTER_MODE 2
++
++#define PICO_PLANAR_MODE 1
++#define PICO_PACKED_MODE 0
++
++/* Bits in coefficients */
++#define PICO_COEFF_BITS 12
++
++/* Operation bits */
++#define PICO_USE_ACC (1 << 2)
++#define PICO_SINGLE_VECTOR (1 << 3)
++
++
++#define __str(x...) #x
++#define __xstr(x...) __str(x)
++
++#define PICO_PUT_W(pico_reg, x) \
++ __builtin_mvrc_w(PICO_CPNO, pico_reg, x);
++#define PICO_GET_W(pico_reg) \
++ __builtin_mvcr_w(PICO_CPNO, pico_reg)
++
++#define PICO_PUT_D(pico_reg, x) \
++ __builtin_mvrc_d(PICO_CPNO, pico_reg, x);
++#define PICO_GET_D(pico_reg) \
++ __builtin_mvcr_d(PICO_CPNO, pico_reg)
++
++
++#define PICO_STCM_W(ptr, pico_regs...) \
++ asm volatile ("stcm.w\tcp" __xstr(PICO_CPNO) ", %0," __xstr(pico_regs) :: "r"(ptr));
++#define PICO_STCM_D(ptr, pico_regs...) \
++ asm volatile ("stcm.d\tcp" __xstr(PICO_CPNO) ", %0," __xstr(pico_regs) :: "r"(ptr));
++
++#define PICO_STCM_W_DEC(ptr, pico_regs...) \
++ asm volatile ("stcm.w\tcp" __xstr(PICO_CPNO) ", --%0," __xstr(pico_regs) : "+r"(ptr));
++#define PICO_STCM_D_DEC(ptr, pico_regs...) \
++ asm volatile ("stcm.d\tcp" __xstr(PICO_CPNO) ", --%0," __xstr(pico_regs) : "+r"(ptr));
++
++#define PICO_LDCM_W(ptr, pico_regs...) \
++ asm volatile ("ldcm.w\tcp" __xstr(PICO_CPNO) ", %0," __xstr(pico_regs) :: "r"(ptr));
++#define PICO_LDCM_D(ptr, pico_regs...) \
++ asm volatile ("ldcm.d\tcp" __xstr(PICO_CPNO) ", %0," __xstr(pico_regs) :: "r"(ptr));
++
++#define PICO_LDCM_W_INC(ptr, pico_regs...) \
++ asm volatile ("ldcm.w\tcp" __xstr(PICO_CPNO) ", %0++," __xstr(pico_regs) : "+r"(ptr));
++#define PICO_LDCM_D_INC(ptr, pico_regs...) \
++ asm volatile ("ldcm.d\tcp" __xstr(PICO_CPNO) ", %0++," __xstr(pico_regs) : "+r"(ptr));
++
++#define PICO_OP(op, dst_addr, addr0, addr1, addr2) \
++ __builtin_cop(PICO_CPNO, addr0, addr1, addr2, op | dst_addr);
++
++
++#endif
++
+diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
+index ecd28f5..3221d0c 100644
+--- a/libswscale/swscale_internal.h
++++ b/libswscale/swscale_internal.h
+@@ -173,7 +173,7 @@ typedef struct SwsContext{
+ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c);
+ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation);
+
+-char *sws_format_name(int format);
++char *sws_format_name(enum PixelFormat format);
+
+ //FIXME replace this with something faster
+ #define isPlanarYUV(x) ((x)==PIX_FMT_YUV410P || (x)==PIX_FMT_YUV420P \
+diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
+index 71759bc..fa83985 100644
+--- a/libswscale/yuv2rgb.c
++++ b/libswscale/yuv2rgb.c
+@@ -44,6 +44,10 @@
+ #include "yuv2rgb_mlib.c"
+ #endif
+
++#ifdef ARCH_AVR32
++#include "yuv2rgb_avr32.c"
++#endif
++
+ #define DITHER1XBPP // only for mmx
+
+ const uint8_t __attribute__((aligned(8))) dither_2x2_4[2][8]={
+@@ -601,6 +605,12 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
+ if(t) return t;
+ }
+ #endif
++#ifdef ARCH_AVR32
++ {
++ SwsFunc t= yuv2rgb_init_avr32(c);
++ if(t) return t;
++ }
++#endif
+ #ifdef HAVE_ALTIVEC
+ if (c->flags & SWS_CPU_CAPS_ALTIVEC)
+ {
+@@ -678,6 +688,10 @@ int yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange,
+ //printf("%lld %lld %lld %lld %lld\n", cy, crv, cbu, cgu, cgv);
+ oy -= 256*brightness;
+
++#ifdef ARCH_AVR32
++ yuv2rgb_c_init_tables_avr32 (c, inv_table, fullRange, brightness, contrast, saturation);
++#endif
++
+ for (i = 0; i < 1024; i++) {
+ int j;
+
+diff --git a/libswscale/yuv2rgb_avr32.c b/libswscale/yuv2rgb_avr32.c
+new file mode 100644
+index 0000000..4a8341e
+--- /dev/null
++++ b/libswscale/yuv2rgb_avr32.c
+@@ -0,0 +1,416 @@
++/*
++ * Copyright (c) 2007 Atmel Corporation. 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 ATMEL may not be used to endorse or promote products
++ * derived from this software without specific prior written
++ * permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY ATMEL ``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 EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL
++ * 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 "pico-avr32.h"
++
++
++#define RGB(uv_part) \
++ __asm__ volatile ( \
++ "ld.w\t%0, %3[%7:" uv_part " << 2]\n\t" /* tmp = c->table_gV[V] */ \
++ "ld.w\t%1, %4[%8:" uv_part " << 2]\n\t" /* g = c->table_gU[U] */ \
++ "ld.w\t%2, %5[%8:" uv_part " << 2]\n\t" /* b = c->table_bU[U] */ \
++ "add\t%1, %0\n\t" /* g += tmp */\
++ "ld.w\t%0, %6[%7:" uv_part " << 2]" /* r = c->table_rV[V] */ \
++ : "=&r" (r), "=&r" (g), "=&r" (b) \
++ : "r" (&c->table_gV[0]), "r" (&c->table_gU[0]),"r" (&c->table_bU[0]), \
++ "r" (&c->table_rV[0]), "r" (V), "r" (U));
++
++
++#undef YUV2RGB1
++#define YUV2RGB1(dst, src, y, idx) \
++ { int tmp2; __asm__ volatile ( \
++ "ld.ub\t%0, %3[2*%8]\n\t" /* Y = ((uint32_t*)py_1)[0] */ \
++ "ld.ub\t%1, %4[%0]\n\t" /* tmp = r[(Y >> 24) & 0xFF] */ \
++ "ld.ub\t%2, %5[%0]\n\t" /* tmp = g[(Y >> 24) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 0], %1\n\t" /* dst_1[2] = tmp; */ \
++ "st.b\t%7[6*%8 + 1], %2\n\t" /* dst_1[1] = tmp; */ \
++ "ld.ub\t%1, %6[%0]\n\t" /* tmp = b[(Y >> 24) & 0xFF] */ \
++ "ld.ub\t%0, %3[2*%8 + 1]\n\t" /* Y = ((uint32_t*)py_1)[0] */ \
++ "st.b\t%7[6*%8 + 2], %1\n\t" /* dst_1[0] = tmp; */ \
++ "ld.ub\t%1, %4[%0]\n\t" /* tmp = r[(Y >> 16) & 0xFF] */ \
++ "ld.ub\t%2, %5[%0]\n\t" /* tmp = g[(Y >> 16) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 3], %1\n\t" /* dst_1[5] = tmp; */ \
++ "ld.ub\t%1, %6[%0]\n\t" /* tmp = b[(Y >> 16) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 4], %2\n\t" /* dst_1[4] = tmp; */ \
++ "st.b\t%7[6*%8 + 5], %1" /* dst_1[3] = tmp; */ \
++ : "=&r" (y), "=&r" (tmp), "=&r" (tmp2) \
++ : "r" (src), "r" (r), "r" (g), "r" (b), "r" (dst), "i" (idx)); }
++
++#undef YUV2RGB2
++#define YUV2RGB2(dst, src, y, idx) \
++ { int tmp2; __asm__ volatile ( \
++ "ld.ub\t%0, %3[2*%8]\n\t" /* Y = ((uint32_t*)py_1)[0] */ \
++ "ld.ub\t%1, %4[%0]\n\t" /* tmp = r[(Y >> 24) & 0xFF] */ \
++ "ld.ub\t%2, %5[%0]\n\t" /* tmp = g[(Y >> 24) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 0], %1\n\t" /* dst_1[2] = tmp; */ \
++ "st.b\t%7[6*%8 + 1], %2\n\t" /* dst_1[1] = tmp; */ \
++ "ld.ub\t%1, %6[%0]\n\t" /* tmp = b[(Y >> 24) & 0xFF] */ \
++ "ld.ub\t%0, %3[2*%8 + 1]\n\t" /* Y = ((uint32_t*)py_1)[0] */ \
++ "st.b\t%7[6*%8 + 2], %1\n\t" /* dst_1[0] = tmp; */ \
++ "ld.ub\t%1, %4[%0]\n\t" /* tmp = r[(Y >> 16) & 0xFF] */ \
++ "ld.ub\t%2, %5[%0]\n\t" /* tmp = g[(Y >> 16) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 3], %1\n\t" /* dst_1[5] = tmp; */ \
++ "ld.ub\t%1, %6[%0]\n\t" /* tmp = b[(Y >> 16) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 4], %2\n\t" /* dst_1[4] = tmp; */ \
++ "st.b\t%7[6*%8 + 5], %1" /* dst_1[3] = tmp; */ \
++ : "=&r" (y), "=&r" (tmp), "=&r" (tmp2) \
++ : "r" (src), "r" (r), "r" (g), "r" (b), "r" (dst), "i" (idx)); }
++
++
++#undef YUV2BGR1
++#define YUV2BGR1(dst, src, y, idx) \
++ { int tmp2; __asm__ volatile ( \
++ "ld.ub\t%0, %3[2*%8]\n\t" /* Y = ((uint32_t*)py_1)[0] */ \
++ "ld.ub\t%1, %4[%0]\n\t" /* tmp = r[(Y >> 24) & 0xFF] */ \
++ "ld.ub\t%2, %5[%0]\n\t" /* tmp = g[(Y >> 24) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 2], %1\n\t" /* dst_1[2] = tmp; */ \
++ "st.b\t%7[6*%8 + 1], %2\n\t" /* dst_1[1] = tmp; */ \
++ "ld.ub\t%1, %6[%0]\n\t" /* tmp = b[(Y >> 24) & 0xFF] */ \
++ "ld.ub\t%0, %3[2*%8 + 1]\n\t" /* Y = ((uint32_t*)py_1)[0] */ \
++ "st.b\t%7[6*%8 + 0], %1\n\t" /* dst_1[0] = tmp; */ \
++ "ld.ub\t%1, %4[%0]\n\t" /* tmp = r[(Y >> 16) & 0xFF] */ \
++ "ld.ub\t%2, %5[%0]\n\t" /* tmp = g[(Y >> 16) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 5], %1\n\t" /* dst_1[5] = tmp; */ \
++ "ld.ub\t%1, %6[%0]\n\t" /* tmp = b[(Y >> 16) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 4], %2\n\t" /* dst_1[4] = tmp; */ \
++ "st.b\t%7[6*%8 + 3], %1" /* dst_1[3] = tmp; */ \
++ : "=&r" (y), "=&r" (tmp), "=&r" (tmp2) \
++ : "r" (src), "r" (r), "r" (g), "r" (b), "r" (dst), "i" (idx)); }
++
++#undef YUV2BGR2
++#define YUV2BGR2(dst, src, y, idx) \
++ { int tmp2; __asm__ volatile ( \
++ "ld.ub\t%0, %3[2*%8]\n\t" /* Y = ((uint32_t*)py_1)[0] */ \
++ "ld.ub\t%1, %4[%0]\n\t" /* tmp = r[(Y >> 24) & 0xFF] */ \
++ "ld.ub\t%2, %5[%0]\n\t" /* tmp = g[(Y >> 24) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 2], %1\n\t" /* dst_1[2] = tmp; */ \
++ "st.b\t%7[6*%8 + 1], %2\n\t" /* dst_1[1] = tmp; */ \
++ "ld.ub\t%1, %6[%0]\n\t" /* tmp = b[(Y >> 24) & 0xFF] */ \
++ "ld.ub\t%0, %3[2*%8 + 1]\n\t" /* Y = ((uint32_t*)py_1)[0] */ \
++ "st.b\t%7[6*%8 + 0], %1\n\t" /* dst_1[0] = tmp; */ \
++ "ld.ub\t%1, %4[%0]\n\t" /* tmp = r[(Y >> 16) & 0xFF] */ \
++ "ld.ub\t%2, %5[%0]\n\t" /* tmp = g[(Y >> 16) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 5], %1\n\t" /* dst_1[5] = tmp; */ \
++ "ld.ub\t%1, %6[%0]\n\t" /* tmp = b[(Y >> 16) & 0xFF] */ \
++ "st.b\t%7[6*%8 + 4], %2\n\t" /* dst_1[4] = tmp; */ \
++ "st.b\t%7[6*%8 + 3], %1" /* dst_1[3] = tmp; */ \
++ : "=&r" (y), "=&r" (tmp), "=&r" (tmp2) \
++ : "r" (src), "r" (r), "r" (g), "r" (b), "r" (dst), "i" (idx)); }
++
++
++
++int yuv2bgr24_avr32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
++ int srcSliceH, uint8_t* dst[], int dstStride[]){
++ int y;
++
++ if(c->srcFormat == PIX_FMT_YUV422P){
++ srcStride[1] *= 2;
++ srcStride[2] *= 2;
++ }
++
++
++ for(y=0; y<srcSliceH; y+=2){
++ uint8_t *dst_1= (uint8_t*)(dst[0] + (y+srcSliceY )*dstStride[0]);
++ uint8_t *dst_2= (uint8_t*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);
++ uint32_t *r, *g, *b;
++ uint8_t *py_1= src[0] + y*srcStride[0];
++ uint8_t *py_2= py_1 + srcStride[0];
++ uint8_t *pu= src[1] + (y>>1)*srcStride[1];
++ uint8_t *pv= src[2] + (y>>1)*srcStride[2];
++ unsigned int h_size= c->dstW>>3;
++ while (h_size--) {
++ uint32_t U, V, Y1, Y2, tmp;
++ U = ((uint32_t*)pu)[0];
++ V = ((uint32_t*)pv)[0];
++
++ RGB("t")
++ YUV2BGR1(dst_1, py_1, Y1, 0)
++ YUV2BGR1(dst_2, py_2, Y2, 0)
++
++ RGB("u")
++ YUV2BGR2(dst_1, py_1, Y1, 1)
++ YUV2BGR2(dst_2, py_2, Y2, 1)
++
++ RGB("l")
++ YUV2BGR1(dst_1, py_1, Y1, 2)
++ YUV2BGR1(dst_2, py_2, Y2, 2)
++
++ RGB("b")
++ YUV2BGR2(dst_1, py_1, Y1, 3)
++ YUV2BGR2(dst_2, py_2, Y2, 3)
++
++
++
++ pu += 4;
++ pv += 4;
++ py_1 += 8;
++ py_2 += 8;
++ dst_1 += 24;
++ dst_2 += 24;
++ }
++ }
++ return srcSliceH;
++}
++
++
++
++static int yuv2rgb24_avr32(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
++ int srcSliceH, uint8_t* dst[], int dstStride[]){
++ int y;
++
++ if(c->srcFormat == PIX_FMT_YUV422P){
++ srcStride[1] *= 2;
++ srcStride[2] *= 2;
++ }
++ for(y=0; y<srcSliceH; y+=2){
++ uint8_t *dst_1= (uint8_t*)(dst[0] + (y+srcSliceY )*dstStride[0]);
++ uint8_t *dst_2= (uint8_t*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);
++ uint8_t *r, *g, *b;
++ uint8_t *py_1= src[0] + y*srcStride[0];
++ uint8_t *py_2= py_1 + srcStride[0];
++ uint8_t *pu= src[1] + (y>>1)*srcStride[1];
++ uint8_t *pv= src[2] + (y>>1)*srcStride[2];
++ unsigned int h_size= c->dstW>>3;
++ while (h_size--) {
++ uint32_t U, V, Y1, Y2, tmp;
++ U = ((uint32_t*)pu)[0];
++ V = ((uint32_t*)pv)[0];
++
++ RGB("t")
++ YUV2RGB1(dst_1, py_1, Y1, 0)
++ YUV2RGB1(dst_2, py_2, Y2, 0)
++
++ RGB("u")
++ YUV2RGB2(dst_1, py_1, Y1, 1)
++ YUV2RGB2(dst_2, py_2, Y2, 1)
++
++ RGB("l")
++ YUV2RGB1(dst_1, py_1, Y1, 2)
++ YUV2RGB1(dst_2, py_2, Y2, 2)
++
++ RGB("b")
++ YUV2RGB2(dst_1, py_1, Y1, 3)
++ YUV2RGB2(dst_2, py_2, Y2, 3)
++
++ pu += 4;
++ pv += 4;
++ py_1 += 8;
++ py_2 += 8;
++ dst_1 += 24;
++ dst_2 += 24;
++ }
++ }
++ return srcSliceH;
++}
++
++#define SCALE(x, bits) (((x) + ( 1 << (bits - 1))) >> bits)
++#define COEFF_FRAC_BITS 9
++#define OFFSET_FRAC_BITS 2
++
++/* Coefficients used in the pico */
++static struct {
++ short coeff2_2;
++ short coeff2_3;
++ short coeff2_0;
++ short coeff2_1;
++ short coeff1_2;
++ short coeff1_3;
++ short coeff1_0;
++ short coeff1_1;
++ short coeff0_2;
++ short coeff0_3;
++ short coeff0_0;
++ short coeff0_1;
++} pico_coeff;
++
++
++static int yuv2bgr24_avr32_pico(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
++ int srcSliceH, uint8_t* dst[], int dstStride[]){
++ int y;
++ static int first_time = 1;
++
++ /* Initialize pico */
++ PICO_LDCM_D(&pico_coeff,
++ PICO_REGVECT_COEFF0_A, PICO_REGVECT_COEFF0_B,
++ PICO_REGVECT_COEFF1_A, PICO_REGVECT_COEFF1_B,
++ PICO_REGVECT_COEFF2_A, PICO_REGVECT_COEFF2_B);
++
++ PICO_PUT_W(PICO_CONFIG,
++ (PICO_PACKED_MODE << PICO_OUTPUT_MODE
++ | PICO_TRANSFORMATION_MODE << PICO_INPUT_MODE
++ | OFFSET_FRAC_BITS << PICO_OFFSET_FRAC_BITS
++ | COEFF_FRAC_BITS << PICO_COEFF_FRAC_BITS));
++
++
++ if(c->srcFormat == PIX_FMT_YUV422P){
++ srcStride[1] *= 2;
++ srcStride[2] *= 2;
++ }
++
++ for(y=0; y<srcSliceH; y+=2){
++ uint8_t *dst_1= (uint8_t*)(dst[0] + (y+srcSliceY )*dstStride[0]);
++ uint8_t *dst_2= (uint8_t*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);
++ uint8_t *r, *g, *b;
++ uint8_t *py_1= src[0] + y*srcStride[0];
++ uint8_t *py_2= py_1 + srcStride[0];
++ uint8_t *pu= src[1] + (y>>1)*srcStride[1];
++ uint8_t *pv= src[2] + (y>>1)*srcStride[2];
++ unsigned int h_size= c->dstW>>3;
++ int *py_1_int = (int *)py_1;
++ int *py_2_int = (int *)py_2;
++ int *pu_int = (int *)pu;
++ int *pv_int = (int *)pv;
++ while (h_size--) {
++ PICO_PUT_W(PICO_INPIX0, *py_1_int++);
++ PICO_PUT_W(PICO_INPIX1, *pu_int++);
++ PICO_PUT_W(PICO_INPIX2, *pv_int++);
++ PICO_OP(0, 0, 0, 4, 8);
++ PICO_OP(0, 1, 1, 4, 8);
++ PICO_OP(0, 2, 2, 5, 9);
++ PICO_OP(0, 3, 3, 5, 9);
++ PICO_PUT_W(PICO_INPIX0, *py_1_int++);
++ PICO_STCM_W(dst_1, PICO_REGVECT_OUTPIX2, PICO_REGVECT_OUTPIX1, PICO_REGVECT_OUTPIX0);
++ PICO_OP(0, 0, 0, 6, 10);
++ PICO_OP(0, 1, 1, 6, 10);
++ PICO_OP(0, 2, 2, 7, 11);
++ PICO_OP(0, 3, 3, 7, 11);
++ PICO_PUT_W(PICO_INPIX0, *py_2_int++);
++ PICO_STCM_W(dst_1 + 12, PICO_REGVECT_OUTPIX2, PICO_REGVECT_OUTPIX1, PICO_REGVECT_OUTPIX0);
++
++ PICO_OP(0, 0, 0, 4, 8);
++ PICO_OP(0, 1, 1, 4, 8);
++ PICO_OP(0, 2, 2, 5, 9);
++ PICO_OP(0, 3, 3, 5, 9);
++ PICO_PUT_W(PICO_INPIX0, *py_2_int++);
++ PICO_STCM_W(dst_2, PICO_REGVECT_OUTPIX2, PICO_REGVECT_OUTPIX1, PICO_REGVECT_OUTPIX0);
++ PICO_OP(0, 0, 0, 6, 10);
++ PICO_OP(0, 1, 1, 6, 10);
++ PICO_OP(0, 2, 2, 7, 11);
++ PICO_OP(0, 3, 3, 7, 11);
++ PICO_STCM_W(dst_2 + 12, PICO_REGVECT_OUTPIX2, PICO_REGVECT_OUTPIX1, PICO_REGVECT_OUTPIX0);
++
++ dst_1 += 24;
++ dst_2 += 24;
++ }
++ }
++ return srcSliceH;
++}
++
++extern int avr32_use_pico;
++
++SwsFunc yuv2rgb_init_avr32 (SwsContext *c){
++ switch(c->dstFormat){
++ case PIX_FMT_BGR24:
++ {
++ if ( avr32_use_pico ){
++ MSG_ERR("AVR32 BGR24: Using PICO for color space conversion\n");
++ return yuv2bgr24_avr32_pico;
++ } else {
++ MSG_ERR("AVR32 BGR24: Using optimized color space conversion\n");
++ return yuv2bgr24_avr32;
++ }
++ }
++ break;
++ case PIX_FMT_RGB24:
++ {
++ if ( avr32_use_pico ){
++ MSG_ERR("AVR32 RGB24: Using PICO for color space conversion\n");
++ return yuv2bgr24_avr32_pico;
++ } else {
++ MSG_ERR("AVR32 RGB24: Using optimized color space conversion\n");
++ return yuv2rgb24_avr32;
++ }
++ }
++ }
++ return NULL;
++}
++
++
++int yuv2rgb_c_init_tables_avr32 (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation){
++ const int isRgb = (c->dstFormat == PIX_FMT_RGB24);
++
++ int64_t crv = inv_table[0];
++ int64_t cbu = inv_table[1];
++ int64_t cgu = -inv_table[2];
++ int64_t cgv = -inv_table[3];
++ int64_t cy = 1<<16;
++ int64_t oy = 0;
++
++ if(!fullRange){
++ cy= (cy*255) / 219;
++ oy= 16<<16;
++ }
++
++ cy = (cy *contrast )>>16;
++ crv= (crv*contrast * saturation)>>32;
++ cbu= (cbu*contrast * saturation)>>32;
++ cgu= (cgu*contrast * saturation)>>32;
++ cgv= (cgv*contrast * saturation)>>32;
++
++ oy -= 256*brightness;
++
++ pico_coeff.coeff1_0 = SCALE(cy, 16 - COEFF_FRAC_BITS); /* G <- Y */
++ pico_coeff.coeff1_1 = SCALE(cgu, 16 - COEFF_FRAC_BITS); /* G <- U */
++ pico_coeff.coeff1_2 = SCALE(cgv, 16 - COEFF_FRAC_BITS); /* G <- V */
++ pico_coeff.coeff1_3 = (SCALE(-128*cgu - 128*cgv - 16*cy, 16 - OFFSET_FRAC_BITS)
++ + /*0.5*/(1 << (OFFSET_FRAC_BITS-1))); /* G offset */
++
++ if ( isRgb ){
++ pico_coeff.coeff0_0 = SCALE(cy, 16 - COEFF_FRAC_BITS); /* R <- Y */
++ pico_coeff.coeff0_1 = 0; /* R <- U */
++ pico_coeff.coeff0_2 = SCALE(crv, 16 - COEFF_FRAC_BITS); /* R <- V */
++ pico_coeff.coeff0_3 = (SCALE(-128*crv - 16*cy, 16 - OFFSET_FRAC_BITS)
++ + /*0.5*/(1 << (OFFSET_FRAC_BITS-1))); /* R offset */
++
++ pico_coeff.coeff2_0 = SCALE(cy, 16 - COEFF_FRAC_BITS); /* B <- Y */
++ pico_coeff.coeff2_1 = SCALE(cbu, 16 - COEFF_FRAC_BITS); /* B <- U */
++ pico_coeff.coeff2_2 = 0; /* B <- V */
++ pico_coeff.coeff2_3 = (SCALE(-128*cbu - 16*cy, 16 - OFFSET_FRAC_BITS)
++ + /*0.5*/(1 << (OFFSET_FRAC_BITS-1)));/* B offset */
++ } else {
++ pico_coeff.coeff2_0 = SCALE(cy, 16 - COEFF_FRAC_BITS); /* R <- Y */
++ pico_coeff.coeff2_1 = 0; /* R <- U */
++ pico_coeff.coeff2_2 = SCALE(crv, 16 - COEFF_FRAC_BITS); /* R <- V */
++ pico_coeff.coeff2_3 = (SCALE(-128*crv - 16*cy, 16 - OFFSET_FRAC_BITS)
++ + /*0.5*/(1 << (OFFSET_FRAC_BITS-1))); /* R offset */
++
++ pico_coeff.coeff0_0 = SCALE(cy, 16 - COEFF_FRAC_BITS); /* B <- Y */
++ pico_coeff.coeff0_1 = SCALE(cbu, 16 - COEFF_FRAC_BITS); /* B <- U */
++ pico_coeff.coeff0_2 = 0; /* B <- V */
++ pico_coeff.coeff0_3 = (SCALE(-128*cbu - 16*cy, 16 - OFFSET_FRAC_BITS)
++ + /*0.5*/(1 << (OFFSET_FRAC_BITS-1))); /* B offset */
++ }
++
++}
++
++
++#undef RGB
+diff --git a/libvo/vo_fbdev2.c b/libvo/vo_fbdev2.c
+index 053c193..7017770 100644
+--- a/libvo/vo_fbdev2.c
++++ b/libvo/vo_fbdev2.c
+@@ -22,6 +22,9 @@
+ #include "sub.h"
+ #include "mp_msg.h"
+
++/* Draw directly to framebuffer */
++#define USE_CONVERT2FB
++
+ static vo_info_t info = {
+ "Framebuffer Device",
+ "fbdev2",
+@@ -178,6 +181,15 @@ static int fb_preinit(int reset)
+ }
+ fb_orig_vinfo = fb_vinfo;
+
++ /* Reset panning offset */
++ fb_vinfo.yoffset = 0;
++ if (ioctl(fb_dev_fd, FBIOPAN_DISPLAY, &fb_vinfo)) {
++ mp_msg(MSGT_VO, MSGL_ERR,
++ "[fbdev2] FBIOPAN_DISPLAY failed: %s\n",
++ strerror(errno));
++ return 0;
++ }
++
+ fb_bpp = fb_vinfo.bits_per_pixel;
+
+ /* 16 and 15 bpp is reported as 16 bpp */
+@@ -289,6 +301,10 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width,
+ mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't malloc next_frame: %s\n", strerror(errno));
+ return 1;
+ }
++#else
++ if ((fb_line_len * fb_vinfo.yres) <= (fb_finfo.smem_len / 2)
++ && fb_vinfo.yoffset == 0)
++ center += fb_line_len * fb_vinfo.yres;
+ #endif
+ if (fs) memset(frame_buffer, '\0', fb_line_len * fb_vinfo.yres);
+
+@@ -299,14 +315,22 @@ static int query_format(uint32_t format)
+ {
+ // open the device, etc.
+ if (fb_preinit(0)) return 0;
+- if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) {
++ if ((format & IMGFMT_RGB_MASK) == IMGFMT_RGB) {
+ int fb_target_bpp = format & 0xff;
+ set_bpp(&fb_vinfo, fb_target_bpp);
+ fb_vinfo.xres_virtual = fb_vinfo.xres;
+- fb_vinfo.yres_virtual = fb_vinfo.yres;
++ fb_vinfo.yres_virtual = fb_vinfo.yres * 2;
+ if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) {
+- mp_msg(MSGT_VO, MSGL_ERR, "[fbdev2] Can't put VSCREENINFO: %s\n", strerror(errno));
+- return 0;
++ mp_msg(MSGT_VO, MSGL_WARN,
++ "[fbdev2] Can't double virtual y resolution: %s\n",
++ strerror(errno));
++ fb_vinfo.yres_virtual = fb_vinfo.yres;
++ if (ioctl(fb_dev_fd, FBIOPUT_VSCREENINFO, &fb_vinfo)) {
++ mp_msg(MSGT_VO, MSGL_ERR,
++ "[fbdev2] Can't put VSCREENINFO: %s\n",
++ strerror(errno));
++ return -1;
++ }
+ }
+ fb_pixel_size = fb_vinfo.bits_per_pixel / 8;
+ fb_bpp = fb_vinfo.red.length + fb_vinfo.green.length +
+@@ -367,16 +391,67 @@ static void check_events(void)
+
+ static void flip_page(void)
+ {
+-#ifndef USE_CONVERT2FB
+ int i, out_offset = 0, in_offset = 0;
+
+- for (i = 0; i < in_height; i++) {
+- memcpy(center + out_offset, next_frame + in_offset,
+- in_width * fb_pixel_size);
+- out_offset += fb_line_len;
+- in_offset += in_width * fb_pixel_size;
+- }
++#ifndef USE_CONVERT2FB
++ if (1) {
++#else
++ if (fb_vinfo.yres_virtual == fb_vinfo.yres) {
+ #endif
++ for (i = 0; i < in_height; i++) {
++ memcpy(center + out_offset, next_frame + in_offset,
++ in_width * fb_pixel_size);
++ out_offset += fb_line_len;
++ in_offset += in_width * fb_pixel_size;
++ }
++ } else {
++ if (fb_vinfo.yoffset == 0) {
++ fb_vinfo.yoffset += fb_vinfo.yres;
++ center -= fb_line_len * fb_vinfo.yres;
++ } else {
++ fb_vinfo.yoffset = 0;
++ center += fb_line_len * fb_vinfo.yres;
++ }
++
++ if (ioctl(fb_dev_fd, FBIOPAN_DISPLAY, &fb_vinfo)) {
++ mp_msg(MSGT_VO, MSGL_ERR,
++ "[fbdev2] Can't FBIOPAN_DISPLAY: %s\n",
++ strerror(errno));
++ }
++ }
++}
++
++static uint32_t get_image(mp_image_t *mpi)
++{
++ if(mpi->flags&MP_IMGFLAG_READABLE)
++ return VO_FALSE; // slow video ram
++ if(mpi->type==MP_IMGTYPE_STATIC)
++ return VO_FALSE; // it is not static
++
++ if (mpi->flags & (MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_ACCEPT_WIDTH)) {
++ // we're lucky or codec accepts stride => ok, let's go!
++
++ //YUY2 and RGB formats
++ mpi->planes[0] = center;
++ mpi->width = in_width;
++ mpi->stride[0] = fb_line_len;
++
++ // center image
++
++ mpi->flags |= MP_IMGFLAG_DIRECT;
++
++ return VO_TRUE;
++ }
++
++ return VO_FALSE;
++}
++
++static uint32_t put_image(mp_image_t *mpi)
++{
++ // already out?
++ if ((mpi->flags & (MP_IMGFLAG_DIRECT | MP_IMGFLAG_DRAW_CALLBACK)))
++ return VO_TRUE;
++ return VO_FALSE;
+ }
+
+ static void uninit(void)
+@@ -403,6 +478,10 @@ static int control(uint32_t request, void *data, ...)
+ switch (request) {
+ case VOCTRL_QUERY_FORMAT:
+ return query_format(*((uint32_t*)data));
++ case VOCTRL_GET_IMAGE:
++ return get_image(data);
++ case VOCTRL_DRAW_IMAGE:
++ return put_image(data);
+ }
+ return VO_NOTIMPL;
+ }
+diff --git a/version.sh b/version.sh
+index 44b5c5d..cf22a68 100755
+--- a/version.sh
++++ b/version.sh
+@@ -1,2 +1,2 @@
+ #!/bin/sh
+-echo "#define VERSION \"1.0rc1-$1\"" > version.h
++echo "#define VERSION \"1.0rc1.atmel.2-$1\"" > version.h
diff --git a/packages/mplayer/mplayer_0.0+1.0rc1.bb b/packages/mplayer/mplayer_0.0+1.0rc1.bb
index 6d9cd754d5..c0062bddd9 100644
--- a/packages/mplayer/mplayer_0.0+1.0rc1.bb
+++ b/packages/mplayer/mplayer_0.0+1.0rc1.bb
@@ -22,7 +22,11 @@ SRC_URI = "http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2 \
file://imageon-video_out.patch;patch=1 \
file://powerpc-is-ppc.diff;patch=1 \
file://pxa_configure.patch;patch=1 \
- file://pxa-video_out.patch;patch=1 "
+ file://pxa-video_out.patch;patch=1 \
+ "
+
+SRC_URI_append_avr32 = " file://mplayer-1.0rc1-atmel.2.patch;patch=1 \
+ "
# This is required for the collie machine only as all stacks in that
# machine seem to be set to executable by the toolchain. If someone
@@ -34,7 +38,7 @@ PACKAGE_ARCH_mencoder_collie = "collie"
RCONFLICTS_${PN} = "mplayer-atty"
RREPLACES_${PN} = "mplayer-atty"
-PR = "r14"
+PR = "r15"
PARALLEL_MAKE = ""
diff --git a/packages/tasks/task-gpephone.bb b/packages/tasks/task-gpephone.bb
index a77233bedc..e2cef807e0 100644
--- a/packages/tasks/task-gpephone.bb
+++ b/packages/tasks/task-gpephone.bb
@@ -1,5 +1,5 @@
DESCRIPTION = "Task packages for GPE Palmtop Environment Phone Edition"
-PR = "r10"
+PR = "r13"
LICENSE = "MIT"
inherit task
@@ -23,18 +23,16 @@ RDEPENDS_gpephone-task-development = "\
minicom"
RDEPENDS_gpephone-task-base = "\
- cms92init \
- gsmmux \
connect \
- phoneserver \
+ gsmd \
soundserver \
voicecall \
+ dialer \
+ quickdial \
vochistory \
sms \
audioplayer \
videoplayer \
- addressbook \
- calendar \
gpe-applauncher \
gpe-phonepanel \
gpe-bootsplash \
@@ -54,7 +52,6 @@ RDEPENDS_gpephone-task-base = "\
gpe-dm \
gpe-login \
gpe-session-scripts-phone \
- gpe-icons \
gpe-confd \
gpe-autostarter \
xauth \
@@ -72,7 +69,10 @@ RDEPENDS_gpephone-task-base = "\
"
RDEPENDS_gpephone-task-pim = "\
- gpesyncd"
+ contact \
+ calendar2 \
+ useen \
+ "
RDEPENDS_gpephone-task-settings = "\
gpe-su \
@@ -80,10 +80,11 @@ RDEPENDS_gpephone-task-settings = "\
gpe-mixer \
gpe-taskmanager \
minilite \
+ firewall \
+ almmgrd \
machined"
RDEPENDS_gpephone-task-apps = "\
- gpe-what \
gpe-scap \
gpe-windowlist"
diff --git a/packages/tasks/task-sdk-base.bb b/packages/tasks/task-sdk-base.bb
index 4041b27536..1977ab6b98 100644
--- a/packages/tasks/task-sdk-base.bb
+++ b/packages/tasks/task-sdk-base.bb
@@ -1,5 +1,5 @@
DESCRIPTION = "Basic SDK development packages"
-PR = "r1"
+PR = "r2"
LICENSE = "MIT"
ALLOW_EMPTY = "1"
@@ -31,7 +31,6 @@ RDEPENDS = "\
gnutls-dev \
libgpg-error-dev \
libidl-dev \
- libiw-dev \
libmimedir-dev \
libpcap-dev \
libpixman-dev \
diff --git a/packages/tasks/task-sdk-gpephone.bb b/packages/tasks/task-sdk-gpephone.bb
index 56b398b04e..77889d7143 100644
--- a/packages/tasks/task-sdk-gpephone.bb
+++ b/packages/tasks/task-sdk-gpephone.bb
@@ -1,21 +1,27 @@
DESCRIPTION = "SDK task for GPE Phone Edition"
-PR = "r0"
+PR = "r4"
LICENSE = "MIT"
ALLOW_EMPTY = "1"
RDEPENDS = "\
libidn-dev \
- libim-dev \
- gloox-dev \
- libabenabler-dev \
- libcalenabler-dev \
+ libabenabler2-dev \
+ libcalenabler2-dev \
libchenabler-dev \
libgemwidget-dev \
libiac-dev \
- libim-dev \
- liblipsevent-dev \
- libmsgenabler-dev \
- librecord-dev \
+ libiac2-dev \
+ libim2-dev \
+ liblipsevent2-dev \
+ libmsgenabler2-dev \
+ librecord2-dev \
libvocenabler-dev \
linphone-dev \
+ libsettings-dev \
+ libgemwidget-dev \
+ libalmmgr-dev \
+ libgpephone-dev \
+ libgsmd-dev \
+ libtapi-dev \
+ libvoc-dev \
" \ No newline at end of file
diff --git a/packages/tea/tea_17.3.5.bb b/packages/tea/tea_17.3.5.bb
index c8dac8c94f..da1bad00a9 100644
--- a/packages/tea/tea_17.3.5.bb
+++ b/packages/tea/tea_17.3.5.bb
@@ -10,3 +10,5 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/tea-editor/${P}.tar.bz2 \
file://move-endif.patch;patch=1;pnum=0"
EXTRA_OECONF = "--enable-legacy"
+
+FILES_${PN}-doc += "${datadir}/${PN}/doc"
diff --git a/packages/tinymail/libtinymail-0.0.1/no-iconv-detect.patch b/packages/tinymail/libtinymail-0.0.1/no-iconv-detect.patch
index 558cbb2f93..cfda4cb0f2 100644
--- a/packages/tinymail/libtinymail-0.0.1/no-iconv-detect.patch
+++ b/packages/tinymail/libtinymail-0.0.1/no-iconv-detect.patch
@@ -1,66 +1,9 @@
---- /tmp/ticonv.m4 2006-11-19 12:01:18.000000000 +0100
-+++ trunk/m4/ticonv.m4 2006-11-19 12:14:50.378554000 +0100
-@@ -14,12 +14,7 @@
- save_LIBS="$LIBS"
- CFLAGS="$CFLAGS $ICONV_CFLAGS"
- LIBS="$LIBS $ICONV_LIBS -liconv"
--AC_CACHE_CHECK(for iconv in -liconv, ac_cv_libiconv, AC_LINK_IFELSE([AC_LANG_PROGRAM([[
--#include <iconv.h>
--]], [[
-- iconv_t cd;
-- cd = iconv_open ("UTF-8", "ISO-8859-1");
--]])],[ac_cv_libiconv=yes],[ac_cv_libiconv=no]))
-+
- if test $ac_cv_libiconv = yes; then
- ICONV_LIBS="$ICONV_LIBS -liconv"
- have_iconv=yes
-@@ -33,39 +28,6 @@
- if test $ac_cv_libiconv = no; then
- AC_CHECK_FUNCS(gnu_get_libc_version)
- fi
-- AC_CACHE_CHECK([if iconv() handles UTF-8], ac_cv_libiconv_utf8, AC_RUN_IFELSE([AC_LANG_SOURCE([[
--#include <iconv.h>
--#include <stdlib.h>
--#include <string.h>
--#ifdef HAVE_GNU_GET_LIBC_VERSION
--#include <gnu/libc-version.h>
--#endif
--
--int main (int argc, char **argv)
--{
-- const char *from = "Some Text \xA4";
-- const char *utf8 = "Some Text \xC2\xA4";
-- char *transbuf = malloc (20), *trans = transbuf;
-- iconv_t cd;
-- size_t from_len = strlen (from), utf8_len = 20;
-- size_t utf8_real_len = strlen (utf8);
--
--#ifdef HAVE_GNU_GET_LIBC_VERSION
-- /* glibc 2.1.2's iconv is broken in hard to test ways. */
-- if (!strcmp (gnu_get_libc_version (), "2.1.2"))
-- exit (1);
--#endif
--
-- cd = iconv_open ("UTF-8", "ISO-8859-1");
-- if (cd == (iconv_t) -1)
-- exit (1);
-- if (iconv (cd, &from, &from_len, &trans, &utf8_len) == -1 || from_len != 0)
-- exit (1);
-- if (memcmp (utf8, transbuf, utf8_real_len) != 0)
-- exit (1);
--
-- exit (0);
--}]])],[ac_cv_libiconv_utf8=yes],[ac_cv_libiconv_utf8=no; have_iconv=no],[ac_cv_libiconv_utf8=no; have_iconv=no]))
- fi
+--- m4/ticonv.m4~ 2007-10-30 13:57:32.000000000 +0100
++++ trunk/m4/ticonv.m4 2007-10-30 13:57:32.000000000 +0100
+@@ -76,15 +76,6 @@
+
+ CFLAGS="$CFLAGS -I$srcdir"
- if test "$have_iconv" = no; then
-@@ -73,20 +35,5 @@
- fi
- AC_SUBST(ICONV_CFLAGS)
- AC_SUBST(ICONV_LIBS)
--
--CFLAGS="$CFLAGS -I$srcdir"
--
-AC_MSG_CHECKING(preferred charset formats for system iconv)
-AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#define CONFIGURE_IN
@@ -70,9 +13,6 @@
-],[
- AC_MSG_RESULT(not found)
-],[])
--
--CFLAGS="$save_CFLAGS"
--LIBS="$save_LIBS"
--
- ])
-+
+
+ CFLAGS="$save_CFLAGS"
+ LIBS="$save_LIBS"
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/avr32-arch-2.patch b/packages/uclibc/uclibc-0.9.28/avr32/avr32-arch-2.patch
new file mode 100644
index 0000000000..0e8c2a1c02
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/avr32-arch-2.patch
@@ -0,0 +1,2135 @@
+Subject: [PATCH] AVR32 Architecture support
+
+Add support for the AVR32 architecture in the core libc and build system.
+This also adds AVR32-ELF definitions to elf.h
+
+---
+
+ Rules.mak | 4
+ extra/Configs/Config.avr32 | 38 +++++
+ extra/Configs/Config.in | 7 +
+ include/elf.h | 51 +++++++
+ libc/sysdeps/linux/avr32/Makefile | 93 +++++++++++++
+ libc/sysdeps/linux/avr32/__longjmp.S | 17 ++
+ libc/sysdeps/linux/avr32/_mmap.c | 33 ++++
+ libc/sysdeps/linux/avr32/bits/atomicity.h | 86 ++++++++++++
+ libc/sysdeps/linux/avr32/bits/byteswap.h | 80 +++++++++++
+ libc/sysdeps/linux/avr32/bits/endian.h | 7 +
+ libc/sysdeps/linux/avr32/bits/fcntl.h | 167 +++++++++++++++++++++++++
+ libc/sysdeps/linux/avr32/bits/kernel_stat.h | 63 +++++++++
+ libc/sysdeps/linux/avr32/bits/kernel_types.h | 56 ++++++++
+ libc/sysdeps/linux/avr32/bits/machine-gmon.h | 69 ++++++++++
+ libc/sysdeps/linux/avr32/bits/mman.h | 95 ++++++++++++++
+ libc/sysdeps/linux/avr32/bits/profil-counter.h | 26 +++
+ libc/sysdeps/linux/avr32/bits/setjmp.h | 21 +++
+ libc/sysdeps/linux/avr32/bits/syscalls.h | 143 +++++++++++++++++++++
+ libc/sysdeps/linux/avr32/bits/wordsize.h | 1
+ libc/sysdeps/linux/avr32/brk.c | 23 +++
+ libc/sysdeps/linux/avr32/bsd-_setjmp.S | 12 +
+ libc/sysdeps/linux/avr32/bsd-setjmp.S | 12 +
+ libc/sysdeps/linux/avr32/clone.c | 37 +++++
+ libc/sysdeps/linux/avr32/crt1.S | 93 +++++++++++++
+ libc/sysdeps/linux/avr32/crti.S | 17 ++
+ libc/sysdeps/linux/avr32/crtn.S | 14 ++
+ libc/sysdeps/linux/avr32/mmap.c | 31 ++++
+ libc/sysdeps/linux/avr32/setjmp.S | 43 ++++++
+ libc/sysdeps/linux/avr32/sigaction.c | 49 +++++++
+ libc/sysdeps/linux/avr32/sigrestorer.S | 11 +
+ libc/sysdeps/linux/avr32/sys/elf.h | 26 +++
+ libc/sysdeps/linux/avr32/sys/io.h | 48 +++++++
+ libc/sysdeps/linux/avr32/sys/procfs.h | 123 ++++++++++++++++++
+ libc/sysdeps/linux/avr32/sys/ucontext.h | 94 ++++++++++++++
+ libc/sysdeps/linux/avr32/sys/user.h | 46 ++++++
+ libc/sysdeps/linux/avr32/syscall.S | 81 ++++++++++++
+ libc/sysdeps/linux/avr32/vfork.S | 55 ++++++++
+ 37 files changed, 1872 insertions(+)
+
+Index: uClibc-0.9.28/extra/Configs/Config.avr32
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/extra/Configs/Config.avr32 2006-05-05 09:27:17.000000000 +0200
+@@ -0,0 +1,38 @@
++#
++# For a description of the syntax of this configuration file,
++# see extra/config/Kconfig-language.txt
++#
++
++config HAVE_ELF
++ bool
++ default y
++
++config TARGET_ARCH
++ default "avr32"
++
++config ARCH_CFLAGS
++ string
++
++config ARCH_LDFLAGS
++ string
++
++config LIBGCC_CFLAGS
++ string
++
++config ARCH_SUPPORTS_BIG_ENDIAN
++ bool
++ default y
++
++config UCLIBC_COMPLETELY_PIC
++ select FORCE_SHAREABLE_TEXT_SEGMENTS
++ bool
++ default y
++
++choice
++ prompt "Target CPU Type"
++ default CONFIG_AP7000
++
++config CONFIG_AP7000
++ bool "AP7000"
++
++endchoice
+Index: uClibc-0.9.28/extra/Configs/Config.in
+===================================================================
+--- uClibc-0.9.28.orig/extra/Configs/Config.in 2006-04-19 12:47:48.000000000 +0200
++++ uClibc-0.9.28/extra/Configs/Config.in 2006-04-19 12:48:33.000000000 +0200
+@@ -16,6 +16,9 @@ config TARGET_alpha
+ config TARGET_arm
+ bool "arm"
+
++config TARGET_avr32
++ bool "avr32"
++
+ config TARGET_bfin
+ bool "bfin"
+
+@@ -83,6 +86,10 @@ if TARGET_arm
+ source "extra/Configs/Config.arm"
+ endif
+
++if TARGET_avr32
++source "extra/Configs/Config.avr32"
++endif
++
+ if TARGET_bfin
+ source "extra/Configs/Config.bfin"
+ endif
+Index: uClibc-0.9.28/include/elf.h
+===================================================================
+--- uClibc-0.9.28.orig/include/elf.h 2006-04-19 12:47:48.000000000 +0200
++++ uClibc-0.9.28/include/elf.h 2006-05-05 09:28:38.000000000 +0200
+@@ -261,6 +261,8 @@ typedef struct
+ #define EM_NIOS32 0xfebb /* Altera Nios 32 */
+ #define EM_ALTERA_NIOS2 0x9ee5 /* Altera Nios II */
+
++#define EM_AVR32 0x18ad
++
+ /* V850 backend magic number. Written in the absense of an ABI. */
+ #define EM_CYGNUS_V850 0x9080
+
+@@ -2687,6 +2689,55 @@ typedef Elf32_Addr Elf32_Conflict;
+ /* Keep this the last entry. */
+ #define R_V850_NUM 25
+
++/* Atmel AVR32 relocations. */
++#define R_AVR32_NONE 0
++#define R_AVR32_32 1
++#define R_AVR32_16 2
++#define R_AVR32_8 3
++#define R_AVR32_32_PCREL 4
++#define R_AVR32_16_PCREL 5
++#define R_AVR32_8_PCREL 6
++#define R_AVR32_DIFF32 7
++#define R_AVR32_DIFF16 8
++#define R_AVR32_DIFF8 9
++#define R_AVR32_GOT32 10
++#define R_AVR32_GOT16 11
++#define R_AVR32_GOT8 12
++#define R_AVR32_21S 13
++#define R_AVR32_16U 14
++#define R_AVR32_16S 15
++#define R_AVR32_8S 16
++#define R_AVR32_8S_EXT 17
++#define R_AVR32_22H_PCREL 18
++#define R_AVR32_18W_PCREL 19
++#define R_AVR32_16B_PCREL 20
++#define R_AVR32_16N_PCREL 21
++#define R_AVR32_14UW_PCREL 22
++#define R_AVR32_11H_PCREL 23
++#define R_AVR32_10UW_PCREL 24
++#define R_AVR32_9H_PCREL 25
++#define R_AVR32_9UW_PCREL 26
++#define R_AVR32_HI16 27
++#define R_AVR32_LO16 28
++#define R_AVR32_GOTPC 29
++#define R_AVR32_GOTCALL 30
++#define R_AVR32_LDA_GOT 31
++#define R_AVR32_GOT21S 32
++#define R_AVR32_GOT18SW 33
++#define R_AVR32_GOT16S 34
++#define R_AVR32_GOT7UW 35
++#define R_AVR32_32_CPENT 36
++#define R_AVR32_CPCALL 37
++#define R_AVR32_16_CP 38
++#define R_AVR32_9W_CP 39
++#define R_AVR32_RELATIVE 40
++#define R_AVR32_GLOB_DAT 41
++#define R_AVR32_JMP_SLOT 42
++#define R_AVR32_ALIGN 43
++#define R_AVR32_NUM 44
++
++/* AVR32 dynamic tags */
++#define DT_AVR32_GOTSZ 0x70000001 /* Total size of GOT in bytes */
+
+ #define R_H8_NONE 0
+ #define R_H8_DIR32 1
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/Makefile 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,93 @@
++# 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
++
++TOPDIR=../../../../
++include $(TOPDIR)Rules.mak
++ASFLAGS=$(CFLAGS)
++
++CRT_SRC = crt1.S
++CRT_OBJ = crt1.o
++SCRT_OBJ = $(patsubst %,S%, $(CRT_OBJ))
++CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
++
++SSRC=__longjmp.S setjmp.S bsd-setjmp.S vfork.S \
++ bsd-_setjmp.S sigrestorer.S syscall.S
++SOBJS=$(patsubst %.S,%.o, $(SSRC))
++
++CSRC=clone.c brk.c sigaction.c mmap.c
++COBJS=$(patsubst %.c,%.o, $(CSRC))
++
++OBJS=$(SOBJS) $(COBJS)
++
++OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
++
++all: $(OBJ_LIST)
++
++$(OBJ_LIST): $(OBJS) $(CRT_OBJ) $(SCRT_OBJ) $(CTOR_TARGETS)
++ echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
++ $(INSTALL) -d $(TOPDIR)lib/
++ cp $(CRT_OBJ) $(SCRT_OBJ) $(TOPDIR)lib/
++
++$(CRT_OBJ): $(CRT_SRC)
++ $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++$(SCRT_OBJ): $(CRT_SRC)
++ $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* $< -c -o $*.o
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++$(SOBJS): %.o : %.S
++ $(CC) $(ASFLAGS) -c $< -o $@
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++$(COBJS): %.o : %.c
++ $(CC) $(CFLAGS) -c $< -o $@
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
++crti.o: crti.S
++ $(CC) $(ASFLAGS) -c crti.S -o crti.o
++
++$(TOPDIR)lib/crti.o: crti.o
++ $(INSTALL) -d $(TOPDIR)lib/
++ cp crti.o $(TOPDIR)lib/
++
++crtn.o: crtn.S
++ $(CC) $(ASFLAGS) -c crtn.S -o crtn.o
++
++$(TOPDIR)lib/crtn.o: crtn.o
++ $(INSTALL) -d $(TOPDIR)lib/
++ cp crtn.o $(TOPDIR)lib/
++else
++$(TOPDIR)lib/crti.o:
++ $(INSTALL) -d $(TOPDIR)lib/
++ $(AR) $(ARFLAGS) $(TOPDIR)lib/crti.o
++$(TOPDIR)lib/crtn.o:
++ $(INSTALL) -d $(TOPDIR)lib/
++ $(AR) $(ARFLAGS) $(TOPDIR)lib/crtn.o
++endif
++
++
++headers:
++# $(LN) -fs ../libc/sysdeps/linux/avr32/fpu_control.h $(TOPDIR)/include/
++
++clean:
++ $(RM) *.[oa] *~ core
++ $(RM) bits/sysnum.h
++ $(RM) gmon-start.S
++
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/__longjmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/__longjmp.S 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,17 @@
++/* longjmp for AVR32
++ *
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++
++ .global __longjmp
++ .type __longjmp,"function"
++ .align 1
++__longjmp:
++ ldm r12++, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
++ mov r12, r11 /* get the return value right */
++ mustr r8 /* restore status register (lower half) */
++ cp r12, 0 /* can't return zero */
++ frs
++ moveq r12, 1
++ mov pc,lr
++ .size __longjmp, . - __longjmp
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/_mmap.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/_mmap.c 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,33 @@
++/* Copyright (C) 2005 Atmel Norway
++
++ 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
++
++ Derived in part from the Linux-8086 C library, the GNU C Library, and several
++ other sundry sources. Files within this library are copyright by their
++ respective copyright holders.
++ */
++
++#include <errno.h>
++#include <sys/mman.h>
++#include <sys/syscall.h>
++
++#define __NR_mmap2 __NR_mmap
++
++static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
++
++__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
++{
++ return mmap2(addr, len, prot, flags, fd, offset >> 12);
++}
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/atomicity.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/atomicity.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,86 @@
++/* Low-level functions for atomic operations. AVR32 version.
++ Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _ATOMICITY_H
++#define _ATOMICITY_H 1
++
++#include <inttypes.h>
++
++static inline int
++__attribute__((unused))
++exchange_and_add (volatile uint32_t *mem, int val)
++{
++ int tmp, result;
++
++ __asm__ __volatile__(
++ "/* Inline exchange and add */\n"
++ "1: ssrf 5\n"
++ " ld.w %0, %3\n"
++ " add %1, %0, %4\n"
++ " stcond %2, %1\n"
++ " brne 1b"
++ : "=&r"(result), "=&r"(tmp), "=m"(*mem)
++ : "m"(*mem), "r"(val)
++ : "cc", "memory");
++
++ return result;
++}
++
++static inline void
++__attribute__((unused))
++atomic_add (volatile uin32_t *mem, int val)
++{
++ int result;
++
++ __asm__ __volatile__(
++ "/* Inline atomic add */\n"
++ "1: ssrf 5\n"
++ " ld.w %0, %2\n"
++ " add %0, %3\n"
++ " stcond %2, %0\n"
++ " brne 1b"
++ : "=&r"(result), "=m"(*mem)
++ : "m"(*mem), "r"(val)
++ : "cc", "memory");
++}
++
++static inline int
++__attribute__((unused))
++compare_and_swap(volatile long int *p, long int oldval, long int newval)
++{
++ long int result, tmp;
++
++ __asm__ __volatile__(
++ "/* Inline compare and swap */\n"
++ "1: ssrf 5\n"
++ " ld.w %1, %3\n"
++ " cp.w %1, %5\n"
++ " sreq %0\n"
++ " brne 2f\n"
++ " stcond %2, %4\n"
++ " brne 1b\n"
++ "2:"
++ : "=&r"(result), "=&r"(tmp), "=m"(*p)
++ : "m"(*p), "r"(newval), "r"(oldval)
++ : "cc", "memory");
++
++ return result;
++}
++
++#endif /* atomicity.h */
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/byteswap.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/byteswap.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,80 @@
++/* Macros to swap the order of bytes in integer values.
++ Copyright (C) 2005 Atmel Norway.
++
++ 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. */
++
++#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
++# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
++#endif
++
++#ifndef _BITS_BYTESWAP_H
++#define _BITS_BYTESWAP_H 1
++
++/* Swap bytes in 16 bit value. */
++#if defined __GNUC__
++# define __bswap_16(x) (__extension__ __builtin_bswap_16(x))
++#else
++/* This is better than nothing. */
++static __inline unsigned short int
++__bswap_16 (unsigned short int __bsx)
++{
++ return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
++}
++#endif
++
++/* Swap bytes in 32 bit value. */
++#if defined __GNUC__
++# define __bswap_32(x) (__extension__ __builtin_bswap_32(x))
++#else
++static __inline unsigned int
++__bswap_32 (unsigned int __bsx)
++{
++ return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
++ (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
++}
++#endif
++
++#if defined __GNUC__
++/* Swap bytes in 64 bit value. */
++# define __bswap_constant_64(x) \
++ ((((x) & 0xff00000000000000ull) >> 56) \
++ | (((x) & 0x00ff000000000000ull) >> 40) \
++ | (((x) & 0x0000ff0000000000ull) >> 24) \
++ | (((x) & 0x000000ff00000000ull) >> 8) \
++ | (((x) & 0x00000000ff000000ull) << 8) \
++ | (((x) & 0x0000000000ff0000ull) << 24) \
++ | (((x) & 0x000000000000ff00ull) << 40) \
++ | (((x) & 0x00000000000000ffull) << 56))
++
++# define __bswap_64(x) \
++ (__extension__ \
++ ({ \
++ union { \
++ __extension__ unsigned long long int __ll; \
++ unsigned int __l[2]; \
++ } __w, __r; \
++ if (__builtin_constant_p(x)) \
++ __r.__ll = __bswap_constant_64(x); \
++ else { \
++ __w.__ll = (x); \
++ __r.__l[0] = __bswap_32(__w.__l[1]); \
++ __r.__l[1] = __bswap_32(__w.__l[0]); \
++ } \
++ __r.__ll; \
++ }))
++#endif
++
++#endif /* _BITS_BYTESWAP_H */
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/endian.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/endian.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,7 @@
++/* AVR32 is big-endian */
++
++#ifndef _ENDIAN_H
++# error "Never use <bits/endian.h> directly; include <endian.h> instead."
++#endif
++
++#define __BYTE_ORDER __BIG_ENDIAN
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/fcntl.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/fcntl.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,167 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ *
++ * This file is part of the Linux kernel
++ */
++#ifndef _FCNTL_H
++# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
++#endif
++
++#include <sys/types.h>
++
++/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
++ located on an ext2 file system */
++#define O_ACCMODE 0003
++#define O_RDONLY 00
++#define O_WRONLY 01
++#define O_RDWR 02
++#define O_CREAT 0100 /* not fcntl */
++#define O_EXCL 0200 /* not fcntl */
++#define O_NOCTTY 0400 /* not fcntl */
++#define O_TRUNC 01000 /* not fcntl */
++#define O_APPEND 02000
++#define O_NONBLOCK 04000
++#define O_NDELAY O_NONBLOCK
++#define O_SYNC 010000
++#define O_ASYNC 020000
++
++#ifdef __USE_GNU
++# define O_DIRECTORY 040000 /* must be a directory */
++# define O_NOFOLLOW 0100000 /* don't follow links */
++# define O_DIRECT 0200000 /* direct disk access */
++#endif
++
++#ifdef __USE_LARGEFILE64
++# define O_LARGEFILE 0400000
++#endif
++
++/* For now Linux has synchronisity options for data and read operations.
++ We define the symbols here but let them do the same as O_SYNC since
++ this is a superset. */
++#if defined __USE_POSIX199309 || defined __USE_UNIX98
++# define O_DSYNC O_SYNC /* Synchronize data. */
++# define O_RSYNC O_SYNC /* Synchronize read operations. */
++#endif
++
++#define F_DUPFD 0 /* dup */
++#define F_GETFD 1 /* get close_on_exec */
++#define F_SETFD 2 /* set/clear close_on_exec */
++#define F_GETFL 3 /* get file->f_flags */
++#define F_SETFL 4 /* set file->f_flags */
++
++#ifndef __USE_FILE_OFFSET64
++# define F_GETLK 5
++# define F_SETLK 6
++# define F_SETLKW 7
++#else
++# define F_GETLK F_GETLK64
++# define F_SETLK F_SETLK64
++# define F_SETLKW F_SETLKW64
++#endif
++#define F_GETLK64 12 /* using 'struct flock64' */
++#define F_SETLK64 13
++#define F_SETLKW64 14
++
++#if defined __USE_BSD || defined __USE_XOPEN2K
++# define F_SETOWN 8 /* for sockets. */
++# define F_GETOWN 9 /* for sockets. */
++#endif
++
++#ifdef __USE_GNU
++# define F_SETSIG 10 /* for sockets. */
++# define F_GETSIG 11 /* for sockets. */
++#endif
++
++#ifdef __USE_GNU
++# define F_SETLEASE 1024 /* Set a lease. */
++# define F_GETLEASE 1025 /* Enquire what lease is active. */
++# define F_NOTIFY 1026 /* Request notfications on a directory. */
++#endif
++
++/* for F_[GET|SET]FL */
++#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
++
++/* for posix fcntl() and lockf() */
++#define F_RDLCK 0
++#define F_WRLCK 1
++#define F_UNLCK 2
++
++/* for old implementation of bsd flock () */
++#define F_EXLCK 4 /* or 3 */
++#define F_SHLCK 8 /* or 4 */
++
++/* for leases */
++#define F_INPROGRESS 16
++
++#ifdef __USE_BSD
++/* operations for bsd flock(), also used by the kernel implementation */
++# define LOCK_SH 1 /* shared lock */
++# define LOCK_EX 2 /* exclusive lock */
++# define LOCK_NB 4 /* or'd with one of the above to prevent
++ blocking */
++# define LOCK_UN 8 /* remove lock */
++#endif
++
++#ifdef __USE_GNU
++# define LOCK_MAND 32 /* This is a mandatory flock */
++# define LOCK_READ 64 /* ... Which allows concurrent
++ read operations */
++# define LOCK_WRITE 128 /* ... Which allows concurrent
++ write operations */
++# define LOCK_RW 192 /* ... Which allows concurrent
++ read & write ops */
++#endif
++
++#ifdef __USE_GNU
++/* Types of directory notifications that may be requested with F_NOTIFY. */
++# define DN_ACCESS 0x00000001 /* File accessed. */
++# define DN_MODIFY 0x00000002 /* File modified. */
++# define DN_CREATE 0x00000004 /* File created. */
++# define DN_DELETE 0x00000008 /* File removed. */
++# define DN_RENAME 0x00000010 /* File renamed. */
++# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
++# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
++#endif
++
++struct flock {
++ short l_type;
++ short l_whence;
++#ifndef __USE_FILE_OFFSET64
++ __off_t l_start;
++ __off_t l_len;
++#else
++ __off64_t l_start;
++ __off64_t l_len;
++#endif
++ __pid_t l_pid;
++};
++
++#ifdef __USE_LARGEFILE64
++struct flock64 {
++ short l_type;
++ short l_whence;
++ __off64_t l_start;
++ __off64_t l_len;
++ __pid_t l_pid;
++};
++#endif
++
++/* Define some more compatibility macros to be backward compatible with
++ * BSD systems which did not managed to hide these kernel macros. */
++#ifdef __USE_BSD
++# define FAPPEND O_APPEND
++# define FFSYNC O_FSYNC
++# define FASYNC O_ASYNC
++# define FNONBLOCK O_NONBLOCK
++# define FNDELAY O_NDELAY
++#endif /* Use BSD. */
++
++/* Advise to `posix_fadvise'. */
++#ifdef __USE_XOPEN2K
++# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
++# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
++# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
++# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
++# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
++# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
++#endif
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_stat.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_stat.h 2006-05-05 09:28:32.000000000 +0200
+@@ -0,0 +1,63 @@
++#ifndef _BITS_STAT_STRUCT_H
++#define _BITS_STAT_STRUCT_H
++
++/*
++ * This file provides struct stat, taken from kernel 2.6.4
++ * (include/asm-avr32/stat.h revision 1.1).
++ */
++
++struct kernel_stat {
++ unsigned long st_dev;
++ unsigned long st_ino;
++ unsigned short st_mode;
++ unsigned short st_nlink;
++ unsigned short st_uid;
++ unsigned short st_gid;
++ unsigned long st_rdev;
++ unsigned long st_size;
++ unsigned long st_blksize;
++ unsigned long st_blocks;
++ unsigned long st_atime;
++ unsigned long st_atime_nsec;
++ unsigned long st_mtime;
++ unsigned long st_mtime_nsec;
++ unsigned long st_ctime;
++ unsigned long st_ctime_nsec;
++ unsigned long __unused4;
++ unsigned long __unused5;
++};
++
++#define STAT_HAVE_NSEC 1
++
++struct kernel_stat64 {
++ unsigned long long st_dev;
++
++ unsigned long long st_ino;
++ unsigned int st_mode;
++ unsigned int st_nlink;
++
++ unsigned long st_uid;
++ unsigned long st_gid;
++
++ unsigned long long st_rdev;
++
++ long long st_size;
++ unsigned long __pad1;
++ unsigned long st_blksize;
++
++ unsigned long long st_blocks;
++
++ unsigned long st_atime;
++ unsigned long st_atime_nsec;
++
++ unsigned long st_mtime;
++ unsigned long st_mtime_nsec;
++
++ unsigned long st_ctime;
++ unsigned long st_ctime_nsec;
++
++ unsigned long __unused1;
++ unsigned long __unused2;
++};
++
++#endif /* _BITS_STAT_STRUCT_H */
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_types.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_types.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,56 @@
++/* Note that we use the exact same include guard #define names
++ * as asm/posix_types.h. This will avoid gratuitous conflicts
++ * with the posix_types.h kernel header, and will ensure that
++ * our private content, and not the kernel header, will win.
++ * -Erik
++ */
++#ifndef __ASM_AVR32_POSIX_TYPES_H
++#define __ASM_AVR32_POSIX_TYPES_H
++
++/*
++ * This file is generally used by user-level software, so you need to
++ * be a little careful about namespace pollution etc. Also, we cannot
++ * assume GCC is being used.
++ */
++
++typedef unsigned long __kernel_dev_t;
++typedef unsigned long __kernel_ino_t;
++typedef unsigned short __kernel_mode_t;
++typedef unsigned short __kernel_nlink_t;
++typedef long __kernel_off_t;
++typedef int __kernel_pid_t;
++typedef unsigned short __kernel_ipc_pid_t;
++typedef unsigned int __kernel_uid_t;
++typedef unsigned int __kernel_gid_t;
++typedef unsigned long __kernel_size_t;
++typedef int __kernel_ssize_t;
++typedef int __kernel_ptrdiff_t;
++typedef long __kernel_time_t;
++typedef long __kernel_suseconds_t;
++typedef long __kernel_clock_t;
++typedef int __kernel_timer_t;
++typedef int __kernel_clockid_t;
++typedef int __kernel_daddr_t;
++typedef char * __kernel_caddr_t;
++typedef unsigned short __kernel_uid16_t;
++typedef unsigned short __kernel_gid16_t;
++typedef unsigned int __kernel_uid32_t;
++typedef unsigned int __kernel_gid32_t;
++
++typedef unsigned short __kernel_old_uid_t;
++typedef unsigned short __kernel_old_gid_t;
++typedef unsigned short __kernel_old_dev_t;
++
++#ifdef __GNUC__
++typedef long long __kernel_loff_t;
++#endif
++
++typedef struct {
++#if defined(__USE_ALL)
++ int val[2];
++#else
++ int __val[2];
++#endif
++} __kernel_fsid_t;
++
++#endif /* __ASM_AVR32_POSIX_TYPES_H */
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/machine-gmon.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/machine-gmon.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,69 @@
++/* Machine-dependent definitions for profiling support. AVR32 version.
++ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#define mcount_internal __mcount_internal
++
++#define _MCOUNT_DECL(frompc, selfpc) \
++static void __attribute((used)) mcount_internal(unsigned long frompc, unsigned long selfpc)
++
++/*
++ * This mcount implementation expects to get called after the prologue
++ * has been run. It also expects that r7 contains a valid frame
++ * pointer.
++ *
++ * When profiling, the compiler should generate something like this at
++ * each function entry:
++ *
++ * pushm r0-r7,lr // lr mandatory, others optional
++ * mov r7, sp
++ * // rest of prologue goes here
++ * mcall pc[.LC1 - .]
++ * // rest of function goes here
++ * .LC1:
++ * .long mcount
++ *
++ * or for PIC:
++ *
++ * pushm r0-r7,lr
++ * mov r7, sp
++ * // rest of prologue goes here
++ * lddpc r0, .LC1
++ * .L1: rsub r0, pc
++ * mcall r0[mcount@GOT]
++ * // rest of function goes here
++ * .LC1:
++ * .long .L1 - _GLOBAL_OFFSET_TABLE_
++ *
++ * This way, when mcount() is called, r7 points to the calling
++ * function's return address. It is guaranteed that calling mcount
++ * will clobber no registers except LR, which is unavoidable.
++ */
++#define MCOUNT asm( \
++ " .align 4\n" \
++ " .global _mcount\n" \
++ " .type _mcount,@function\n" \
++ "_mcount:\n" \
++ " pushm r8-r12,lr\n" \
++ " mov r11, lr\n" \
++ " ld.w r12, r7[0]\n" \
++ " rcall __mcount_internal\n" \
++ " popm r8-r12,pc\n" \
++ " .size _mcount, . - _mcount\n" \
++ " .weak mcount\n" \
++ " mcount = _mcount");
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/mman.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/mman.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,95 @@
++/* Definitions for POSIX memory map interface. Linux/AVR32 version.
++ Copyright (C) 1997, 2000 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_MMAN_H
++# error "Never include this file directly. Use <sys/mman.h> instead"
++#endif
++
++/* The following definitions basically come from the kernel headers.
++ But the kernel header is not namespace clean. */
++
++
++/* Protections are chosen from these bits, OR'd together. The
++ implementation does not necessarily support PROT_EXEC or PROT_WRITE
++ without PROT_READ. The only guarantees are that no writing will be
++ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
++
++#define PROT_READ 0x1 /* Page can be read. */
++#define PROT_WRITE 0x2 /* Page can be written. */
++#define PROT_EXEC 0x4 /* Page can be executed. */
++#define PROT_NONE 0x0 /* Page can not be accessed. */
++
++/* Sharing types (must choose one and only one of these). */
++#define MAP_SHARED 0x01 /* Share changes. */
++#define MAP_PRIVATE 0x02 /* Changes are private. */
++#ifdef __USE_MISC
++# define MAP_TYPE 0x0f /* Mask for type of mapping. */
++#endif
++
++/* Other flags. */
++#define MAP_FIXED 0x10 /* Interpret addr exactly. */
++#ifdef __USE_MISC
++# define MAP_FILE 0
++# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
++# define MAP_ANON MAP_ANONYMOUS
++#endif
++
++/* These are Linux-specific. */
++#ifdef __USE_MISC
++# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
++# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
++# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
++# define MAP_LOCKED 0x2000 /* Lock the mapping. */
++# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
++# define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
++# define MAP_NONBLOCK 0x10000 /* do not block on IO */
++#endif
++
++/* Flags to `msync'. */
++#define MS_ASYNC 1 /* Sync memory asynchronously. */
++#define MS_SYNC 4 /* Synchronous memory sync. */
++#define MS_INVALIDATE 2 /* Invalidate the caches. */
++
++/* Flags for `mlockall'. */
++#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
++#define MCL_FUTURE 2 /* Lock all additions to address
++ space. */
++
++/* Flags for `mremap'. */
++#ifdef __USE_GNU
++# define MREMAP_MAYMOVE 1
++#endif
++
++/* Advise to `madvise'. */
++#ifdef __USE_BSD
++# define MADV_NORMAL 0 /* No further special treatment. */
++# define MADV_RANDOM 1 /* Expect random page references. */
++# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
++# define MADV_WILLNEED 3 /* Will need these pages. */
++# define MADV_DONTNEED 4 /* Don't need these pages. */
++#endif
++
++/* The POSIX people had to invent similar names for the same things. */
++#ifdef __USE_XOPEN2K
++# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
++# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
++# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
++# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
++# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
++#endif
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/profil-counter.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/profil-counter.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,26 @@
++/* Low-level statistical profiling support function. Linux/AVR32 version.
++ Copyright (C) 1996, 1997, 1998, 2002 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 <signal.h>
++
++void
++profil_counter(int signo, siginfo_t *si, struct sigcontext *sc)
++{
++ profil_count((void *)sc->pc);
++}
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/setjmp.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/setjmp.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,21 @@
++/*
++ * Copyright (C) 2004-2005 Atmel Norway
++ */
++#ifndef _SETJMP_H
++# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
++#endif
++
++#ifndef _ASM
++/*
++ * The jump buffer contains r0-r7, sr, sp and lr. Other registers are
++ * not saved.
++ */
++typedef int __jmp_buf[11];
++#endif
++
++#define __JMP_BUF_SP 4
++
++/* Test if longjmp to JMPBUF would unwind the frame containing a local
++ variable at ADDRESS. */
++#define _JMPBUF_UNWINDS(jmpbuf, address) \
++ ((void *)(address) < (void *)(jmpbuf[__JMP_BUF_SP]))
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/syscalls.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/syscalls.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,143 @@
++#ifndef _SYSCALL_H
++# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
++#endif
++
++/*
++ * This includes the `__NR_<name>' syscall numbers taken from the
++ * Linux kernel header files. It also defines the traditional
++ * `SYS_<name>' macros for older programs.
++ */
++#include <bits/sysnum.h>
++
++#ifndef __set_errno
++# define __set_errno(val) (*__errno_location()) = (val)
++#endif
++#ifndef SYS_ify
++# define SYS_ify(syscall_name) (__NR_##syscall_name)
++#endif
++
++#ifndef __ASSEMBLER__
++
++#undef _syscall0
++#define _syscall0(type,name) \
++ type name(void) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 0)); \
++ }
++
++#undef _syscall1
++#define _syscall1(type,name,type1,arg1) \
++ type name(type1 arg1) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 1, arg1)); \
++ }
++
++#undef _syscall2
++#define _syscall2(type,name,type1,arg1,type2,arg2) \
++ type name(type1 arg1, type2 arg2) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 2, arg1, arg2)); \
++ }
++
++#undef _syscall3
++#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
++ type name(type1 arg1, type2 arg2, type3 arg3) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 3, arg1, \
++ arg2, arg3)); \
++ }
++
++#undef _syscall4
++#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
++ type4,arg4) \
++ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 4, arg1, arg2, \
++ arg3, arg4)); \
++ }
++
++#undef _syscall5
++#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
++ type4,arg4,type5,arg5) \
++ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
++ type5 arg5) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 5, arg1, arg2, \
++ arg3, arg4, arg5)); \
++ }
++
++#undef _syscall6
++#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3, \
++ type4,arg4,type5,arg5,type6,arg6) \
++ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
++ type5 arg5, type6 arg6) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 6, arg1, arg2, arg3, \
++ arg4, arg5, arg6)); \
++ }
++
++#undef unlikely
++#define unlikely(x) __builtin_expect((x), 0)
++
++#undef INLINE_SYSCALL
++#define INLINE_SYSCALL(name, nr, args...) \
++ ({ \
++ unsigned _sys_result = INTERNAL_SYSCALL(name, , nr, args); \
++ if (unlikely(INTERNAL_SYSCALL_ERROR_P(_sys_result, ))) { \
++ __set_errno(INTERNAL_SYSCALL_ERRNO(_sys_result, )); \
++ _sys_result = (unsigned int) -1; \
++ } \
++ (int) _sys_result; \
++ })
++
++#undef INTERNAL_SYSCALL_DECL
++#define INTERNAL_SYSCALL_DECL(err) do { } while(0)
++
++#undef INTERNAL_SYSCALL
++#define INTERNAL_SYSCALL(name, err, nr, args...) \
++ ({ \
++ register int _a1 asm ("r12"); \
++ register int _scno asm("r8") = SYS_ify(name); \
++ LOAD_ARGS_##nr (args); \
++ asm volatile ("scall /* syscall " #name " */" \
++ : "=r" (_a1) \
++ : "r"(_scno) ASM_ARGS_##nr \
++ : "lr", "cc", "memory"); \
++ _a1; \
++ })
++
++#undef INTERNAL_SYSCALL_ERROR_P
++#define INTERNAL_SYSCALL_ERROR_P(val, err) \
++ ((unsigned int)(val) >= 0xfffff001U)
++
++#undef INTERNAL_SYSCALL_ERRNO
++#define INTERNAL_SYSCALL_ERRNO(val, errr) (-(val))
++
++#define LOAD_ARGS_0() do { } while(0)
++#define ASM_ARGS_0
++#define LOAD_ARGS_1(a1) \
++ _a1 = (int) (a1); \
++ LOAD_ARGS_0()
++#define ASM_ARGS_1 ASM_ARGS_0, "r"(_a1)
++#define LOAD_ARGS_2(a1, a2) \
++ register int _a2 asm("r11") = (int)(a2); \
++ LOAD_ARGS_1(a1)
++#define ASM_ARGS_2 ASM_ARGS_1, "r"(_a2)
++#define LOAD_ARGS_3(a1, a2, a3) \
++ register int _a3 asm("r10") = (int)(a3); \
++ LOAD_ARGS_2(a1, a2)
++#define ASM_ARGS_3 ASM_ARGS_2, "r"(_a3)
++#define LOAD_ARGS_4(a1, a2, a3, a4) \
++ register int _a4 asm("r9") = (int)(a4); \
++ LOAD_ARGS_3(a1, a2, a3)
++#define ASM_ARGS_4 ASM_ARGS_3, "r"(_a4)
++#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
++ register int _a5 asm("r5") = (int)(a5); \
++ LOAD_ARGS_4(a1, a2, a3, a4)
++#define ASM_ARGS_5 ASM_ARGS_4, "r"(_a5)
++#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
++ register int _a6 asm("r3") = (int)(a6); \
++ LOAD_ARGS_5(a1, a2, a3, a4, a5)
++#define ASM_ARGS_6 ASM_ARGS_5, "r"(_a6)
++
++#endif /* __ASSEMBLER__ */
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/wordsize.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/wordsize.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1 @@
++#define __WORDSIZE 32
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/brk.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/brk.c 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,23 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <errno.h>
++#include <sys/syscall.h>
++
++void *__curbrk = 0;
++
++int brk (void *addr)
++{
++ void *newbrk;
++
++ newbrk = INLINE_SYSCALL(brk, 1, addr);
++
++ __curbrk = newbrk;
++
++ if (newbrk < addr) {
++ __set_errno (ENOMEM);
++ return -1;
++ }
++
++ return 0;
++}
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-_setjmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-_setjmp.S 2006-05-05 09:26:42.000000000 +0200
+@@ -0,0 +1,12 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++
++ /* This just does a tail-call to __sigsetjmp(env, 0) */
++ .global _setjmp
++ .type _setjmp,"function"
++ .align 1
++_setjmp:
++ mov r11, 0
++ bral __sigsetjmp_internal
++ .size _setjmp, . - _setjmp
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-setjmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-setjmp.S 2006-05-05 09:26:42.000000000 +0200
+@@ -0,0 +1,12 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++
++ /* This just does a tail-call to __sigsetjmp(env, 1) */
++ .global setjmp
++ .type setjmp,"function"
++ .align 1
++setjmp:
++ mov r11, 1
++ bral __sigsetjmp_internal
++ .size setjmp, . - setjmp
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/clone.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/clone.c 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,37 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <errno.h>
++#include <sys/syscall.h>
++#include <unistd.h>
++
++/*
++ * I don't know if we can be absolutely certain that the fn and arg
++ * parameters are preserved when returning as the child. If the
++ * compiler stores them in registers (r0-r7), they should be.
++ */
++int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg)
++{
++ register int (*_fn)(void *arg) = fn;
++ register void *_arg = arg;
++ int err;
++
++ /* Sanity check the arguments */
++ err = -EINVAL;
++ if (!fn)
++ goto syscall_error;
++ if (!child_stack)
++ goto syscall_error;
++
++ err = INLINE_SYSCALL(clone, 2, flags, child_stack);
++ if (err < 0)
++ goto syscall_error;
++ else if (err != 0)
++ return err;
++
++ _exit(_fn(_arg));
++
++syscall_error:
++ __set_errno (-err);
++ return -1;
++}
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/crt1.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/crt1.S 2006-05-05 09:28:23.000000000 +0200
+@@ -0,0 +1,93 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ *
++ * When we enter _start, the stack looks like this:
++ * argc argument counter
++ * argv[0] pointer to program name
++ * argv[1..argc-1] pointers to program args
++ * NULL
++ * env[0..N] pointers to environment variables
++ * NULL
++ *
++ * r12 contains a function pointer to be registered with `atexit'.
++ * This is how the dynamic linker arranges to have DT_FINI functions
++ * called for shared libraries that have been loaded before this
++ * code runs.
++ *
++ * We're going to call the following function:
++ * __uClibc_main(int (*main)(int, char **, char **), int argc,
++ * char **argv, void (*app_init)(void), void (*app_fini)(void),
++ * void (*rtld_fini)(void), void *stack_end)
++ *
++ * So we need to set up things as follows:
++ * r12 = address of main
++ * r11 = argc
++ * r10 = &argv[0]
++ * r9 = address of _init
++ * r8 = address of _fini
++ * sp[0] = whatever we got passed in r12
++ */
++
++#include <features.h>
++
++ .text
++ .global _start
++ .type _start, @function
++_start:
++ /* Clear the frame pointer and link register since this is the outermost frame. */
++ mov r7, 0
++ mov lr, 0
++
++ ld.w r11, sp++ /* argc */
++ mov r10, sp /* &argv[0] */
++
++ st.w --sp, r10 /* stack_end */
++ st.w --sp, r12 /* rtld_fini */
++
++#ifdef __PIC__
++ lddpc r6, .L_GOT
++.L_RGOT:
++ rsub r6, pc
++ lda.w r9, _init
++ lda.w r8, _fini
++ lda.w r12, main
++
++ /* Ok, now run uClibc's main() -- should not return */
++ call __uClibc_main
++
++ .align 2
++.L_GOT:
++ .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
++#else
++ lddpc r9, __init_addr /* app_init */
++ lddpc r8, __fini_addr /* app_fini */
++ lddpc r12, __main_addr /* main */
++
++ /* Ok, now run uClibc's main() -- should not return */
++ lddpc pc, ___uClibc_main_addr
++
++ .align 2
++__init_addr:
++ .long _init
++__fini_addr:
++ .long _fini
++__main_addr:
++ .long main
++___uClibc_main_addr:
++ .long __uClibc_main
++#endif
++ .size _start, . - _start
++
++ /*
++ * The LSB says we need this.
++ */
++ .section ".note.ABI-tag", "a"
++ .align 4
++ .long 2f - 1f /* namesz */
++ .long 4f - 3f /* descsz */
++ .long 1 /* type */
++1: .asciz "GNU" /* name */
++2: .align 4
++3: .long 0 /* Linux executable */
++ .long 2,6,0 /* Earliest compatible kernel */
++4: .align 4
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/crti.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/crti.S 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,17 @@
++
++ .section .init
++ .align 2
++ .global _init
++ .type _init, @function
++_init:
++ /* Use a four-byte instruction to avoid NOPs */
++ stm --sp, r0-r7,lr
++ .align 2
++
++ .section .fini
++ .align 2
++ .global _fini
++ .type _fini, @function
++_fini:
++ stm --sp, r0-r7,lr
++ .align 2
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/crtn.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/crtn.S 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,14 @@
++
++ .section .init
++ .align 2
++ .global _init
++ .type _init, @function
++ ldm sp++, r0-r7,pc
++ .size _init, . - _init
++
++ .section .fini
++ .align 2
++ .global _fini
++ .type _fini, @function
++ ldm sp++, r0-r7,pc
++ .size _fini, . - _fini
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/mmap.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/mmap.c 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2005 Atmel Norway
++
++ 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
++
++ Derived in part from the Linux-8086 C library, the GNU C Library, and several
++ other sundry sources. Files within this library are copyright by their
++ respective copyright holders.
++ */
++
++#include <errno.h>
++#include <sys/mman.h>
++#include <sys/syscall.h>
++
++static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
++
++__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
++{
++ return mmap2(addr, len, prot, flags, fd, offset >> 12);
++}
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/setjmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/setjmp.S 2006-05-05 09:28:28.000000000 +0200
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#define _SETJMP_H
++#define _ASM
++#include <bits/setjmp.h>
++
++ .text
++
++ .global __sigsetjmp
++ .type __sigsetjmp,"function"
++
++ /* Create a global, hidden symbol for use by setjmp() and _setjmp().
++ If it's not hidden, the linker will complain about a relative
++ jump to a dynamic symbol when building a shared library.
++
++ Also, if a user overrides the __sigsetjmp function, he might not
++ expect the setjmp() and _setjmp() function to effectively be
++ overridden as well. */
++ .global __sigsetjmp_internal
++ .hidden __sigsetjmp_internal
++ .type __sigsetjmp_internal,"function"
++ .align 1
++__sigsetjmp:
++__sigsetjmp_internal:
++ mustr r8
++ stm r12, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
++
++ /* Make a tail call to __sigjmp_save; it takes the same args. */
++#ifdef __PIC__
++ mov r9, r6
++ lddpc r6, .LG
++.L1: rsub r6, pc
++ ld.w r8, r6[__sigjmp_save@got]
++ mov r6, r9
++ mov pc, r8
++
++ .align 2
++.LG: .long .L1 - _GLOBAL_OFFSET_TABLE_
++#else
++ rjmp __sigjmp_save
++#endif
++ .size __sigsetjmp, . - __sigsetjmp
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sigaction.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sigaction.c 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,49 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <errno.h>
++#include <signal.h>
++#include <string.h>
++#include <sys/syscall.h>
++#include <bits/kernel_sigaction.h>
++
++#define SA_RESTORER 0x04000000
++extern void __default_rt_sa_restorer(void);
++
++/*
++ * If act is not NULL, change the action for sig to *act.
++ * If oact is not NULL, put the old action for sig in *oact.
++ */
++int __libc_sigaction(int signum, const struct sigaction *act,
++ struct sigaction *oldact)
++{
++ struct kernel_sigaction kact, koact;
++ int result;
++
++ if (act) {
++ kact.k_sa_handler = act->sa_handler;
++ memcpy(&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
++ kact.sa_flags = act->sa_flags;
++ if (kact.sa_flags & (SA_RESTORER | SA_ONSTACK))
++ kact.sa_restorer = act->sa_restorer;
++ else
++ kact.sa_restorer = __default_rt_sa_restorer;
++ kact.sa_flags |= SA_RESTORER;
++ }
++
++ result = __syscall_rt_sigaction(signum, act ? __ptrvalue(&kact) : NULL,
++ oldact ? __ptrvalue(&koact) : NULL,
++ _NSIG / 8);
++
++ if (oldact && result >= 0) {
++ oldact->sa_handler = koact.k_sa_handler;
++ memcpy(&oldact->sa_mask, &koact.sa_mask,
++ sizeof(oldact->sa_mask));
++ oldact->sa_flags = koact.sa_flags;
++ oldact->sa_restorer = koact.sa_restorer;
++ }
++
++ return result;
++}
++
++weak_alias(__libc_sigaction, sigaction)
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sigrestorer.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sigrestorer.S 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,11 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <sys/syscall.h>
++
++ .global __default_rt_sa_restorer
++ .type __default_rt_sa_restorer,"function"
++ .align 1
++__default_rt_sa_restorer:
++ mov r8, __NR_rt_sigreturn
++ scall
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/elf.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/elf.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,26 @@
++/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_ELF_H
++#define _SYS_ELF_H 1
++
++#warning "This header is obsolete; use <sys/procfs.h> instead."
++
++#include <sys/procfs.h>
++
++#endif /* sys/elf.h */
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/io.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/io.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,48 @@
++/* Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_IO_H
++
++#define _SYS_IO_H 1
++#include <features.h>
++
++__BEGIN_DECLS
++
++/* If TURN_ON is TRUE, request for permission to do direct i/o on the
++ port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
++ permission off for that range. This call requires root privileges. */
++extern int ioperm (unsigned long int __from, unsigned long int __num,
++ int __turn_on) __THROW;
++
++/* Set the I/O privilege level to LEVEL. If LEVEL is nonzero,
++ permission to access any I/O port is granted. This call requires
++ root privileges. */
++extern int iopl (int __level) __THROW;
++
++/* The functions that actually perform reads and writes. */
++extern unsigned char inb (unsigned long int port) __THROW;
++extern unsigned short int inw (unsigned long int port) __THROW;
++extern unsigned long int inl (unsigned long int port) __THROW;
++
++extern void outb (unsigned char value, unsigned long int port) __THROW;
++extern void outw (unsigned short value, unsigned long int port) __THROW;
++extern void outl (unsigned long value, unsigned long int port) __THROW;
++
++__END_DECLS
++
++#endif /* _SYS_IO_H */
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/procfs.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/procfs.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,123 @@
++/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_PROCFS_H
++#define _SYS_PROCFS_H 1
++
++/* This is somewhat modelled after the file of the same name on SVR4
++ systems. It provides a definition of the core file format for ELF
++ used on Linux. It doesn't have anything to do with the /proc file
++ system, even though Linux has one.
++
++ Anyway, the whole purpose of this file is for GDB and GDB only.
++ Don't read too much into it. Don't use it for anything other than
++ GDB unless you know what you are doing. */
++
++#include <features.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#include <sys/user.h>
++
++__BEGIN_DECLS
++
++/* Type for a general-purpose register. */
++typedef unsigned long elf_greg_t;
++
++/* And the whole bunch of them. We could have used `struct
++ user_regs' directly in the typedef, but tradition says that
++ the register set is an array, which does have some peculiar
++ semantics, so leave it that way. */
++#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t))
++typedef elf_greg_t elf_gregset_t[ELF_NGREG];
++
++/* Register set for the floating-point registers. */
++typedef struct user_fpregs elf_fpregset_t;
++
++/* Signal info. */
++struct elf_siginfo
++ {
++ int si_signo; /* Signal number. */
++ int si_code; /* Extra code. */
++ int si_errno; /* Errno. */
++ };
++
++/* Definitions to generate Intel SVR4-like core files. These mostly
++ have the same names as the SVR4 types with "elf_" tacked on the
++ front to prevent clashes with Linux definitions, and the typedef
++ forms have been avoided. This is mostly like the SVR4 structure,
++ but more Linuxy, with things that Linux does not support and which
++ GDB doesn't really use excluded. */
++
++struct elf_prstatus
++ {
++ struct elf_siginfo pr_info; /* Info associated with signal. */
++ short int pr_cursig; /* Current signal. */
++ unsigned long int pr_sigpend; /* Set of pending signals. */
++ unsigned long int pr_sighold; /* Set of held signals. */
++ __pid_t pr_pid;
++ __pid_t pr_ppid;
++ __pid_t pr_pgrp;
++ __pid_t pr_sid;
++ struct timeval pr_utime; /* User time. */
++ struct timeval pr_stime; /* System time. */
++ struct timeval pr_cutime; /* Cumulative user time. */
++ struct timeval pr_cstime; /* Cumulative system time. */
++ elf_gregset_t pr_reg; /* GP registers. */
++ int pr_fpvalid; /* True if math copro being used. */
++ };
++
++
++#define ELF_PRARGSZ (80) /* Number of chars for args. */
++
++struct elf_prpsinfo
++ {
++ char pr_state; /* Numeric process state. */
++ char pr_sname; /* Char for pr_state. */
++ char pr_zomb; /* Zombie. */
++ char pr_nice; /* Nice val. */
++ unsigned long int pr_flag; /* Flags. */
++ unsigned short int pr_uid;
++ unsigned short int pr_gid;
++ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
++ /* Lots missing */
++ char pr_fname[16]; /* Filename of executable. */
++ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
++ };
++
++/* The rest of this file provides the types for emulation of the
++ Solaris <proc_service.h> interfaces that should be implemented by
++ users of libthread_db. */
++
++/* Addresses. */
++typedef void *psaddr_t;
++
++/* Register sets. Linux has different names. */
++typedef elf_gregset_t prgregset_t;
++typedef elf_fpregset_t prfpregset_t;
++
++/* We don't have any differences between processes and threads,
++ therefore have only one PID type. */
++typedef __pid_t lwpid_t;
++
++/* Process status and info. In the end we do provide typedefs for them. */
++typedef struct elf_prstatus prstatus_t;
++typedef struct elf_prpsinfo prpsinfo_t;
++
++__END_DECLS
++
++#endif /* sys/procfs.h */
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/ucontext.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/ucontext.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,94 @@
++/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++/* Linux/AVR32 ABI compliant context switching support. */
++
++#ifndef _SYS_UCONTEXT_H
++#define _SYS_UCONTEXT_H 1
++
++#include <features.h>
++#include <signal.h>
++#include <sys/procfs.h>
++#include <bits/sigcontext.h>
++
++typedef int greg_t;
++
++/* Number of general registers. */
++#define NGREG 16
++
++/* Container for all general registers. */
++typedef elf_gregset_t gregset_t;
++
++/* Number of each register is the `gregset_t' array. */
++enum
++{
++ R0 = 0,
++#define R0 R0
++ R1 = 1,
++#define R1 R1
++ R2 = 2,
++#define R2 R2
++ R3 = 3,
++#define R3 R3
++ R4 = 4,
++#define R4 R4
++ R5 = 5,
++#define R5 R5
++ R6 = 6,
++#define R6 R6
++ R7 = 7,
++#define R7 R7
++ R8 = 8,
++#define R8 R8
++ R9 = 9,
++#define R9 R9
++ R10 = 10,
++#define R10 R10
++ R11 = 11,
++#define R11 R11
++ R12 = 12,
++#define R12 R12
++ R13 = 13,
++#define R13 R13
++ R14 = 14,
++#define R14 R14
++ R15 = 15
++#define R15 R15
++};
++
++/* Structure to describe FPU registers. */
++typedef elf_fpregset_t fpregset_t;
++
++/* Context to describe whole processor state. */
++typedef struct
++ {
++ gregset_t gregs;
++ fpregset_t fpregs;
++ } mcontext_t;
++
++/* Userlevel context. */
++typedef struct ucontext
++{
++ unsigned long uc_flags;
++ struct ucontext *uc_link;
++ stack_t uc_stack;
++ struct sigcontext uc_mcontext;
++ sigset_t uc_sigmask; /* mask last for extensibility */
++} ucontext_t;
++
++#endif /* sys/ucontext.h */
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/user.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/user.h 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,46 @@
++#ifndef _SYS_USER_H
++#define _SYS_USER_H
++
++struct user_fpregs
++{
++
++};
++
++struct user_regs
++{
++ unsigned long sr;
++ unsigned long pc;
++ unsigned long lr;
++ unsigned long sp;
++ unsigned long r12;
++ unsigned long r11;
++ unsigned long r10;
++ unsigned long r9;
++ unsigned long r8;
++ unsigned long r7;
++ unsigned long r6;
++ unsigned long r5;
++ unsigned long r4;
++ unsigned long r3;
++ unsigned long r2;
++ unsigned long r1;
++ unsigned long r0;
++ unsigned long r12_orig;
++};
++
++struct user
++{
++ struct user_regs regs; /* general registers */
++ size_t u_tsize; /* text size (pages) */
++ size_t u_dsize; /* data size (pages) */
++ size_t u_ssize; /* stack size (pages) */
++ unsigned long start_code; /* text starting address */
++ unsigned long start_data; /* data starting address */
++ unsigned long start_stack; /* stack starting address */
++ long int signal; /* signal causing core dump */
++ struct user_regs * u_ar0; /* help gdb find registers */
++ unsigned long magic; /* identifies a core file */
++ char u_comm[32]; /* user command name */
++};
++
++#endif /* _SYS_USER_H */
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/syscall.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/syscall.S 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,81 @@
++/*
++ * syscall for AVR32/uClibc
++ *
++ * Copyright (C) 2004 Atmel Norway
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU Library General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or (at your
++ * option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
++ * for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this program; if not, write to the Free Software Foundation,
++ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++#include <features.h>
++
++ .text
++
++ /*
++ * long int syscall(long int sysno, ...)
++ */
++ .global syscall
++ .type syscall, @function
++ .align 2
++syscall:
++ stm --sp, r3,r5,lr
++ sub lr, sp, -12
++ mov r8, r12
++ ldm lr, r3,r5,r9-r12
++ scall
++ cp.w r12, -4095
++ brlo .Ldone
++
++#ifdef __PIC__
++ lddpc r5, .Lgot
++.Lgotcalc:
++ rsub r5, pc
++# ifdef __UCLIBC_HAS_THREADS__
++ mov r3, r12
++ mcall r5[__errno_location@got]
++ st.w r12[0], r3
++# else
++ ld.w r3, r5[errno@got]
++ st.w r3[0], r12
++# endif
++#else
++# ifdef __UCLIBC_HAS_THREADS__
++ mov r3, r12
++ mcall .Lerrno_location
++ st.w r12[0], r3
++# else
++ lddpc r3, .Lerrno
++ st.w r3[0], r12
++# endif
++#endif
++ mov r12, -1
++
++.Ldone:
++ ldm sp++, r3,r5,pc
++
++ .align 2
++#ifdef __PIC__
++.Lgot:
++ .long .Lgotcalc - _GLOBAL_OFFSET_TABLE_
++#else
++# ifdef __UCLIBC_HAS_THREADS__
++.Lerrno_location:
++ .long __errno_location
++# else
++.Lerrno:
++ .long errno
++# endif
++#endif
++
++
++ .size syscall, . - syscall
+Index: uClibc-0.9.28/libc/sysdeps/linux/avr32/vfork.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libc/sysdeps/linux/avr32/vfork.S 2006-04-19 12:48:33.000000000 +0200
+@@ -0,0 +1,55 @@
++ /*
++ * vfork for uClibc
++ *
++ * Copyright (C) 2005 Atmel Norway
++ */
++
++ /*
++ * Clone the process without copying the address space. The
++ * calling process is suspended until the child either exits
++ * or calls execve.
++ *
++ * This all means that we cannot rely on the stack to store
++ * away registers, since they will be overwritten by the child
++ * as soon as it makes another function call (e.g. execve()).
++ * Fortunately, the Linux kernel preserves LR across system calls.
++ */
++#include <features.h>
++#include <sys/syscall.h>
++
++ .global __vfork
++ .type __vfork,@function
++ .align 1
++__vfork:
++ mov r8, __NR_vfork
++ scall
++ cp.w r12, -4096
++ retls r12
++
++ /* vfork failed, so we may use the stack freely */
++ pushm r4-r7,lr
++#ifdef __PIC__
++ lddpc r6, .L_GOT
++ rsub r4, r12, 0
++.L_RGOT:
++ rsub r6, pc
++ mcall r6[__errno_location@got]
++#else
++ rsub r4, r12, 0
++ mcall .L__errno_location
++#endif
++ st.w r12[0], r4
++ popm r4-r7,pc,r12=-1
++
++ .align 2
++#ifdef __PIC__
++.L_GOT:
++ .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
++#else
++.L__errno_location:
++ .long __errno_location
++#endif
++ .size __vfork, . - __vfork
++
++ .weak vfork
++ vfork = __vfork
+Index: uClibc-0.9.28/Rules.mak
+===================================================================
+--- uClibc-0.9.28.orig/Rules.mak 2006-05-05 09:26:01.000000000 +0200
++++ uClibc-0.9.28/Rules.mak 2006-05-05 09:27:17.000000000 +0200
+@@ -231,6 +231,10 @@ ifeq ($(strip $(TARGET_ARCH)),frv)
+ UCLIBC_LDSO=ld.so.1
+ endif
+
++ifeq ($(strip $(TARGET_ARCH)),avr32)
++ CPU_CFLAGS-$(CONFIG_AP7000) += -mcpu=ap7000
++endif
++
+ # Keep the check_gcc from being needlessly executed
+ ifndef PIEFLAG
+ ifneq ($(UCLIBC_BUILD_PIE),y)
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/avr32-linkrelax-option.patch b/packages/uclibc/uclibc-0.9.28/avr32/avr32-linkrelax-option.patch
new file mode 100644
index 0000000000..991e3442c7
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/avr32-linkrelax-option.patch
@@ -0,0 +1,40 @@
+From nobody Mon Sep 17 00:00:00 2001
+Subject: [PATCH] Make linkrelax configurable
+From: HÃ¥vard Skinnemoen <hskinnemoen@atmel.com>
+Date: 1133951618 +0100
+
+Add a linkrelax option to the configure system which will give
+appropriate options to the compiler, assembler and linker to enable
+link-time optimizations.
+
+---
+
+ Rules.mak | 2 ++
+ extra/Configs/Config.avr32 | 4 ++++
+ 2 files changed, 6 insertions(+)
+
+Index: uClibc-0.9.28/Rules.mak
+===================================================================
+--- uClibc-0.9.28.orig/Rules.mak 2006-02-08 17:58:53.000000000 +0100
++++ uClibc-0.9.28/Rules.mak 2006-02-08 17:59:07.000000000 +0100
+@@ -233,6 +233,8 @@ endif
+
+ ifeq ($(strip $(TARGET_ARCH)),avr32)
+ CPU_CFLAGS-$(CONFIG_AP7000) += -mcpu=ap7000
++ CPU_CFLAGS-$(LINKRELAX) += -masm-addr-pseudos -Wa,--pic,--linkrelax
++ CPU_LDFLAGS-$(LINKRELAX) += --relax
+ endif
+
+ # Keep the check_gcc from being needlessly executed
+Index: uClibc-0.9.28/extra/Configs/Config.avr32
+===================================================================
+--- uClibc-0.9.28.orig/extra/Configs/Config.avr32 2006-02-08 17:58:53.000000000 +0100
++++ uClibc-0.9.28/extra/Configs/Config.avr32 2006-02-08 17:59:07.000000000 +0100
+@@ -36,3 +36,7 @@ config CONFIG_AP7000
+ bool "AP7000"
+
+ endchoice
++
++config LINKRELAX
++ bool "Enable linker optimizations"
++ default n
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/avr32-string-ops.patch b/packages/uclibc/uclibc-0.9.28/avr32/avr32-string-ops.patch
new file mode 100644
index 0000000000..8518ccf664
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/avr32-string-ops.patch
@@ -0,0 +1,1139 @@
+Subject: [PATCH] AVR32-optimized string operations
+
+Add hand-optimized AVR32-specific string operations. Some of them
+need a bit more testing, though.
+
+---
+
+ libc/string/avr32/Makefile | 40 +++++++++++
+ libc/string/avr32/bcopy.S | 15 ++++
+ libc/string/avr32/bzero.S | 12 +++
+ libc/string/avr32/memchr.S | 62 +++++++++++++++++
+ libc/string/avr32/memcmp.S | 50 +++++++++++++
+ libc/string/avr32/memcpy.S | 110 ++++++++++++++++++++++++++++++
+ libc/string/avr32/memmove.S | 114 +++++++++++++++++++++++++++++++
+ libc/string/avr32/memset.S | 60 ++++++++++++++++
+ libc/string/avr32/strcat.S | 95 ++++++++++++++++++++++++++
+ libc/string/avr32/strcmp.S | 80 ++++++++++++++++++++++
+ libc/string/avr32/strcpy.S | 63 +++++++++++++++++
+ libc/string/avr32/stringtest.c | 144 ++++++++++++++++++++++++++++++++++++++++
+ libc/string/avr32/strlen.S | 52 ++++++++++++++
+ libc/string/avr32/strncpy.S | 77 +++++++++++++++++++++
+ libc/string/avr32/test_memcpy.c | 66 ++++++++++++++++++
+ 15 files changed, 1040 insertions(+)
+
+Index: uClibc-0.9.28-avr32/libc/string/avr32/bcopy.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/bcopy.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,15 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++ .text
++ .global bcopy
++ .type bcopy, @function
++ .align 1
++bcopy:
++ /* Swap the first two arguments */
++ eor r11, r12
++ eor r12, r11
++ eor r11, r12
++ rjmp __memmove
++ .size bcopy, . - bcopy
+Index: uClibc-0.9.28-avr32/libc/string/avr32/bzero.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/bzero.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,12 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++ .text
++ .global bzero
++ .type bzero, @function
++ .align 1
++bzero:
++ mov r10, r11
++ mov r11, 0
++ rjmp __memset
+Index: uClibc-0.9.28-avr32/libc/string/avr32/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/Makefile 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,40 @@
++# 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
++
++TOPDIR=../../../
++include $(TOPDIR)Rules.mak
++
++SSRC := bcopy.S bzero.S memcmp.S memcpy.S memmove.S
++SSRC += memset.S strcmp.S strlen.S
++# memchr.S, strcat.S, strcpy.S, strncpy.S is broken
++SOBJS := $(patsubst %.S,%.o, $(SSRC))
++OBJS := $(SOBJS)
++
++OBJ_LIST:= ../../obj.string.$(TARGET_ARCH)
++
++all: $(OBJ_LIST)
++
++$(OBJ_LIST): $(OBJS)
++ echo $(addprefix string/$(TARGET_ARCH)/, $(OBJS)) > $@
++
++$(SOBJS): %.o: %.S
++ $(CC) $(ASFLAGS) -c $< -o $@
++ $(STRIPTOOL) -x -R .note -R .comment $@
++
++clean:
++ $(RM) *.[oa] *~ core
+Index: uClibc-0.9.28-avr32/libc/string/avr32/memchr.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/memchr.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,62 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define str r12
++#define chr r11
++#define len r10
++
++ .text
++ .global memchr
++ .type memchr, @function
++memchr:
++ or chr, chr, chr << 8
++ or chr, chr, chr << 16
++
++ mov r9, str
++ andl r9, 3, COH
++ brne .Lunaligned_str
++
++1: sub len, 4
++ brlt 2f
++ ld.w r8, str++
++ psub.b r9, r8, r11
++ tnbz r9
++ brne 1b
++
++ sub str, 4
++ bfextu r9, r8, 24, 8
++ cp.b r9, r11
++ reteq str
++ sub str, -1
++ bfextu r9, r8, 16, 8
++ cp.b r9, r11
++ reteq str
++ sub str, -1
++ bfextu r9, r8, 8, 8
++ cp.b r9, r11
++ reteq str
++ sub str, -1
++ retal str
++
++2: sub len, -4
++ reteq 0
++
++3: ld.ub r8, str++
++ cp.w r8, 0
++ reteq str
++ sub len, 1
++ brne 3b
++
++ retal 0
++
++.Lunaligned_str:
++1: sub len, 1
++ retlt 0
++ ld.ub r8, str++
++ cp.b r8, r11
++ reteq str
++ sub r9, 1
++ brge 1b
++
++ rjmp .Laligned_search
+Index: uClibc-0.9.28-avr32/libc/string/avr32/memcmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/memcmp.S 2006-10-20 10:42:09.000000000 +0200
+@@ -0,0 +1,50 @@
++/*
++ * Copyright (C) 2004 Atmel Norway.
++ */
++
++#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:
++ psub.b r9, r8, r9
++ bfextu r8, r9, 24, 8
++ retne r8
++ bfextu r8, r9, 16, 8
++ retne r8
++ bfextu r8, r9, 8, 8
++ retne r8
++ retal r9
++
++ .size memcmp, . - memcmp
++
++ .weak bcmp
++ bcmp = memcmp
+Index: uClibc-0.9.28-avr32/libc/string/avr32/memcpy.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/memcpy.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,110 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++/* 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
++
++ .global __memcpy
++ .hidden __memcpy
++ .type __memcpy, @function
++memcpy:
++__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
+Index: uClibc-0.9.28-avr32/libc/string/avr32/memmove.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/memmove.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,114 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define dst r12
++#define src r11
++#define len r10
++
++ .text
++ .global memmove
++ .type memmove, @function
++
++ .global __memmove
++ .hidden __memmove
++ .type __memmove, @function
++memmove:
++__memmove:
++ cp.w src, dst
++ brge __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
+Index: uClibc-0.9.28-avr32/libc/string/avr32/memset.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/memset.S 2006-10-20 10:42:15.000000000 +0200
+@@ -0,0 +1,60 @@
++/*
++ * Copyright (C) 2004 Atmel Norway.
++ */
++
++#define s r12
++#define c r11
++#define n r10
++
++ .text
++ .global memset
++ .type memset, @function
++
++ .global __memset
++ .hidden __memset
++ .type __memset, @function
++
++ .align 1
++memset:
++__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
+Index: uClibc-0.9.28-avr32/libc/string/avr32/strcat.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/strcat.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,95 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define s1 r9
++#define s2 r11
++
++ .text
++ .global strcat
++ .type strcat, @function
++ .align 1
++strcat:
++ mov s1, r12
++
++ /* Make sure s1 is word-aligned */
++ mov r10, s1
++ andl r10, 3, COH
++ breq 2f
++
++ add pc, pc, r10 << 3
++ sub r0, r0, 0 /* 4-byte nop */
++ ld.ub r8, s1++
++ sub r8, r8, 0
++ breq 2f
++ ld.ub r8, s1++
++ sub r8, r8, 0
++ breq 3f
++ ld.ub r8, s1++
++ sub r8, r8, 0
++ breq 4f
++
++ /* Find the end of the first string */
++5: ld.w r8, s1++
++ tnbz r8
++ brne 5b
++
++ sub s1, 4
++
++ bfextu r10, r8, 24, 8
++ cp.w r10, 0
++ breq 1f
++ sub s1, -1
++ bfextu r10, r8, 16, 8
++ cp.w r10, 0
++ breq 2f
++ sub s1, -1
++ bfextu r10, r8, 8, 8
++ cp.w r10, 0
++ breq 3f
++ sub s1, -1
++ rjmp 4f
++
++ /* Now, append s2 */
++1: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++2: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++3: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++4: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++
++ /* Copy one word at a time */
++ ld.w r8, s2++
++ tnbz r8
++ breq 2f
++1: st.w r8, s2++
++ ld.w r8, s2++
++ tnbz r8
++ brne 1b
++
++ /* Copy the remaining bytes */
++ bfextu r10, r8, 24, 8
++ st.b s1++, r10
++ cp.w r10, 0
++ reteq r12
++ bfextu r10, r8, 16, 8
++ st.b s1++, r10
++ cp.w r10, 0
++ reteq r12
++ bfextu r10, r8, 8, 8
++ st.b s1++, r10
++ cp.w r10, 0
++ reteq r12
++ st.b s1++, r8
++ retal r12
++ .size strcat, . - strcat
+Index: uClibc-0.9.28-avr32/libc/string/avr32/strcmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/strcmp.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,80 @@
++/*
++ * Copyright (C) 2004 Atmel Norway.
++ */
++
++#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
++
++ .weak strcoll
++ strcoll = strcmp
+Index: uClibc-0.9.28-avr32/libc/string/avr32/strcpy.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/strcpy.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,63 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ *
++ * To reduce the size, this one might simply call strncpy with len = -1.
++ */
++
++#define dst r9
++#define src r11
++
++ .text
++ .global strcpy
++ .type strcpy, @function
++strcpy:
++ mov dst, r12
++
++ pref src[0]
++
++ /*
++ * Check alignment. If src is aligned but dst isn't, we can't
++ * do much about it...
++ */
++ mov r8, src
++ andl r8, 3 COH
++ brne .Lunaligned_src
++
++.Laligned_copy:
++1: ld.w r8, src++
++ tnbz r8
++ breq 2f
++ st.w dst++, r8
++ rjmp 1b
++
++2: /*
++ * Ok, r8 now contains the terminating '\0'. Copy the
++ * remaining bytes individually.
++ */
++ bfextu r10, r8, 24, 8
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++ bfextu r10, r8, 16, 8
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++ bfextu r10, r8, 8, 8
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++ st.b dst++, r8
++ retal r12
++
++.Lunaligned_src:
++ /* Copy bytes until we're aligned */
++ rsub r8, r8, 4
++ add pc, pc, r8 << 3
++ nop
++ nop
++ ld.ub r10, src++
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++
++ rjmp .Laligned_copy
+Index: uClibc-0.9.28-avr32/libc/string/avr32/stringtest.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/stringtest.c 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,144 @@
++
++#include <stdio.h>
++#include <string.h>
++#include <time.h>
++#include <sys/mman.h>
++
++#define BUF_SIZE (8 * 1024)
++
++static char *buf1;
++static char *buf1_ref;
++static char *buf2;
++
++extern void *optimized_memcpy(void *dest, void *src, size_t len);
++extern void *optimized_memmove(void *dest, void *src, size_t len);
++extern char *optimized_strcpy(char *dest, char *src);
++extern char *optimized_strncpy(char *dest, char *src, size_t len);
++
++void dump_mismatch(char *buf, char *ref, size_t len)
++{
++ int i, j;
++
++ for (i = 0; i < len; i += 16) {
++ if (memcmp(buf + i, ref + i, 16) == 0)
++ continue;
++
++ printf("%4x buf:", i);
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", buf[j]);
++ printf("\n ref:");
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", ref[j]);
++ printf("\n");
++ }
++}
++
++static void test_memcpy(int src_offset, int dst_offset, int len)
++{
++ clock_t start, old, new;
++ int i;
++
++ memset(buf1, 0x55, BUF_SIZE);
++ memset(buf1_ref, 0x55, BUF_SIZE);
++ memset(buf2, 0xaa, BUF_SIZE);
++
++ printf("Testing memcpy with offsets %d => %d and len %d...",
++ src_offset, dst_offset, len);
++
++ start = clock();
++ for (i = 0; i < 8192; i++)
++ optimized_memcpy(buf1 + dst_offset, buf2 + src_offset, len);
++ new = clock() - start;
++ start = clock();
++ for ( i = 0; i < 8192; i++)
++ memcpy(buf1_ref + dst_offset, buf2 + src_offset, len);
++ old = clock() - start;
++
++ if (memcmp(buf1, buf1_ref, BUF_SIZE) == 0)
++ printf("OK\n");
++ else {
++ printf("FAILED\n");
++ dump_mismatch(buf1, buf1_ref, BUF_SIZE);
++ }
++ printf("CPU time used: %d vs. %d\n", new, old);
++}
++
++static void test_memmove(int src_offset, int dst_offset, int len)
++{
++ clock_t start, old, new;
++
++ memset(buf1, 0x55, BUF_SIZE);
++ memset(buf1_ref, 0x55, BUF_SIZE);
++ memset(buf2, 0xaa, BUF_SIZE);
++
++ printf("Testing memmove with offsets %d => %d and len %d...",
++ src_offset, dst_offset, len);
++
++ start = clock();
++ optimized_memmove(buf1 + dst_offset, buf2 + src_offset, len);
++ new = clock() - start;
++ start = clock();
++ memmove(buf1_ref + dst_offset, buf2 + src_offset, len);
++ old = clock() - start;
++
++ if (memcmp(buf1, buf1_ref, BUF_SIZE) == 0)
++ printf("OK\n");
++ else {
++ printf("FAILED\n");
++ dump_mismatch(buf1, buf1_ref, BUF_SIZE);
++ }
++ printf("CPU time used: %d vs. %d\n", new, old);
++}
++
++int main(int argc, char *argv[])
++{
++ buf2 = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
++ if (buf2 == MAP_FAILED) {
++ perror("Failed to allocate memory for buf2");
++ return 1;
++ }
++ buf1 = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
++ if (buf1 == MAP_FAILED) {
++ perror("Failed to allocate memory for buf1");
++ return 1;
++ }
++ buf1_ref = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
++ if (buf1_ref == MAP_FAILED) {
++ perror("Failed to allocate memory for buf1_ref");
++ return 1;
++ }
++ printf("\n === MEMCPY ===\n\n");
++
++ test_memcpy(0, 0, BUF_SIZE - 32);
++ test_memcpy(0, 0, 1);
++ test_memcpy(0, 0, 31);
++ test_memcpy(0, 0, 32);
++ test_memcpy(0, 0, 127);
++ test_memcpy(0, 0, 128);
++ test_memcpy(4, 4, BUF_SIZE - 32 - 4);
++ test_memcpy(1, 1, BUF_SIZE - 32 - 1);
++ test_memcpy(1, 1, 126);
++ test_memcpy(0, 3, 128);
++ test_memcpy(1, 4, 128);
++ test_memcpy(0, 0, 0);
++
++ printf("\n === MEMMOVE ===\n\n");
++
++ test_memmove(0, 0, BUF_SIZE - 32);
++ test_memmove(0, 0, 1);
++ test_memmove(0, 0, 31);
++ test_memmove(0, 0, 32);
++ test_memmove(0, 0, BUF_SIZE - 33);
++ test_memmove(0, 0, 128);
++ test_memmove(4, 4, BUF_SIZE - 32 - 4);
++ test_memmove(1, 1, BUF_SIZE - 32 - 1);
++ test_memmove(1, 1, BUF_SIZE - 130);
++ test_memmove(0, 3, BUF_SIZE - 128);
++ test_memmove(1, 4, BUF_SIZE - 128);
++ test_memmove(0, 0, 0);
++
++ return 0;
++}
+Index: uClibc-0.9.28-avr32/libc/string/avr32/strlen.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/strlen.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,52 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#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
+Index: uClibc-0.9.28-avr32/libc/string/avr32/strncpy.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/strncpy.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,77 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define dst r9
++#define src r11
++
++ .text
++ .global strcpy
++ .type strncpy, @function
++strncpy:
++ mov dst, r12
++
++ pref src[0]
++ mov dst, r12
++
++ /*
++ * Check alignment. If src is aligned but dst isn't, we can't
++ * do much about it...
++ */
++ mov r8, src
++ andl r8, 3 COH
++ brne .Lunaligned_src
++
++.Laligned_copy:
++ sub r10, 4
++ brlt 3f
++1: ld.w r8, src++
++ tnbz r8
++ breq 2f
++ st.w dst++, r8
++ sub r10, 4
++ brne 1b
++
++3: sub r10, -4
++ reteq r12
++
++ /* This is safe as long as src is word-aligned and r10 > 0 */
++ ld.w r8, src++
++
++2: /*
++ * Ok, r8 now contains the terminating '\0'. Copy the
++ * remaining bytes individually.
++ */
++ bfextu r11, r8, 24, 8
++ st.b dst++, r11
++ cp.w r11, 0
++ reteq r12
++ sub r10, 1
++ reteq r12
++ bfextu r11, r8, 16, 8
++ st.b dst++, r11
++ cp.w r11, 0
++ reteq r12
++ sub r10, 1
++ reteq r12
++ bfextu r11, r8, 8, 8
++ st.b dst++, r11
++ cp.w r11, 0
++ reteq r12
++ sub r10, 1
++ reteq r12
++ st.b dst++, r8
++ retal r12
++
++.Lunaligned_src:
++ /* Copy bytes until we're aligned */
++ min r8, r8, r10
++ sub r10, r8
++ sub r8, 1
++ retlt r12
++1: ld.ub r10, src++
++ st.b dst++, r10
++ sub r8, 1
++ brge 1b
++
++ rjmp .Laligned_copy
+Index: uClibc-0.9.28-avr32/libc/string/avr32/test_memcpy.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/test_memcpy.c 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,66 @@
++
++#include <stdio.h>
++#include <string.h>
++
++#define BUF_SIZE 32768
++
++static char buf1[BUF_SIZE] __attribute__((aligned(32)));
++static char buf1_ref[BUF_SIZE] __attribute__((aligned(32)));
++static char buf2[BUF_SIZE] __attribute__((aligned(32)));
++
++extern void *new_memcpy(void *dest, void *src, size_t len);
++
++void dump_mismatch(char *buf, char *ref, size_t len)
++{
++ int i, j;
++
++ for (i = 0; i < len; i += 16) {
++ if (memcmp(buf + i, ref + i, 16) == 0)
++ continue;
++
++ printf("% 4x buf:", i);
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", buf[j]);
++ printf("\n ref:");
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", ref[j]);
++ printf("\n");
++ }
++}
++
++void test(int src_offset, int dst_offset, int len)
++{
++ memset(buf1, 0x55, sizeof(buf1));
++ memset(buf1_ref, 0x55, sizeof(buf1_ref));
++ memset(buf2, 0xaa, sizeof(buf2));
++
++ printf("Testing with offsets %d => %d and len %d...",
++ src_offset, dst_offset, len);
++
++ new_memcpy(buf1 + dst_offset, buf2 + src_offset, len);
++ memcpy(buf1_ref + dst_offset, buf2 + src_offset, len);
++
++ if (memcmp(buf1, buf1_ref, sizeof(buf1)) == 0)
++ printf("OK\n");
++ else {
++ printf("FAILED\n");
++ dump_mismatch(buf1, buf1_ref, sizeof(buf1));
++ }
++}
++
++int main(int argc, char *argv[])
++{
++ test(0, 0, BUF_SIZE);
++ test(0, 0, 1);
++ test(0, 0, 31);
++ test(0, 0, 32);
++ test(0, 0, 127);
++ test(0, 0, 128);
++ test(4, 4, BUF_SIZE - 4);
++ test(1, 1, BUF_SIZE - 1);
++ test(1, 1, 126);
++ test(0, 3, 128);
++ test(1, 4, 128);
++
++ return 0;
++}
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/fix-__libc_fcntl64-varargs-prototype.patch b/packages/uclibc/uclibc-0.9.28/avr32/fix-__libc_fcntl64-varargs-prototype.patch
new file mode 100644
index 0000000000..3319f98de9
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/fix-__libc_fcntl64-varargs-prototype.patch
@@ -0,0 +1,24 @@
+Subject: [PATCH] Fix __libc_fcntl64 prototype in __syscall_fcntl.c
+
+__libc_fcntl64 is a varargs function and should be declared as such.
+Otherwise, the gcc compiler for AVR32, and perhaps other architectures,
+will use the wrong calling convention.
+
+---
+
+ libc/sysdeps/linux/common/__syscall_fcntl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: uClibc-0.9.28/libc/sysdeps/linux/common/__syscall_fcntl.c
+===================================================================
+--- uClibc-0.9.28.orig/libc/sysdeps/linux/common/__syscall_fcntl.c 2006-02-07 16:48:32.000000000 +0100
++++ uClibc-0.9.28/libc/sysdeps/linux/common/__syscall_fcntl.c 2006-02-07 17:19:09.000000000 +0100
+@@ -12,7 +12,7 @@
+ #include <fcntl.h>
+
+ #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
+-extern int __libc_fcntl64(int fd, int cmd, long arg);
++extern int __libc_fcntl64(int fd, int cmd, ...);
+ #endif
+
+ #define __NR___syscall_fcntl __NR_fcntl
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/fix-broken-__libc_open-declaration.patch b/packages/uclibc/uclibc-0.9.28/avr32/fix-broken-__libc_open-declaration.patch
new file mode 100644
index 0000000000..aafdc8cd7f
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/fix-broken-__libc_open-declaration.patch
@@ -0,0 +1,30 @@
+From nobody Mon Sep 17 00:00:00 2001
+From: HÃ¥vard Skinnemoen <hskinnemoen@atmel.com>
+Date: Fri Apr 7 17:10:32 2006 +0200
+Subject: [PATCH] Fix broken __libc_open declaration in open64.c
+
+__libc_open is a vararg function and should therefore be declared as
+such. Fixes bug #4190.
+
+---
+
+ libc/sysdeps/linux/common/open64.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+70f2c81903327a8a346e370830932b80045ab04e
+diff --git a/libc/sysdeps/linux/common/open64.c b/libc/sysdeps/linux/common/open64.c
+index 543aa13..d9a27a7 100644
+--- a/libc/sysdeps/linux/common/open64.c
++++ b/libc/sysdeps/linux/common/open64.c
+@@ -26,7 +26,7 @@
+ #endif
+
+ #ifdef __UCLIBC_HAS_LFS__
+-extern int __libc_open (__const char *file, int oflag, mode_t mode);
++extern int __libc_open (__const char *file, int oflag, ...);
+
+ /* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
+ a third argument is the file protection. */
+--
+1.2.4
+
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/fix-getrusage-argument-type.patch b/packages/uclibc/uclibc-0.9.28/avr32/fix-getrusage-argument-type.patch
new file mode 100644
index 0000000000..d68576b9bd
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/fix-getrusage-argument-type.patch
@@ -0,0 +1,19 @@
+Subject: [PATCH] Fix getrusage argument type
+
+The first argument to getrusage is of type __rusage_who_t, not int.
+This patch fixes that.
+---
+
+ libc/sysdeps/linux/common/getrusage.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: uClibc-0.9.28/libc/sysdeps/linux/common/getrusage.c
+===================================================================
+--- uClibc-0.9.28.orig/libc/sysdeps/linux/common/getrusage.c 2006-02-07 17:18:22.000000000 +0100
++++ uClibc-0.9.28/libc/sysdeps/linux/common/getrusage.c 2006-02-07 17:18:31.000000000 +0100
+@@ -10,4 +10,4 @@
+ #include "syscalls.h"
+ #include <unistd.h>
+ #include <wait.h>
+-_syscall2(int, getrusage, int, who, struct rusage *, usage);
++_syscall2(int, getrusage, __rusage_who_t, who, struct rusage *, usage);
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/ldd-avr32-support.patch b/packages/uclibc/uclibc-0.9.28/avr32/ldd-avr32-support.patch
new file mode 100644
index 0000000000..dd61f174a7
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/ldd-avr32-support.patch
@@ -0,0 +1,25 @@
+Subject: [PATCH] ldd: AVR32 support
+
+Add AVR32-specific definitions to ldd.
+
+---
+
+ utils/ldd.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+Index: uClibc-0.9.28/utils/ldd.c
+===================================================================
+--- uClibc-0.9.28.orig/utils/ldd.c 2006-02-07 16:48:02.000000000 +0100
++++ uClibc-0.9.28/utils/ldd.c 2006-02-07 17:13:00.000000000 +0100
+@@ -56,6 +56,11 @@
+ #define ELFCLASSM ELFCLASS32
+ #endif
+
++#if defined(__avr32__)
++#define MATCH_MACHINE(x) (x == EM_AVR32)
++#define ELFCLASSM ELFCLASS32
++#endif
++
+ #if defined(__s390__)
+ #define MATCH_MACHINE(x) (x == EM_S390)
+ #define ELFCLASSM ELFCLASS32
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/ldso-always-inline-_dl_memcpy.patch b/packages/uclibc/uclibc-0.9.28/avr32/ldso-always-inline-_dl_memcpy.patch
new file mode 100644
index 0000000000..cf0e677ffe
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/ldso-always-inline-_dl_memcpy.patch
@@ -0,0 +1,24 @@
+Subject: [PATCH] ldso: Always inline _dl_memcpy()
+
+On some gcc versions, inline is merely a hint. AVR32 depends on this
+function actually getting inlined, so we need to use __always_inline
+instead of just inline.
+
+---
+
+ ldso/include/dl-string.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: uClibc-0.9.28/ldso/include/dl-string.h
+===================================================================
+--- uClibc-0.9.28.orig/ldso/include/dl-string.h 2006-02-07 17:01:28.000000000 +0100
++++ uClibc-0.9.28/ldso/include/dl-string.h 2006-02-07 17:03:02.000000000 +0100
+@@ -134,7 +134,7 @@ static inline char * _dl_strstr(const ch
+ } while (1);
+ }
+
+-static inline void * _dl_memcpy(void * dst, const void * src, size_t len)
++static __always_inline void * _dl_memcpy(void * dst, const void * src, size_t len)
+ {
+ register char *a = dst-1;
+ register const char *b = src-1;
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/ldso-always-inline-syscalls.patch b/packages/uclibc/uclibc-0.9.28/avr32/ldso-always-inline-syscalls.patch
new file mode 100644
index 0000000000..e6f5c42585
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/ldso-always-inline-syscalls.patch
@@ -0,0 +1,107 @@
+Subject: [PATCH] ldso: Always inline system calls
+
+Some versions of gcc consider inline merely a hint. AVR32 depends on
+the system calls actually being inlined, so we need to use
+__always_inline instead of just inline.
+
+---
+
+ ldso/include/dl-syscall.h | 38 +++++++++++++++++++-------------------
+ 1 file changed, 19 insertions(+), 19 deletions(-)
+
+Index: uClibc-0.9.28/ldso/include/dl-syscall.h
+===================================================================
+--- uClibc-0.9.28.orig/ldso/include/dl-syscall.h 2006-02-07 17:07:06.000000000 +0100
++++ uClibc-0.9.28/ldso/include/dl-syscall.h 2006-02-07 17:08:47.000000000 +0100
+@@ -60,59 +60,59 @@
+ dynamic linking at all, so we cannot return any error codes.
+ We just punt if there is an error. */
+ #define __NR__dl_exit __NR_exit
+-static inline _syscall1(void, _dl_exit, int, status);
++static __always_inline _syscall1(void, _dl_exit, int, status);
+
+ #define __NR__dl_close __NR_close
+-static inline _syscall1(int, _dl_close, int, fd);
++static __always_inline _syscall1(int, _dl_close, int, fd);
+
+ #define __NR__dl_open __NR_open
+-static inline _syscall3(int, _dl_open, const char *, fn, int, flags, __kernel_mode_t, mode);
++static __always_inline _syscall3(int, _dl_open, const char *, fn, int, flags, __kernel_mode_t, mode);
+
+ #define __NR__dl_write __NR_write
+-static inline _syscall3(unsigned long, _dl_write, int, fd,
++static __always_inline _syscall3(unsigned long, _dl_write, int, fd,
+ const void *, buf, unsigned long, count);
+
+ #define __NR__dl_read __NR_read
+-static inline _syscall3(unsigned long, _dl_read, int, fd,
++static __always_inline _syscall3(unsigned long, _dl_read, int, fd,
+ const void *, buf, unsigned long, count);
+
+ #define __NR__dl_mprotect __NR_mprotect
+-static inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, len, int, prot);
++static __always_inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, len, int, prot);
+
+ #define __NR__dl_stat __NR_stat
+-static inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf);
++static __always_inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf);
+
+ #define __NR__dl_munmap __NR_munmap
+-static inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length);
++static __always_inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length);
+
+ #define __NR__dl_getuid __NR_getuid
+-static inline _syscall0(uid_t, _dl_getuid);
++static __always_inline _syscall0(uid_t, _dl_getuid);
+
+ #define __NR__dl_geteuid __NR_geteuid
+-static inline _syscall0(uid_t, _dl_geteuid);
++static __always_inline _syscall0(uid_t, _dl_geteuid);
+
+ #define __NR__dl_getgid __NR_getgid
+-static inline _syscall0(gid_t, _dl_getgid);
++static __always_inline _syscall0(gid_t, _dl_getgid);
+
+ #define __NR__dl_getegid __NR_getegid
+-static inline _syscall0(gid_t, _dl_getegid);
++static __always_inline _syscall0(gid_t, _dl_getegid);
+
+ #define __NR__dl_getpid __NR_getpid
+-static inline _syscall0(gid_t, _dl_getpid);
++static __always_inline _syscall0(gid_t, _dl_getpid);
+
+ #define __NR__dl_readlink __NR_readlink
+-static inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, size_t, bufsiz);
++static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, size_t, bufsiz);
+
+ #ifdef __NR_mmap
+ #ifdef MMAP_HAS_6_ARGS
+ #define __NR__dl_mmap __NR_mmap
+-static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
++static __always_inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
+ int, prot, int, flags, int, fd, off_t, offset);
+ #else
+ #define __NR__dl_mmap_real __NR_mmap
+-static inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
++static __always_inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
+
+-static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
++static __always_inline void * _dl_mmap(void * addr, unsigned long size, int prot,
+ int flags, int fd, unsigned long offset)
+ {
+ unsigned long buffer[6];
+@@ -128,12 +128,12 @@ static inline void * _dl_mmap(void * add
+ #endif
+ #elif defined __NR_mmap2
+ #define __NR___syscall_mmap2 __NR_mmap2
+-static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
++static __always_inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
+ size_t, len, int, prot, int, flags, int, fd, off_t, offset);
+ /*always 12, even on architectures where PAGE_SHIFT != 12 */
+ #define MMAP2_PAGE_SHIFT 12
+ #define MAP_FAILED ((void *) -1)
+-static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
++static __always_inline void * _dl_mmap(void * addr, unsigned long size, int prot,
+ int flags, int fd, unsigned long offset)
+ {
+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-2.patch b/packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-2.patch
new file mode 100644
index 0000000000..ddeb84d069
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-2.patch
@@ -0,0 +1,526 @@
+Subject: [PATCH] ldso: AVR32 support
+
+This implements the AVR32-specific parts of the dynamic linker.
+
+---
+
+ ldso/ldso/avr32/dl-debug.h | 45 +++++++++
+ ldso/ldso/avr32/dl-startup.h | 110 ++++++++++++++++++++++++
+ ldso/ldso/avr32/dl-syscalls.h | 5 +
+ ldso/ldso/avr32/dl-sysdep.h | 103 ++++++++++++++++++++++
+ ldso/ldso/avr32/elfinterp.c | 191 ++++++++++++++++++++++++++++++++++++++++++
+ ldso/ldso/avr32/resolve.S | 28 ++++++
+ 6 files changed, 482 insertions(+)
+
+Index: uClibc-0.9.28/ldso/ldso/avr32/dl-debug.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/ldso/ldso/avr32/dl-debug.h 2006-05-05 09:30:43.000000000 +0200
+@@ -0,0 +1,45 @@
++/*
++ * AVR32 ELF shared libary loader support
++ *
++ * Copyright (C) 2005 Atmel Norway
++ * 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.
++ */
++
++static const char *_dl_reltypes_tab[] = {
++ "R_AVR32_NONE",
++ "R_AVR32_32", "R_AVR32_16", "R_AVR32_8",
++ "R_AVR32_32_PCREL", "R_AVR32_16_PCREL", "R_AVR32_8_PCREL",
++ "R_AVR32_DIFF32", "R_AVR32_DIFF16", "R_AVR32_DIFF8",
++ "R_AVR32_GOT32", "R_AVR32_GOT16", "R_AVR32_GOT8",
++ "R_AVR32_21S", "R_AVR32_16U", "R_AVR32_16S", "R_AVR32_8S", "R_AVR32_8S_EXT",
++ "R_AVR32_22H_PCREL", "R_AVR32_18W_PCREL", "R_AVR32_16B_PCREL",
++ "R_AVR32_16N_PCREL", "R_AVR32_14UW_PCREL", "R_AVR32_11H_PCREL",
++ "R_AVR32_10UW_PCREL", "R_AVR32_9H_PCREL", "R_AVR32_9UW_PCREL",
++ "R_AVR32_HI16", "R_AVR32_LO16",
++ "R_AVR32_GOTPC", "R_AVR32_GOTCALL", "R_AVR32_LDA_GOT",
++ "R_AVR32_GOT21S", "R_AVR32_GOT18SW", "R_AVR32_GOT16S", "R_AVR32_GOT7UW",
++ "R_AVR32_32_CPENT", "R_AVR32_CPCALL", "R_AVR32_16_CP", "R_AVR32_9W_CP",
++ "R_AVR32_RELATIVE", "R_AVR32_GLOB_DAT", "R_AVR32_JMP_SLOT",
++ "R_AVR32_ALIGN",
++};
+Index: uClibc-0.9.28/ldso/ldso/avr32/dl-startup.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/ldso/ldso/avr32/dl-startup.h 2006-05-05 09:29:45.000000000 +0200
+@@ -0,0 +1,110 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * Architecture specific code used by dl-startup.c
++ * Copyright (C) 2005 Atmel Norway
++ */
++
++/* This is the library loader's main entry point. Let _dl_boot2 do its
++ * initializations and jump to the application's entry point
++ * afterwards. */
++asm( " .text\n"
++ " .global _start\n"
++ " .type _start,@function\n"
++ "_start:\n"
++ /* All arguments are on the stack initially */
++ " mov r12, sp\n"
++ " rcall _dl_start\n"
++ /* Returns user entry point in r12. Save it. */
++ " mov r0, r12\n"
++ /* We're PIC, so get the Global Offset Table */
++ " lddpc r6, .L_GOT\n"
++ ".L_RGOT:\n"
++ " rsub r6, pc\n"
++ /* Adjust argc and argv according to _dl_skip_args */
++ " ld.w r1, r6[_dl_skip_args@got]\n"
++ " ld.w r1, r1[0]\n"
++ " ld.w r2, sp++\n"
++ " sub r2, r1\n"
++ " add sp, sp, r1 << 2\n"
++ " st.w --sp, r2\n"
++ /* Load the finalizer function */
++ " ld.w r12, r6[_dl_fini@got]\n"
++ /* Jump to the user's entry point */
++ " mov pc, r0\n\n"
++
++ " .align 2\n"
++ ".L_GOT:"
++ " .long .L_RGOT - _GLOBAL_OFFSET_TABLE_\n"
++ " .size _start, . - _start\n"
++ " .previous\n");
++
++/* Get a pointer to the argv array. On many platforms this can be just
++ * the address if the first argument, on other platforms we need to
++ * do something a little more subtle here. */
++#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long *)ARGS + 1)
++
++
++/* We can't call functions before the GOT has been initialized */
++#define NO_FUNCS_BEFORE_BOOTSTRAP
++
++/*
++ * Relocate the GOT during dynamic loader bootstrap. This will add
++ * the load address to all entries in the GOT, which is necessary
++ * because the linker doesn't generate R_AVR32_RELATIVE relocs for the
++ * GOT.
++ */
++static __always_inline
++void PERFORM_BOOTSTRAP_GOT(struct elf_resolve *tpnt)
++{
++ Elf32_Addr i, nr_got;
++ register Elf32_Addr *__r6 __asm__("r6");
++ Elf32_Addr *got = __r6;
++
++ nr_got = tpnt->dynamic_info[DT_AVR32_GOTSZ_IDX] / sizeof(*got);
++ for (i = 2; i < nr_got; i++)
++ got[i] += tpnt->loadaddr;
++}
++
++#define PERFORM_BOOTSTRAP_GOT(tpnt) PERFORM_BOOTSTRAP_GOT(tpnt)
++
++/* Handle relocation of the symbols in the dynamic loader. */
++static __always_inline
++void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
++ unsigned long symbol_addr,
++ unsigned long load_addr, Elf32_Sym *symtab)
++{
++ switch(ELF32_R_TYPE(rpnt->r_info)) {
++ case R_AVR32_NONE:
++ break;
++ case R_AVR32_GLOB_DAT:
++ case R_AVR32_JMP_SLOT:
++ *reloc_addr = symbol_addr;
++ break;
++ case R_AVR32_RELATIVE:
++ SEND_STDERR_DEBUG("Applying RELATIVE relocation: ");
++ SEND_ADDRESS_STDERR_DEBUG(load_addr, 0);
++ SEND_STDERR_DEBUG(" + ");
++ SEND_ADDRESS_STDERR_DEBUG(rpnt->r_addend, 1);
++ *reloc_addr = load_addr + rpnt->r_addend;
++ break;
++ default:
++ SEND_STDERR("BOOTSTRAP_RELOC: unhandled reloc_type ");
++ SEND_NUMBER_STDERR(ELF32_R_TYPE(rpnt->r_info), 1);
++ SEND_STDERR("REL, SYMBOL, LOAD: ");
++ SEND_ADDRESS_STDERR(reloc_addr, 0);
++ SEND_STDERR(", ");
++ SEND_ADDRESS_STDERR(symbol_addr, 0);
++ SEND_STDERR(", ");
++ SEND_ADDRESS_STDERR(load_addr, 1);
++ _dl_exit(1);
++ }
++}
++
++/* Transfer control to the user's application, once the dynamic loader
++ * is done. This routine has to exit the current function, then call
++ * the _dl_elf_main function.
++ *
++ * Since our _dl_boot will simply call whatever is returned by
++ * _dl_boot2, we can just return the address we're supposed to
++ * call. */
++#define START() return _dl_elf_main;
+Index: uClibc-0.9.28/ldso/ldso/avr32/dl-syscalls.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/ldso/ldso/avr32/dl-syscalls.h 2006-05-05 09:29:25.000000000 +0200
+@@ -0,0 +1,5 @@
++/* We can't use the real errno in ldso, since it has not yet
++ * been dynamicly linked in yet. */
++extern int _dl_errno;
++#define __set_errno(X) {(_dl_errno) = (X);}
++#include "sys/syscall.h"
+Index: uClibc-0.9.28/ldso/ldso/avr32/dl-sysdep.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/ldso/ldso/avr32/dl-sysdep.h 2006-05-05 09:30:43.000000000 +0200
+@@ -0,0 +1,103 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * Various assembly language/system dependent hacks that are required
++ * so that we can minimize the amount of platform specific code.
++ * Copyright (C) 2004-2005 Atmel Norway
++ */
++
++/* Define this if the system uses RELOCA. */
++#define ELF_USES_RELOCA
++
++#include <elf.h>
++
++#define ARCH_NUM 1
++#define DT_AVR32_GOTSZ_IDX (DT_NUM + OS_NUM)
++
++#define ARCH_DYNAMIC_INFO(dpnt, dynamic, debug_addr) \
++ do { \
++ if (dpnt->d_tag == DT_AVR32_GOTSZ) \
++ dynamic[DT_AVR32_GOTSZ_IDX] = dpnt->d_un.d_val; \
++ } while (0)
++
++/* Initialization sequence for the application/library GOT. */
++#define INIT_GOT(GOT_BASE,MODULE) \
++ do { \
++ unsigned long i, nr_got; \
++ \
++ GOT_BASE[0] = (unsigned long) _dl_linux_resolve; \
++ GOT_BASE[1] = (unsigned long) MODULE; \
++ \
++ /* Add load address displacement to all GOT entries */ \
++ nr_got = MODULE->dynamic_info[DT_AVR32_GOTSZ_IDX] / 4; \
++ for (i = 2; i < nr_got; i++) \
++ GOT_BASE[i] += (unsigned long)MODULE->loadaddr; \
++ } while (0)
++
++#define do_rem(result, n, base) ((result) = (n) % (base))
++
++/* Here we define the magic numbers that this dynamic loader should accept */
++#define MAGIC1 EM_AVR32
++#undef MAGIC2
++
++/* Used for error messages */
++#define ELF_TARGET "AVR32"
++
++unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got);
++
++/* 4096 bytes alignment */
++#define PAGE_ALIGN 0xfffff000
++#define ADDR_ALIGN 0xfff
++#define OFFS_ALIGN 0x7ffff000
++
++#define elf_machine_type_class(type) \
++ ((type == R_AVR32_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)
++
++/* AVR32 doesn't need any COPY relocs */
++#define DL_NO_COPY_RELOCS
++
++/* Return the link-time address of _DYNAMIC. Conveniently, this is the
++ first element of the GOT. This must be inlined in a function which
++ uses global data. */
++static inline Elf32_Addr
++elf_machine_dynamic (void)
++{
++ register Elf32_Addr *got asm ("r6");
++ return *got;
++}
++
++/* Return the run-time load address of the shared object. */
++static inline Elf32_Addr
++elf_machine_load_address (void)
++{
++ extern void __dl_start asm("_dl_start");
++ Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
++ Elf32_Addr pcrel_addr;
++
++ asm (" lddpc %0, 2f\n"
++ "1: add %0, pc\n"
++ " rjmp 3f\n"
++ " .align 2\n"
++ "2: .long _dl_start - 1b\n"
++ "3:\n"
++ : "=r"(pcrel_addr) : : "cc");
++
++ return pcrel_addr - got_addr;
++}
++
++/*
++ * Perform any RELATIVE relocations specified by DT_RELCOUNT.
++ * Currently, we don't use that tag, but we might in the future as
++ * this would reduce the startup time somewhat (although probably not by much).
++ */
++static inline void
++elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
++ Elf32_Word relative_count)
++{
++ Elf32_Rela *rpnt = (void *)rel_addr;
++
++ do {
++ Elf32_Addr *reloc_addr;
++ reloc_addr = (void *)(load_off + (rpnt++)->r_offset);
++ *reloc_addr = load_off + rpnt->r_addend;
++ } while (--relative_count);
++}
+Index: uClibc-0.9.28/ldso/ldso/avr32/elfinterp.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/ldso/ldso/avr32/elfinterp.c 2006-05-05 09:30:43.000000000 +0200
+@@ -0,0 +1,191 @@
++/*
++ * AVR32 ELF shared library loader suppport
++ *
++ * Copyright (C) 2004-2006 Atmel Corporation
++ *
++ * 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.
++ */
++
++unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got)
++{
++ struct elf_resolve *tpnt = (struct elf_resolve *)got[1];
++ Elf32_Sym *sym;
++ unsigned long local_gotno;
++ unsigned long gotsym;
++ unsigned long new_addr;
++ char *strtab, *symname;
++ unsigned long *entry;
++ unsigned long sym_index = got_offset / 4;
++
++#if 0
++ local_gotno = tpnt->dynamic_info[DT_AVR32_LOCAL_GOTNO];
++ gotsym = tpnt->dynamic_info[DT_AVR32_GOTSYM];
++
++ sym = ((Elf32_Sym *)(tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr))
++ + sym_index;
++ strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
++ symname = strtab + sym->st_name;
++
++#if 0
++ new_addr = (unsigned long) _dl_find_hash(strtab + sym->st_name,
++ tpnt->symbol_scope, tpnt,
++ resolver);
++#endif
++
++ entry = (unsigned long *)(got + local_gotno + sym_index - gotsym);
++ *entry = new_addr;
++#endif
++
++ return new_addr;
++}
++
++static int
++_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ unsigned long rel_addr, unsigned long rel_size,
++ int (*reloc_func)(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab))
++{
++ Elf32_Sym *symtab;
++ Elf32_Rela *rpnt;
++ char *strtab;
++ int i;
++
++ rpnt = (Elf32_Rela *)rel_addr;
++ rel_size /= sizeof(Elf32_Rela);
++ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
++ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
++
++ for (i = 0; i < rel_size; i++, rpnt++) {
++ int symtab_index, res;
++
++ symtab_index = ELF32_R_SYM(rpnt->r_info);
++
++ debug_sym(symtab, strtab, symtab_index);
++ debug_reloc(symtab, strtab, rpnt);
++
++ res = reloc_func(tpnt, scope, rpnt, symtab, strtab);
++
++ if (res == 0)
++ continue;
++
++ _dl_dprintf(2, "\n%s: ", _dl_progname);
++
++ if (symtab_index)
++ _dl_dprintf(2, "symbol '%s': ",
++ strtab + symtab[symtab_index].st_name);
++
++ if (res < 0) {
++ int reloc_type = ELF32_R_TYPE(rpnt->r_info);
++#if defined(__SUPPORT_LD_DEBUG__)
++ _dl_dprintf(2, "can't handle reloc type %s\n",
++ _dl_reltypes(reloc_type));
++#else
++ _dl_dprintf(2, "can't handle reloc type %x\n",
++ reloc_type);
++#endif
++ _dl_exit(-res);
++ } else {
++ _dl_dprintf(2, "can't resolve symbol\n");
++ return res;
++ }
++ }
++
++ return 0;
++}
++
++static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab)
++{
++ int reloc_type;
++ int symtab_index;
++ char *symname;
++ unsigned long *reloc_addr;
++ unsigned long symbol_addr;
++#if defined(__SUPPORT_LD_DEBUG__)
++ unsigned long old_val;
++#endif
++
++ reloc_addr = (unsigned long *)(tpnt->loadaddr + rpnt->r_offset);
++ reloc_type = ELF32_R_TYPE(rpnt->r_info);
++ symtab_index = ELF32_R_SYM(rpnt->r_info);
++ symbol_addr = 0;
++ symname = strtab + symtab[symtab_index].st_name;
++
++ if (symtab_index) {
++ symbol_addr = (unsigned long)
++ _dl_find_hash(strtab + symtab[symtab_index].st_name,
++ tpnt->symbol_scope, tpnt,
++ elf_machine_type_class(reloc_type));
++
++ /* Allow undefined references to weak symbols */
++ if (!symbol_addr &&
++ ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
++ _dl_progname, symname);
++ return 0;
++ }
++ }
++
++#if defined(__SUPPORT_LD_DEBUG__)
++ old_val = *reloc_addr;
++#endif
++ switch (reloc_type) {
++ case R_AVR32_NONE:
++ break;
++ case R_AVR32_GLOB_DAT:
++ case R_AVR32_JMP_SLOT:
++ *reloc_addr = symbol_addr + rpnt->r_addend;
++ break;
++ case R_AVR32_RELATIVE:
++ *reloc_addr = (unsigned long)tpnt->loadaddr
++ + rpnt->r_addend;
++ break;
++ default:
++ return -1;
++ }
++
++#if defined(__SUPPORT_LD_DEBUG__)
++ if (_dl_debug_reloc && _dl_debug_detail)
++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n",
++ old_val, *reloc_addr);
++#endif
++
++ return 0;
++}
++
++void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
++ unsigned long rel_addr,
++ unsigned long rel_size)
++{
++ /* TODO: Might want to support this in order to get faster
++ * startup times... */
++}
++
++int _dl_parse_relocation_information(struct dyn_elf *rpnt,
++ unsigned long rel_addr,
++ unsigned long rel_size)
++{
++ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size,
++ _dl_do_reloc);
++}
+Index: uClibc-0.9.28/ldso/ldso/avr32/resolve.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/ldso/ldso/avr32/resolve.S 2006-05-05 09:29:25.000000000 +0200
+@@ -0,0 +1,28 @@
++/*
++ * Linux dynamic resolving code for AVR32. Fixes up the GOT entry as
++ * indicated in register r12 and jumps to the resolved address.
++ *
++ * 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.
++ *
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define ip r5
++
++ .text
++ .global _dl_linux_resolve
++ .type _dl_linux_resolve,@function
++_dl_linux_resolve:
++ /* The PLT code pushed r8 for us. It contains the address of this
++ function's GOT entry, that is entry 0. ip contains the address
++ of the GOT entry of the function we wanted to call. */
++ stm --sp, r9-r12, lr
++ mov r11, r8
++ sub r12, ip, r8
++ rcall _dl_linux_resolver
++ mov ip, r12
++ popm r8-r12,lr
++ mov pc, ip
++ .size _dl_linux_resolve, . - _dl_linux_resolve
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-needs-CONSTANT_STRING_GOT_FIXUP.patch b/packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-needs-CONSTANT_STRING_GOT_FIXUP.patch
new file mode 100644
index 0000000000..222749f3c2
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-needs-CONSTANT_STRING_GOT_FIXUP.patch
@@ -0,0 +1,23 @@
+Subject: [PATCH] ldso: AVR32 needs CONSTANT_STRING_GOT_FIXUP
+
+Add AVR32 to the list of architectures needing CONSTANT_STRING_GOT_FIXUP.
+
+---
+
+ ldso/include/dl-string.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+Index: uClibc-0.9.28/ldso/include/dl-string.h
+===================================================================
+--- uClibc-0.9.28.orig/ldso/include/dl-string.h 2006-02-07 16:58:58.000000000 +0100
++++ uClibc-0.9.28/ldso/include/dl-string.h 2006-02-07 16:59:28.000000000 +0100
+@@ -271,7 +271,8 @@ static __always_inline char * _dl_simple
+ /* On some arches constant strings are referenced through the GOT.
+ * This requires that load_addr must already be defined... */
+ #if defined(mc68000) || defined(__arm__) || defined(__mips__) \
+- || defined(__sh__) || defined(__powerpc__)
++ || defined(__sh__) || defined(__powerpc__) \
++ || defined(__avr32__)
+ # define CONSTANT_STRING_GOT_FIXUP(X) \
+ if ((X) < (const char *) load_addr) (X) += load_addr
+ # define NO_EARLY_SEND_STDERR
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-startup-hack.patch b/packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-startup-hack.patch
new file mode 100644
index 0000000000..0cdc2ccb32
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/ldso-avr32-startup-hack.patch
@@ -0,0 +1,40 @@
+Subject: [PATCH] ldso: AVR32 startup hack
+
+AVR32 needs to do both PERFORM_BOOTSTRAP_GOT and a full relocation of
+the GOT. I don't quite remember why, but I think it's because some GOT
+entries just need the load address added to them, while the rest need
+the full relocation code.
+
+This patch should be revisited to figure out whether we're processing
+relocations against undefined symbols and whether that's something we
+should be doing...
+
+---
+
+ ldso/ldso/dl-startup.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+Index: uClibc-0.9.28/ldso/ldso/dl-startup.c
+===================================================================
+--- uClibc-0.9.28.orig/ldso/ldso/dl-startup.c 2006-02-07 16:49:27.000000000 +0100
++++ uClibc-0.9.28/ldso/ldso/dl-startup.c 2006-02-07 17:12:09.000000000 +0100
+@@ -217,7 +217,9 @@ static void * __attribute_used__ _dl_sta
+ /* some arches (like MIPS) we have to tweak the GOT before relocations */
+ PERFORM_BOOTSTRAP_GOT(tpnt);
+
+-#else
++#endif
++
++#if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__)
+
+ /* OK, now do the relocations. We do not do a lazy binding here, so
+ that once we are done, we have considerably more flexibility. */
+@@ -259,7 +261,7 @@ static void * __attribute_used__ _dl_sta
+ rel_addr += relative_count * sizeof(ELF_RELOC);;
+ }
+
+- rpnt = (ELF_RELOC *) (rel_addr + load_addr);
++ rpnt = (ELF_RELOC *) (rel_addr /* + load_addr */);
+ for (i = 0; i < rel_size; i += sizeof(ELF_RELOC), rpnt++) {
+ reloc_addr = (unsigned long *) (load_addr + (unsigned long) rpnt->r_offset);
+ symtab_index = ELF_R_SYM(rpnt->r_info);
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/ldso-define-MAP_FAILED.patch b/packages/uclibc/uclibc-0.9.28/avr32/ldso-define-MAP_FAILED.patch
new file mode 100644
index 0000000000..d2838ef197
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/ldso-define-MAP_FAILED.patch
@@ -0,0 +1,23 @@
+Subject: [PATCH] ldso: Define MAP_FAILED for _dl_mmap()
+
+When using mmap2() to emulate mmap(), _dl_mmap() uses MAP_FAILED to
+indicate failure. MAP_FAILED is not defined anywhere, so this patch
+defines it.
+
+---
+
+ ldso/include/dl-syscall.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+Index: uClibc-0.9.28/ldso/include/dl-syscall.h
+===================================================================
+--- uClibc-0.9.28.orig/ldso/include/dl-syscall.h 2006-02-07 16:49:27.000000000 +0100
++++ uClibc-0.9.28/ldso/include/dl-syscall.h 2006-02-07 17:07:06.000000000 +0100
+@@ -132,6 +132,7 @@ static inline _syscall6(__ptr_t, __sysca
+ size_t, len, int, prot, int, flags, int, fd, off_t, offset);
+ /*always 12, even on architectures where PAGE_SHIFT != 12 */
+ #define MMAP2_PAGE_SHIFT 12
++#define MAP_FAILED ((void *) -1)
+ static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
+ int flags, int fd, unsigned long offset)
+ {
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/let-optimized-stringops-override-default-ones.patch b/packages/uclibc/uclibc-0.9.28/avr32/let-optimized-stringops-override-default-ones.patch
new file mode 100644
index 0000000000..a383a6e62d
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/let-optimized-stringops-override-default-ones.patch
@@ -0,0 +1,28 @@
+From 7b2f125425cf777e7937b533217588e27952b87d Mon Sep 17 00:00:00 2001
+From: Haavard Skinnemoen <hskinnemoen@atmel.com>
+Date: Mon, 7 Aug 2006 11:12:50 +0200
+Subject: [PATCH] Let optimized stringops override default ones
+
+The default, slow stringops must be archived _before_ the optimized
+stringops if there is to be any point doing the optimizations in the
+first place.
+---
+ libc/Makefile | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/libc/Makefile b/libc/Makefile
+index 31e4bab..687eac5 100644
+--- a/libc/Makefile
++++ b/libc/Makefile
+@@ -59,7 +59,7 @@ # will evaluate to no files :(.
+ $(AR) dN 2 $(LIBNAME) $$objs && \
+ $(AR) dN 2 $(LIBNAME) $$objs
+ @for objfile in obj.signal \
+- obj.string.generic obj.string.$(TARGET_ARCH) obj.string \
++ obj.string obj.string.generic obj.string.$(TARGET_ARCH) \
+ obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \
+ if [ -e $$objfile ] ; then \
+ if [ "$(MAKE_IS_SILENT)" = "n" ] ; then \
+--
+1.4.1.1
+
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/libpthread-avr32.patch b/packages/uclibc/uclibc-0.9.28/avr32/libpthread-avr32.patch
new file mode 100644
index 0000000000..5277677ee5
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/libpthread-avr32.patch
@@ -0,0 +1,105 @@
+Subject: [PATCH] libpthread: AVR32 support
+
+Implement pt-machine.h for AVR32.
+---
+
+ libpthread/linuxthreads/sysdeps/avr32/pt-machine.h | 92 +++++++++++++++++++++
+ 1 file changed, 92 insertions(+)
+
+Index: uClibc-0.9.28/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h 2006-02-07 17:14:47.000000000 +0100
+@@ -0,0 +1,92 @@
++/* Machine-dependent pthreads configuration and inline functions.
++
++ Copyright (C) 2005 Atmel Norway
++ 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; see the file COPYING.LIB. If not,
++ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ Boston, MA 02111-1307, USA. */
++
++#ifndef _PT_MACHINE_H
++#define _PT_MACHINE_H 1
++
++#include <features.h>
++
++static inline int
++_test_and_set (int *p, int v) __THROW
++{
++ int result;
++
++ __asm__ __volatile__(
++ "/* Inline test and set */\n"
++ "1: ssrf 5\n"
++ " ld.w %0, %2\n"
++ " tst %0, %3\n"
++ " breq 2f\n"
++ " stcond %1, %3\n"
++ " brne 1b\n"
++ "2:"
++ : "=&r"(result), "=m"(*p)
++ : "m"(*p), "r"(v)
++ : "memory", "cc");
++
++ return result;
++}
++
++#ifndef PT_EI
++# define PT_EI extern inline
++#endif
++
++extern long int testandset (int *spinlock);
++extern int __compare_and_swap (long int *p, long int oldval, long int newval);
++
++/* Spinlock implementation; required. */
++PT_EI long int
++testandset (int *spinlock)
++{
++ return _test_and_set(spinlock, 1);
++}
++
++
++/* Get some notion of the current stack. Need not be exactly the top
++ of the stack, just something somewhere in the current frame. */
++#define CURRENT_STACK_FRAME stack_pointer
++register char * stack_pointer __asm__ ("sp");
++
++/* Compare-and-swap for semaphores. */
++
++#define HAS_COMPARE_AND_SWAP
++PT_EI int
++__compare_and_swap(long int *p, long int oldval, long int newval)
++{
++ long int result, tmp;
++
++ __asm__ __volatile__(
++ "/* Inline compare and swap */\n"
++ "1: ssrf 5\n"
++ " ld.w %1, %3\n"
++ " cp.w %1, %5\n"
++ " sreq %0\n"
++ " brne 2f\n"
++ " stcond %2, %4\n"
++ " brne 1b\n"
++ "2:"
++ : "=&r"(result), "=&r"(tmp), "=m"(*p)
++ : "m"(*p), "r"(newval), "r"(oldval)
++ : "cc", "memory");
++
++ return result;
++}
++
++#endif /* pt-machine.h */
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/no-create_module-on-avr32.patch b/packages/uclibc/uclibc-0.9.28/avr32/no-create_module-on-avr32.patch
new file mode 100644
index 0000000000..9bfdc53cfc
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/no-create_module-on-avr32.patch
@@ -0,0 +1,27 @@
+Subject: [PATCH] Don't include create_module() for AVR32
+
+The create_module() system call is obsolete in Linux 2.6, so the
+AVR32 kernel doesn't even have it.
+
+Come to think about it, this should be completely unnecessary as the
+create_module function is only a stub when __NR_create_module is
+undefined.
+---
+
+ libc/sysdeps/linux/common/create_module.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+Index: uClibc-0.9.28/libc/sysdeps/linux/common/create_module.c
+===================================================================
+--- uClibc-0.9.28.orig/libc/sysdeps/linux/common/create_module.c 2006-02-07 16:48:38.000000000 +0100
++++ uClibc-0.9.28/libc/sysdeps/linux/common/create_module.c 2006-02-07 17:17:14.000000000 +0100
+@@ -61,7 +61,8 @@ unsigned long create_module(const char *
+ {
+ return __create_module(name, size, 0, 0);
+ }
+-#else
++/* create_module is obsolete in Linux 2.6, so AVR32 doesn't have it */
++#elif !defined(__avr32__)
+ /* Sparc, MIPS, etc don't mistake return values for errors. */
+ _syscall2(unsigned long, create_module, const char *, name, size_t, size);
+ #endif
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/remove-bogus-version-hack-and-just-use-asm-generic-if-it-exists.patch b/packages/uclibc/uclibc-0.9.28/avr32/remove-bogus-version-hack-and-just-use-asm-generic-if-it-exists.patch
new file mode 100644
index 0000000000..9f27f68f0a
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/remove-bogus-version-hack-and-just-use-asm-generic-if-it-exists.patch
@@ -0,0 +1,48 @@
+--- a/extra/scripts/fix_includes.sh 2005-08-18 00:49:41.000000000 +0200
++++ b/extra/scripts/fix_includes.sh 2006-09-27 13:23:12.000000000 +0200
+@@ -78,36 +78,6 @@ if [ ! -d "$KERNEL_SOURCE" ]; then
+ exit 1;
+ fi;
+
+-if [ -f "$KERNEL_SOURCE/Makefile" ] ; then
+-# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
+-eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' $KERNEL_SOURCE/Makefile`
+-else
+-ver=`grep UTS_RELEASE $KERNEL_SOURCE/include/linux/version.h | cut -d '"' -f 2`
+-VERSION=`echo "$ver" | cut -d '.' -f 1`
+-PATCHLEVEL=`echo "$ver" | cut -d '.' -f 2`
+-if echo "$ver" | grep -q '-' ; then
+-SUBLEVEL=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.//" | cut -d '-' -f 1`
+-EXTRAVERSION=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.${SUBLEVEL}-//"`
+-else
+-SUBLEVEL=`echo "$ver" | cut -d '.' -f 3`
+-#EXTRAVERSION=
+-fi
+-fi
+-if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
+-then
+- echo "Unable to determine version for kernel headers"
+- echo -e "\tprovided in directory $KERNEL_SOURCE"
+- exit 1
+-fi
+-
+-if [ "$MAKE_IS_SILENT" != "y" ]; then
+-echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}"
+-echo -e "\n"
+-echo "Using kernel headers from $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} for architecture '$TARGET_ARCH'"
+-echo -e "\tprovided in directory $KERNEL_SOURCE"
+-echo -e "\n"
+-fi
+-
+ # Create a symlink to include/asm
+
+ rm -f include/asm*
+@@ -172,7 +142,7 @@ fi;
+
+
+ # Annoyingly, 2.6.x kernel headers also need an include/asm-generic/ directory
+-if [ $VERSION -eq 2 ] && [ $PATCHLEVEL -ge 6 ] ; then
++if [ -d $KERNEL_SOURCE/include/asm-generic ] ; then
+ ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic
+ fi;
+
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/sync-fcntl-h-with-linux-kernel.patch b/packages/uclibc/uclibc-0.9.28/avr32/sync-fcntl-h-with-linux-kernel.patch
new file mode 100644
index 0000000000..ae6de2b102
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/sync-fcntl-h-with-linux-kernel.patch
@@ -0,0 +1,54 @@
+---
+ libc/sysdeps/linux/avr32/bits/fcntl.h | 33 +++++++++++++++++----------------
+ 1 file changed, 17 insertions(+), 16 deletions(-)
+
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/fcntl.h
+===================================================================
+--- uClibc-0.9.28-avr32.orig/libc/sysdeps/linux/avr32/bits/fcntl.h 2006-11-23 17:38:30.000000000 +0100
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/fcntl.h 2006-11-23 17:52:15.000000000 +0100
+@@ -11,28 +11,29 @@
+
+ /* open/fcntl - O_SYNC is only implemented on blocks devices and on files
+ located on an ext2 file system */
+-#define O_ACCMODE 0003
+-#define O_RDONLY 00
+-#define O_WRONLY 01
+-#define O_RDWR 02
+-#define O_CREAT 0100 /* not fcntl */
+-#define O_EXCL 0200 /* not fcntl */
+-#define O_NOCTTY 0400 /* not fcntl */
+-#define O_TRUNC 01000 /* not fcntl */
+-#define O_APPEND 02000
+-#define O_NONBLOCK 04000
++#define O_ACCMODE 00000003
++#define O_RDONLY 00000000
++#define O_WRONLY 00000001
++#define O_RDWR 00000002
++#define O_CREAT 00000100 /* not fcntl */
++#define O_EXCL 00000200 /* not fcntl */
++#define O_NOCTTY 00000400 /* not fcntl */
++#define O_TRUNC 00001000 /* not fcntl */
++#define O_APPEND 00002000
++#define O_NONBLOCK 00004000
+ #define O_NDELAY O_NONBLOCK
+-#define O_SYNC 010000
+-#define O_ASYNC 020000
++#define O_SYNC 00010000
++#define O_ASYNC 00020000
+
+ #ifdef __USE_GNU
+-# define O_DIRECTORY 040000 /* must be a directory */
+-# define O_NOFOLLOW 0100000 /* don't follow links */
+-# define O_DIRECT 0200000 /* direct disk access */
++# define O_DIRECT 00040000 /* must be a directory */
++# define O_DIRECTORY 00200000 /* direct disk access */
++# define O_NOFOLLOW 00400000 /* don't follow links */
++# define O_NOATIME 01000000 /* don't set atime */
+ #endif
+
+ #ifdef __USE_LARGEFILE64
+-# define O_LARGEFILE 0400000
++# define O_LARGEFILE 00100000
+ #endif
+
+ /* For now Linux has synchronisity options for data and read operations.
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/uClibc-0.9.28-avr32-20060621.patch b/packages/uclibc/uclibc-0.9.28/avr32/uClibc-0.9.28-avr32-20060621.patch
new file mode 100644
index 0000000000..430b54c1c1
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/uClibc-0.9.28-avr32-20060621.patch
@@ -0,0 +1,4322 @@
+diff -Nur uClibc-0.9.28/extra/Configs/Config.avr32 uClibc-0.9.28-avr32-20060621/extra/Configs/Config.avr32
+--- uClibc-0.9.28/extra/Configs/Config.avr32 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/extra/Configs/Config.avr32 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,38 @@
++#
++# For a description of the syntax of this configuration file,
++# see extra/config/Kconfig-language.txt
++#
++
++config HAVE_ELF
++ bool
++ default y
++
++config TARGET_ARCH
++ default "avr32"
++
++config ARCH_CFLAGS
++ string
++
++config ARCH_LDFLAGS
++ string
++
++config LIBGCC_CFLAGS
++ string
++
++config ARCH_SUPPORTS_BIG_ENDIAN
++ bool
++ default y
++
++config UCLIBC_COMPLETELY_PIC
++ select FORCE_SHAREABLE_TEXT_SEGMENTS
++ bool
++ default y
++
++choice
++ prompt "Target CPU Type"
++ default CONFIG_AP7000
++
++config CONFIG_AP7000
++ bool "AP7000"
++
++endchoice
+diff -Nur uClibc-0.9.28/extra/Configs/Config.in uClibc-0.9.28-avr32-20060621/extra/Configs/Config.in
+--- uClibc-0.9.28/extra/Configs/Config.in 2005-08-18 00:49:41.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/extra/Configs/Config.in 2006-06-21 11:35:56.000000000 +0200
+@@ -16,6 +16,9 @@
+ config TARGET_arm
+ bool "arm"
+
++config TARGET_avr32
++ bool "avr32"
++
+ config TARGET_bfin
+ bool "bfin"
+
+@@ -83,6 +86,10 @@
+ source "extra/Configs/Config.arm"
+ endif
+
++if TARGET_avr32
++source "extra/Configs/Config.avr32"
++endif
++
+ if TARGET_bfin
+ source "extra/Configs/Config.bfin"
+ endif
+diff -Nur uClibc-0.9.28/include/elf.h uClibc-0.9.28-avr32-20060621/include/elf.h
+--- uClibc-0.9.28/include/elf.h 2005-08-18 00:49:41.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/include/elf.h 2006-06-21 11:35:56.000000000 +0200
+@@ -261,6 +261,8 @@
+ #define EM_NIOS32 0xfebb /* Altera Nios 32 */
+ #define EM_ALTERA_NIOS2 0x9ee5 /* Altera Nios II */
+
++#define EM_AVR32 0x18ad
++
+ /* V850 backend magic number. Written in the absense of an ABI. */
+ #define EM_CYGNUS_V850 0x9080
+
+@@ -2687,6 +2689,55 @@
+ /* Keep this the last entry. */
+ #define R_V850_NUM 25
+
++/* Atmel AVR32 relocations. */
++#define R_AVR32_NONE 0
++#define R_AVR32_32 1
++#define R_AVR32_16 2
++#define R_AVR32_8 3
++#define R_AVR32_32_PCREL 4
++#define R_AVR32_16_PCREL 5
++#define R_AVR32_8_PCREL 6
++#define R_AVR32_DIFF32 7
++#define R_AVR32_DIFF16 8
++#define R_AVR32_DIFF8 9
++#define R_AVR32_GOT32 10
++#define R_AVR32_GOT16 11
++#define R_AVR32_GOT8 12
++#define R_AVR32_21S 13
++#define R_AVR32_16U 14
++#define R_AVR32_16S 15
++#define R_AVR32_8S 16
++#define R_AVR32_8S_EXT 17
++#define R_AVR32_22H_PCREL 18
++#define R_AVR32_18W_PCREL 19
++#define R_AVR32_16B_PCREL 20
++#define R_AVR32_16N_PCREL 21
++#define R_AVR32_14UW_PCREL 22
++#define R_AVR32_11H_PCREL 23
++#define R_AVR32_10UW_PCREL 24
++#define R_AVR32_9H_PCREL 25
++#define R_AVR32_9UW_PCREL 26
++#define R_AVR32_HI16 27
++#define R_AVR32_LO16 28
++#define R_AVR32_GOTPC 29
++#define R_AVR32_GOTCALL 30
++#define R_AVR32_LDA_GOT 31
++#define R_AVR32_GOT21S 32
++#define R_AVR32_GOT18SW 33
++#define R_AVR32_GOT16S 34
++#define R_AVR32_GOT7UW 35
++#define R_AVR32_32_CPENT 36
++#define R_AVR32_CPCALL 37
++#define R_AVR32_16_CP 38
++#define R_AVR32_9W_CP 39
++#define R_AVR32_RELATIVE 40
++#define R_AVR32_GLOB_DAT 41
++#define R_AVR32_JMP_SLOT 42
++#define R_AVR32_ALIGN 43
++#define R_AVR32_NUM 44
++
++/* AVR32 dynamic tags */
++#define DT_AVR32_GOTSZ 0x70000001 /* Total size of GOT in bytes */
+
+ #define R_H8_NONE 0
+ #define R_H8_DIR32 1
+diff -Nur uClibc-0.9.28/ldso/include/dl-string.h uClibc-0.9.28-avr32-20060621/ldso/include/dl-string.h
+--- uClibc-0.9.28/ldso/include/dl-string.h 2005-08-18 00:49:41.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/ldso/include/dl-string.h 2006-06-21 11:35:57.000000000 +0200
+@@ -134,7 +134,7 @@
+ } while (1);
+ }
+
+-static inline void * _dl_memcpy(void * dst, const void * src, size_t len)
++static __always_inline void * _dl_memcpy(void * dst, const void * src, size_t len)
+ {
+ register char *a = dst-1;
+ register const char *b = src-1;
+@@ -271,7 +271,8 @@
+ /* On some arches constant strings are referenced through the GOT.
+ * This requires that load_addr must already be defined... */
+ #if defined(mc68000) || defined(__arm__) || defined(__mips__) \
+- || defined(__sh__) || defined(__powerpc__)
++ || defined(__sh__) || defined(__powerpc__) \
++ || defined(__avr32__)
+ # define CONSTANT_STRING_GOT_FIXUP(X) \
+ if ((X) < (const char *) load_addr) (X) += load_addr
+ # define NO_EARLY_SEND_STDERR
+diff -Nur uClibc-0.9.28/ldso/include/dl-syscall.h uClibc-0.9.28-avr32-20060621/ldso/include/dl-syscall.h
+--- uClibc-0.9.28/ldso/include/dl-syscall.h 2005-08-18 00:49:41.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/ldso/include/dl-syscall.h 2006-06-21 11:35:57.000000000 +0200
+@@ -60,59 +60,59 @@
+ dynamic linking at all, so we cannot return any error codes.
+ We just punt if there is an error. */
+ #define __NR__dl_exit __NR_exit
+-static inline _syscall1(void, _dl_exit, int, status);
++static __always_inline _syscall1(void, _dl_exit, int, status);
+
+ #define __NR__dl_close __NR_close
+-static inline _syscall1(int, _dl_close, int, fd);
++static __always_inline _syscall1(int, _dl_close, int, fd);
+
+ #define __NR__dl_open __NR_open
+-static inline _syscall3(int, _dl_open, const char *, fn, int, flags, __kernel_mode_t, mode);
++static __always_inline _syscall3(int, _dl_open, const char *, fn, int, flags, __kernel_mode_t, mode);
+
+ #define __NR__dl_write __NR_write
+-static inline _syscall3(unsigned long, _dl_write, int, fd,
++static __always_inline _syscall3(unsigned long, _dl_write, int, fd,
+ const void *, buf, unsigned long, count);
+
+ #define __NR__dl_read __NR_read
+-static inline _syscall3(unsigned long, _dl_read, int, fd,
++static __always_inline _syscall3(unsigned long, _dl_read, int, fd,
+ const void *, buf, unsigned long, count);
+
+ #define __NR__dl_mprotect __NR_mprotect
+-static inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, len, int, prot);
++static __always_inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, len, int, prot);
+
+ #define __NR__dl_stat __NR_stat
+-static inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf);
++static __always_inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf);
+
+ #define __NR__dl_munmap __NR_munmap
+-static inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length);
++static __always_inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length);
+
+ #define __NR__dl_getuid __NR_getuid
+-static inline _syscall0(uid_t, _dl_getuid);
++static __always_inline _syscall0(uid_t, _dl_getuid);
+
+ #define __NR__dl_geteuid __NR_geteuid
+-static inline _syscall0(uid_t, _dl_geteuid);
++static __always_inline _syscall0(uid_t, _dl_geteuid);
+
+ #define __NR__dl_getgid __NR_getgid
+-static inline _syscall0(gid_t, _dl_getgid);
++static __always_inline _syscall0(gid_t, _dl_getgid);
+
+ #define __NR__dl_getegid __NR_getegid
+-static inline _syscall0(gid_t, _dl_getegid);
++static __always_inline _syscall0(gid_t, _dl_getegid);
+
+ #define __NR__dl_getpid __NR_getpid
+-static inline _syscall0(gid_t, _dl_getpid);
++static __always_inline _syscall0(gid_t, _dl_getpid);
+
+ #define __NR__dl_readlink __NR_readlink
+-static inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, size_t, bufsiz);
++static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, size_t, bufsiz);
+
+ #ifdef __NR_mmap
+ #ifdef MMAP_HAS_6_ARGS
+ #define __NR__dl_mmap __NR_mmap
+-static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
++static __always_inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
+ int, prot, int, flags, int, fd, off_t, offset);
+ #else
+ #define __NR__dl_mmap_real __NR_mmap
+-static inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
++static __always_inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
+
+-static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
++static __always_inline void * _dl_mmap(void * addr, unsigned long size, int prot,
+ int flags, int fd, unsigned long offset)
+ {
+ unsigned long buffer[6];
+@@ -128,11 +128,12 @@
+ #endif
+ #elif defined __NR_mmap2
+ #define __NR___syscall_mmap2 __NR_mmap2
+-static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
++static __always_inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
+ size_t, len, int, prot, int, flags, int, fd, off_t, offset);
+ /*always 12, even on architectures where PAGE_SHIFT != 12 */
+ #define MMAP2_PAGE_SHIFT 12
+-static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
++#define MAP_FAILED ((void *) -1)
++static __always_inline void * _dl_mmap(void * addr, unsigned long size, int prot,
+ int flags, int fd, unsigned long offset)
+ {
+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
+diff -Nur uClibc-0.9.28/ldso/ldso/avr32/dl-debug.h uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/dl-debug.h
+--- uClibc-0.9.28/ldso/ldso/avr32/dl-debug.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/dl-debug.h 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,45 @@
++/*
++ * AVR32 ELF shared libary loader support
++ *
++ * Copyright (C) 2005 Atmel Norway
++ * 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.
++ */
++
++static const char *_dl_reltypes_tab[] = {
++ "R_AVR32_NONE",
++ "R_AVR32_32", "R_AVR32_16", "R_AVR32_8",
++ "R_AVR32_32_PCREL", "R_AVR32_16_PCREL", "R_AVR32_8_PCREL",
++ "R_AVR32_DIFF32", "R_AVR32_DIFF16", "R_AVR32_DIFF8",
++ "R_AVR32_GOT32", "R_AVR32_GOT16", "R_AVR32_GOT8",
++ "R_AVR32_21S", "R_AVR32_16U", "R_AVR32_16S", "R_AVR32_8S", "R_AVR32_8S_EXT",
++ "R_AVR32_22H_PCREL", "R_AVR32_18W_PCREL", "R_AVR32_16B_PCREL",
++ "R_AVR32_16N_PCREL", "R_AVR32_14UW_PCREL", "R_AVR32_11H_PCREL",
++ "R_AVR32_10UW_PCREL", "R_AVR32_9H_PCREL", "R_AVR32_9UW_PCREL",
++ "R_AVR32_HI16", "R_AVR32_LO16",
++ "R_AVR32_GOTPC", "R_AVR32_GOTCALL", "R_AVR32_LDA_GOT",
++ "R_AVR32_GOT21S", "R_AVR32_GOT18SW", "R_AVR32_GOT16S", "R_AVR32_GOT7UW",
++ "R_AVR32_32_CPENT", "R_AVR32_CPCALL", "R_AVR32_16_CP", "R_AVR32_9W_CP",
++ "R_AVR32_RELATIVE", "R_AVR32_GLOB_DAT", "R_AVR32_JMP_SLOT",
++ "R_AVR32_ALIGN",
++};
+diff -Nur uClibc-0.9.28/ldso/ldso/avr32/dl-startup.h uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/dl-startup.h
+--- uClibc-0.9.28/ldso/ldso/avr32/dl-startup.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/dl-startup.h 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,110 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * Architecture specific code used by dl-startup.c
++ * Copyright (C) 2005 Atmel Norway
++ */
++
++/* This is the library loader's main entry point. Let _dl_boot2 do its
++ * initializations and jump to the application's entry point
++ * afterwards. */
++asm( " .text\n"
++ " .global _start\n"
++ " .type _start,@function\n"
++ "_start:\n"
++ /* All arguments are on the stack initially */
++ " mov r12, sp\n"
++ " rcall _dl_start\n"
++ /* Returns user entry point in r12. Save it. */
++ " mov r0, r12\n"
++ /* We're PIC, so get the Global Offset Table */
++ " lddpc r6, .L_GOT\n"
++ ".L_RGOT:\n"
++ " rsub r6, pc\n"
++ /* Adjust argc and argv according to _dl_skip_args */
++ " ld.w r1, r6[_dl_skip_args@got]\n"
++ " ld.w r1, r1[0]\n"
++ " ld.w r2, sp++\n"
++ " sub r2, r1\n"
++ " add sp, sp, r1 << 2\n"
++ " st.w --sp, r2\n"
++ /* Load the finalizer function */
++ " ld.w r12, r6[_dl_fini@got]\n"
++ /* Jump to the user's entry point */
++ " mov pc, r0\n\n"
++
++ " .align 2\n"
++ ".L_GOT:"
++ " .long .L_RGOT - _GLOBAL_OFFSET_TABLE_\n"
++ " .size _start, . - _start\n"
++ " .previous\n");
++
++/* Get a pointer to the argv array. On many platforms this can be just
++ * the address if the first argument, on other platforms we need to
++ * do something a little more subtle here. */
++#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long *)ARGS + 1)
++
++
++/* We can't call functions before the GOT has been initialized */
++#define NO_FUNCS_BEFORE_BOOTSTRAP
++
++/*
++ * Relocate the GOT during dynamic loader bootstrap. This will add
++ * the load address to all entries in the GOT, which is necessary
++ * because the linker doesn't generate R_AVR32_RELATIVE relocs for the
++ * GOT.
++ */
++static __always_inline
++void PERFORM_BOOTSTRAP_GOT(struct elf_resolve *tpnt)
++{
++ Elf32_Addr i, nr_got;
++ register Elf32_Addr *__r6 __asm__("r6");
++ Elf32_Addr *got = __r6;
++
++ nr_got = tpnt->dynamic_info[DT_AVR32_GOTSZ_IDX] / sizeof(*got);
++ for (i = 2; i < nr_got; i++)
++ got[i] += tpnt->loadaddr;
++}
++
++#define PERFORM_BOOTSTRAP_GOT(tpnt) PERFORM_BOOTSTRAP_GOT(tpnt)
++
++/* Handle relocation of the symbols in the dynamic loader. */
++static __always_inline
++void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
++ unsigned long symbol_addr,
++ unsigned long load_addr, Elf32_Sym *symtab)
++{
++ switch(ELF32_R_TYPE(rpnt->r_info)) {
++ case R_AVR32_NONE:
++ break;
++ case R_AVR32_GLOB_DAT:
++ case R_AVR32_JMP_SLOT:
++ *reloc_addr = symbol_addr;
++ break;
++ case R_AVR32_RELATIVE:
++ SEND_STDERR_DEBUG("Applying RELATIVE relocation: ");
++ SEND_ADDRESS_STDERR_DEBUG(load_addr, 0);
++ SEND_STDERR_DEBUG(" + ");
++ SEND_ADDRESS_STDERR_DEBUG(rpnt->r_addend, 1);
++ *reloc_addr = load_addr + rpnt->r_addend;
++ break;
++ default:
++ SEND_STDERR("BOOTSTRAP_RELOC: unhandled reloc_type ");
++ SEND_NUMBER_STDERR(ELF32_R_TYPE(rpnt->r_info), 1);
++ SEND_STDERR("REL, SYMBOL, LOAD: ");
++ SEND_ADDRESS_STDERR(reloc_addr, 0);
++ SEND_STDERR(", ");
++ SEND_ADDRESS_STDERR(symbol_addr, 0);
++ SEND_STDERR(", ");
++ SEND_ADDRESS_STDERR(load_addr, 1);
++ _dl_exit(1);
++ }
++}
++
++/* Transfer control to the user's application, once the dynamic loader
++ * is done. This routine has to exit the current function, then call
++ * the _dl_elf_main function.
++ *
++ * Since our _dl_boot will simply call whatever is returned by
++ * _dl_boot2, we can just return the address we're supposed to
++ * call. */
++#define START() return _dl_elf_main;
+diff -Nur uClibc-0.9.28/ldso/ldso/avr32/dl-syscalls.h uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/dl-syscalls.h
+--- uClibc-0.9.28/ldso/ldso/avr32/dl-syscalls.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/dl-syscalls.h 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,5 @@
++/* We can't use the real errno in ldso, since it has not yet
++ * been dynamicly linked in yet. */
++extern int _dl_errno;
++#define __set_errno(X) {(_dl_errno) = (X);}
++#include "sys/syscall.h"
+diff -Nur uClibc-0.9.28/ldso/ldso/avr32/dl-sysdep.h uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/dl-sysdep.h
+--- uClibc-0.9.28/ldso/ldso/avr32/dl-sysdep.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/dl-sysdep.h 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,103 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * Various assembly language/system dependent hacks that are required
++ * so that we can minimize the amount of platform specific code.
++ * Copyright (C) 2004-2005 Atmel Norway
++ */
++
++/* Define this if the system uses RELOCA. */
++#define ELF_USES_RELOCA
++
++#include <elf.h>
++
++#define ARCH_NUM 1
++#define DT_AVR32_GOTSZ_IDX (DT_NUM + OS_NUM)
++
++#define ARCH_DYNAMIC_INFO(dpnt, dynamic, debug_addr) \
++ do { \
++ if (dpnt->d_tag == DT_AVR32_GOTSZ) \
++ dynamic[DT_AVR32_GOTSZ_IDX] = dpnt->d_un.d_val; \
++ } while (0)
++
++/* Initialization sequence for the application/library GOT. */
++#define INIT_GOT(GOT_BASE,MODULE) \
++ do { \
++ unsigned long i, nr_got; \
++ \
++ GOT_BASE[0] = (unsigned long) _dl_linux_resolve; \
++ GOT_BASE[1] = (unsigned long) MODULE; \
++ \
++ /* Add load address displacement to all GOT entries */ \
++ nr_got = MODULE->dynamic_info[DT_AVR32_GOTSZ_IDX] / 4; \
++ for (i = 2; i < nr_got; i++) \
++ GOT_BASE[i] += (unsigned long)MODULE->loadaddr; \
++ } while (0)
++
++#define do_rem(result, n, base) ((result) = (n) % (base))
++
++/* Here we define the magic numbers that this dynamic loader should accept */
++#define MAGIC1 EM_AVR32
++#undef MAGIC2
++
++/* Used for error messages */
++#define ELF_TARGET "AVR32"
++
++unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got);
++
++/* 4096 bytes alignment */
++#define PAGE_ALIGN 0xfffff000
++#define ADDR_ALIGN 0xfff
++#define OFFS_ALIGN 0x7ffff000
++
++#define elf_machine_type_class(type) \
++ ((type == R_AVR32_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)
++
++/* AVR32 doesn't need any COPY relocs */
++#define DL_NO_COPY_RELOCS
++
++/* Return the link-time address of _DYNAMIC. Conveniently, this is the
++ first element of the GOT. This must be inlined in a function which
++ uses global data. */
++static inline Elf32_Addr
++elf_machine_dynamic (void)
++{
++ register Elf32_Addr *got asm ("r6");
++ return *got;
++}
++
++/* Return the run-time load address of the shared object. */
++static inline Elf32_Addr
++elf_machine_load_address (void)
++{
++ extern void __dl_start asm("_dl_start");
++ Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
++ Elf32_Addr pcrel_addr;
++
++ asm (" lddpc %0, 2f\n"
++ "1: add %0, pc\n"
++ " rjmp 3f\n"
++ " .align 2\n"
++ "2: .long _dl_start - 1b\n"
++ "3:\n"
++ : "=r"(pcrel_addr) : : "cc");
++
++ return pcrel_addr - got_addr;
++}
++
++/*
++ * Perform any RELATIVE relocations specified by DT_RELCOUNT.
++ * Currently, we don't use that tag, but we might in the future as
++ * this would reduce the startup time somewhat (although probably not by much).
++ */
++static inline void
++elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
++ Elf32_Word relative_count)
++{
++ Elf32_Rela *rpnt = (void *)rel_addr;
++
++ do {
++ Elf32_Addr *reloc_addr;
++ reloc_addr = (void *)(load_off + (rpnt++)->r_offset);
++ *reloc_addr = load_off + rpnt->r_addend;
++ } while (--relative_count);
++}
+diff -Nur uClibc-0.9.28/ldso/ldso/avr32/elfinterp.c uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/elfinterp.c
+--- uClibc-0.9.28/ldso/ldso/avr32/elfinterp.c 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/elfinterp.c 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,191 @@
++/*
++ * AVR32 ELF shared library loader suppport
++ *
++ * Copyright (C) 2004-2006 Atmel Corporation
++ *
++ * 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.
++ */
++
++unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got)
++{
++ struct elf_resolve *tpnt = (struct elf_resolve *)got[1];
++ Elf32_Sym *sym;
++ unsigned long local_gotno;
++ unsigned long gotsym;
++ unsigned long new_addr;
++ char *strtab, *symname;
++ unsigned long *entry;
++ unsigned long sym_index = got_offset / 4;
++
++#if 0
++ local_gotno = tpnt->dynamic_info[DT_AVR32_LOCAL_GOTNO];
++ gotsym = tpnt->dynamic_info[DT_AVR32_GOTSYM];
++
++ sym = ((Elf32_Sym *)(tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr))
++ + sym_index;
++ strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
++ symname = strtab + sym->st_name;
++
++#if 0
++ new_addr = (unsigned long) _dl_find_hash(strtab + sym->st_name,
++ tpnt->symbol_scope, tpnt,
++ resolver);
++#endif
++
++ entry = (unsigned long *)(got + local_gotno + sym_index - gotsym);
++ *entry = new_addr;
++#endif
++
++ return new_addr;
++}
++
++static int
++_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ unsigned long rel_addr, unsigned long rel_size,
++ int (*reloc_func)(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab))
++{
++ Elf32_Sym *symtab;
++ Elf32_Rela *rpnt;
++ char *strtab;
++ int i;
++
++ rpnt = (Elf32_Rela *)rel_addr;
++ rel_size /= sizeof(Elf32_Rela);
++ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
++ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
++
++ for (i = 0; i < rel_size; i++, rpnt++) {
++ int symtab_index, res;
++
++ symtab_index = ELF32_R_SYM(rpnt->r_info);
++
++ debug_sym(symtab, strtab, symtab_index);
++ debug_reloc(symtab, strtab, rpnt);
++
++ res = reloc_func(tpnt, scope, rpnt, symtab, strtab);
++
++ if (res == 0)
++ continue;
++
++ _dl_dprintf(2, "\n%s: ", _dl_progname);
++
++ if (symtab_index)
++ _dl_dprintf(2, "symbol '%s': ",
++ strtab + symtab[symtab_index].st_name);
++
++ if (res < 0) {
++ int reloc_type = ELF32_R_TYPE(rpnt->r_info);
++#if defined(__SUPPORT_LD_DEBUG__)
++ _dl_dprintf(2, "can't handle reloc type %s\n",
++ _dl_reltypes(reloc_type));
++#else
++ _dl_dprintf(2, "can't handle reloc type %x\n",
++ reloc_type);
++#endif
++ _dl_exit(-res);
++ } else {
++ _dl_dprintf(2, "can't resolve symbol\n");
++ return res;
++ }
++ }
++
++ return 0;
++}
++
++static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab)
++{
++ int reloc_type;
++ int symtab_index;
++ char *symname;
++ unsigned long *reloc_addr;
++ unsigned long symbol_addr;
++#if defined(__SUPPORT_LD_DEBUG__)
++ unsigned long old_val;
++#endif
++
++ reloc_addr = (unsigned long *)(tpnt->loadaddr + rpnt->r_offset);
++ reloc_type = ELF32_R_TYPE(rpnt->r_info);
++ symtab_index = ELF32_R_SYM(rpnt->r_info);
++ symbol_addr = 0;
++ symname = strtab + symtab[symtab_index].st_name;
++
++ if (symtab_index) {
++ symbol_addr = (unsigned long)
++ _dl_find_hash(strtab + symtab[symtab_index].st_name,
++ tpnt->symbol_scope, tpnt,
++ elf_machine_type_class(reloc_type));
++
++ /* Allow undefined references to weak symbols */
++ if (!symbol_addr &&
++ ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
++ _dl_progname, symname);
++ return 0;
++ }
++ }
++
++#if defined(__SUPPORT_LD_DEBUG__)
++ old_val = *reloc_addr;
++#endif
++ switch (reloc_type) {
++ case R_AVR32_NONE:
++ break;
++ case R_AVR32_GLOB_DAT:
++ case R_AVR32_JMP_SLOT:
++ *reloc_addr = symbol_addr + rpnt->r_addend;
++ break;
++ case R_AVR32_RELATIVE:
++ *reloc_addr = (unsigned long)tpnt->loadaddr
++ + rpnt->r_addend;
++ break;
++ default:
++ return -1;
++ }
++
++#if defined(__SUPPORT_LD_DEBUG__)
++ if (_dl_debug_reloc && _dl_debug_detail)
++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n",
++ old_val, *reloc_addr);
++#endif
++
++ return 0;
++}
++
++void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
++ unsigned long rel_addr,
++ unsigned long rel_size)
++{
++ /* TODO: Might want to support this in order to get faster
++ * startup times... */
++}
++
++int _dl_parse_relocation_information(struct dyn_elf *rpnt,
++ unsigned long rel_addr,
++ unsigned long rel_size)
++{
++ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size,
++ _dl_do_reloc);
++}
+diff -Nur uClibc-0.9.28/ldso/ldso/avr32/resolve.S uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/resolve.S
+--- uClibc-0.9.28/ldso/ldso/avr32/resolve.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/ldso/ldso/avr32/resolve.S 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,28 @@
++/*
++ * Linux dynamic resolving code for AVR32. Fixes up the GOT entry as
++ * indicated in register r12 and jumps to the resolved address.
++ *
++ * 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.
++ *
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define ip r5
++
++ .text
++ .global _dl_linux_resolve
++ .type _dl_linux_resolve,@function
++_dl_linux_resolve:
++ /* The PLT code pushed r8 for us. It contains the address of this
++ function's GOT entry, that is entry 0. ip contains the address
++ of the GOT entry of the function we wanted to call. */
++ stm --sp, r9-r12, lr
++ mov r11, r8
++ sub r12, ip, r8
++ rcall _dl_linux_resolver
++ mov ip, r12
++ popm r8-r12,lr
++ mov pc, ip
++ .size _dl_linux_resolve, . - _dl_linux_resolve
+diff -Nur uClibc-0.9.28/ldso/ldso/dl-startup.c uClibc-0.9.28-avr32-20060621/ldso/ldso/dl-startup.c
+--- uClibc-0.9.28/ldso/ldso/dl-startup.c 2005-08-18 00:49:41.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/ldso/ldso/dl-startup.c 2006-06-21 11:35:57.000000000 +0200
+@@ -217,7 +217,9 @@
+ /* some arches (like MIPS) we have to tweak the GOT before relocations */
+ PERFORM_BOOTSTRAP_GOT(tpnt);
+
+-#else
++#endif
++
++#if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__)
+
+ /* OK, now do the relocations. We do not do a lazy binding here, so
+ that once we are done, we have considerably more flexibility. */
+@@ -259,7 +261,7 @@
+ rel_addr += relative_count * sizeof(ELF_RELOC);;
+ }
+
+- rpnt = (ELF_RELOC *) (rel_addr + load_addr);
++ rpnt = (ELF_RELOC *) (rel_addr /* + load_addr */);
+ for (i = 0; i < rel_size; i += sizeof(ELF_RELOC), rpnt++) {
+ reloc_addr = (unsigned long *) (load_addr + (unsigned long) rpnt->r_offset);
+ symtab_index = ELF_R_SYM(rpnt->r_info);
+diff -Nur uClibc-0.9.28/libc/string/avr32/bcopy.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/bcopy.S
+--- uClibc-0.9.28/libc/string/avr32/bcopy.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/bcopy.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,15 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++ .text
++ .global bcopy
++ .type bcopy, @function
++ .align 1
++bcopy:
++ /* Swap the first two arguments */
++ eor r11, r12
++ eor r12, r11
++ eor r11, r12
++ rjmp memmove
++ .size bcopy, . - bcopy
+diff -Nur uClibc-0.9.28/libc/string/avr32/bzero.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/bzero.S
+--- uClibc-0.9.28/libc/string/avr32/bzero.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/bzero.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,12 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++ .text
++ .global bzero
++ .type bzero, @function
++ .align 1
++bzero:
++ mov r10, r11
++ mov r11, 0
++ rjmp memset
+diff -Nur uClibc-0.9.28/libc/string/avr32/Makefile uClibc-0.9.28-avr32-20060621/libc/string/avr32/Makefile
+--- uClibc-0.9.28/libc/string/avr32/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/Makefile 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,45 @@
++# 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
++
++TOPDIR=../../../
++include $(TOPDIR)Rules.mak
++
++SSRC := bcopy.S bzero.S memcmp.S memcpy.S memmove.S
++SSRC += memset.S strcmp.S strlen.S
++# memchr.S, strcat.S, strcpy.S, strncpy.S is broken
++SOBJS := $(addprefix __avr32_,$(addsuffix .o,$(basename $(SSRC))))
++
++all: $(SOBJS) $(LIBC)
++
++$(LIBC): ar-target
++
++ar-target: $(SOBJS)
++ $(AR) $(ARFLAGS) $(LIBC) $(SOBJS)
++
++$(SOBJS): __avr32_%.o: %.S
++ $(CC) $(ASFLAGS) -D$*=__avr32_$* -c $< -o $@
++ $(STRIPTOOL) -x -R .note -R .comment $@
++
++clean:
++ $(RM) *.[oa] *~ core
++
++stringtest.o: stringtest.c
++ $(CC) $(CFLAGS) -c $< -o $@
++
++stringtest: stringtest.o $(SOBJS)
++ $(CC) -static -o $@ $^
+diff -Nur uClibc-0.9.28/libc/string/avr32/memchr.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/memchr.S
+--- uClibc-0.9.28/libc/string/avr32/memchr.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/memchr.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,62 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define str r12
++#define chr r11
++#define len r10
++
++ .text
++ .global memchr
++ .type memchr, @function
++memchr:
++ insert.b chr:l, chr
++ insert.h chr:t, chr
++
++ mov r9, str
++ andl r9, 3, COH
++ brne .Lunaligned_str
++
++1: sub len, 4
++ brlt 2f
++ ld.w r8, str++
++ psub.b r9, r8, r11
++ tnbz r9
++ brne 1b
++
++ sub str, 4
++ extract.b r9, r8:t
++ cp.b r9, r11
++ reteq str
++ sub str, -1
++ extract.b r9, r8:u
++ cp.b r9, r11
++ reteq str
++ sub str, -1
++ extract.b r9, r8:l
++ cp.b r9, r11
++ reteq str
++ sub str, -1
++ retal str
++
++2: sub len, -4
++ reteq 0
++
++3: ld.ub r8, str++
++ cp.w r8, 0
++ reteq str
++ sub len, 1
++ brne 3b
++
++ retal 0
++
++.Lunaligned_str:
++1: sub len, 1
++ retlt 0
++ ld.ub r8, str++
++ cp.b r8, r11
++ reteq str
++ sub r9, 1
++ brge 1b
++
++ rjmp .Laligned_search
+diff -Nur uClibc-0.9.28/libc/string/avr32/memcmp.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/memcmp.S
+--- uClibc-0.9.28/libc/string/avr32/memcmp.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/memcmp.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,26 @@
++/*
++ * Copyright (C) 2004 Atmel Norway.
++ */
++
++#define s1 r12
++#define s2 r11
++#define len r10
++
++ .text
++ .global memcmp
++ .type memcmp, @function
++ .align 1
++memcmp:
++ cp.w len, 1
++ retlt 0
++1: ld.ub r8, s1++
++ ld.ub r9, s2++
++ sub r8, r9
++ subfne len, 1
++ brne 1b
++
++ retal r8
++ .size memcmp, . - memcmp
++
++ .weak bcmp
++ bcmp = memcmp
+diff -Nur uClibc-0.9.28/libc/string/avr32/memcpy.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/memcpy.S
+--- uClibc-0.9.28/libc/string/avr32/memcpy.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/memcpy.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,106 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++/* 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 */
++ pref src[32]
++ 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
+diff -Nur uClibc-0.9.28/libc/string/avr32/memmove.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/memmove.S
+--- uClibc-0.9.28/libc/string/avr32/memmove.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/memmove.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,124 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define dst r12
++#define src r11
++#define len r10
++
++ .text
++ .global memmove
++ .type memmove, @function
++memmove:
++ cp.w src, dst
++#ifdef memmove
++ brge optimized_memcpy
++#else
++ brge memcpy
++#endif
++
++ 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 */
++ pref src[-36]
++ 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 */
++#if 1
++ sub len, -16
++ breq 2f
++1: ld.ub r0, --src
++ st.b --dst, r0
++ sub len, 1
++ brne 1b
++#else
++ neg len
++ add pc, pc, len << 2
++ .rept 15
++ ld.ub r0, --src
++ st.b --dst, r0
++ .endr
++#endif
++
++2: 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[-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
+diff -Nur uClibc-0.9.28/libc/string/avr32/memset.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/memset.S
+--- uClibc-0.9.28/libc/string/avr32/memset.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/memset.S 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,54 @@
++/*
++ * Copyright (C) 2004 Atmel Norway.
++ */
++
++#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
++ insert.b r8:l, r8
++ tst s, r11
++ insert.h r8:t, r8
++ 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
+diff -Nur uClibc-0.9.28/libc/string/avr32/strcat.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/strcat.S
+--- uClibc-0.9.28/libc/string/avr32/strcat.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/strcat.S 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,96 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define s1 r9
++#define s2 r11
++
++ .text
++ .global strcat
++ .type strcat, @function
++ .align 1
++strcat:
++ mov s1, r12
++
++ /* Make sure s1 is word-aligned */
++ mov r10, s1
++ andl r10, 3, COH
++ breq 2f
++
++ add pc, pc, r10 << 3
++ sub r0, r0, 0 /* 4-byte nop */
++ ld.ub r8, s1++
++ sub r8, r8, 0
++ breq 2f
++ ld.ub r8, s1++
++ sub r8, r8, 0
++ breq 3f
++ ld.ub r8, s1++
++ sub r8, r8, 0
++ breq 4f
++
++ /* Find the end of the first string */
++5: ld.w r8, s1++
++ tnbz r8
++ brne 5b
++
++ sub s1, 4
++
++ extract.b r10, r8:t
++ cp.w r10, 0
++ breq 1f
++ sub s1, -1
++ extract.b r10, r8:u
++ cp.w r10, 0
++ breq 2f
++ sub s1, -1
++ extract.b r10, r8:l
++ cp.w r10, 0
++ breq 3f
++ sub s1, -1
++ rjmp 4f
++
++ /* Now, append s2 */
++1: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++2: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++3: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++4: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++
++ /* Copy one word at a time */
++ ld.w r8, s2++
++ tnbz r8
++ breq 2f
++1: st.w r8, s2++
++ ld.w r8, s2++
++ tnbz r8
++ brne 1b
++
++ /* Copy the remaining bytes */
++ extract.b r10, r8:t
++ st.b s1++, r10
++ cp.w r10, 0
++ reteq r12
++ extract.b r10, r8:u
++ st.b s1++, r10
++ cp.w r10, 0
++ reteq r12
++ extract.b r10, r8:l
++ st.b s1++, r10
++ cp.w r10, 0
++ reteq r12
++ extract.b r10, r8:b
++ st.b s1++, r10
++ retal r12
++ .size strcat, . - strcat
+diff -Nur uClibc-0.9.28/libc/string/avr32/strcmp.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/strcmp.S
+--- uClibc-0.9.28/libc/string/avr32/strcmp.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/strcmp.S 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,77 @@
++/*
++ * Copyright (C) 2004 Atmel Norway.
++ */
++
++#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: extract.b r12, r8:t
++ extract.b r11, r9:t
++ sub r12, r11
++ retne r12
++ cp.w r11, 0
++ reteq 0
++ extract.b r12, r8:u
++ extract.b r11, r9:u
++ sub r12, r11
++ retne r12
++ cp.w r11, 0
++ reteq 0
++ extract.b r12, r8:l
++ extract.b r11, r9:l
++ sub r12, r11
++ retne r12
++ cp.w r11, 0
++ reteq 0
++ extract.b r12, r8:b
++ extract.b r11, r9:b
++ 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
+diff -Nur uClibc-0.9.28/libc/string/avr32/strcpy.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/strcpy.S
+--- uClibc-0.9.28/libc/string/avr32/strcpy.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/strcpy.S 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,64 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ *
++ * To reduce the size, this one might simply call strncpy with len = -1.
++ */
++
++#define dst r9
++#define src r11
++
++ .text
++ .global strcpy
++ .type strcpy, @function
++strcpy:
++ mov dst, r12
++
++ pref src[0]
++
++ /*
++ * Check alignment. If src is aligned but dst isn't, we can't
++ * do much about it...
++ */
++ mov r8, src
++ andl r8, 3 COH
++ brne .Lunaligned_src
++
++.Laligned_copy:
++1: ld.w r8, src++
++ tnbz r8
++ breq 2f
++ st.w dst++, r8
++ rjmp 1b
++
++2: /*
++ * Ok, r8 now contains the terminating '\0'. Copy the
++ * remaining bytes individually.
++ */
++ extract.b r10, r8:t
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++ extract.b r10, r8:u
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++ extract.b r10, r8:l
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++ extract.b r10, r8:b
++ st.b dst++, r10
++ retal r12
++
++.Lunaligned_src:
++ /* Copy bytes until we're aligned */
++ rsub r8, r8, 4
++ add pc, pc, r8 << 3
++ nop
++ nop
++ ld.ub r10, src++
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++
++ rjmp .Laligned_copy
+diff -Nur uClibc-0.9.28/libc/string/avr32/stringtest.c uClibc-0.9.28-avr32-20060621/libc/string/avr32/stringtest.c
+--- uClibc-0.9.28/libc/string/avr32/stringtest.c 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/stringtest.c 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,144 @@
++
++#include <stdio.h>
++#include <string.h>
++#include <time.h>
++#include <sys/mman.h>
++
++#define BUF_SIZE (8 * 1024)
++
++static char *buf1;
++static char *buf1_ref;
++static char *buf2;
++
++extern void *optimized_memcpy(void *dest, void *src, size_t len);
++extern void *optimized_memmove(void *dest, void *src, size_t len);
++extern char *optimized_strcpy(char *dest, char *src);
++extern char *optimized_strncpy(char *dest, char *src, size_t len);
++
++void dump_mismatch(char *buf, char *ref, size_t len)
++{
++ int i, j;
++
++ for (i = 0; i < len; i += 16) {
++ if (memcmp(buf + i, ref + i, 16) == 0)
++ continue;
++
++ printf("%4x buf:", i);
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", buf[j]);
++ printf("\n ref:");
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", ref[j]);
++ printf("\n");
++ }
++}
++
++static void test_memcpy(int src_offset, int dst_offset, int len)
++{
++ clock_t start, old, new;
++ int i;
++
++ memset(buf1, 0x55, BUF_SIZE);
++ memset(buf1_ref, 0x55, BUF_SIZE);
++ memset(buf2, 0xaa, BUF_SIZE);
++
++ printf("Testing memcpy with offsets %d => %d and len %d...",
++ src_offset, dst_offset, len);
++
++ start = clock();
++ for (i = 0; i < 8192; i++)
++ optimized_memcpy(buf1 + dst_offset, buf2 + src_offset, len);
++ new = clock() - start;
++ start = clock();
++ for ( i = 0; i < 8192; i++)
++ memcpy(buf1_ref + dst_offset, buf2 + src_offset, len);
++ old = clock() - start;
++
++ if (memcmp(buf1, buf1_ref, BUF_SIZE) == 0)
++ printf("OK\n");
++ else {
++ printf("FAILED\n");
++ dump_mismatch(buf1, buf1_ref, BUF_SIZE);
++ }
++ printf("CPU time used: %d vs. %d\n", new, old);
++}
++
++static void test_memmove(int src_offset, int dst_offset, int len)
++{
++ clock_t start, old, new;
++
++ memset(buf1, 0x55, BUF_SIZE);
++ memset(buf1_ref, 0x55, BUF_SIZE);
++ memset(buf2, 0xaa, BUF_SIZE);
++
++ printf("Testing memmove with offsets %d => %d and len %d...",
++ src_offset, dst_offset, len);
++
++ start = clock();
++ optimized_memmove(buf1 + dst_offset, buf2 + src_offset, len);
++ new = clock() - start;
++ start = clock();
++ memmove(buf1_ref + dst_offset, buf2 + src_offset, len);
++ old = clock() - start;
++
++ if (memcmp(buf1, buf1_ref, BUF_SIZE) == 0)
++ printf("OK\n");
++ else {
++ printf("FAILED\n");
++ dump_mismatch(buf1, buf1_ref, BUF_SIZE);
++ }
++ printf("CPU time used: %d vs. %d\n", new, old);
++}
++
++int main(int argc, char *argv[])
++{
++ buf2 = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
++ if (buf2 == MAP_FAILED) {
++ perror("Failed to allocate memory for buf2");
++ return 1;
++ }
++ buf1 = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
++ if (buf1 == MAP_FAILED) {
++ perror("Failed to allocate memory for buf1");
++ return 1;
++ }
++ buf1_ref = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
++ if (buf1_ref == MAP_FAILED) {
++ perror("Failed to allocate memory for buf1_ref");
++ return 1;
++ }
++ printf("\n === MEMCPY ===\n\n");
++
++ test_memcpy(0, 0, BUF_SIZE - 32);
++ test_memcpy(0, 0, 1);
++ test_memcpy(0, 0, 31);
++ test_memcpy(0, 0, 32);
++ test_memcpy(0, 0, 127);
++ test_memcpy(0, 0, 128);
++ test_memcpy(4, 4, BUF_SIZE - 32 - 4);
++ test_memcpy(1, 1, BUF_SIZE - 32 - 1);
++ test_memcpy(1, 1, 126);
++ test_memcpy(0, 3, 128);
++ test_memcpy(1, 4, 128);
++ test_memcpy(0, 0, 0);
++
++ printf("\n === MEMMOVE ===\n\n");
++
++ test_memmove(0, 0, BUF_SIZE - 32);
++ test_memmove(0, 0, 1);
++ test_memmove(0, 0, 31);
++ test_memmove(0, 0, 32);
++ test_memmove(0, 0, BUF_SIZE - 33);
++ test_memmove(0, 0, 128);
++ test_memmove(4, 4, BUF_SIZE - 32 - 4);
++ test_memmove(1, 1, BUF_SIZE - 32 - 1);
++ test_memmove(1, 1, BUF_SIZE - 130);
++ test_memmove(0, 3, BUF_SIZE - 128);
++ test_memmove(1, 4, BUF_SIZE - 128);
++ test_memmove(0, 0, 0);
++
++ return 0;
++}
+diff -Nur uClibc-0.9.28/libc/string/avr32/strlen.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/strlen.S
+--- uClibc-0.9.28/libc/string/avr32/strlen.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/strlen.S 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,52 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#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
++ extract.b r9, r8:t
++ cp.w r9, 0
++ subeq r12, 4
++ reteq r12
++ extract.b r9, r8:u
++ cp.w r9, 0
++ subeq r12, 3
++ reteq r12
++ extract.b r9, r8:l
++ 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
+diff -Nur uClibc-0.9.28/libc/string/avr32/strncpy.S uClibc-0.9.28-avr32-20060621/libc/string/avr32/strncpy.S
+--- uClibc-0.9.28/libc/string/avr32/strncpy.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/strncpy.S 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,78 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define dst r9
++#define src r11
++
++ .text
++ .global strcpy
++ .type strncpy, @function
++strncpy:
++ mov dst, r12
++
++ pref src[0]
++ mov dst, r12
++
++ /*
++ * Check alignment. If src is aligned but dst isn't, we can't
++ * do much about it...
++ */
++ mov r8, src
++ andl r8, 3 COH
++ brne .Lunaligned_src
++
++.Laligned_copy:
++ sub r10, 4
++ brlt 3f
++1: ld.w r8, src++
++ tnbz r8
++ breq 2f
++ st.w dst++, r8
++ sub r10, 4
++ brne 1b
++
++3: sub r10, -4
++ reteq r12
++
++ /* This is safe as long as src is word-aligned and r10 > 0 */
++ ld.w r8, src++
++
++2: /*
++ * Ok, r8 now contains the terminating '\0'. Copy the
++ * remaining bytes individually.
++ */
++ extract.b r11, r8:t
++ st.b dst++, r11
++ cp.w r11, 0
++ reteq r12
++ sub r10, 1
++ reteq r12
++ extract.b r11, r8:u
++ st.b dst++, r11
++ cp.w r11, 0
++ reteq r12
++ sub r10, 1
++ reteq r12
++ extract.b r11, r8:l
++ st.b dst++, r11
++ cp.w r11, 0
++ reteq r12
++ sub r10, 1
++ reteq r12
++ extract.b r10, r8:b
++ st.b dst++, r10
++ retal r12
++
++.Lunaligned_src:
++ /* Copy bytes until we're aligned */
++ min r8, r8, r10
++ sub r10, r8
++ sub r8, 1
++ retlt r12
++1: ld.ub r10, src++
++ st.b dst++, r10
++ sub r8, 1
++ brge 1b
++
++ rjmp .Laligned_copy
+diff -Nur uClibc-0.9.28/libc/string/avr32/test_memcpy.c uClibc-0.9.28-avr32-20060621/libc/string/avr32/test_memcpy.c
+--- uClibc-0.9.28/libc/string/avr32/test_memcpy.c 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/string/avr32/test_memcpy.c 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,66 @@
++
++#include <stdio.h>
++#include <string.h>
++
++#define BUF_SIZE 32768
++
++static char buf1[BUF_SIZE] __attribute__((aligned(32)));
++static char buf1_ref[BUF_SIZE] __attribute__((aligned(32)));
++static char buf2[BUF_SIZE] __attribute__((aligned(32)));
++
++extern void *new_memcpy(void *dest, void *src, size_t len);
++
++void dump_mismatch(char *buf, char *ref, size_t len)
++{
++ int i, j;
++
++ for (i = 0; i < len; i += 16) {
++ if (memcmp(buf + i, ref + i, 16) == 0)
++ continue;
++
++ printf("% 4x buf:", i);
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", buf[j]);
++ printf("\n ref:");
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", ref[j]);
++ printf("\n");
++ }
++}
++
++void test(int src_offset, int dst_offset, int len)
++{
++ memset(buf1, 0x55, sizeof(buf1));
++ memset(buf1_ref, 0x55, sizeof(buf1_ref));
++ memset(buf2, 0xaa, sizeof(buf2));
++
++ printf("Testing with offsets %d => %d and len %d...",
++ src_offset, dst_offset, len);
++
++ new_memcpy(buf1 + dst_offset, buf2 + src_offset, len);
++ memcpy(buf1_ref + dst_offset, buf2 + src_offset, len);
++
++ if (memcmp(buf1, buf1_ref, sizeof(buf1)) == 0)
++ printf("OK\n");
++ else {
++ printf("FAILED\n");
++ dump_mismatch(buf1, buf1_ref, sizeof(buf1));
++ }
++}
++
++int main(int argc, char *argv[])
++{
++ test(0, 0, BUF_SIZE);
++ test(0, 0, 1);
++ test(0, 0, 31);
++ test(0, 0, 32);
++ test(0, 0, 127);
++ test(0, 0, 128);
++ test(4, 4, BUF_SIZE - 4);
++ test(1, 1, BUF_SIZE - 1);
++ test(1, 1, 126);
++ test(0, 3, 128);
++ test(1, 4, 128);
++
++ return 0;
++}
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/atomicity.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/atomicity.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/atomicity.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/atomicity.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,86 @@
++/* Low-level functions for atomic operations. AVR32 version.
++ Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _ATOMICITY_H
++#define _ATOMICITY_H 1
++
++#include <inttypes.h>
++
++static inline int
++__attribute__((unused))
++exchange_and_add (volatile uint32_t *mem, int val)
++{
++ int tmp, result;
++
++ __asm__ __volatile__(
++ "/* Inline exchange and add */\n"
++ "1: ssrf 5\n"
++ " ld.w %0, %3\n"
++ " add %1, %0, %4\n"
++ " stcond %2, %1\n"
++ " brne 1b"
++ : "=&r"(result), "=&r"(tmp), "=m"(*mem)
++ : "m"(*mem), "r"(val)
++ : "cc", "memory");
++
++ return result;
++}
++
++static inline void
++__attribute__((unused))
++atomic_add (volatile uin32_t *mem, int val)
++{
++ int result;
++
++ __asm__ __volatile__(
++ "/* Inline atomic add */\n"
++ "1: ssrf 5\n"
++ " ld.w %0, %2\n"
++ " add %0, %3\n"
++ " stcond %2, %0\n"
++ " brne 1b"
++ : "=&r"(result), "=m"(*mem)
++ : "m"(*mem), "r"(val)
++ : "cc", "memory");
++}
++
++static inline int
++__attribute__((unused))
++compare_and_swap(volatile long int *p, long int oldval, long int newval)
++{
++ long int result, tmp;
++
++ __asm__ __volatile__(
++ "/* Inline compare and swap */\n"
++ "1: ssrf 5\n"
++ " ld.w %1, %3\n"
++ " cp.w %1, %5\n"
++ " sreq %0\n"
++ " brne 2f\n"
++ " stcond %2, %4\n"
++ " brne 1b\n"
++ "2:"
++ : "=&r"(result), "=&r"(tmp), "=m"(*p)
++ : "m"(*p), "r"(newval), "r"(oldval)
++ : "cc", "memory");
++
++ return result;
++}
++
++#endif /* atomicity.h */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/byteswap.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/byteswap.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/byteswap.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/byteswap.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,80 @@
++/* Macros to swap the order of bytes in integer values.
++ Copyright (C) 2005 Atmel Norway.
++
++ 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. */
++
++#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
++# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
++#endif
++
++#ifndef _BITS_BYTESWAP_H
++#define _BITS_BYTESWAP_H 1
++
++/* Swap bytes in 16 bit value. */
++#if defined __GNUC__
++# define __bswap_16(x) (__extension__ __builtin_bswap_16(x))
++#else
++/* This is better than nothing. */
++static __inline unsigned short int
++__bswap_16 (unsigned short int __bsx)
++{
++ return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
++}
++#endif
++
++/* Swap bytes in 32 bit value. */
++#if defined __GNUC__
++# define __bswap_32(x) (__extension__ __builtin_bswap_32(x))
++#else
++static __inline unsigned int
++__bswap_32 (unsigned int __bsx)
++{
++ return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
++ (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
++}
++#endif
++
++#if defined __GNUC__
++/* Swap bytes in 64 bit value. */
++# define __bswap_constant_64(x) \
++ ((((x) & 0xff00000000000000ull) >> 56) \
++ | (((x) & 0x00ff000000000000ull) >> 40) \
++ | (((x) & 0x0000ff0000000000ull) >> 24) \
++ | (((x) & 0x000000ff00000000ull) >> 8) \
++ | (((x) & 0x00000000ff000000ull) << 8) \
++ | (((x) & 0x0000000000ff0000ull) << 24) \
++ | (((x) & 0x000000000000ff00ull) << 40) \
++ | (((x) & 0x00000000000000ffull) << 56))
++
++# define __bswap_64(x) \
++ (__extension__ \
++ ({ \
++ union { \
++ __extension__ unsigned long long int __ll; \
++ unsigned int __l[2]; \
++ } __w, __r; \
++ if (__builtin_constant_p(x)) \
++ __r.__ll = __bswap_constant_64(x); \
++ else { \
++ __w.__ll = (x); \
++ __r.__l[0] = __bswap_32(__w.__l[1]); \
++ __r.__l[1] = __bswap_32(__w.__l[0]); \
++ } \
++ __r.__ll; \
++ }))
++#endif
++
++#endif /* _BITS_BYTESWAP_H */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/endian.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/endian.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/endian.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/endian.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,7 @@
++/* AVR32 is big-endian */
++
++#ifndef _ENDIAN_H
++# error "Never use <bits/endian.h> directly; include <endian.h> instead."
++#endif
++
++#define __BYTE_ORDER __BIG_ENDIAN
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/fcntl.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/fcntl.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/fcntl.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/fcntl.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,167 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ *
++ * This file is part of the Linux kernel
++ */
++#ifndef _FCNTL_H
++# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
++#endif
++
++#include <sys/types.h>
++
++/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
++ located on an ext2 file system */
++#define O_ACCMODE 0003
++#define O_RDONLY 00
++#define O_WRONLY 01
++#define O_RDWR 02
++#define O_CREAT 0100 /* not fcntl */
++#define O_EXCL 0200 /* not fcntl */
++#define O_NOCTTY 0400 /* not fcntl */
++#define O_TRUNC 01000 /* not fcntl */
++#define O_APPEND 02000
++#define O_NONBLOCK 04000
++#define O_NDELAY O_NONBLOCK
++#define O_SYNC 010000
++#define O_ASYNC 020000
++
++#ifdef __USE_GNU
++# define O_DIRECTORY 040000 /* must be a directory */
++# define O_NOFOLLOW 0100000 /* don't follow links */
++# define O_DIRECT 0200000 /* direct disk access */
++#endif
++
++#ifdef __USE_LARGEFILE64
++# define O_LARGEFILE 0400000
++#endif
++
++/* For now Linux has synchronisity options for data and read operations.
++ We define the symbols here but let them do the same as O_SYNC since
++ this is a superset. */
++#if defined __USE_POSIX199309 || defined __USE_UNIX98
++# define O_DSYNC O_SYNC /* Synchronize data. */
++# define O_RSYNC O_SYNC /* Synchronize read operations. */
++#endif
++
++#define F_DUPFD 0 /* dup */
++#define F_GETFD 1 /* get close_on_exec */
++#define F_SETFD 2 /* set/clear close_on_exec */
++#define F_GETFL 3 /* get file->f_flags */
++#define F_SETFL 4 /* set file->f_flags */
++
++#ifndef __USE_FILE_OFFSET64
++# define F_GETLK 5
++# define F_SETLK 6
++# define F_SETLKW 7
++#else
++# define F_GETLK F_GETLK64
++# define F_SETLK F_SETLK64
++# define F_SETLKW F_SETLKW64
++#endif
++#define F_GETLK64 12 /* using 'struct flock64' */
++#define F_SETLK64 13
++#define F_SETLKW64 14
++
++#if defined __USE_BSD || defined __USE_XOPEN2K
++# define F_SETOWN 8 /* for sockets. */
++# define F_GETOWN 9 /* for sockets. */
++#endif
++
++#ifdef __USE_GNU
++# define F_SETSIG 10 /* for sockets. */
++# define F_GETSIG 11 /* for sockets. */
++#endif
++
++#ifdef __USE_GNU
++# define F_SETLEASE 1024 /* Set a lease. */
++# define F_GETLEASE 1025 /* Enquire what lease is active. */
++# define F_NOTIFY 1026 /* Request notfications on a directory. */
++#endif
++
++/* for F_[GET|SET]FL */
++#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
++
++/* for posix fcntl() and lockf() */
++#define F_RDLCK 0
++#define F_WRLCK 1
++#define F_UNLCK 2
++
++/* for old implementation of bsd flock () */
++#define F_EXLCK 4 /* or 3 */
++#define F_SHLCK 8 /* or 4 */
++
++/* for leases */
++#define F_INPROGRESS 16
++
++#ifdef __USE_BSD
++/* operations for bsd flock(), also used by the kernel implementation */
++# define LOCK_SH 1 /* shared lock */
++# define LOCK_EX 2 /* exclusive lock */
++# define LOCK_NB 4 /* or'd with one of the above to prevent
++ blocking */
++# define LOCK_UN 8 /* remove lock */
++#endif
++
++#ifdef __USE_GNU
++# define LOCK_MAND 32 /* This is a mandatory flock */
++# define LOCK_READ 64 /* ... Which allows concurrent
++ read operations */
++# define LOCK_WRITE 128 /* ... Which allows concurrent
++ write operations */
++# define LOCK_RW 192 /* ... Which allows concurrent
++ read & write ops */
++#endif
++
++#ifdef __USE_GNU
++/* Types of directory notifications that may be requested with F_NOTIFY. */
++# define DN_ACCESS 0x00000001 /* File accessed. */
++# define DN_MODIFY 0x00000002 /* File modified. */
++# define DN_CREATE 0x00000004 /* File created. */
++# define DN_DELETE 0x00000008 /* File removed. */
++# define DN_RENAME 0x00000010 /* File renamed. */
++# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
++# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
++#endif
++
++struct flock {
++ short l_type;
++ short l_whence;
++#ifndef __USE_FILE_OFFSET64
++ __off_t l_start;
++ __off_t l_len;
++#else
++ __off64_t l_start;
++ __off64_t l_len;
++#endif
++ __pid_t l_pid;
++};
++
++#ifdef __USE_LARGEFILE64
++struct flock64 {
++ short l_type;
++ short l_whence;
++ __off64_t l_start;
++ __off64_t l_len;
++ __pid_t l_pid;
++};
++#endif
++
++/* Define some more compatibility macros to be backward compatible with
++ * BSD systems which did not managed to hide these kernel macros. */
++#ifdef __USE_BSD
++# define FAPPEND O_APPEND
++# define FFSYNC O_FSYNC
++# define FASYNC O_ASYNC
++# define FNONBLOCK O_NONBLOCK
++# define FNDELAY O_NDELAY
++#endif /* Use BSD. */
++
++/* Advise to `posix_fadvise'. */
++#ifdef __USE_XOPEN2K
++# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
++# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
++# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
++# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
++# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
++# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
++#endif
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_stat.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/kernel_stat.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_stat.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/kernel_stat.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,63 @@
++#ifndef _BITS_STAT_STRUCT_H
++#define _BITS_STAT_STRUCT_H
++
++/*
++ * This file provides struct stat, taken from kernel 2.6.4
++ * (include/asm-avr32/stat.h revision 1.1).
++ */
++
++struct kernel_stat {
++ unsigned long st_dev;
++ unsigned long st_ino;
++ unsigned short st_mode;
++ unsigned short st_nlink;
++ unsigned short st_uid;
++ unsigned short st_gid;
++ unsigned long st_rdev;
++ unsigned long st_size;
++ unsigned long st_blksize;
++ unsigned long st_blocks;
++ unsigned long st_atime;
++ unsigned long st_atime_nsec;
++ unsigned long st_mtime;
++ unsigned long st_mtime_nsec;
++ unsigned long st_ctime;
++ unsigned long st_ctime_nsec;
++ unsigned long __unused4;
++ unsigned long __unused5;
++};
++
++#define STAT_HAVE_NSEC 1
++
++struct kernel_stat64 {
++ unsigned long long st_dev;
++
++ unsigned long long st_ino;
++ unsigned int st_mode;
++ unsigned int st_nlink;
++
++ unsigned long st_uid;
++ unsigned long st_gid;
++
++ unsigned long long st_rdev;
++
++ long long st_size;
++ unsigned long __pad1;
++ unsigned long st_blksize;
++
++ unsigned long long st_blocks;
++
++ unsigned long st_atime;
++ unsigned long st_atime_nsec;
++
++ unsigned long st_mtime;
++ unsigned long st_mtime_nsec;
++
++ unsigned long st_ctime;
++ unsigned long st_ctime_nsec;
++
++ unsigned long __unused1;
++ unsigned long __unused2;
++};
++
++#endif /* _BITS_STAT_STRUCT_H */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_types.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/kernel_types.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/kernel_types.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/kernel_types.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,56 @@
++/* Note that we use the exact same include guard #define names
++ * as asm/posix_types.h. This will avoid gratuitous conflicts
++ * with the posix_types.h kernel header, and will ensure that
++ * our private content, and not the kernel header, will win.
++ * -Erik
++ */
++#ifndef __ASM_AVR32_POSIX_TYPES_H
++#define __ASM_AVR32_POSIX_TYPES_H
++
++/*
++ * This file is generally used by user-level software, so you need to
++ * be a little careful about namespace pollution etc. Also, we cannot
++ * assume GCC is being used.
++ */
++
++typedef unsigned long __kernel_dev_t;
++typedef unsigned long __kernel_ino_t;
++typedef unsigned short __kernel_mode_t;
++typedef unsigned short __kernel_nlink_t;
++typedef long __kernel_off_t;
++typedef int __kernel_pid_t;
++typedef unsigned short __kernel_ipc_pid_t;
++typedef unsigned int __kernel_uid_t;
++typedef unsigned int __kernel_gid_t;
++typedef unsigned long __kernel_size_t;
++typedef int __kernel_ssize_t;
++typedef int __kernel_ptrdiff_t;
++typedef long __kernel_time_t;
++typedef long __kernel_suseconds_t;
++typedef long __kernel_clock_t;
++typedef int __kernel_timer_t;
++typedef int __kernel_clockid_t;
++typedef int __kernel_daddr_t;
++typedef char * __kernel_caddr_t;
++typedef unsigned short __kernel_uid16_t;
++typedef unsigned short __kernel_gid16_t;
++typedef unsigned int __kernel_uid32_t;
++typedef unsigned int __kernel_gid32_t;
++
++typedef unsigned short __kernel_old_uid_t;
++typedef unsigned short __kernel_old_gid_t;
++typedef unsigned short __kernel_old_dev_t;
++
++#ifdef __GNUC__
++typedef long long __kernel_loff_t;
++#endif
++
++typedef struct {
++#if defined(__USE_ALL)
++ int val[2];
++#else
++ int __val[2];
++#endif
++} __kernel_fsid_t;
++
++#endif /* __ASM_AVR32_POSIX_TYPES_H */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/machine-gmon.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/machine-gmon.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/machine-gmon.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/machine-gmon.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,69 @@
++/* Machine-dependent definitions for profiling support. AVR32 version.
++ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#define mcount_internal __mcount_internal
++
++#define _MCOUNT_DECL(frompc, selfpc) \
++static void __attribute((used)) mcount_internal(unsigned long frompc, unsigned long selfpc)
++
++/*
++ * This mcount implementation expects to get called after the prologue
++ * has been run. It also expects that r7 contains a valid frame
++ * pointer.
++ *
++ * When profiling, the compiler should generate something like this at
++ * each function entry:
++ *
++ * pushm r0-r7,lr // lr mandatory, others optional
++ * mov r7, sp
++ * // rest of prologue goes here
++ * mcall pc[.LC1 - .]
++ * // rest of function goes here
++ * .LC1:
++ * .long mcount
++ *
++ * or for PIC:
++ *
++ * pushm r0-r7,lr
++ * mov r7, sp
++ * // rest of prologue goes here
++ * lddpc r0, .LC1
++ * .L1: rsub r0, pc
++ * mcall r0[mcount@GOT]
++ * // rest of function goes here
++ * .LC1:
++ * .long .L1 - _GLOBAL_OFFSET_TABLE_
++ *
++ * This way, when mcount() is called, r7 points to the calling
++ * function's return address. It is guaranteed that calling mcount
++ * will clobber no registers except LR, which is unavoidable.
++ */
++#define MCOUNT asm( \
++ " .align 4\n" \
++ " .global _mcount\n" \
++ " .type _mcount,@function\n" \
++ "_mcount:\n" \
++ " pushm r8-r12,lr\n" \
++ " mov r11, lr\n" \
++ " ld.w r12, r7[0]\n" \
++ " rcall __mcount_internal\n" \
++ " popm r8-r12,pc\n" \
++ " .size _mcount, . - _mcount\n" \
++ " .weak mcount\n" \
++ " mcount = _mcount");
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/mman.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/mman.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/mman.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/mman.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,95 @@
++/* Definitions for POSIX memory map interface. Linux/AVR32 version.
++ Copyright (C) 1997, 2000 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_MMAN_H
++# error "Never include this file directly. Use <sys/mman.h> instead"
++#endif
++
++/* The following definitions basically come from the kernel headers.
++ But the kernel header is not namespace clean. */
++
++
++/* Protections are chosen from these bits, OR'd together. The
++ implementation does not necessarily support PROT_EXEC or PROT_WRITE
++ without PROT_READ. The only guarantees are that no writing will be
++ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
++
++#define PROT_READ 0x1 /* Page can be read. */
++#define PROT_WRITE 0x2 /* Page can be written. */
++#define PROT_EXEC 0x4 /* Page can be executed. */
++#define PROT_NONE 0x0 /* Page can not be accessed. */
++
++/* Sharing types (must choose one and only one of these). */
++#define MAP_SHARED 0x01 /* Share changes. */
++#define MAP_PRIVATE 0x02 /* Changes are private. */
++#ifdef __USE_MISC
++# define MAP_TYPE 0x0f /* Mask for type of mapping. */
++#endif
++
++/* Other flags. */
++#define MAP_FIXED 0x10 /* Interpret addr exactly. */
++#ifdef __USE_MISC
++# define MAP_FILE 0
++# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
++# define MAP_ANON MAP_ANONYMOUS
++#endif
++
++/* These are Linux-specific. */
++#ifdef __USE_MISC
++# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
++# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
++# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
++# define MAP_LOCKED 0x2000 /* Lock the mapping. */
++# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
++# define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
++# define MAP_NONBLOCK 0x10000 /* do not block on IO */
++#endif
++
++/* Flags to `msync'. */
++#define MS_ASYNC 1 /* Sync memory asynchronously. */
++#define MS_SYNC 4 /* Synchronous memory sync. */
++#define MS_INVALIDATE 2 /* Invalidate the caches. */
++
++/* Flags for `mlockall'. */
++#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
++#define MCL_FUTURE 2 /* Lock all additions to address
++ space. */
++
++/* Flags for `mremap'. */
++#ifdef __USE_GNU
++# define MREMAP_MAYMOVE 1
++#endif
++
++/* Advise to `madvise'. */
++#ifdef __USE_BSD
++# define MADV_NORMAL 0 /* No further special treatment. */
++# define MADV_RANDOM 1 /* Expect random page references. */
++# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
++# define MADV_WILLNEED 3 /* Will need these pages. */
++# define MADV_DONTNEED 4 /* Don't need these pages. */
++#endif
++
++/* The POSIX people had to invent similar names for the same things. */
++#ifdef __USE_XOPEN2K
++# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
++# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
++# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
++# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
++# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
++#endif
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/profil-counter.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/profil-counter.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/profil-counter.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/profil-counter.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,26 @@
++/* Low-level statistical profiling support function. Linux/AVR32 version.
++ Copyright (C) 1996, 1997, 1998, 2002 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 <signal.h>
++
++void
++profil_counter(int signo, siginfo_t *si, struct sigcontext *sc)
++{
++ profil_count((void *)sc->pc);
++}
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/setjmp.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/setjmp.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/setjmp.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/setjmp.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,21 @@
++/*
++ * Copyright (C) 2004-2005 Atmel Norway
++ */
++#ifndef _SETJMP_H
++# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
++#endif
++
++#ifndef _ASM
++/*
++ * The jump buffer contains r0-r7, sr, sp and lr. Other registers are
++ * not saved.
++ */
++typedef int __jmp_buf[11];
++#endif
++
++#define __JMP_BUF_SP 4
++
++/* Test if longjmp to JMPBUF would unwind the frame containing a local
++ variable at ADDRESS. */
++#define _JMPBUF_UNWINDS(jmpbuf, address) \
++ ((void *)(address) < (void *)(jmpbuf[__JMP_BUF_SP]))
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/syscalls.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/syscalls.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/syscalls.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/syscalls.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,143 @@
++#ifndef _SYSCALL_H
++# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
++#endif
++
++/*
++ * This includes the `__NR_<name>' syscall numbers taken from the
++ * Linux kernel header files. It also defines the traditional
++ * `SYS_<name>' macros for older programs.
++ */
++#include <bits/sysnum.h>
++
++#ifndef __set_errno
++# define __set_errno(val) (*__errno_location()) = (val)
++#endif
++#ifndef SYS_ify
++# define SYS_ify(syscall_name) (__NR_##syscall_name)
++#endif
++
++#ifndef __ASSEMBLER__
++
++#undef _syscall0
++#define _syscall0(type,name) \
++ type name(void) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 0)); \
++ }
++
++#undef _syscall1
++#define _syscall1(type,name,type1,arg1) \
++ type name(type1 arg1) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 1, arg1)); \
++ }
++
++#undef _syscall2
++#define _syscall2(type,name,type1,arg1,type2,arg2) \
++ type name(type1 arg1, type2 arg2) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 2, arg1, arg2)); \
++ }
++
++#undef _syscall3
++#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
++ type name(type1 arg1, type2 arg2, type3 arg3) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 3, arg1, \
++ arg2, arg3)); \
++ }
++
++#undef _syscall4
++#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
++ type4,arg4) \
++ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 4, arg1, arg2, \
++ arg3, arg4)); \
++ }
++
++#undef _syscall5
++#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
++ type4,arg4,type5,arg5) \
++ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
++ type5 arg5) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 5, arg1, arg2, \
++ arg3, arg4, arg5)); \
++ }
++
++#undef _syscall6
++#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3, \
++ type4,arg4,type5,arg5,type6,arg6) \
++ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
++ type5 arg5, type6 arg6) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 6, arg1, arg2, arg3, \
++ arg4, arg5, arg6)); \
++ }
++
++#undef unlikely
++#define unlikely(x) __builtin_expect((x), 0)
++
++#undef INLINE_SYSCALL
++#define INLINE_SYSCALL(name, nr, args...) \
++ ({ \
++ unsigned _sys_result = INTERNAL_SYSCALL(name, , nr, args); \
++ if (unlikely(INTERNAL_SYSCALL_ERROR_P(_sys_result, ))) { \
++ __set_errno(INTERNAL_SYSCALL_ERRNO(_sys_result, )); \
++ _sys_result = (unsigned int) -1; \
++ } \
++ (int) _sys_result; \
++ })
++
++#undef INTERNAL_SYSCALL_DECL
++#define INTERNAL_SYSCALL_DECL(err) do { } while(0)
++
++#undef INTERNAL_SYSCALL
++#define INTERNAL_SYSCALL(name, err, nr, args...) \
++ ({ \
++ register int _a1 asm ("r12"); \
++ register int _scno asm("r8") = SYS_ify(name); \
++ LOAD_ARGS_##nr (args); \
++ asm volatile ("scall /* syscall " #name " */" \
++ : "=r" (_a1) \
++ : "r"(_scno) ASM_ARGS_##nr \
++ : "lr", "cc", "memory"); \
++ _a1; \
++ })
++
++#undef INTERNAL_SYSCALL_ERROR_P
++#define INTERNAL_SYSCALL_ERROR_P(val, err) \
++ ((unsigned int)(val) >= 0xfffff001U)
++
++#undef INTERNAL_SYSCALL_ERRNO
++#define INTERNAL_SYSCALL_ERRNO(val, errr) (-(val))
++
++#define LOAD_ARGS_0() do { } while(0)
++#define ASM_ARGS_0
++#define LOAD_ARGS_1(a1) \
++ _a1 = (int) (a1); \
++ LOAD_ARGS_0()
++#define ASM_ARGS_1 ASM_ARGS_0, "r"(_a1)
++#define LOAD_ARGS_2(a1, a2) \
++ register int _a2 asm("r11") = (int)(a2); \
++ LOAD_ARGS_1(a1)
++#define ASM_ARGS_2 ASM_ARGS_1, "r"(_a2)
++#define LOAD_ARGS_3(a1, a2, a3) \
++ register int _a3 asm("r10") = (int)(a3); \
++ LOAD_ARGS_2(a1, a2)
++#define ASM_ARGS_3 ASM_ARGS_2, "r"(_a3)
++#define LOAD_ARGS_4(a1, a2, a3, a4) \
++ register int _a4 asm("r9") = (int)(a4); \
++ LOAD_ARGS_3(a1, a2, a3)
++#define ASM_ARGS_4 ASM_ARGS_3, "r"(_a4)
++#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
++ register int _a5 asm("r5") = (int)(a5); \
++ LOAD_ARGS_4(a1, a2, a3, a4)
++#define ASM_ARGS_5 ASM_ARGS_4, "r"(_a5)
++#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
++ register int _a6 asm("r3") = (int)(a6); \
++ LOAD_ARGS_5(a1, a2, a3, a4, a5)
++#define ASM_ARGS_6 ASM_ARGS_5, "r"(_a6)
++
++#endif /* __ASSEMBLER__ */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/wordsize.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/wordsize.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bits/wordsize.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bits/wordsize.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1 @@
++#define __WORDSIZE 32
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/brk.c uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/brk.c
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/brk.c 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/brk.c 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,23 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <errno.h>
++#include <sys/syscall.h>
++
++void *__curbrk = 0;
++
++int brk (void *addr)
++{
++ void *newbrk;
++
++ newbrk = INLINE_SYSCALL(brk, 1, addr);
++
++ __curbrk = newbrk;
++
++ if (newbrk < addr) {
++ __set_errno (ENOMEM);
++ return -1;
++ }
++
++ return 0;
++}
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-_setjmp.S uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bsd-_setjmp.S
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-_setjmp.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bsd-_setjmp.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,12 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++
++ /* This just does a tail-call to __sigsetjmp(env, 0) */
++ .global _setjmp
++ .type _setjmp,"function"
++ .align 1
++_setjmp:
++ mov r11, 0
++ bral __sigsetjmp_internal
++ .size _setjmp, . - _setjmp
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-setjmp.S uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bsd-setjmp.S
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/bsd-setjmp.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/bsd-setjmp.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,12 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++
++ /* This just does a tail-call to __sigsetjmp(env, 1) */
++ .global setjmp
++ .type setjmp,"function"
++ .align 1
++setjmp:
++ mov r11, 1
++ bral __sigsetjmp_internal
++ .size setjmp, . - setjmp
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/clone.c uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/clone.c
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/clone.c 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/clone.c 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,37 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <errno.h>
++#include <sys/syscall.h>
++#include <unistd.h>
++
++/*
++ * I don't know if we can be absolutely certain that the fn and arg
++ * parameters are preserved when returning as the child. If the
++ * compiler stores them in registers (r0-r7), they should be.
++ */
++int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg)
++{
++ register int (*_fn)(void *arg) = fn;
++ register void *_arg = arg;
++ int err;
++
++ /* Sanity check the arguments */
++ err = -EINVAL;
++ if (!fn)
++ goto syscall_error;
++ if (!child_stack)
++ goto syscall_error;
++
++ err = INLINE_SYSCALL(clone, 2, flags, child_stack);
++ if (err < 0)
++ goto syscall_error;
++ else if (err != 0)
++ return err;
++
++ _exit(_fn(_arg));
++
++syscall_error:
++ __set_errno (-err);
++ return -1;
++}
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/crt1.S uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/crt1.S
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/crt1.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/crt1.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,93 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ *
++ * When we enter _start, the stack looks like this:
++ * argc argument counter
++ * argv[0] pointer to program name
++ * argv[1..argc-1] pointers to program args
++ * NULL
++ * env[0..N] pointers to environment variables
++ * NULL
++ *
++ * r12 contains a function pointer to be registered with `atexit'.
++ * This is how the dynamic linker arranges to have DT_FINI functions
++ * called for shared libraries that have been loaded before this
++ * code runs.
++ *
++ * We're going to call the following function:
++ * __uClibc_main(int (*main)(int, char **, char **), int argc,
++ * char **argv, void (*app_init)(void), void (*app_fini)(void),
++ * void (*rtld_fini)(void), void *stack_end)
++ *
++ * So we need to set up things as follows:
++ * r12 = address of main
++ * r11 = argc
++ * r10 = &argv[0]
++ * r9 = address of _init
++ * r8 = address of _fini
++ * sp[0] = whatever we got passed in r12
++ */
++
++#include <features.h>
++
++ .text
++ .global _start
++ .type _start, @function
++_start:
++ /* Clear the frame pointer and link register since this is the outermost frame. */
++ mov r7, 0
++ mov lr, 0
++
++ ld.w r11, sp++ /* argc */
++ mov r10, sp /* &argv[0] */
++
++ st.w --sp, r10 /* stack_end */
++ st.w --sp, r12 /* rtld_fini */
++
++#ifdef __PIC__
++ lddpc r6, .L_GOT
++.L_RGOT:
++ rsub r6, pc
++ lda.w r9, _init
++ lda.w r8, _fini
++ lda.w r12, main
++
++ /* Ok, now run uClibc's main() -- should not return */
++ call __uClibc_main
++
++ .align 2
++.L_GOT:
++ .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
++#else
++ lddpc r9, __init_addr /* app_init */
++ lddpc r8, __fini_addr /* app_fini */
++ lddpc r12, __main_addr /* main */
++
++ /* Ok, now run uClibc's main() -- should not return */
++ lddpc pc, ___uClibc_main_addr
++
++ .align 2
++__init_addr:
++ .long _init
++__fini_addr:
++ .long _fini
++__main_addr:
++ .long main
++___uClibc_main_addr:
++ .long __uClibc_main
++#endif
++ .size _start, . - _start
++
++ /*
++ * The LSB says we need this.
++ */
++ .section ".note.ABI-tag", "a"
++ .align 4
++ .long 2f - 1f /* namesz */
++ .long 4f - 3f /* descsz */
++ .long 1 /* type */
++1: .asciz "GNU" /* name */
++2: .align 4
++3: .long 0 /* Linux executable */
++ .long 2,6,0 /* Earliest compatible kernel */
++4: .align 4
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/crti.S uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/crti.S
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/crti.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/crti.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,17 @@
++
++ .section .init
++ .align 2
++ .global _init
++ .type _init, @function
++_init:
++ /* Use a four-byte instruction to avoid NOPs */
++ stm --sp, r0-r7,lr
++ .align 2
++
++ .section .fini
++ .align 2
++ .global _fini
++ .type _fini, @function
++_fini:
++ stm --sp, r0-r7,lr
++ .align 2
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/crtn.S uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/crtn.S
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/crtn.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/crtn.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,14 @@
++
++ .section .init
++ .align 2
++ .global _init
++ .type _init, @function
++ ldm sp++, r0-r7,pc
++ .size _init, . - _init
++
++ .section .fini
++ .align 2
++ .global _fini
++ .type _fini, @function
++ ldm sp++, r0-r7,pc
++ .size _fini, . - _fini
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/__longjmp.S uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/__longjmp.S
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/__longjmp.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/__longjmp.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,17 @@
++/* longjmp for AVR32
++ *
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++
++ .global __longjmp
++ .type __longjmp,"function"
++ .align 1
++__longjmp:
++ ldm r12++, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
++ mov r12, r11 /* get the return value right */
++ mustr r8 /* restore status register (lower half) */
++ cp r12, 0 /* can't return zero */
++ frs
++ moveq r12, 1
++ mov pc,lr
++ .size __longjmp, . - __longjmp
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/Makefile uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/Makefile
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/Makefile 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/Makefile 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,93 @@
++# 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
++
++TOPDIR=../../../../
++include $(TOPDIR)Rules.mak
++ASFLAGS=$(CFLAGS)
++
++CRT_SRC = crt1.S
++CRT_OBJ = crt1.o
++SCRT_OBJ = $(patsubst %,S%, $(CRT_OBJ))
++CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
++
++SSRC=__longjmp.S setjmp.S bsd-setjmp.S vfork.S \
++ bsd-_setjmp.S sigrestorer.S syscall.S
++SOBJS=$(patsubst %.S,%.o, $(SSRC))
++
++CSRC=clone.c brk.c sigaction.c mmap.c
++COBJS=$(patsubst %.c,%.o, $(CSRC))
++
++OBJS=$(SOBJS) $(COBJS)
++
++OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
++
++all: $(OBJ_LIST)
++
++$(OBJ_LIST): $(OBJS) $(CRT_OBJ) $(SCRT_OBJ) $(CTOR_TARGETS)
++ echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
++ $(INSTALL) -d $(TOPDIR)lib/
++ cp $(CRT_OBJ) $(SCRT_OBJ) $(TOPDIR)lib/
++
++$(CRT_OBJ): $(CRT_SRC)
++ $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++$(SCRT_OBJ): $(CRT_SRC)
++ $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* $< -c -o $*.o
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++$(SOBJS): %.o : %.S
++ $(CC) $(ASFLAGS) -c $< -o $@
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++$(COBJS): %.o : %.c
++ $(CC) $(CFLAGS) -c $< -o $@
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
++crti.o: crti.S
++ $(CC) $(ASFLAGS) -c crti.S -o crti.o
++
++$(TOPDIR)lib/crti.o: crti.o
++ $(INSTALL) -d $(TOPDIR)lib/
++ cp crti.o $(TOPDIR)lib/
++
++crtn.o: crtn.S
++ $(CC) $(ASFLAGS) -c crtn.S -o crtn.o
++
++$(TOPDIR)lib/crtn.o: crtn.o
++ $(INSTALL) -d $(TOPDIR)lib/
++ cp crtn.o $(TOPDIR)lib/
++else
++$(TOPDIR)lib/crti.o:
++ $(INSTALL) -d $(TOPDIR)lib/
++ $(AR) $(ARFLAGS) $(TOPDIR)lib/crti.o
++$(TOPDIR)lib/crtn.o:
++ $(INSTALL) -d $(TOPDIR)lib/
++ $(AR) $(ARFLAGS) $(TOPDIR)lib/crtn.o
++endif
++
++
++headers:
++# $(LN) -fs ../libc/sysdeps/linux/avr32/fpu_control.h $(TOPDIR)/include/
++
++clean:
++ $(RM) *.[oa] *~ core
++ $(RM) bits/sysnum.h
++ $(RM) gmon-start.S
++
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/_mmap.c uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/_mmap.c
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/_mmap.c 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/_mmap.c 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,33 @@
++/* Copyright (C) 2005 Atmel Norway
++
++ 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
++
++ Derived in part from the Linux-8086 C library, the GNU C Library, and several
++ other sundry sources. Files within this library are copyright by their
++ respective copyright holders.
++ */
++
++#include <errno.h>
++#include <sys/mman.h>
++#include <sys/syscall.h>
++
++#define __NR_mmap2 __NR_mmap
++
++static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
++
++__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
++{
++ return mmap2(addr, len, prot, flags, fd, offset >> 12);
++}
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/mmap.c uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/mmap.c
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/mmap.c 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/mmap.c 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2005 Atmel Norway
++
++ 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
++
++ Derived in part from the Linux-8086 C library, the GNU C Library, and several
++ other sundry sources. Files within this library are copyright by their
++ respective copyright holders.
++ */
++
++#include <errno.h>
++#include <sys/mman.h>
++#include <sys/syscall.h>
++
++static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
++
++__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
++{
++ return mmap2(addr, len, prot, flags, fd, offset >> 12);
++}
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/setjmp.S uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/setjmp.S
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/setjmp.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/setjmp.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#define _SETJMP_H
++#define _ASM
++#include <bits/setjmp.h>
++
++ .text
++
++ .global __sigsetjmp
++ .type __sigsetjmp,"function"
++
++ /* Create a global, hidden symbol for use by setjmp() and _setjmp().
++ If it's not hidden, the linker will complain about a relative
++ jump to a dynamic symbol when building a shared library.
++
++ Also, if a user overrides the __sigsetjmp function, he might not
++ expect the setjmp() and _setjmp() function to effectively be
++ overridden as well. */
++ .global __sigsetjmp_internal
++ .hidden __sigsetjmp_internal
++ .type __sigsetjmp_internal,"function"
++ .align 1
++__sigsetjmp:
++__sigsetjmp_internal:
++ mustr r8
++ stm r12, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
++
++ /* Make a tail call to __sigjmp_save; it takes the same args. */
++#ifdef __PIC__
++ mov r9, r6
++ lddpc r6, .LG
++.L1: rsub r6, pc
++ ld.w r8, r6[__sigjmp_save@got]
++ mov r6, r9
++ mov pc, r8
++
++ .align 2
++.LG: .long .L1 - _GLOBAL_OFFSET_TABLE_
++#else
++ rjmp __sigjmp_save
++#endif
++ .size __sigsetjmp, . - __sigsetjmp
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/sigaction.c uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sigaction.c
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/sigaction.c 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sigaction.c 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,49 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <errno.h>
++#include <signal.h>
++#include <string.h>
++#include <sys/syscall.h>
++#include <bits/kernel_sigaction.h>
++
++#define SA_RESTORER 0x04000000
++extern void __default_rt_sa_restorer(void);
++
++/*
++ * If act is not NULL, change the action for sig to *act.
++ * If oact is not NULL, put the old action for sig in *oact.
++ */
++int __libc_sigaction(int signum, const struct sigaction *act,
++ struct sigaction *oldact)
++{
++ struct kernel_sigaction kact, koact;
++ int result;
++
++ if (act) {
++ kact.k_sa_handler = act->sa_handler;
++ memcpy(&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
++ kact.sa_flags = act->sa_flags;
++ if (kact.sa_flags & (SA_RESTORER | SA_ONSTACK))
++ kact.sa_restorer = act->sa_restorer;
++ else
++ kact.sa_restorer = __default_rt_sa_restorer;
++ kact.sa_flags |= SA_RESTORER;
++ }
++
++ result = __syscall_rt_sigaction(signum, act ? __ptrvalue(&kact) : NULL,
++ oldact ? __ptrvalue(&koact) : NULL,
++ _NSIG / 8);
++
++ if (oldact && result >= 0) {
++ oldact->sa_handler = koact.k_sa_handler;
++ memcpy(&oldact->sa_mask, &koact.sa_mask,
++ sizeof(oldact->sa_mask));
++ oldact->sa_flags = koact.sa_flags;
++ oldact->sa_restorer = koact.sa_restorer;
++ }
++
++ return result;
++}
++
++weak_alias(__libc_sigaction, sigaction)
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/sigrestorer.S uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sigrestorer.S
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/sigrestorer.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sigrestorer.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,11 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <sys/syscall.h>
++
++ .global __default_rt_sa_restorer
++ .type __default_rt_sa_restorer,"function"
++ .align 1
++__default_rt_sa_restorer:
++ mov r8, __NR_rt_sigreturn
++ scall
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/elf.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sys/elf.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/elf.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sys/elf.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,26 @@
++/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_ELF_H
++#define _SYS_ELF_H 1
++
++#warning "This header is obsolete; use <sys/procfs.h> instead."
++
++#include <sys/procfs.h>
++
++#endif /* sys/elf.h */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/io.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sys/io.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/io.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sys/io.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,48 @@
++/* Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_IO_H
++
++#define _SYS_IO_H 1
++#include <features.h>
++
++__BEGIN_DECLS
++
++/* If TURN_ON is TRUE, request for permission to do direct i/o on the
++ port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
++ permission off for that range. This call requires root privileges. */
++extern int ioperm (unsigned long int __from, unsigned long int __num,
++ int __turn_on) __THROW;
++
++/* Set the I/O privilege level to LEVEL. If LEVEL is nonzero,
++ permission to access any I/O port is granted. This call requires
++ root privileges. */
++extern int iopl (int __level) __THROW;
++
++/* The functions that actually perform reads and writes. */
++extern unsigned char inb (unsigned long int port) __THROW;
++extern unsigned short int inw (unsigned long int port) __THROW;
++extern unsigned long int inl (unsigned long int port) __THROW;
++
++extern void outb (unsigned char value, unsigned long int port) __THROW;
++extern void outw (unsigned short value, unsigned long int port) __THROW;
++extern void outl (unsigned long value, unsigned long int port) __THROW;
++
++__END_DECLS
++
++#endif /* _SYS_IO_H */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/procfs.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sys/procfs.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/procfs.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sys/procfs.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,123 @@
++/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_PROCFS_H
++#define _SYS_PROCFS_H 1
++
++/* This is somewhat modelled after the file of the same name on SVR4
++ systems. It provides a definition of the core file format for ELF
++ used on Linux. It doesn't have anything to do with the /proc file
++ system, even though Linux has one.
++
++ Anyway, the whole purpose of this file is for GDB and GDB only.
++ Don't read too much into it. Don't use it for anything other than
++ GDB unless you know what you are doing. */
++
++#include <features.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#include <sys/user.h>
++
++__BEGIN_DECLS
++
++/* Type for a general-purpose register. */
++typedef unsigned long elf_greg_t;
++
++/* And the whole bunch of them. We could have used `struct
++ user_regs' directly in the typedef, but tradition says that
++ the register set is an array, which does have some peculiar
++ semantics, so leave it that way. */
++#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t))
++typedef elf_greg_t elf_gregset_t[ELF_NGREG];
++
++/* Register set for the floating-point registers. */
++typedef struct user_fpregs elf_fpregset_t;
++
++/* Signal info. */
++struct elf_siginfo
++ {
++ int si_signo; /* Signal number. */
++ int si_code; /* Extra code. */
++ int si_errno; /* Errno. */
++ };
++
++/* Definitions to generate Intel SVR4-like core files. These mostly
++ have the same names as the SVR4 types with "elf_" tacked on the
++ front to prevent clashes with Linux definitions, and the typedef
++ forms have been avoided. This is mostly like the SVR4 structure,
++ but more Linuxy, with things that Linux does not support and which
++ GDB doesn't really use excluded. */
++
++struct elf_prstatus
++ {
++ struct elf_siginfo pr_info; /* Info associated with signal. */
++ short int pr_cursig; /* Current signal. */
++ unsigned long int pr_sigpend; /* Set of pending signals. */
++ unsigned long int pr_sighold; /* Set of held signals. */
++ __pid_t pr_pid;
++ __pid_t pr_ppid;
++ __pid_t pr_pgrp;
++ __pid_t pr_sid;
++ struct timeval pr_utime; /* User time. */
++ struct timeval pr_stime; /* System time. */
++ struct timeval pr_cutime; /* Cumulative user time. */
++ struct timeval pr_cstime; /* Cumulative system time. */
++ elf_gregset_t pr_reg; /* GP registers. */
++ int pr_fpvalid; /* True if math copro being used. */
++ };
++
++
++#define ELF_PRARGSZ (80) /* Number of chars for args. */
++
++struct elf_prpsinfo
++ {
++ char pr_state; /* Numeric process state. */
++ char pr_sname; /* Char for pr_state. */
++ char pr_zomb; /* Zombie. */
++ char pr_nice; /* Nice val. */
++ unsigned long int pr_flag; /* Flags. */
++ unsigned short int pr_uid;
++ unsigned short int pr_gid;
++ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
++ /* Lots missing */
++ char pr_fname[16]; /* Filename of executable. */
++ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
++ };
++
++/* The rest of this file provides the types for emulation of the
++ Solaris <proc_service.h> interfaces that should be implemented by
++ users of libthread_db. */
++
++/* Addresses. */
++typedef void *psaddr_t;
++
++/* Register sets. Linux has different names. */
++typedef elf_gregset_t prgregset_t;
++typedef elf_fpregset_t prfpregset_t;
++
++/* We don't have any differences between processes and threads,
++ therefore have only one PID type. */
++typedef __pid_t lwpid_t;
++
++/* Process status and info. In the end we do provide typedefs for them. */
++typedef struct elf_prstatus prstatus_t;
++typedef struct elf_prpsinfo prpsinfo_t;
++
++__END_DECLS
++
++#endif /* sys/procfs.h */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/ucontext.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sys/ucontext.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/ucontext.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sys/ucontext.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,94 @@
++/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++/* Linux/AVR32 ABI compliant context switching support. */
++
++#ifndef _SYS_UCONTEXT_H
++#define _SYS_UCONTEXT_H 1
++
++#include <features.h>
++#include <signal.h>
++#include <sys/procfs.h>
++#include <bits/sigcontext.h>
++
++typedef int greg_t;
++
++/* Number of general registers. */
++#define NGREG 16
++
++/* Container for all general registers. */
++typedef elf_gregset_t gregset_t;
++
++/* Number of each register is the `gregset_t' array. */
++enum
++{
++ R0 = 0,
++#define R0 R0
++ R1 = 1,
++#define R1 R1
++ R2 = 2,
++#define R2 R2
++ R3 = 3,
++#define R3 R3
++ R4 = 4,
++#define R4 R4
++ R5 = 5,
++#define R5 R5
++ R6 = 6,
++#define R6 R6
++ R7 = 7,
++#define R7 R7
++ R8 = 8,
++#define R8 R8
++ R9 = 9,
++#define R9 R9
++ R10 = 10,
++#define R10 R10
++ R11 = 11,
++#define R11 R11
++ R12 = 12,
++#define R12 R12
++ R13 = 13,
++#define R13 R13
++ R14 = 14,
++#define R14 R14
++ R15 = 15
++#define R15 R15
++};
++
++/* Structure to describe FPU registers. */
++typedef elf_fpregset_t fpregset_t;
++
++/* Context to describe whole processor state. */
++typedef struct
++ {
++ gregset_t gregs;
++ fpregset_t fpregs;
++ } mcontext_t;
++
++/* Userlevel context. */
++typedef struct ucontext
++{
++ unsigned long uc_flags;
++ struct ucontext *uc_link;
++ stack_t uc_stack;
++ struct sigcontext uc_mcontext;
++ sigset_t uc_sigmask; /* mask last for extensibility */
++} ucontext_t;
++
++#endif /* sys/ucontext.h */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/user.h uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sys/user.h
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/sys/user.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/sys/user.h 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,46 @@
++#ifndef _SYS_USER_H
++#define _SYS_USER_H
++
++struct user_fpregs
++{
++
++};
++
++struct user_regs
++{
++ unsigned long sr;
++ unsigned long pc;
++ unsigned long lr;
++ unsigned long sp;
++ unsigned long r12;
++ unsigned long r11;
++ unsigned long r10;
++ unsigned long r9;
++ unsigned long r8;
++ unsigned long r7;
++ unsigned long r6;
++ unsigned long r5;
++ unsigned long r4;
++ unsigned long r3;
++ unsigned long r2;
++ unsigned long r1;
++ unsigned long r0;
++ unsigned long r12_orig;
++};
++
++struct user
++{
++ struct user_regs regs; /* general registers */
++ size_t u_tsize; /* text size (pages) */
++ size_t u_dsize; /* data size (pages) */
++ size_t u_ssize; /* stack size (pages) */
++ unsigned long start_code; /* text starting address */
++ unsigned long start_data; /* data starting address */
++ unsigned long start_stack; /* stack starting address */
++ long int signal; /* signal causing core dump */
++ struct user_regs * u_ar0; /* help gdb find registers */
++ unsigned long magic; /* identifies a core file */
++ char u_comm[32]; /* user command name */
++};
++
++#endif /* _SYS_USER_H */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/syscall.S uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/syscall.S
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/syscall.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/syscall.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,81 @@
++/*
++ * syscall for AVR32/uClibc
++ *
++ * Copyright (C) 2004 Atmel Norway
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU Library General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or (at your
++ * option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
++ * for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this program; if not, write to the Free Software Foundation,
++ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++#include <features.h>
++
++ .text
++
++ /*
++ * long int syscall(long int sysno, ...)
++ */
++ .global syscall
++ .type syscall, @function
++ .align 2
++syscall:
++ stm --sp, r3,r5,lr
++ sub lr, sp, -12
++ mov r8, r12
++ ldm lr, r3,r5,r9-r12
++ scall
++ cp.w r12, -4095
++ brlo .Ldone
++
++#ifdef __PIC__
++ lddpc r5, .Lgot
++.Lgotcalc:
++ rsub r5, pc
++# ifdef __UCLIBC_HAS_THREADS__
++ mov r3, r12
++ mcall r5[__errno_location@got]
++ st.w r12[0], r3
++# else
++ ld.w r3, r5[errno@got]
++ st.w r3[0], r12
++# endif
++#else
++# ifdef __UCLIBC_HAS_THREADS__
++ mov r3, r12
++ mcall .Lerrno_location
++ st.w r12[0], r3
++# else
++ lddpc r3, .Lerrno
++ st.w r3[0], r12
++# endif
++#endif
++ mov r12, -1
++
++.Ldone:
++ ldm sp++, r3,r5,pc
++
++ .align 2
++#ifdef __PIC__
++.Lgot:
++ .long .Lgotcalc - _GLOBAL_OFFSET_TABLE_
++#else
++# ifdef __UCLIBC_HAS_THREADS__
++.Lerrno_location:
++ .long __errno_location
++# else
++.Lerrno:
++ .long errno
++# endif
++#endif
++
++
++ .size syscall, . - syscall
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/avr32/vfork.S uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/vfork.S
+--- uClibc-0.9.28/libc/sysdeps/linux/avr32/vfork.S 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/avr32/vfork.S 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,55 @@
++ /*
++ * vfork for uClibc
++ *
++ * Copyright (C) 2005 Atmel Norway
++ */
++
++ /*
++ * Clone the process without copying the address space. The
++ * calling process is suspended until the child either exits
++ * or calls execve.
++ *
++ * This all means that we cannot rely on the stack to store
++ * away registers, since they will be overwritten by the child
++ * as soon as it makes another function call (e.g. execve()).
++ * Fortunately, the Linux kernel preserves LR across system calls.
++ */
++#include <features.h>
++#include <sys/syscall.h>
++
++ .global __vfork
++ .type __vfork,@function
++ .align 1
++__vfork:
++ mov r8, __NR_vfork
++ scall
++ cp.w r12, -4096
++ retls r12
++
++ /* vfork failed, so we may use the stack freely */
++ pushm r4-r7,lr
++#ifdef __PIC__
++ lddpc r6, .L_GOT
++ rsub r4, r12, 0
++.L_RGOT:
++ rsub r6, pc
++ mcall r6[__errno_location@got]
++#else
++ rsub r4, r12, 0
++ mcall .L__errno_location
++#endif
++ st.w r12[0], r4
++ popm r4-r7,pc,r12=-1
++
++ .align 2
++#ifdef __PIC__
++.L_GOT:
++ .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
++#else
++.L__errno_location:
++ .long __errno_location
++#endif
++ .size __vfork, . - __vfork
++
++ .weak vfork
++ vfork = __vfork
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/common/create_module.c uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/common/create_module.c
+--- uClibc-0.9.28/libc/sysdeps/linux/common/create_module.c 2005-08-18 00:49:42.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/common/create_module.c 2006-06-21 11:35:57.000000000 +0200
+@@ -61,7 +61,8 @@
+ {
+ return __create_module(name, size, 0, 0);
+ }
+-#else
++/* create_module is obsolete in Linux 2.6, so AVR32 doesn't have it */
++#elif !defined(__avr32__)
+ /* Sparc, MIPS, etc don't mistake return values for errors. */
+ _syscall2(unsigned long, create_module, const char *, name, size_t, size);
+ #endif
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/common/getrusage.c uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/common/getrusage.c
+--- uClibc-0.9.28/libc/sysdeps/linux/common/getrusage.c 2005-08-18 00:49:42.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/common/getrusage.c 2006-06-21 11:35:56.000000000 +0200
+@@ -10,4 +10,4 @@
+ #include "syscalls.h"
+ #include <unistd.h>
+ #include <wait.h>
+-_syscall2(int, getrusage, int, who, struct rusage *, usage);
++_syscall2(int, getrusage, __rusage_who_t, who, struct rusage *, usage);
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/common/open64.c uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/common/open64.c
+--- uClibc-0.9.28/libc/sysdeps/linux/common/open64.c 2005-08-18 00:49:42.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/common/open64.c 2006-06-21 11:35:56.000000000 +0200
+@@ -26,7 +26,7 @@
+ #endif
+
+ #ifdef __UCLIBC_HAS_LFS__
+-extern int __libc_open (__const char *file, int oflag, mode_t mode);
++extern int __libc_open (__const char *file, int oflag, ...);
+
+ /* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
+ a third argument is the file protection. */
+diff -Nur uClibc-0.9.28/libc/sysdeps/linux/common/__syscall_fcntl.c uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/common/__syscall_fcntl.c
+--- uClibc-0.9.28/libc/sysdeps/linux/common/__syscall_fcntl.c 2005-08-18 00:49:42.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/libc/sysdeps/linux/common/__syscall_fcntl.c 2006-06-21 11:35:56.000000000 +0200
+@@ -12,7 +12,7 @@
+ #include <fcntl.h>
+
+ #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
+-extern int __libc_fcntl64(int fd, int cmd, long arg);
++extern int __libc_fcntl64(int fd, int cmd, ...);
+ #endif
+
+ #define __NR___syscall_fcntl __NR_fcntl
+diff -Nur uClibc-0.9.28/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h uClibc-0.9.28-avr32-20060621/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h
+--- uClibc-0.9.28/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h 2006-06-21 11:35:57.000000000 +0200
+@@ -0,0 +1,92 @@
++/* Machine-dependent pthreads configuration and inline functions.
++
++ Copyright (C) 2005 Atmel Norway
++ 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; see the file COPYING.LIB. If not,
++ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ Boston, MA 02111-1307, USA. */
++
++#ifndef _PT_MACHINE_H
++#define _PT_MACHINE_H 1
++
++#include <features.h>
++
++static inline int
++_test_and_set (int *p, int v) __THROW
++{
++ int result;
++
++ __asm__ __volatile__(
++ "/* Inline test and set */\n"
++ "1: ssrf 5\n"
++ " ld.w %0, %2\n"
++ " tst %0, %3\n"
++ " breq 2f\n"
++ " stcond %1, %3\n"
++ " brne 1b\n"
++ "2:"
++ : "=&r"(result), "=m"(*p)
++ : "m"(*p), "r"(v)
++ : "memory", "cc");
++
++ return result;
++}
++
++#ifndef PT_EI
++# define PT_EI extern inline
++#endif
++
++extern long int testandset (int *spinlock);
++extern int __compare_and_swap (long int *p, long int oldval, long int newval);
++
++/* Spinlock implementation; required. */
++PT_EI long int
++testandset (int *spinlock)
++{
++ return _test_and_set(spinlock, 1);
++}
++
++
++/* Get some notion of the current stack. Need not be exactly the top
++ of the stack, just something somewhere in the current frame. */
++#define CURRENT_STACK_FRAME stack_pointer
++register char * stack_pointer __asm__ ("sp");
++
++/* Compare-and-swap for semaphores. */
++
++#define HAS_COMPARE_AND_SWAP
++PT_EI int
++__compare_and_swap(long int *p, long int oldval, long int newval)
++{
++ long int result, tmp;
++
++ __asm__ __volatile__(
++ "/* Inline compare and swap */\n"
++ "1: ssrf 5\n"
++ " ld.w %1, %3\n"
++ " cp.w %1, %5\n"
++ " sreq %0\n"
++ " brne 2f\n"
++ " stcond %2, %4\n"
++ " brne 1b\n"
++ "2:"
++ : "=&r"(result), "=&r"(tmp), "=m"(*p)
++ : "m"(*p), "r"(newval), "r"(oldval)
++ : "cc", "memory");
++
++ return result;
++}
++
++#endif /* pt-machine.h */
+diff -Nur uClibc-0.9.28/Makefile uClibc-0.9.28-avr32-20060621/Makefile
+--- uClibc-0.9.28/Makefile 2005-08-18 00:49:49.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/Makefile 2006-06-21 11:35:57.000000000 +0200
+@@ -163,7 +163,7 @@
+ else \
+ extra_exclude="" ; \
+ fi ; \
+- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \
++ tar -chf - --exclude .svn --exclude CVS $$extra_exclude include \
+ | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
+ ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
+ # Remove floating point related headers since float support is disabled.
+diff -Nur uClibc-0.9.28/Rules.mak uClibc-0.9.28-avr32-20060621/Rules.mak
+--- uClibc-0.9.28/Rules.mak 2005-08-18 00:49:49.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/Rules.mak 2006-06-21 11:35:57.000000000 +0200
+@@ -231,6 +231,10 @@
+ UCLIBC_LDSO=ld.so.1
+ endif
+
++ifeq ($(strip $(TARGET_ARCH)),avr32)
++ CPU_CFLAGS-$(CONFIG_AP7000) += -mcpu=ap7000
++endif
++
+ # Keep the check_gcc from being needlessly executed
+ ifndef PIEFLAG
+ ifneq ($(UCLIBC_BUILD_PIE),y)
+@@ -266,7 +270,11 @@
+ # If -msoft-float isn't supported, we want an error anyway.
+ # Hmm... might need to revisit this for arm since it has 2 different
+ # soft float encodings.
++ifeq ($(strip $(TARGET_ARCH)),avr32)
++# GCC on avr32 doesn't support -msoft-float, it's the default.
++else
+ CPU_CFLAGS += -msoft-float
++endif
+ ifeq ($(strip $(TARGET_ARCH)),arm)
+ # No longer needed with current toolchains, but leave it here for now.
+ # If anyone is actually still using gcc 2.95 (say), they can uncomment it.
+diff -Nur uClibc-0.9.28/Rules.mak.orig uClibc-0.9.28-avr32-20060621/Rules.mak.orig
+--- uClibc-0.9.28/Rules.mak.orig 1970-01-01 01:00:00.000000000 +0100
++++ uClibc-0.9.28-avr32-20060621/Rules.mak.orig 2006-06-21 11:35:56.000000000 +0200
+@@ -0,0 +1,358 @@
++# Rules.make for uClibc
++#
++# Copyright (C) 2000 by Lineo, inc.
++# Copyright (C) 2000-2002 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
++
++
++#-----------------------------------------------------------
++# This file contains rules which are shared between multiple
++# Makefiles. All normal configuration options live in the
++# file named ".config". Don't mess with this file unless
++# you know what you are doing.
++
++
++#-----------------------------------------------------------
++# If you are running a cross compiler, you will want to set
++# 'CROSS' to something more interesting ... Target
++# architecture is determined by asking the CC compiler what
++# arch it compiles things for, so unless your compiler is
++# broken, you should not need to specify TARGET_ARCH.
++#
++# Most people will set this stuff on the command line, i.e.
++# make CROSS=arm-linux-
++# will build uClibc for 'arm'.
++
++ifndef CROSS
++CROSS=
++endif
++CC = $(CROSS)gcc
++AR = $(CROSS)ar
++LD = $(CROSS)ld
++NM = $(CROSS)nm
++RANLIB = $(CROSS)ranlib
++STRIPTOOL = $(CROSS)strip
++
++INSTALL = install
++LN = ln
++RM = rm -f
++
++# Select the compiler needed to build binaries for your development system
++HOSTCC = gcc
++HOSTCFLAGS = -O2 -Wall
++
++
++#---------------------------------------------------------
++# Nothing beyond this point should ever be touched by mere
++# mortals. Unless you hang out with the gods, you should
++# probably leave all this stuff alone.
++MAJOR_VERSION := 0
++MINOR_VERSION := 9
++SUBLEVEL := 28
++VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
++# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
++LC_ALL := C
++export MAJOR_VERSION MINOR_VERSION SUBLEVEL VERSION LC_ALL
++
++SHARED_FULLNAME:=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
++SHARED_MAJORNAME:=libc.so.$(MAJOR_VERSION)
++UCLIBC_LDSO:=ld-uClibc.so.$(MAJOR_VERSION)
++LIBNAME:=libc.a
++LIBC:=$(TOPDIR)libc/$(LIBNAME)
++
++# Make sure DESTDIR and PREFIX can be used to install
++# PREFIX is a uClibcism while DESTDIR is a common GNUism
++ifndef PREFIX
++PREFIX = $(DESTDIR)
++endif
++
++# Pull in the user's uClibc configuration
++ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
++-include $(TOPDIR).config
++endif
++
++ifndef CROSS
++CROSS=$(subst ",, $(strip $(CROSS_COMPILER_PREFIX)))
++endif
++
++# A nifty macro to make testing gcc features easier
++check_gcc=$(shell \
++ if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
++ then echo "$(1)"; else echo "$(2)"; fi)
++check_as=$(shell \
++ if $(CC) -Wa,$(1) -Wa,-Z -c -o /dev/null -xassembler /dev/null > /dev/null 2>&1; \
++ then echo "-Wa,$(1)"; fi)
++
++# Setup some shortcuts so that silent mode is silent like it should be
++ifeq ($(subst s,,$(MAKEFLAGS)),$(MAKEFLAGS))
++export MAKE_IS_SILENT=n
++SECHO=@echo
++SHELL_SET_X=set -x
++else
++export MAKE_IS_SILENT=y
++SECHO=-@false
++SHELL_SET_X=set +x
++endif
++
++# Make certain these contain a final "/", but no "//"s.
++TARGET_ARCH:=$(shell grep -s ^TARGET_ARCH $(TOPDIR)/.config | sed -e 's/^TARGET_ARCH=//' -e 's/"//g')
++RUNTIME_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(RUNTIME_PREFIX))))))
++DEVEL_PREFIX:=$(strip $(subst //,/, $(subst ,/, $(subst ",, $(strip $(DEVEL_PREFIX))))))
++export RUNTIME_PREFIX DEVEL_PREFIX
++
++ARFLAGS:=cr
++
++OPTIMIZATION:=
++PICFLAG:=-fPIC
++PIEFLAG_NAME:=-fPIE
++
++# Some nice CPU specific optimizations
++ifeq ($(strip $(TARGET_ARCH)),i386)
++ OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
++ OPTIMIZATION+=$(call check_gcc,-falign-jumps=0 -falign-loops=0,-malign-jumps=0 -malign-loops=0)
++ CPU_CFLAGS-$(CONFIG_386)+=-march=i386
++ CPU_CFLAGS-$(CONFIG_486)+=-march=i486
++ CPU_CFLAGS-$(CONFIG_ELAN)+=-march=i486
++ CPU_CFLAGS-$(CONFIG_586)+=-march=i586
++ CPU_CFLAGS-$(CONFIG_586MMX)+=$(call check_gcc,-march=pentium-mmx,-march=i586)
++ CPU_CFLAGS-$(CONFIG_686)+=-march=i686
++ CPU_CFLAGS-$(CONFIG_PENTIUMII)+=$(call check_gcc,-march=pentium2,-march=i686)
++ CPU_CFLAGS-$(CONFIG_PENTIUMIII)+=$(call check_gcc,-march=pentium3,-march=i686)
++ CPU_CFLAGS-$(CONFIG_PENTIUM4)+=$(call check_gcc,-march=pentium4,-march=i686)
++ CPU_CFLAGS-$(CONFIG_K6)+=$(call check_gcc,-march=k6,-march=i586)
++ CPU_CFLAGS-$(CONFIG_K7)+=$(call check_gcc,-march=athlon,-malign-functions=4 -march=i686)
++ CPU_CFLAGS-$(CONFIG_CRUSOE)+=-march=i686 -malign-functions=0 -malign-jumps=0 -malign-loops=0
++ CPU_CFLAGS-$(CONFIG_WINCHIPC6)+=$(call check_gcc,-march=winchip-c6,-march=i586)
++ CPU_CFLAGS-$(CONFIG_WINCHIP2)+=$(call check_gcc,-march=winchip2,-march=i586)
++ CPU_CFLAGS-$(CONFIG_CYRIXIII)+=$(call check_gcc,-march=c3,-march=i486) -malign-functions=0 -malign-jumps=0 -malign-loops=0
++ CPU_CFLAGS-$(CONFIG_NEHEMIAH)+=$(call check_gcc,-march=c3-2,-march=i686)
++endif
++
++ifeq ($(strip $(TARGET_ARCH)),arm)
++ OPTIMIZATION+=-fstrict-aliasing
++ CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN)+=-EL
++ CPU_LDFLAGS-$(ARCH_BIG_ENDIAN)+=-EB
++ CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian
++ CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian
++ CPU_CFLAGS-$(CONFIG_GENERIC_ARM)+=
++ CPU_CFLAGS-$(CONFIG_ARM610)+=-mtune=arm610 -march=armv3
++ CPU_CFLAGS-$(CONFIG_ARM710)+=-mtune=arm710 -march=armv3
++ CPU_CFLAGS-$(CONFIG_ARM720T)+=-mtune=arm7tdmi -march=armv4
++ CPU_CFLAGS-$(CONFIG_ARM920T)+=-mtune=arm9tdmi -march=armv4
++ CPU_CFLAGS-$(CONFIG_ARM922T)+=-mtune=arm9tdmi -march=armv4
++ CPU_CFLAGS-$(CONFIG_ARM926T)+=-mtune=arm9tdmi -march=armv5
++ CPU_CFLAGS-$(CONFIG_ARM1136JF_S)+=-mtune=arm1136jf-s -march=armv6
++ CPU_CFLAGS-$(CONFIG_ARM_SA110)+=-mtune=strongarm110 -march=armv4
++ CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4
++ CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110)
++ CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv4 -Wa,-mcpu=xscale
++endif
++
++ifeq ($(strip $(TARGET_ARCH)),mips)
++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_1)+=-mips1
++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_2)+=-mips2 -mtune=mips2
++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_3)+=-mips3 -mtune=mips3
++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_4)+=-mips4 -mtune=mips4
++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS32)+=-mips32 -mtune=mips32
++ CPU_CFLAGS-$(CONFIG_MIPS_ISA_MIPS64)+=-mips64 -mtune=mips32
++endif
++
++ifeq ($(strip $(TARGET_ARCH)),sh)
++ OPTIMIZATION+=-fstrict-aliasing
++ OPTIMIZATION+= $(call check_gcc,-mprefergot,)
++ CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN)+=-EL
++ CPU_LDFLAGS-$(ARCH_BIG_ENDIAN)+=-EB
++ CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-ml
++ CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mb
++ CPU_CFLAGS-$(CONFIG_SH2)+=-m2
++ CPU_CFLAGS-$(CONFIG_SH3)+=-m3
++ifeq ($(strip $(UCLIBC_HAS_FLOATS)),y)
++ CPU_CFLAGS-$(CONFIG_SH2A)+=-m2a
++ CPU_CFLAGS-$(CONFIG_SH4)+=-m4
++else
++ CPU_CFLAGS-$(CONFIG_SH2A)+=-m2a-nofpu
++ CPU_CFLAGS-$(CONFIG_SH4)+=-m4-nofpu
++endif
++endif
++
++ifeq ($(strip $(TARGET_ARCH)),sh64)
++ OPTIMIZATION+=-fstrict-aliasing
++ CPU_LDFLAGS-$(ARCH_LITTLE_ENDIAN):=-EL
++ CPU_LDFLAGS-$(ARCH_BIG_ENDIAN):=-EB
++ CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN):=-ml
++ CPU_CFLAGS-$(ARCH_BIG_ENDIAN):=-mb
++ CPU_CFLAGS-$(CONFIG_SH5)+=-m5-32media
++endif
++
++ifeq ($(strip $(TARGET_ARCH)),h8300)
++ CPU_LDFLAGS-$(CONFIG_H8300H)+= -ms8300h
++ CPU_LDFLAGS-$(CONFIG_H8S) += -ms8300s
++ CPU_CFLAGS-$(CONFIG_H8300H) += -mh -mint32 -fsigned-char
++ CPU_CFLAGS-$(CONFIG_H8S) += -ms -mint32 -fsigned-char
++endif
++
++ifeq ($(strip $(TARGET_ARCH)),cris)
++ CPU_LDFLAGS-$(CONFIG_CRIS)+=-mcrislinux
++ CPU_CFLAGS-$(CONFIG_CRIS)+=-mlinux
++ PICFLAG:=-fpic
++ PIEFLAG_NAME:=-fpie
++endif
++
++ifeq ($(strip $(TARGET_ARCH)),powerpc)
++# PowerPC can hold 8192 entries in its GOT with -fpic which is more than
++# enough. Therefore use -fpic which will reduce code size and generates
++# faster code.
++ PICFLAG:=-fpic
++ PIEFLAG_NAME:=-fpie
++endif
++
++ifeq ($(strip $(TARGET_ARCH)),frv)
++ CPU_LDFLAGS-$(CONFIG_FRV)+=-melf32frvfd
++ CPU_CFLAGS-$(CONFIG_FRV)+=-mfdpic
++ # Using -pie causes the program to have an interpreter, which is
++ # forbidden, so we must make do with -shared. Unfortunately,
++ # -shared by itself would get us global function descriptors
++ # and calls through PLTs, dynamic resolution of symbols, etc,
++ # which would break as well, but -Bsymbolic comes to the rescue.
++ export LDPIEFLAG:=-shared -Bsymbolic
++ UCLIBC_LDSO=ld.so.1
++endif
++
++ifeq ($(strip $(TARGET_ARCH)),avr32)
++ CPU_CFLAGS-$(CONFIG_AP7000) += -mcpu=ap7000
++endif
++
++# Keep the check_gcc from being needlessly executed
++ifndef PIEFLAG
++ifneq ($(UCLIBC_BUILD_PIE),y)
++export PIEFLAG:=
++else
++export PIEFLAG:=$(call check_gcc,$(PIEFLAG_NAME),$(PICFLAG))
++endif
++endif
++# We need to keep track of both the CC PIE flag (above) as
++# well as the LD PIE flag (below) because we can't rely on
++# gcc passing -pie if we used -fPIE
++ifndef LDPIEFLAG
++ifneq ($(UCLIBC_BUILD_PIE),y)
++export LDPIEFLAG:=
++else
++export LDPIEFLAG:=$(shell $(LD) --help | grep -q pie && echo "-Wl,-pie")
++endif
++endif
++
++# Use '-Os' optimization if available, else use -O2, allow Config to override
++OPTIMIZATION+=$(call check_gcc,-Os,-O2)
++# Use the gcc 3.4 -funit-at-a-time optimization when available
++OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
++
++# Add a bunch of extra pedantic annoyingly strict checks
++XWARNINGS=$(subst ",, $(strip $(WARNINGS))) -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
++XARCH_CFLAGS=$(subst ",, $(strip $(ARCH_CFLAGS)))
++CPU_CFLAGS=$(subst ",, $(strip $(CPU_CFLAGS-y)))
++
++LDADD_LIBFLOAT=
++ifeq ($(strip $(UCLIBC_HAS_SOFT_FLOAT)),y)
++# Add -msoft-float to the CPU_FLAGS since ldso and libdl ignore CFLAGS.
++# If -msoft-float isn't supported, we want an error anyway.
++# Hmm... might need to revisit this for arm since it has 2 different
++# soft float encodings.
++ CPU_CFLAGS += -msoft-float
++ifeq ($(strip $(TARGET_ARCH)),arm)
++# No longer needed with current toolchains, but leave it here for now.
++# If anyone is actually still using gcc 2.95 (say), they can uncomment it.
++# LDADD_LIBFLOAT=-lfloat
++endif
++endif
++
++SSP_DISABLE_FLAGS:=$(call check_gcc,-fno-stack-protector,)
++ifeq ($(UCLIBC_BUILD_SSP),y)
++SSP_CFLAGS:=$(call check_gcc,-fno-stack-protector-all,)
++SSP_CFLAGS+=$(call check_gcc,-fstack-protector,)
++SSP_ALL_CFLAGS:=$(call check_gcc,-fstack-protector-all,)
++else
++SSP_CFLAGS:=$(SSP_DISABLE_FLAGS)
++endif
++
++# Some nice CFLAGS to work with
++CFLAGS:=$(XWARNINGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \
++ -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)include -I.
++LDFLAGS_NOSTRIP:=$(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc -z defs
++
++ifeq ($(DODEBUG),y)
++ #CFLAGS += -g3
++ CFLAGS += -O0 -g3
++ LDFLAGS := $(LDFLAGS_NOSTRIP)
++ STRIPTOOL:= true -Since_we_are_debugging
++else
++ CFLAGS += $(OPTIMIZATION) $(XARCH_CFLAGS)
++ LDFLAGS := $(LDFLAGS_NOSTRIP) -s
++endif
++
++ifeq ($(UCLIBC_BUILD_RELRO),y)
++LDFLAGS+=-z relro
++endif
++
++ifeq ($(UCLIBC_BUILD_NOW),y)
++LDFLAGS+=-z now
++endif
++
++# Sigh, some stupid versions of gcc can't seem to cope with '-iwithprefix include'
++#CFLAGS+=-iwithprefix include
++CFLAGS+=-isystem $(shell $(CC) -print-file-name=include)
++
++ifneq ($(DOASSERTS),y)
++ CFLAGS += -DNDEBUG
++endif
++
++CFLAGS_NOPIC:=$(CFLAGS)
++ifeq ($(DOPIC),y)
++ CFLAGS += $(PICFLAG)
++endif
++
++ifeq ($(DL_FINI_CRT_COMPAT),y)
++CFLAGS += -D_DL_FINI_CRT_COMPAT
++endif
++
++# Keep the check_as from being needlessly executed
++ASFLAGS = $(CFLAGS)
++ifndef ASFLAGS_NOEXEC
++ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)
++export ASFLAGS_NOEXEC := $(call check_as,--noexecstack)
++else
++export ASFLAGS_NOEXEC :=
++endif
++endif
++ASFLAGS += $(ASFLAGS_NOEXEC)
++
++LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
++LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
++LIBGCC_DIR:=$(dir $(LIBGCC))
++
++########################################
++#
++# uClinux shared lib support
++#
++
++ifeq ($(CONFIG_BINFMT_SHARED_FLAT),y)
++ # For the shared version of this, we specify no stack and its library ID
++ FLTFLAGS += -s 0
++ LIBID=1
++ export LIBID FLTFLAGS
++ SHARED_TARGET = lib/libc
++endif
++
++TARGET_ARCH:=$(strip $(subst ",, $(strip $(TARGET_ARCH))))
+diff -Nur uClibc-0.9.28/utils/ldd.c uClibc-0.9.28-avr32-20060621/utils/ldd.c
+--- uClibc-0.9.28/utils/ldd.c 2005-08-18 00:49:41.000000000 +0200
++++ uClibc-0.9.28-avr32-20060621/utils/ldd.c 2006-06-21 11:35:57.000000000 +0200
+@@ -56,6 +56,11 @@
+ #define ELFCLASSM ELFCLASS32
+ #endif
+
++#if defined(__avr32__)
++#define MATCH_MACHINE(x) (x == EM_AVR32)
++#define ELFCLASSM ELFCLASS32
++#endif
++
+ #if defined(__s390__)
+ #define MATCH_MACHINE(x) (x == EM_S390)
+ #define ELFCLASSM ELFCLASS32
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/uClibc-0.9.28-avr32-20061019.patch b/packages/uclibc/uclibc-0.9.28/avr32/uClibc-0.9.28-avr32-20061019.patch
new file mode 100644
index 0000000000..6608b4df94
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/uClibc-0.9.28-avr32-20061019.patch
@@ -0,0 +1,4080 @@
+Index: uClibc-0.9.28-avr32/Makefile
+===================================================================
+--- uClibc-0.9.28-avr32.orig/Makefile 2006-10-19 15:05:49.000000000 +0200
++++ uClibc-0.9.28-avr32/Makefile 2006-10-19 15:05:52.000000000 +0200
+@@ -163,7 +163,7 @@ install_dev:
+ else \
+ extra_exclude="" ; \
+ fi ; \
+- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \
++ tar -chf - --exclude .svn --exclude CVS $$extra_exclude include \
+ | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
+ ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
+ # Remove floating point related headers since float support is disabled.
+Index: uClibc-0.9.28-avr32/extra/scripts/fix_includes.sh
+===================================================================
+--- uClibc-0.9.28-avr32.orig/extra/scripts/fix_includes.sh 2006-10-19 15:05:49.000000000 +0200
++++ uClibc-0.9.28-avr32/extra/scripts/fix_includes.sh 2006-10-19 15:05:52.000000000 +0200
+@@ -78,36 +78,6 @@ if [ ! -d "$KERNEL_SOURCE" ]; then
+ exit 1;
+ fi;
+
+-if [ -f "$KERNEL_SOURCE/Makefile" ] ; then
+-# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION
+-eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' $KERNEL_SOURCE/Makefile`
+-else
+-ver=`grep UTS_RELEASE $KERNEL_SOURCE/include/linux/version.h | cut -d '"' -f 2`
+-VERSION=`echo "$ver" | cut -d '.' -f 1`
+-PATCHLEVEL=`echo "$ver" | cut -d '.' -f 2`
+-if echo "$ver" | grep -q '-' ; then
+-SUBLEVEL=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.//" | cut -d '-' -f 1`
+-EXTRAVERSION=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.${SUBLEVEL}-//"`
+-else
+-SUBLEVEL=`echo "$ver" | cut -d '.' -f 3`
+-#EXTRAVERSION=
+-fi
+-fi
+-if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ]
+-then
+- echo "Unable to determine version for kernel headers"
+- echo -e "\tprovided in directory $KERNEL_SOURCE"
+- exit 1
+-fi
+-
+-if [ "$MAKE_IS_SILENT" != "y" ]; then
+-echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}"
+-echo -e "\n"
+-echo "Using kernel headers from $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION} for architecture '$TARGET_ARCH'"
+-echo -e "\tprovided in directory $KERNEL_SOURCE"
+-echo -e "\n"
+-fi
+-
+ # Create a symlink to include/asm
+
+ rm -f include/asm*
+@@ -172,7 +142,7 @@ fi;
+
+
+ # Annoyingly, 2.6.x kernel headers also need an include/asm-generic/ directory
+-if [ $VERSION -eq 2 ] && [ $PATCHLEVEL -ge 6 ] ; then
++if [ -d $KERNEL_SOURCE/include/asm-generic ] ; then
+ ln -fs $KERNEL_SOURCE/include/asm-generic include/asm-generic
+ fi;
+
+Index: uClibc-0.9.28-avr32/libc/Makefile
+===================================================================
+--- uClibc-0.9.28-avr32.orig/libc/Makefile 2006-10-19 15:05:49.000000000 +0200
++++ uClibc-0.9.28-avr32/libc/Makefile 2006-10-19 15:05:52.000000000 +0200
+@@ -59,7 +59,7 @@ $(LIBNAME) shared_$(LIBNAME) ar-target:
+ $(AR) dN 2 $(LIBNAME) $$objs && \
+ $(AR) dN 2 $(LIBNAME) $$objs
+ @for objfile in obj.signal \
+- obj.string.generic obj.string.$(TARGET_ARCH) obj.string \
++ obj.string obj.string.generic obj.string.$(TARGET_ARCH) \
+ obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \
+ if [ -e $$objfile ] ; then \
+ if [ "$(MAKE_IS_SILENT)" = "n" ] ; then \
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/common/getrusage.c
+===================================================================
+--- uClibc-0.9.28-avr32.orig/libc/sysdeps/linux/common/getrusage.c 2006-10-19 15:05:49.000000000 +0200
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/common/getrusage.c 2006-10-19 15:05:52.000000000 +0200
+@@ -10,4 +10,4 @@
+ #include "syscalls.h"
+ #include <unistd.h>
+ #include <wait.h>
+-_syscall2(int, getrusage, int, who, struct rusage *, usage);
++_syscall2(int, getrusage, __rusage_who_t, who, struct rusage *, usage);
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/common/__syscall_fcntl.c
+===================================================================
+--- uClibc-0.9.28-avr32.orig/libc/sysdeps/linux/common/__syscall_fcntl.c 2006-10-19 15:05:49.000000000 +0200
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/common/__syscall_fcntl.c 2006-10-19 15:05:52.000000000 +0200
+@@ -12,7 +12,7 @@
+ #include <fcntl.h>
+
+ #if defined __UCLIBC_HAS_LFS__ && defined __NR_fcntl64
+-extern int __libc_fcntl64(int fd, int cmd, long arg);
++extern int __libc_fcntl64(int fd, int cmd, ...);
+ #endif
+
+ #define __NR___syscall_fcntl __NR_fcntl
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/common/open64.c
+===================================================================
+--- uClibc-0.9.28-avr32.orig/libc/sysdeps/linux/common/open64.c 2006-10-19 15:05:49.000000000 +0200
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/common/open64.c 2006-10-19 15:05:52.000000000 +0200
+@@ -26,7 +26,7 @@
+ #endif
+
+ #ifdef __UCLIBC_HAS_LFS__
+-extern int __libc_open (__const char *file, int oflag, mode_t mode);
++extern int __libc_open (__const char *file, int oflag, ...);
+
+ /* Open FILE with access OFLAG. If OFLAG includes O_CREAT,
+ a third argument is the file protection. */
+Index: uClibc-0.9.28-avr32/extra/Configs/Config.avr32
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/extra/Configs/Config.avr32 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,42 @@
++#
++# For a description of the syntax of this configuration file,
++# see extra/config/Kconfig-language.txt
++#
++
++config HAVE_ELF
++ bool
++ default y
++
++config TARGET_ARCH
++ default "avr32"
++
++config ARCH_CFLAGS
++ string
++
++config ARCH_LDFLAGS
++ string
++
++config LIBGCC_CFLAGS
++ string
++
++config ARCH_SUPPORTS_BIG_ENDIAN
++ bool
++ default y
++
++config UCLIBC_COMPLETELY_PIC
++ select FORCE_SHAREABLE_TEXT_SEGMENTS
++ bool
++ default y
++
++choice
++ prompt "Target CPU Type"
++ default CONFIG_AP7000
++
++config CONFIG_AP7000
++ bool "AP7000"
++
++endchoice
++
++config LINKRELAX
++ bool "Enable linker optimizations"
++ default n
+Index: uClibc-0.9.28-avr32/extra/Configs/Config.in
+===================================================================
+--- uClibc-0.9.28-avr32.orig/extra/Configs/Config.in 2006-10-19 15:05:49.000000000 +0200
++++ uClibc-0.9.28-avr32/extra/Configs/Config.in 2006-10-19 15:05:52.000000000 +0200
+@@ -16,6 +16,9 @@ config TARGET_alpha
+ config TARGET_arm
+ bool "arm"
+
++config TARGET_avr32
++ bool "avr32"
++
+ config TARGET_bfin
+ bool "bfin"
+
+@@ -83,6 +86,10 @@ if TARGET_arm
+ source "extra/Configs/Config.arm"
+ endif
+
++if TARGET_avr32
++source "extra/Configs/Config.avr32"
++endif
++
+ if TARGET_bfin
+ source "extra/Configs/Config.bfin"
+ endif
+Index: uClibc-0.9.28-avr32/include/elf.h
+===================================================================
+--- uClibc-0.9.28-avr32.orig/include/elf.h 2006-10-19 15:05:49.000000000 +0200
++++ uClibc-0.9.28-avr32/include/elf.h 2006-10-19 15:05:52.000000000 +0200
+@@ -261,6 +261,8 @@ typedef struct
+ #define EM_NIOS32 0xfebb /* Altera Nios 32 */
+ #define EM_ALTERA_NIOS2 0x9ee5 /* Altera Nios II */
+
++#define EM_AVR32 0x18ad
++
+ /* V850 backend magic number. Written in the absense of an ABI. */
+ #define EM_CYGNUS_V850 0x9080
+
+@@ -2687,6 +2689,55 @@ typedef Elf32_Addr Elf32_Conflict;
+ /* Keep this the last entry. */
+ #define R_V850_NUM 25
+
++/* Atmel AVR32 relocations. */
++#define R_AVR32_NONE 0
++#define R_AVR32_32 1
++#define R_AVR32_16 2
++#define R_AVR32_8 3
++#define R_AVR32_32_PCREL 4
++#define R_AVR32_16_PCREL 5
++#define R_AVR32_8_PCREL 6
++#define R_AVR32_DIFF32 7
++#define R_AVR32_DIFF16 8
++#define R_AVR32_DIFF8 9
++#define R_AVR32_GOT32 10
++#define R_AVR32_GOT16 11
++#define R_AVR32_GOT8 12
++#define R_AVR32_21S 13
++#define R_AVR32_16U 14
++#define R_AVR32_16S 15
++#define R_AVR32_8S 16
++#define R_AVR32_8S_EXT 17
++#define R_AVR32_22H_PCREL 18
++#define R_AVR32_18W_PCREL 19
++#define R_AVR32_16B_PCREL 20
++#define R_AVR32_16N_PCREL 21
++#define R_AVR32_14UW_PCREL 22
++#define R_AVR32_11H_PCREL 23
++#define R_AVR32_10UW_PCREL 24
++#define R_AVR32_9H_PCREL 25
++#define R_AVR32_9UW_PCREL 26
++#define R_AVR32_HI16 27
++#define R_AVR32_LO16 28
++#define R_AVR32_GOTPC 29
++#define R_AVR32_GOTCALL 30
++#define R_AVR32_LDA_GOT 31
++#define R_AVR32_GOT21S 32
++#define R_AVR32_GOT18SW 33
++#define R_AVR32_GOT16S 34
++#define R_AVR32_GOT7UW 35
++#define R_AVR32_32_CPENT 36
++#define R_AVR32_CPCALL 37
++#define R_AVR32_16_CP 38
++#define R_AVR32_9W_CP 39
++#define R_AVR32_RELATIVE 40
++#define R_AVR32_GLOB_DAT 41
++#define R_AVR32_JMP_SLOT 42
++#define R_AVR32_ALIGN 43
++#define R_AVR32_NUM 44
++
++/* AVR32 dynamic tags */
++#define DT_AVR32_GOTSZ 0x70000001 /* Total size of GOT in bytes */
+
+ #define R_H8_NONE 0
+ #define R_H8_DIR32 1
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/Makefile 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,93 @@
++# 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
++
++TOPDIR=../../../../
++include $(TOPDIR)Rules.mak
++ASFLAGS=$(CFLAGS)
++
++CRT_SRC = crt1.S
++CRT_OBJ = crt1.o
++SCRT_OBJ = $(patsubst %,S%, $(CRT_OBJ))
++CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
++
++SSRC=__longjmp.S setjmp.S bsd-setjmp.S vfork.S \
++ bsd-_setjmp.S sigrestorer.S syscall.S
++SOBJS=$(patsubst %.S,%.o, $(SSRC))
++
++CSRC=clone.c brk.c sigaction.c mmap.c
++COBJS=$(patsubst %.c,%.o, $(CSRC))
++
++OBJS=$(SOBJS) $(COBJS)
++
++OBJ_LIST=../../../obj.sysdeps.$(TARGET_ARCH)
++
++all: $(OBJ_LIST)
++
++$(OBJ_LIST): $(OBJS) $(CRT_OBJ) $(SCRT_OBJ) $(CTOR_TARGETS)
++ echo $(patsubst %, sysdeps/linux/$(TARGET_ARCH)/%, $(OBJS)) > $(OBJ_LIST)
++ $(INSTALL) -d $(TOPDIR)lib/
++ cp $(CRT_OBJ) $(SCRT_OBJ) $(TOPDIR)lib/
++
++$(CRT_OBJ): $(CRT_SRC)
++ $(CC) $(ASFLAGS) -DL_$* $< -c -o $*.o
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++$(SCRT_OBJ): $(CRT_SRC)
++ $(CC) $(ASFLAGS) $(PIEFLAG) -DL_$* $< -c -o $*.o
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++$(SOBJS): %.o : %.S
++ $(CC) $(ASFLAGS) -c $< -o $@
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++$(COBJS): %.o : %.c
++ $(CC) $(CFLAGS) -c $< -o $@
++ $(STRIPTOOL) -x -R .note -R .comment $*.o
++
++ifeq ($(strip $(UCLIBC_CTOR_DTOR)),y)
++crti.o: crti.S
++ $(CC) $(ASFLAGS) -c crti.S -o crti.o
++
++$(TOPDIR)lib/crti.o: crti.o
++ $(INSTALL) -d $(TOPDIR)lib/
++ cp crti.o $(TOPDIR)lib/
++
++crtn.o: crtn.S
++ $(CC) $(ASFLAGS) -c crtn.S -o crtn.o
++
++$(TOPDIR)lib/crtn.o: crtn.o
++ $(INSTALL) -d $(TOPDIR)lib/
++ cp crtn.o $(TOPDIR)lib/
++else
++$(TOPDIR)lib/crti.o:
++ $(INSTALL) -d $(TOPDIR)lib/
++ $(AR) $(ARFLAGS) $(TOPDIR)lib/crti.o
++$(TOPDIR)lib/crtn.o:
++ $(INSTALL) -d $(TOPDIR)lib/
++ $(AR) $(ARFLAGS) $(TOPDIR)lib/crtn.o
++endif
++
++
++headers:
++# $(LN) -fs ../libc/sysdeps/linux/avr32/fpu_control.h $(TOPDIR)/include/
++
++clean:
++ $(RM) *.[oa] *~ core
++ $(RM) bits/sysnum.h
++ $(RM) gmon-start.S
++
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/__longjmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/__longjmp.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,17 @@
++/* longjmp for AVR32
++ *
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++
++ .global __longjmp
++ .type __longjmp,"function"
++ .align 1
++__longjmp:
++ ldm r12++, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
++ mov r12, r11 /* get the return value right */
++ mustr r8 /* restore status register (lower half) */
++ cp r12, 0 /* can't return zero */
++ frs
++ moveq r12, 1
++ mov pc,lr
++ .size __longjmp, . - __longjmp
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/_mmap.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/_mmap.c 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,33 @@
++/* Copyright (C) 2005 Atmel Norway
++
++ 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
++
++ Derived in part from the Linux-8086 C library, the GNU C Library, and several
++ other sundry sources. Files within this library are copyright by their
++ respective copyright holders.
++ */
++
++#include <errno.h>
++#include <sys/mman.h>
++#include <sys/syscall.h>
++
++#define __NR_mmap2 __NR_mmap
++
++static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
++
++__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
++{
++ return mmap2(addr, len, prot, flags, fd, offset >> 12);
++}
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/atomicity.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/atomicity.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,86 @@
++/* Low-level functions for atomic operations. AVR32 version.
++ Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _ATOMICITY_H
++#define _ATOMICITY_H 1
++
++#include <inttypes.h>
++
++static inline int
++__attribute__((unused))
++exchange_and_add (volatile uint32_t *mem, int val)
++{
++ int tmp, result;
++
++ __asm__ __volatile__(
++ "/* Inline exchange and add */\n"
++ "1: ssrf 5\n"
++ " ld.w %0, %3\n"
++ " add %1, %0, %4\n"
++ " stcond %2, %1\n"
++ " brne 1b"
++ : "=&r"(result), "=&r"(tmp), "=m"(*mem)
++ : "m"(*mem), "r"(val)
++ : "cc", "memory");
++
++ return result;
++}
++
++static inline void
++__attribute__((unused))
++atomic_add (volatile uin32_t *mem, int val)
++{
++ int result;
++
++ __asm__ __volatile__(
++ "/* Inline atomic add */\n"
++ "1: ssrf 5\n"
++ " ld.w %0, %2\n"
++ " add %0, %3\n"
++ " stcond %2, %0\n"
++ " brne 1b"
++ : "=&r"(result), "=m"(*mem)
++ : "m"(*mem), "r"(val)
++ : "cc", "memory");
++}
++
++static inline int
++__attribute__((unused))
++compare_and_swap(volatile long int *p, long int oldval, long int newval)
++{
++ long int result, tmp;
++
++ __asm__ __volatile__(
++ "/* Inline compare and swap */\n"
++ "1: ssrf 5\n"
++ " ld.w %1, %3\n"
++ " cp.w %1, %5\n"
++ " sreq %0\n"
++ " brne 2f\n"
++ " stcond %2, %4\n"
++ " brne 1b\n"
++ "2:"
++ : "=&r"(result), "=&r"(tmp), "=m"(*p)
++ : "m"(*p), "r"(newval), "r"(oldval)
++ : "cc", "memory");
++
++ return result;
++}
++
++#endif /* atomicity.h */
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/byteswap.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/byteswap.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,80 @@
++/* Macros to swap the order of bytes in integer values.
++ Copyright (C) 2005 Atmel Norway.
++
++ 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. */
++
++#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
++# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
++#endif
++
++#ifndef _BITS_BYTESWAP_H
++#define _BITS_BYTESWAP_H 1
++
++/* Swap bytes in 16 bit value. */
++#if defined __GNUC__
++# define __bswap_16(x) (__extension__ __builtin_bswap_16(x))
++#else
++/* This is better than nothing. */
++static __inline unsigned short int
++__bswap_16 (unsigned short int __bsx)
++{
++ return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
++}
++#endif
++
++/* Swap bytes in 32 bit value. */
++#if defined __GNUC__
++# define __bswap_32(x) (__extension__ __builtin_bswap_32(x))
++#else
++static __inline unsigned int
++__bswap_32 (unsigned int __bsx)
++{
++ return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
++ (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
++}
++#endif
++
++#if defined __GNUC__
++/* Swap bytes in 64 bit value. */
++# define __bswap_constant_64(x) \
++ ((((x) & 0xff00000000000000ull) >> 56) \
++ | (((x) & 0x00ff000000000000ull) >> 40) \
++ | (((x) & 0x0000ff0000000000ull) >> 24) \
++ | (((x) & 0x000000ff00000000ull) >> 8) \
++ | (((x) & 0x00000000ff000000ull) << 8) \
++ | (((x) & 0x0000000000ff0000ull) << 24) \
++ | (((x) & 0x000000000000ff00ull) << 40) \
++ | (((x) & 0x00000000000000ffull) << 56))
++
++# define __bswap_64(x) \
++ (__extension__ \
++ ({ \
++ union { \
++ __extension__ unsigned long long int __ll; \
++ unsigned int __l[2]; \
++ } __w, __r; \
++ if (__builtin_constant_p(x)) \
++ __r.__ll = __bswap_constant_64(x); \
++ else { \
++ __w.__ll = (x); \
++ __r.__l[0] = __bswap_32(__w.__l[1]); \
++ __r.__l[1] = __bswap_32(__w.__l[0]); \
++ } \
++ __r.__ll; \
++ }))
++#endif
++
++#endif /* _BITS_BYTESWAP_H */
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/endian.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/endian.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,7 @@
++/* AVR32 is big-endian */
++
++#ifndef _ENDIAN_H
++# error "Never use <bits/endian.h> directly; include <endian.h> instead."
++#endif
++
++#define __BYTE_ORDER __BIG_ENDIAN
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/fcntl.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/fcntl.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,167 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ *
++ * This file is part of the Linux kernel
++ */
++#ifndef _FCNTL_H
++# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
++#endif
++
++#include <sys/types.h>
++
++/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
++ located on an ext2 file system */
++#define O_ACCMODE 0003
++#define O_RDONLY 00
++#define O_WRONLY 01
++#define O_RDWR 02
++#define O_CREAT 0100 /* not fcntl */
++#define O_EXCL 0200 /* not fcntl */
++#define O_NOCTTY 0400 /* not fcntl */
++#define O_TRUNC 01000 /* not fcntl */
++#define O_APPEND 02000
++#define O_NONBLOCK 04000
++#define O_NDELAY O_NONBLOCK
++#define O_SYNC 010000
++#define O_ASYNC 020000
++
++#ifdef __USE_GNU
++# define O_DIRECTORY 040000 /* must be a directory */
++# define O_NOFOLLOW 0100000 /* don't follow links */
++# define O_DIRECT 0200000 /* direct disk access */
++#endif
++
++#ifdef __USE_LARGEFILE64
++# define O_LARGEFILE 0400000
++#endif
++
++/* For now Linux has synchronisity options for data and read operations.
++ We define the symbols here but let them do the same as O_SYNC since
++ this is a superset. */
++#if defined __USE_POSIX199309 || defined __USE_UNIX98
++# define O_DSYNC O_SYNC /* Synchronize data. */
++# define O_RSYNC O_SYNC /* Synchronize read operations. */
++#endif
++
++#define F_DUPFD 0 /* dup */
++#define F_GETFD 1 /* get close_on_exec */
++#define F_SETFD 2 /* set/clear close_on_exec */
++#define F_GETFL 3 /* get file->f_flags */
++#define F_SETFL 4 /* set file->f_flags */
++
++#ifndef __USE_FILE_OFFSET64
++# define F_GETLK 5
++# define F_SETLK 6
++# define F_SETLKW 7
++#else
++# define F_GETLK F_GETLK64
++# define F_SETLK F_SETLK64
++# define F_SETLKW F_SETLKW64
++#endif
++#define F_GETLK64 12 /* using 'struct flock64' */
++#define F_SETLK64 13
++#define F_SETLKW64 14
++
++#if defined __USE_BSD || defined __USE_XOPEN2K
++# define F_SETOWN 8 /* for sockets. */
++# define F_GETOWN 9 /* for sockets. */
++#endif
++
++#ifdef __USE_GNU
++# define F_SETSIG 10 /* for sockets. */
++# define F_GETSIG 11 /* for sockets. */
++#endif
++
++#ifdef __USE_GNU
++# define F_SETLEASE 1024 /* Set a lease. */
++# define F_GETLEASE 1025 /* Enquire what lease is active. */
++# define F_NOTIFY 1026 /* Request notfications on a directory. */
++#endif
++
++/* for F_[GET|SET]FL */
++#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
++
++/* for posix fcntl() and lockf() */
++#define F_RDLCK 0
++#define F_WRLCK 1
++#define F_UNLCK 2
++
++/* for old implementation of bsd flock () */
++#define F_EXLCK 4 /* or 3 */
++#define F_SHLCK 8 /* or 4 */
++
++/* for leases */
++#define F_INPROGRESS 16
++
++#ifdef __USE_BSD
++/* operations for bsd flock(), also used by the kernel implementation */
++# define LOCK_SH 1 /* shared lock */
++# define LOCK_EX 2 /* exclusive lock */
++# define LOCK_NB 4 /* or'd with one of the above to prevent
++ blocking */
++# define LOCK_UN 8 /* remove lock */
++#endif
++
++#ifdef __USE_GNU
++# define LOCK_MAND 32 /* This is a mandatory flock */
++# define LOCK_READ 64 /* ... Which allows concurrent
++ read operations */
++# define LOCK_WRITE 128 /* ... Which allows concurrent
++ write operations */
++# define LOCK_RW 192 /* ... Which allows concurrent
++ read & write ops */
++#endif
++
++#ifdef __USE_GNU
++/* Types of directory notifications that may be requested with F_NOTIFY. */
++# define DN_ACCESS 0x00000001 /* File accessed. */
++# define DN_MODIFY 0x00000002 /* File modified. */
++# define DN_CREATE 0x00000004 /* File created. */
++# define DN_DELETE 0x00000008 /* File removed. */
++# define DN_RENAME 0x00000010 /* File renamed. */
++# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
++# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
++#endif
++
++struct flock {
++ short l_type;
++ short l_whence;
++#ifndef __USE_FILE_OFFSET64
++ __off_t l_start;
++ __off_t l_len;
++#else
++ __off64_t l_start;
++ __off64_t l_len;
++#endif
++ __pid_t l_pid;
++};
++
++#ifdef __USE_LARGEFILE64
++struct flock64 {
++ short l_type;
++ short l_whence;
++ __off64_t l_start;
++ __off64_t l_len;
++ __pid_t l_pid;
++};
++#endif
++
++/* Define some more compatibility macros to be backward compatible with
++ * BSD systems which did not managed to hide these kernel macros. */
++#ifdef __USE_BSD
++# define FAPPEND O_APPEND
++# define FFSYNC O_FSYNC
++# define FASYNC O_ASYNC
++# define FNONBLOCK O_NONBLOCK
++# define FNDELAY O_NDELAY
++#endif /* Use BSD. */
++
++/* Advise to `posix_fadvise'. */
++#ifdef __USE_XOPEN2K
++# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
++# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
++# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
++# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
++# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
++# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
++#endif
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/kernel_stat.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/kernel_stat.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,63 @@
++#ifndef _BITS_STAT_STRUCT_H
++#define _BITS_STAT_STRUCT_H
++
++/*
++ * This file provides struct stat, taken from kernel 2.6.4
++ * (include/asm-avr32/stat.h revision 1.1).
++ */
++
++struct kernel_stat {
++ unsigned long st_dev;
++ unsigned long st_ino;
++ unsigned short st_mode;
++ unsigned short st_nlink;
++ unsigned short st_uid;
++ unsigned short st_gid;
++ unsigned long st_rdev;
++ unsigned long st_size;
++ unsigned long st_blksize;
++ unsigned long st_blocks;
++ unsigned long st_atime;
++ unsigned long st_atime_nsec;
++ unsigned long st_mtime;
++ unsigned long st_mtime_nsec;
++ unsigned long st_ctime;
++ unsigned long st_ctime_nsec;
++ unsigned long __unused4;
++ unsigned long __unused5;
++};
++
++#define STAT_HAVE_NSEC 1
++
++struct kernel_stat64 {
++ unsigned long long st_dev;
++
++ unsigned long long st_ino;
++ unsigned int st_mode;
++ unsigned int st_nlink;
++
++ unsigned long st_uid;
++ unsigned long st_gid;
++
++ unsigned long long st_rdev;
++
++ long long st_size;
++ unsigned long __pad1;
++ unsigned long st_blksize;
++
++ unsigned long long st_blocks;
++
++ unsigned long st_atime;
++ unsigned long st_atime_nsec;
++
++ unsigned long st_mtime;
++ unsigned long st_mtime_nsec;
++
++ unsigned long st_ctime;
++ unsigned long st_ctime_nsec;
++
++ unsigned long __unused1;
++ unsigned long __unused2;
++};
++
++#endif /* _BITS_STAT_STRUCT_H */
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/kernel_types.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/kernel_types.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,56 @@
++/* Note that we use the exact same include guard #define names
++ * as asm/posix_types.h. This will avoid gratuitous conflicts
++ * with the posix_types.h kernel header, and will ensure that
++ * our private content, and not the kernel header, will win.
++ * -Erik
++ */
++#ifndef __ASM_AVR32_POSIX_TYPES_H
++#define __ASM_AVR32_POSIX_TYPES_H
++
++/*
++ * This file is generally used by user-level software, so you need to
++ * be a little careful about namespace pollution etc. Also, we cannot
++ * assume GCC is being used.
++ */
++
++typedef unsigned long __kernel_dev_t;
++typedef unsigned long __kernel_ino_t;
++typedef unsigned short __kernel_mode_t;
++typedef unsigned short __kernel_nlink_t;
++typedef long __kernel_off_t;
++typedef int __kernel_pid_t;
++typedef unsigned short __kernel_ipc_pid_t;
++typedef unsigned int __kernel_uid_t;
++typedef unsigned int __kernel_gid_t;
++typedef unsigned long __kernel_size_t;
++typedef int __kernel_ssize_t;
++typedef int __kernel_ptrdiff_t;
++typedef long __kernel_time_t;
++typedef long __kernel_suseconds_t;
++typedef long __kernel_clock_t;
++typedef int __kernel_timer_t;
++typedef int __kernel_clockid_t;
++typedef int __kernel_daddr_t;
++typedef char * __kernel_caddr_t;
++typedef unsigned short __kernel_uid16_t;
++typedef unsigned short __kernel_gid16_t;
++typedef unsigned int __kernel_uid32_t;
++typedef unsigned int __kernel_gid32_t;
++
++typedef unsigned short __kernel_old_uid_t;
++typedef unsigned short __kernel_old_gid_t;
++typedef unsigned short __kernel_old_dev_t;
++
++#ifdef __GNUC__
++typedef long long __kernel_loff_t;
++#endif
++
++typedef struct {
++#if defined(__USE_ALL)
++ int val[2];
++#else
++ int __val[2];
++#endif
++} __kernel_fsid_t;
++
++#endif /* __ASM_AVR32_POSIX_TYPES_H */
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/machine-gmon.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/machine-gmon.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,69 @@
++/* Machine-dependent definitions for profiling support. AVR32 version.
++ Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#define mcount_internal __mcount_internal
++
++#define _MCOUNT_DECL(frompc, selfpc) \
++static void __attribute((used)) mcount_internal(unsigned long frompc, unsigned long selfpc)
++
++/*
++ * This mcount implementation expects to get called after the prologue
++ * has been run. It also expects that r7 contains a valid frame
++ * pointer.
++ *
++ * When profiling, the compiler should generate something like this at
++ * each function entry:
++ *
++ * pushm r0-r7,lr // lr mandatory, others optional
++ * mov r7, sp
++ * // rest of prologue goes here
++ * mcall pc[.LC1 - .]
++ * // rest of function goes here
++ * .LC1:
++ * .long mcount
++ *
++ * or for PIC:
++ *
++ * pushm r0-r7,lr
++ * mov r7, sp
++ * // rest of prologue goes here
++ * lddpc r0, .LC1
++ * .L1: rsub r0, pc
++ * mcall r0[mcount@GOT]
++ * // rest of function goes here
++ * .LC1:
++ * .long .L1 - _GLOBAL_OFFSET_TABLE_
++ *
++ * This way, when mcount() is called, r7 points to the calling
++ * function's return address. It is guaranteed that calling mcount
++ * will clobber no registers except LR, which is unavoidable.
++ */
++#define MCOUNT asm( \
++ " .align 4\n" \
++ " .global _mcount\n" \
++ " .type _mcount,@function\n" \
++ "_mcount:\n" \
++ " pushm r8-r12,lr\n" \
++ " mov r11, lr\n" \
++ " ld.w r12, r7[0]\n" \
++ " rcall __mcount_internal\n" \
++ " popm r8-r12,pc\n" \
++ " .size _mcount, . - _mcount\n" \
++ " .weak mcount\n" \
++ " mcount = _mcount");
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/mman.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/mman.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,95 @@
++/* Definitions for POSIX memory map interface. Linux/AVR32 version.
++ Copyright (C) 1997, 2000 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_MMAN_H
++# error "Never include this file directly. Use <sys/mman.h> instead"
++#endif
++
++/* The following definitions basically come from the kernel headers.
++ But the kernel header is not namespace clean. */
++
++
++/* Protections are chosen from these bits, OR'd together. The
++ implementation does not necessarily support PROT_EXEC or PROT_WRITE
++ without PROT_READ. The only guarantees are that no writing will be
++ allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
++
++#define PROT_READ 0x1 /* Page can be read. */
++#define PROT_WRITE 0x2 /* Page can be written. */
++#define PROT_EXEC 0x4 /* Page can be executed. */
++#define PROT_NONE 0x0 /* Page can not be accessed. */
++
++/* Sharing types (must choose one and only one of these). */
++#define MAP_SHARED 0x01 /* Share changes. */
++#define MAP_PRIVATE 0x02 /* Changes are private. */
++#ifdef __USE_MISC
++# define MAP_TYPE 0x0f /* Mask for type of mapping. */
++#endif
++
++/* Other flags. */
++#define MAP_FIXED 0x10 /* Interpret addr exactly. */
++#ifdef __USE_MISC
++# define MAP_FILE 0
++# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
++# define MAP_ANON MAP_ANONYMOUS
++#endif
++
++/* These are Linux-specific. */
++#ifdef __USE_MISC
++# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
++# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
++# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
++# define MAP_LOCKED 0x2000 /* Lock the mapping. */
++# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
++# define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
++# define MAP_NONBLOCK 0x10000 /* do not block on IO */
++#endif
++
++/* Flags to `msync'. */
++#define MS_ASYNC 1 /* Sync memory asynchronously. */
++#define MS_SYNC 4 /* Synchronous memory sync. */
++#define MS_INVALIDATE 2 /* Invalidate the caches. */
++
++/* Flags for `mlockall'. */
++#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
++#define MCL_FUTURE 2 /* Lock all additions to address
++ space. */
++
++/* Flags for `mremap'. */
++#ifdef __USE_GNU
++# define MREMAP_MAYMOVE 1
++#endif
++
++/* Advise to `madvise'. */
++#ifdef __USE_BSD
++# define MADV_NORMAL 0 /* No further special treatment. */
++# define MADV_RANDOM 1 /* Expect random page references. */
++# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
++# define MADV_WILLNEED 3 /* Will need these pages. */
++# define MADV_DONTNEED 4 /* Don't need these pages. */
++#endif
++
++/* The POSIX people had to invent similar names for the same things. */
++#ifdef __USE_XOPEN2K
++# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
++# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
++# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
++# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
++# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
++#endif
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/profil-counter.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/profil-counter.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,26 @@
++/* Low-level statistical profiling support function. Linux/AVR32 version.
++ Copyright (C) 1996, 1997, 1998, 2002 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 <signal.h>
++
++void
++profil_counter(int signo, siginfo_t *si, struct sigcontext *sc)
++{
++ profil_count((void *)sc->pc);
++}
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/setjmp.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/setjmp.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,21 @@
++/*
++ * Copyright (C) 2004-2005 Atmel Norway
++ */
++#ifndef _SETJMP_H
++# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
++#endif
++
++#ifndef _ASM
++/*
++ * The jump buffer contains r0-r7, sr, sp and lr. Other registers are
++ * not saved.
++ */
++typedef int __jmp_buf[11];
++#endif
++
++#define __JMP_BUF_SP 4
++
++/* Test if longjmp to JMPBUF would unwind the frame containing a local
++ variable at ADDRESS. */
++#define _JMPBUF_UNWINDS(jmpbuf, address) \
++ ((void *)(address) < (void *)(jmpbuf[__JMP_BUF_SP]))
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/syscalls.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/syscalls.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,143 @@
++#ifndef _SYSCALL_H
++# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
++#endif
++
++/*
++ * This includes the `__NR_<name>' syscall numbers taken from the
++ * Linux kernel header files. It also defines the traditional
++ * `SYS_<name>' macros for older programs.
++ */
++#include <bits/sysnum.h>
++
++#ifndef __set_errno
++# define __set_errno(val) (*__errno_location()) = (val)
++#endif
++#ifndef SYS_ify
++# define SYS_ify(syscall_name) (__NR_##syscall_name)
++#endif
++
++#ifndef __ASSEMBLER__
++
++#undef _syscall0
++#define _syscall0(type,name) \
++ type name(void) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 0)); \
++ }
++
++#undef _syscall1
++#define _syscall1(type,name,type1,arg1) \
++ type name(type1 arg1) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 1, arg1)); \
++ }
++
++#undef _syscall2
++#define _syscall2(type,name,type1,arg1,type2,arg2) \
++ type name(type1 arg1, type2 arg2) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 2, arg1, arg2)); \
++ }
++
++#undef _syscall3
++#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
++ type name(type1 arg1, type2 arg2, type3 arg3) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 3, arg1, \
++ arg2, arg3)); \
++ }
++
++#undef _syscall4
++#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
++ type4,arg4) \
++ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 4, arg1, arg2, \
++ arg3, arg4)); \
++ }
++
++#undef _syscall5
++#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
++ type4,arg4,type5,arg5) \
++ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
++ type5 arg5) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 5, arg1, arg2, \
++ arg3, arg4, arg5)); \
++ }
++
++#undef _syscall6
++#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3, \
++ type4,arg4,type5,arg5,type6,arg6) \
++ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
++ type5 arg5, type6 arg6) \
++ { \
++ return (type)(INLINE_SYSCALL(name, 6, arg1, arg2, arg3, \
++ arg4, arg5, arg6)); \
++ }
++
++#undef unlikely
++#define unlikely(x) __builtin_expect((x), 0)
++
++#undef INLINE_SYSCALL
++#define INLINE_SYSCALL(name, nr, args...) \
++ ({ \
++ unsigned _sys_result = INTERNAL_SYSCALL(name, , nr, args); \
++ if (unlikely(INTERNAL_SYSCALL_ERROR_P(_sys_result, ))) { \
++ __set_errno(INTERNAL_SYSCALL_ERRNO(_sys_result, )); \
++ _sys_result = (unsigned int) -1; \
++ } \
++ (int) _sys_result; \
++ })
++
++#undef INTERNAL_SYSCALL_DECL
++#define INTERNAL_SYSCALL_DECL(err) do { } while(0)
++
++#undef INTERNAL_SYSCALL
++#define INTERNAL_SYSCALL(name, err, nr, args...) \
++ ({ \
++ register int _a1 asm ("r12"); \
++ register int _scno asm("r8") = SYS_ify(name); \
++ LOAD_ARGS_##nr (args); \
++ asm volatile ("scall /* syscall " #name " */" \
++ : "=r" (_a1) \
++ : "r"(_scno) ASM_ARGS_##nr \
++ : "lr", "cc", "memory"); \
++ _a1; \
++ })
++
++#undef INTERNAL_SYSCALL_ERROR_P
++#define INTERNAL_SYSCALL_ERROR_P(val, err) \
++ ((unsigned int)(val) >= 0xfffff001U)
++
++#undef INTERNAL_SYSCALL_ERRNO
++#define INTERNAL_SYSCALL_ERRNO(val, errr) (-(val))
++
++#define LOAD_ARGS_0() do { } while(0)
++#define ASM_ARGS_0
++#define LOAD_ARGS_1(a1) \
++ _a1 = (int) (a1); \
++ LOAD_ARGS_0()
++#define ASM_ARGS_1 ASM_ARGS_0, "r"(_a1)
++#define LOAD_ARGS_2(a1, a2) \
++ register int _a2 asm("r11") = (int)(a2); \
++ LOAD_ARGS_1(a1)
++#define ASM_ARGS_2 ASM_ARGS_1, "r"(_a2)
++#define LOAD_ARGS_3(a1, a2, a3) \
++ register int _a3 asm("r10") = (int)(a3); \
++ LOAD_ARGS_2(a1, a2)
++#define ASM_ARGS_3 ASM_ARGS_2, "r"(_a3)
++#define LOAD_ARGS_4(a1, a2, a3, a4) \
++ register int _a4 asm("r9") = (int)(a4); \
++ LOAD_ARGS_3(a1, a2, a3)
++#define ASM_ARGS_4 ASM_ARGS_3, "r"(_a4)
++#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
++ register int _a5 asm("r5") = (int)(a5); \
++ LOAD_ARGS_4(a1, a2, a3, a4)
++#define ASM_ARGS_5 ASM_ARGS_4, "r"(_a5)
++#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
++ register int _a6 asm("r3") = (int)(a6); \
++ LOAD_ARGS_5(a1, a2, a3, a4, a5)
++#define ASM_ARGS_6 ASM_ARGS_5, "r"(_a6)
++
++#endif /* __ASSEMBLER__ */
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/wordsize.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bits/wordsize.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1 @@
++#define __WORDSIZE 32
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/brk.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/brk.c 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,23 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <errno.h>
++#include <sys/syscall.h>
++
++void *__curbrk = 0;
++
++int brk (void *addr)
++{
++ void *newbrk;
++
++ newbrk = INLINE_SYSCALL(brk, 1, addr);
++
++ __curbrk = newbrk;
++
++ if (newbrk < addr) {
++ __set_errno (ENOMEM);
++ return -1;
++ }
++
++ return 0;
++}
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bsd-_setjmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bsd-_setjmp.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,12 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++
++ /* This just does a tail-call to __sigsetjmp(env, 0) */
++ .global _setjmp
++ .type _setjmp,"function"
++ .align 1
++_setjmp:
++ mov r11, 0
++ bral __sigsetjmp_internal
++ .size _setjmp, . - _setjmp
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bsd-setjmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/bsd-setjmp.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,12 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++
++ /* This just does a tail-call to __sigsetjmp(env, 1) */
++ .global setjmp
++ .type setjmp,"function"
++ .align 1
++setjmp:
++ mov r11, 1
++ bral __sigsetjmp_internal
++ .size setjmp, . - setjmp
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/clone.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/clone.c 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,37 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <errno.h>
++#include <sys/syscall.h>
++#include <unistd.h>
++
++/*
++ * I don't know if we can be absolutely certain that the fn and arg
++ * parameters are preserved when returning as the child. If the
++ * compiler stores them in registers (r0-r7), they should be.
++ */
++int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg)
++{
++ register int (*_fn)(void *arg) = fn;
++ register void *_arg = arg;
++ int err;
++
++ /* Sanity check the arguments */
++ err = -EINVAL;
++ if (!fn)
++ goto syscall_error;
++ if (!child_stack)
++ goto syscall_error;
++
++ err = INLINE_SYSCALL(clone, 2, flags, child_stack);
++ if (err < 0)
++ goto syscall_error;
++ else if (err != 0)
++ return err;
++
++ _exit(_fn(_arg));
++
++syscall_error:
++ __set_errno (-err);
++ return -1;
++}
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/crt1.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/crt1.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,93 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ *
++ * When we enter _start, the stack looks like this:
++ * argc argument counter
++ * argv[0] pointer to program name
++ * argv[1..argc-1] pointers to program args
++ * NULL
++ * env[0..N] pointers to environment variables
++ * NULL
++ *
++ * r12 contains a function pointer to be registered with `atexit'.
++ * This is how the dynamic linker arranges to have DT_FINI functions
++ * called for shared libraries that have been loaded before this
++ * code runs.
++ *
++ * We're going to call the following function:
++ * __uClibc_main(int (*main)(int, char **, char **), int argc,
++ * char **argv, void (*app_init)(void), void (*app_fini)(void),
++ * void (*rtld_fini)(void), void *stack_end)
++ *
++ * So we need to set up things as follows:
++ * r12 = address of main
++ * r11 = argc
++ * r10 = &argv[0]
++ * r9 = address of _init
++ * r8 = address of _fini
++ * sp[0] = whatever we got passed in r12
++ */
++
++#include <features.h>
++
++ .text
++ .global _start
++ .type _start, @function
++_start:
++ /* Clear the frame pointer and link register since this is the outermost frame. */
++ mov r7, 0
++ mov lr, 0
++
++ ld.w r11, sp++ /* argc */
++ mov r10, sp /* &argv[0] */
++
++ st.w --sp, r10 /* stack_end */
++ st.w --sp, r12 /* rtld_fini */
++
++#ifdef __PIC__
++ lddpc r6, .L_GOT
++.L_RGOT:
++ rsub r6, pc
++ lda.w r9, _init
++ lda.w r8, _fini
++ lda.w r12, main
++
++ /* Ok, now run uClibc's main() -- should not return */
++ call __uClibc_main
++
++ .align 2
++.L_GOT:
++ .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
++#else
++ lddpc r9, __init_addr /* app_init */
++ lddpc r8, __fini_addr /* app_fini */
++ lddpc r12, __main_addr /* main */
++
++ /* Ok, now run uClibc's main() -- should not return */
++ lddpc pc, ___uClibc_main_addr
++
++ .align 2
++__init_addr:
++ .long _init
++__fini_addr:
++ .long _fini
++__main_addr:
++ .long main
++___uClibc_main_addr:
++ .long __uClibc_main
++#endif
++ .size _start, . - _start
++
++ /*
++ * The LSB says we need this.
++ */
++ .section ".note.ABI-tag", "a"
++ .align 4
++ .long 2f - 1f /* namesz */
++ .long 4f - 3f /* descsz */
++ .long 1 /* type */
++1: .asciz "GNU" /* name */
++2: .align 4
++3: .long 0 /* Linux executable */
++ .long 2,6,0 /* Earliest compatible kernel */
++4: .align 4
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/crti.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/crti.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,17 @@
++
++ .section .init
++ .align 2
++ .global _init
++ .type _init, @function
++_init:
++ /* Use a four-byte instruction to avoid NOPs */
++ stm --sp, r0-r7,lr
++ .align 2
++
++ .section .fini
++ .align 2
++ .global _fini
++ .type _fini, @function
++_fini:
++ stm --sp, r0-r7,lr
++ .align 2
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/crtn.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/crtn.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,14 @@
++
++ .section .init
++ .align 2
++ .global _init
++ .type _init, @function
++ ldm sp++, r0-r7,pc
++ .size _init, . - _init
++
++ .section .fini
++ .align 2
++ .global _fini
++ .type _fini, @function
++ ldm sp++, r0-r7,pc
++ .size _fini, . - _fini
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/mmap.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/mmap.c 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,31 @@
++/* Copyright (C) 2005 Atmel Norway
++
++ 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
++
++ Derived in part from the Linux-8086 C library, the GNU C Library, and several
++ other sundry sources. Files within this library are copyright by their
++ respective copyright holders.
++ */
++
++#include <errno.h>
++#include <sys/mman.h>
++#include <sys/syscall.h>
++
++static _syscall6(__ptr_t, mmap2, __ptr_t, addr, size_t, len, int, prot, int, flags, int, fd, __off_t, pgoff);
++
++__ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offset)
++{
++ return mmap2(addr, len, prot, flags, fd, offset >> 12);
++}
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/setjmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/setjmp.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,43 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#define _SETJMP_H
++#define _ASM
++#include <bits/setjmp.h>
++
++ .text
++
++ .global __sigsetjmp
++ .type __sigsetjmp,"function"
++
++ /* Create a global, hidden symbol for use by setjmp() and _setjmp().
++ If it's not hidden, the linker will complain about a relative
++ jump to a dynamic symbol when building a shared library.
++
++ Also, if a user overrides the __sigsetjmp function, he might not
++ expect the setjmp() and _setjmp() function to effectively be
++ overridden as well. */
++ .global __sigsetjmp_internal
++ .hidden __sigsetjmp_internal
++ .type __sigsetjmp_internal,"function"
++ .align 1
++__sigsetjmp:
++__sigsetjmp_internal:
++ mustr r8
++ stm r12, r0,r1,r2,r3,r4,r5,r6,r7,r8,sp,lr
++
++ /* Make a tail call to __sigjmp_save; it takes the same args. */
++#ifdef __PIC__
++ mov r9, r6
++ lddpc r6, .LG
++.L1: rsub r6, pc
++ ld.w r8, r6[__sigjmp_save@got]
++ mov r6, r9
++ mov pc, r8
++
++ .align 2
++.LG: .long .L1 - _GLOBAL_OFFSET_TABLE_
++#else
++ rjmp __sigjmp_save
++#endif
++ .size __sigsetjmp, . - __sigsetjmp
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sigaction.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sigaction.c 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,49 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <errno.h>
++#include <signal.h>
++#include <string.h>
++#include <sys/syscall.h>
++#include <bits/kernel_sigaction.h>
++
++#define SA_RESTORER 0x04000000
++extern void __default_rt_sa_restorer(void);
++
++/*
++ * If act is not NULL, change the action for sig to *act.
++ * If oact is not NULL, put the old action for sig in *oact.
++ */
++int __libc_sigaction(int signum, const struct sigaction *act,
++ struct sigaction *oldact)
++{
++ struct kernel_sigaction kact, koact;
++ int result;
++
++ if (act) {
++ kact.k_sa_handler = act->sa_handler;
++ memcpy(&kact.sa_mask, &act->sa_mask, sizeof (kact.sa_mask));
++ kact.sa_flags = act->sa_flags;
++ if (kact.sa_flags & (SA_RESTORER | SA_ONSTACK))
++ kact.sa_restorer = act->sa_restorer;
++ else
++ kact.sa_restorer = __default_rt_sa_restorer;
++ kact.sa_flags |= SA_RESTORER;
++ }
++
++ result = __syscall_rt_sigaction(signum, act ? __ptrvalue(&kact) : NULL,
++ oldact ? __ptrvalue(&koact) : NULL,
++ _NSIG / 8);
++
++ if (oldact && result >= 0) {
++ oldact->sa_handler = koact.k_sa_handler;
++ memcpy(&oldact->sa_mask, &koact.sa_mask,
++ sizeof(oldact->sa_mask));
++ oldact->sa_flags = koact.sa_flags;
++ oldact->sa_restorer = koact.sa_restorer;
++ }
++
++ return result;
++}
++
++weak_alias(__libc_sigaction, sigaction)
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sigrestorer.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sigrestorer.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,11 @@
++/*
++ * Copyright (C) 2004 Atmel Norway AS
++ */
++#include <sys/syscall.h>
++
++ .global __default_rt_sa_restorer
++ .type __default_rt_sa_restorer,"function"
++ .align 1
++__default_rt_sa_restorer:
++ mov r8, __NR_rt_sigreturn
++ scall
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sys/elf.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sys/elf.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,26 @@
++/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_ELF_H
++#define _SYS_ELF_H 1
++
++#warning "This header is obsolete; use <sys/procfs.h> instead."
++
++#include <sys/procfs.h>
++
++#endif /* sys/elf.h */
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sys/io.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sys/io.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,48 @@
++/* Copyright (C) 1996, 1998, 1999 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_IO_H
++
++#define _SYS_IO_H 1
++#include <features.h>
++
++__BEGIN_DECLS
++
++/* If TURN_ON is TRUE, request for permission to do direct i/o on the
++ port numbers in the range [FROM,FROM+NUM-1]. Otherwise, turn I/O
++ permission off for that range. This call requires root privileges. */
++extern int ioperm (unsigned long int __from, unsigned long int __num,
++ int __turn_on) __THROW;
++
++/* Set the I/O privilege level to LEVEL. If LEVEL is nonzero,
++ permission to access any I/O port is granted. This call requires
++ root privileges. */
++extern int iopl (int __level) __THROW;
++
++/* The functions that actually perform reads and writes. */
++extern unsigned char inb (unsigned long int port) __THROW;
++extern unsigned short int inw (unsigned long int port) __THROW;
++extern unsigned long int inl (unsigned long int port) __THROW;
++
++extern void outb (unsigned char value, unsigned long int port) __THROW;
++extern void outw (unsigned short value, unsigned long int port) __THROW;
++extern void outl (unsigned long value, unsigned long int port) __THROW;
++
++__END_DECLS
++
++#endif /* _SYS_IO_H */
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sys/procfs.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sys/procfs.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,123 @@
++/* Copyright (C) 1996, 1997, 1999, 2001 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++#ifndef _SYS_PROCFS_H
++#define _SYS_PROCFS_H 1
++
++/* This is somewhat modelled after the file of the same name on SVR4
++ systems. It provides a definition of the core file format for ELF
++ used on Linux. It doesn't have anything to do with the /proc file
++ system, even though Linux has one.
++
++ Anyway, the whole purpose of this file is for GDB and GDB only.
++ Don't read too much into it. Don't use it for anything other than
++ GDB unless you know what you are doing. */
++
++#include <features.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#include <sys/user.h>
++
++__BEGIN_DECLS
++
++/* Type for a general-purpose register. */
++typedef unsigned long elf_greg_t;
++
++/* And the whole bunch of them. We could have used `struct
++ user_regs' directly in the typedef, but tradition says that
++ the register set is an array, which does have some peculiar
++ semantics, so leave it that way. */
++#define ELF_NGREG (sizeof (struct user_regs) / sizeof(elf_greg_t))
++typedef elf_greg_t elf_gregset_t[ELF_NGREG];
++
++/* Register set for the floating-point registers. */
++typedef struct user_fpregs elf_fpregset_t;
++
++/* Signal info. */
++struct elf_siginfo
++ {
++ int si_signo; /* Signal number. */
++ int si_code; /* Extra code. */
++ int si_errno; /* Errno. */
++ };
++
++/* Definitions to generate Intel SVR4-like core files. These mostly
++ have the same names as the SVR4 types with "elf_" tacked on the
++ front to prevent clashes with Linux definitions, and the typedef
++ forms have been avoided. This is mostly like the SVR4 structure,
++ but more Linuxy, with things that Linux does not support and which
++ GDB doesn't really use excluded. */
++
++struct elf_prstatus
++ {
++ struct elf_siginfo pr_info; /* Info associated with signal. */
++ short int pr_cursig; /* Current signal. */
++ unsigned long int pr_sigpend; /* Set of pending signals. */
++ unsigned long int pr_sighold; /* Set of held signals. */
++ __pid_t pr_pid;
++ __pid_t pr_ppid;
++ __pid_t pr_pgrp;
++ __pid_t pr_sid;
++ struct timeval pr_utime; /* User time. */
++ struct timeval pr_stime; /* System time. */
++ struct timeval pr_cutime; /* Cumulative user time. */
++ struct timeval pr_cstime; /* Cumulative system time. */
++ elf_gregset_t pr_reg; /* GP registers. */
++ int pr_fpvalid; /* True if math copro being used. */
++ };
++
++
++#define ELF_PRARGSZ (80) /* Number of chars for args. */
++
++struct elf_prpsinfo
++ {
++ char pr_state; /* Numeric process state. */
++ char pr_sname; /* Char for pr_state. */
++ char pr_zomb; /* Zombie. */
++ char pr_nice; /* Nice val. */
++ unsigned long int pr_flag; /* Flags. */
++ unsigned short int pr_uid;
++ unsigned short int pr_gid;
++ int pr_pid, pr_ppid, pr_pgrp, pr_sid;
++ /* Lots missing */
++ char pr_fname[16]; /* Filename of executable. */
++ char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
++ };
++
++/* The rest of this file provides the types for emulation of the
++ Solaris <proc_service.h> interfaces that should be implemented by
++ users of libthread_db. */
++
++/* Addresses. */
++typedef void *psaddr_t;
++
++/* Register sets. Linux has different names. */
++typedef elf_gregset_t prgregset_t;
++typedef elf_fpregset_t prfpregset_t;
++
++/* We don't have any differences between processes and threads,
++ therefore have only one PID type. */
++typedef __pid_t lwpid_t;
++
++/* Process status and info. In the end we do provide typedefs for them. */
++typedef struct elf_prstatus prstatus_t;
++typedef struct elf_prpsinfo prpsinfo_t;
++
++__END_DECLS
++
++#endif /* sys/procfs.h */
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sys/ucontext.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sys/ucontext.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,94 @@
++/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++
++ The GNU C Library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++
++ The GNU C Library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public
++ License along with the GNU C Library; if not, write to the Free
++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
++ 02111-1307 USA. */
++
++/* Linux/AVR32 ABI compliant context switching support. */
++
++#ifndef _SYS_UCONTEXT_H
++#define _SYS_UCONTEXT_H 1
++
++#include <features.h>
++#include <signal.h>
++#include <sys/procfs.h>
++#include <bits/sigcontext.h>
++
++typedef int greg_t;
++
++/* Number of general registers. */
++#define NGREG 16
++
++/* Container for all general registers. */
++typedef elf_gregset_t gregset_t;
++
++/* Number of each register is the `gregset_t' array. */
++enum
++{
++ R0 = 0,
++#define R0 R0
++ R1 = 1,
++#define R1 R1
++ R2 = 2,
++#define R2 R2
++ R3 = 3,
++#define R3 R3
++ R4 = 4,
++#define R4 R4
++ R5 = 5,
++#define R5 R5
++ R6 = 6,
++#define R6 R6
++ R7 = 7,
++#define R7 R7
++ R8 = 8,
++#define R8 R8
++ R9 = 9,
++#define R9 R9
++ R10 = 10,
++#define R10 R10
++ R11 = 11,
++#define R11 R11
++ R12 = 12,
++#define R12 R12
++ R13 = 13,
++#define R13 R13
++ R14 = 14,
++#define R14 R14
++ R15 = 15
++#define R15 R15
++};
++
++/* Structure to describe FPU registers. */
++typedef elf_fpregset_t fpregset_t;
++
++/* Context to describe whole processor state. */
++typedef struct
++ {
++ gregset_t gregs;
++ fpregset_t fpregs;
++ } mcontext_t;
++
++/* Userlevel context. */
++typedef struct ucontext
++{
++ unsigned long uc_flags;
++ struct ucontext *uc_link;
++ stack_t uc_stack;
++ struct sigcontext uc_mcontext;
++ sigset_t uc_sigmask; /* mask last for extensibility */
++} ucontext_t;
++
++#endif /* sys/ucontext.h */
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sys/user.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/sys/user.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,46 @@
++#ifndef _SYS_USER_H
++#define _SYS_USER_H
++
++struct user_fpregs
++{
++
++};
++
++struct user_regs
++{
++ unsigned long sr;
++ unsigned long pc;
++ unsigned long lr;
++ unsigned long sp;
++ unsigned long r12;
++ unsigned long r11;
++ unsigned long r10;
++ unsigned long r9;
++ unsigned long r8;
++ unsigned long r7;
++ unsigned long r6;
++ unsigned long r5;
++ unsigned long r4;
++ unsigned long r3;
++ unsigned long r2;
++ unsigned long r1;
++ unsigned long r0;
++ unsigned long r12_orig;
++};
++
++struct user
++{
++ struct user_regs regs; /* general registers */
++ size_t u_tsize; /* text size (pages) */
++ size_t u_dsize; /* data size (pages) */
++ size_t u_ssize; /* stack size (pages) */
++ unsigned long start_code; /* text starting address */
++ unsigned long start_data; /* data starting address */
++ unsigned long start_stack; /* stack starting address */
++ long int signal; /* signal causing core dump */
++ struct user_regs * u_ar0; /* help gdb find registers */
++ unsigned long magic; /* identifies a core file */
++ char u_comm[32]; /* user command name */
++};
++
++#endif /* _SYS_USER_H */
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/syscall.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/syscall.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,81 @@
++/*
++ * syscall for AVR32/uClibc
++ *
++ * Copyright (C) 2004 Atmel Norway
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU Library General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or (at your
++ * option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful, but WITHOUT
++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
++ * for more details.
++ *
++ * You should have received a copy of the GNU Library General Public License
++ * along with this program; if not, write to the Free Software Foundation,
++ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++#include <features.h>
++
++ .text
++
++ /*
++ * long int syscall(long int sysno, ...)
++ */
++ .global syscall
++ .type syscall, @function
++ .align 2
++syscall:
++ stm --sp, r3,r5,lr
++ sub lr, sp, -12
++ mov r8, r12
++ ldm lr, r3,r5,r9-r12
++ scall
++ cp.w r12, -4095
++ brlo .Ldone
++
++#ifdef __PIC__
++ lddpc r5, .Lgot
++.Lgotcalc:
++ rsub r5, pc
++# ifdef __UCLIBC_HAS_THREADS__
++ mov r3, r12
++ mcall r5[__errno_location@got]
++ st.w r12[0], r3
++# else
++ ld.w r3, r5[errno@got]
++ st.w r3[0], r12
++# endif
++#else
++# ifdef __UCLIBC_HAS_THREADS__
++ mov r3, r12
++ mcall .Lerrno_location
++ st.w r12[0], r3
++# else
++ lddpc r3, .Lerrno
++ st.w r3[0], r12
++# endif
++#endif
++ mov r12, -1
++
++.Ldone:
++ ldm sp++, r3,r5,pc
++
++ .align 2
++#ifdef __PIC__
++.Lgot:
++ .long .Lgotcalc - _GLOBAL_OFFSET_TABLE_
++#else
++# ifdef __UCLIBC_HAS_THREADS__
++.Lerrno_location:
++ .long __errno_location
++# else
++.Lerrno:
++ .long errno
++# endif
++#endif
++
++
++ .size syscall, . - syscall
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/vfork.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/avr32/vfork.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,55 @@
++ /*
++ * vfork for uClibc
++ *
++ * Copyright (C) 2005 Atmel Norway
++ */
++
++ /*
++ * Clone the process without copying the address space. The
++ * calling process is suspended until the child either exits
++ * or calls execve.
++ *
++ * This all means that we cannot rely on the stack to store
++ * away registers, since they will be overwritten by the child
++ * as soon as it makes another function call (e.g. execve()).
++ * Fortunately, the Linux kernel preserves LR across system calls.
++ */
++#include <features.h>
++#include <sys/syscall.h>
++
++ .global __vfork
++ .type __vfork,@function
++ .align 1
++__vfork:
++ mov r8, __NR_vfork
++ scall
++ cp.w r12, -4096
++ retls r12
++
++ /* vfork failed, so we may use the stack freely */
++ pushm r4-r7,lr
++#ifdef __PIC__
++ lddpc r6, .L_GOT
++ rsub r4, r12, 0
++.L_RGOT:
++ rsub r6, pc
++ mcall r6[__errno_location@got]
++#else
++ rsub r4, r12, 0
++ mcall .L__errno_location
++#endif
++ st.w r12[0], r4
++ popm r4-r7,pc,r12=-1
++
++ .align 2
++#ifdef __PIC__
++.L_GOT:
++ .long .L_RGOT - _GLOBAL_OFFSET_TABLE_
++#else
++.L__errno_location:
++ .long __errno_location
++#endif
++ .size __vfork, . - __vfork
++
++ .weak vfork
++ vfork = __vfork
+Index: uClibc-0.9.28-avr32/Rules.mak
+===================================================================
+--- uClibc-0.9.28-avr32.orig/Rules.mak 2006-10-19 15:05:49.000000000 +0200
++++ uClibc-0.9.28-avr32/Rules.mak 2006-10-19 15:05:52.000000000 +0200
+@@ -231,6 +231,12 @@ ifeq ($(strip $(TARGET_ARCH)),frv)
+ UCLIBC_LDSO=ld.so.1
+ endif
+
++ifeq ($(strip $(TARGET_ARCH)),avr32)
++ CPU_CFLAGS-$(CONFIG_AP7000) += -mcpu=ap7000
++ CPU_CFLAGS-$(LINKRELAX) += -masm-addr-pseudos -Wa,--pic,--linkrelax
++ CPU_LDFLAGS-$(LINKRELAX) += --relax
++endif
++
+ # Keep the check_gcc from being needlessly executed
+ ifndef PIEFLAG
+ ifneq ($(UCLIBC_BUILD_PIE),y)
+Index: uClibc-0.9.28-avr32/libc/string/avr32/bcopy.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/bcopy.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,15 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++ .text
++ .global bcopy
++ .type bcopy, @function
++ .align 1
++bcopy:
++ /* Swap the first two arguments */
++ eor r11, r12
++ eor r12, r11
++ eor r11, r12
++ rjmp __memmove
++ .size bcopy, . - bcopy
+Index: uClibc-0.9.28-avr32/libc/string/avr32/bzero.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/bzero.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,12 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++ .text
++ .global bzero
++ .type bzero, @function
++ .align 1
++bzero:
++ mov r10, r11
++ mov r11, 0
++ rjmp __memset
+Index: uClibc-0.9.28-avr32/libc/string/avr32/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/Makefile 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,40 @@
++# 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
++
++TOPDIR=../../../
++include $(TOPDIR)Rules.mak
++
++SSRC := bcopy.S bzero.S memcmp.S memcpy.S memmove.S
++SSRC += memset.S strcmp.S strlen.S
++# memchr.S, strcat.S, strcpy.S, strncpy.S is broken
++SOBJS := $(patsubst %.S,%.o, $(SSRC))
++OBJS := $(SOBJS)
++
++OBJ_LIST:= ../../obj.string.$(TARGET_ARCH)
++
++all: $(OBJ_LIST)
++
++$(OBJ_LIST): $(OBJS)
++ echo $(addprefix string/$(TARGET_ARCH)/, $(OBJS)) > $@
++
++$(SOBJS): %.o: %.S
++ $(CC) $(ASFLAGS) -c $< -o $@
++ $(STRIPTOOL) -x -R .note -R .comment $@
++
++clean:
++ $(RM) *.[oa] *~ core
+Index: uClibc-0.9.28-avr32/libc/string/avr32/memchr.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/memchr.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,62 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define str r12
++#define chr r11
++#define len r10
++
++ .text
++ .global memchr
++ .type memchr, @function
++memchr:
++ or chr, chr, chr << 8
++ or chr, chr, chr << 16
++
++ mov r9, str
++ andl r9, 3, COH
++ brne .Lunaligned_str
++
++1: sub len, 4
++ brlt 2f
++ ld.w r8, str++
++ psub.b r9, r8, r11
++ tnbz r9
++ brne 1b
++
++ sub str, 4
++ bfextu r9, r8, 24, 8
++ cp.b r9, r11
++ reteq str
++ sub str, -1
++ bfextu r9, r8, 16, 8
++ cp.b r9, r11
++ reteq str
++ sub str, -1
++ bfextu r9, r8, 8, 8
++ cp.b r9, r11
++ reteq str
++ sub str, -1
++ retal str
++
++2: sub len, -4
++ reteq 0
++
++3: ld.ub r8, str++
++ cp.w r8, 0
++ reteq str
++ sub len, 1
++ brne 3b
++
++ retal 0
++
++.Lunaligned_str:
++1: sub len, 1
++ retlt 0
++ ld.ub r8, str++
++ cp.b r8, r11
++ reteq str
++ sub r9, 1
++ brge 1b
++
++ rjmp .Laligned_search
+Index: uClibc-0.9.28-avr32/libc/string/avr32/memcmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/memcmp.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,26 @@
++/*
++ * Copyright (C) 2004 Atmel Norway.
++ */
++
++#define s1 r12
++#define s2 r11
++#define len r10
++
++ .text
++ .global memcmp
++ .type memcmp, @function
++ .align 1
++memcmp:
++ cp.w len, 1
++ retlt 0
++1: ld.ub r8, s1++
++ ld.ub r9, s2++
++ sub r8, r9
++ subfne len, 1
++ brne 1b
++
++ retal r8
++ .size memcmp, . - memcmp
++
++ .weak bcmp
++ bcmp = memcmp
+Index: uClibc-0.9.28-avr32/libc/string/avr32/memcpy.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/memcpy.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,110 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++/* 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
++
++ .global __memcpy
++ .hidden __memcpy
++ .type __memcpy, @function
++memcpy:
++__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
+Index: uClibc-0.9.28-avr32/libc/string/avr32/memmove.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/memmove.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,114 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define dst r12
++#define src r11
++#define len r10
++
++ .text
++ .global memmove
++ .type memmove, @function
++
++ .global __memmove
++ .hidden __memmove
++ .type __memmove, @function
++memmove:
++__memmove:
++ cp.w src, dst
++ brge __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
+Index: uClibc-0.9.28-avr32/libc/string/avr32/memset.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/memset.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,60 @@
++/*
++ * Copyright (C) 2004 Atmel Norway.
++ */
++
++#define s r12
++#define c r11
++#define n r10
++
++ .text
++ .global memset
++ .type memset, @function
++
++ .global __memset
++ .hidden __memset
++ .type __memset, @function
++
++ .align 1
++memset:
++__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
++ or r8, r8, r8 << 8
++ or r8, r8, r8 << 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
+Index: uClibc-0.9.28-avr32/libc/string/avr32/strcat.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/strcat.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,95 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define s1 r9
++#define s2 r11
++
++ .text
++ .global strcat
++ .type strcat, @function
++ .align 1
++strcat:
++ mov s1, r12
++
++ /* Make sure s1 is word-aligned */
++ mov r10, s1
++ andl r10, 3, COH
++ breq 2f
++
++ add pc, pc, r10 << 3
++ sub r0, r0, 0 /* 4-byte nop */
++ ld.ub r8, s1++
++ sub r8, r8, 0
++ breq 2f
++ ld.ub r8, s1++
++ sub r8, r8, 0
++ breq 3f
++ ld.ub r8, s1++
++ sub r8, r8, 0
++ breq 4f
++
++ /* Find the end of the first string */
++5: ld.w r8, s1++
++ tnbz r8
++ brne 5b
++
++ sub s1, 4
++
++ bfextu r10, r8, 24, 8
++ cp.w r10, 0
++ breq 1f
++ sub s1, -1
++ bfextu r10, r8, 16, 8
++ cp.w r10, 0
++ breq 2f
++ sub s1, -1
++ bfextu r10, r8, 8, 8
++ cp.w r10, 0
++ breq 3f
++ sub s1, -1
++ rjmp 4f
++
++ /* Now, append s2 */
++1: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++2: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++3: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++4: ld.ub r8, s2++
++ st.b s1++, r8
++ cp.w r8, 0
++ reteq r12
++
++ /* Copy one word at a time */
++ ld.w r8, s2++
++ tnbz r8
++ breq 2f
++1: st.w r8, s2++
++ ld.w r8, s2++
++ tnbz r8
++ brne 1b
++
++ /* Copy the remaining bytes */
++ bfextu r10, r8, 24, 8
++ st.b s1++, r10
++ cp.w r10, 0
++ reteq r12
++ bfextu r10, r8, 16, 8
++ st.b s1++, r10
++ cp.w r10, 0
++ reteq r12
++ bfextu r10, r8, 8, 8
++ st.b s1++, r10
++ cp.w r10, 0
++ reteq r12
++ st.b s1++, r8
++ retal r12
++ .size strcat, . - strcat
+Index: uClibc-0.9.28-avr32/libc/string/avr32/strcmp.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/strcmp.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,80 @@
++/*
++ * Copyright (C) 2004 Atmel Norway.
++ */
++
++#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
++
++ .weak strcoll
++ strcoll = strcmp
+Index: uClibc-0.9.28-avr32/libc/string/avr32/strcpy.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/strcpy.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,63 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ *
++ * To reduce the size, this one might simply call strncpy with len = -1.
++ */
++
++#define dst r9
++#define src r11
++
++ .text
++ .global strcpy
++ .type strcpy, @function
++strcpy:
++ mov dst, r12
++
++ pref src[0]
++
++ /*
++ * Check alignment. If src is aligned but dst isn't, we can't
++ * do much about it...
++ */
++ mov r8, src
++ andl r8, 3 COH
++ brne .Lunaligned_src
++
++.Laligned_copy:
++1: ld.w r8, src++
++ tnbz r8
++ breq 2f
++ st.w dst++, r8
++ rjmp 1b
++
++2: /*
++ * Ok, r8 now contains the terminating '\0'. Copy the
++ * remaining bytes individually.
++ */
++ bfextu r10, r8, 24, 8
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++ bfextu r10, r8, 16, 8
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++ bfextu r10, r8, 8, 8
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++ st.b dst++, r8
++ retal r12
++
++.Lunaligned_src:
++ /* Copy bytes until we're aligned */
++ rsub r8, r8, 4
++ add pc, pc, r8 << 3
++ nop
++ nop
++ ld.ub r10, src++
++ st.b dst++, r10
++ cp.w r10, 0
++ reteq r12
++
++ rjmp .Laligned_copy
+Index: uClibc-0.9.28-avr32/libc/string/avr32/stringtest.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/stringtest.c 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,144 @@
++
++#include <stdio.h>
++#include <string.h>
++#include <time.h>
++#include <sys/mman.h>
++
++#define BUF_SIZE (8 * 1024)
++
++static char *buf1;
++static char *buf1_ref;
++static char *buf2;
++
++extern void *optimized_memcpy(void *dest, void *src, size_t len);
++extern void *optimized_memmove(void *dest, void *src, size_t len);
++extern char *optimized_strcpy(char *dest, char *src);
++extern char *optimized_strncpy(char *dest, char *src, size_t len);
++
++void dump_mismatch(char *buf, char *ref, size_t len)
++{
++ int i, j;
++
++ for (i = 0; i < len; i += 16) {
++ if (memcmp(buf + i, ref + i, 16) == 0)
++ continue;
++
++ printf("%4x buf:", i);
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", buf[j]);
++ printf("\n ref:");
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", ref[j]);
++ printf("\n");
++ }
++}
++
++static void test_memcpy(int src_offset, int dst_offset, int len)
++{
++ clock_t start, old, new;
++ int i;
++
++ memset(buf1, 0x55, BUF_SIZE);
++ memset(buf1_ref, 0x55, BUF_SIZE);
++ memset(buf2, 0xaa, BUF_SIZE);
++
++ printf("Testing memcpy with offsets %d => %d and len %d...",
++ src_offset, dst_offset, len);
++
++ start = clock();
++ for (i = 0; i < 8192; i++)
++ optimized_memcpy(buf1 + dst_offset, buf2 + src_offset, len);
++ new = clock() - start;
++ start = clock();
++ for ( i = 0; i < 8192; i++)
++ memcpy(buf1_ref + dst_offset, buf2 + src_offset, len);
++ old = clock() - start;
++
++ if (memcmp(buf1, buf1_ref, BUF_SIZE) == 0)
++ printf("OK\n");
++ else {
++ printf("FAILED\n");
++ dump_mismatch(buf1, buf1_ref, BUF_SIZE);
++ }
++ printf("CPU time used: %d vs. %d\n", new, old);
++}
++
++static void test_memmove(int src_offset, int dst_offset, int len)
++{
++ clock_t start, old, new;
++
++ memset(buf1, 0x55, BUF_SIZE);
++ memset(buf1_ref, 0x55, BUF_SIZE);
++ memset(buf2, 0xaa, BUF_SIZE);
++
++ printf("Testing memmove with offsets %d => %d and len %d...",
++ src_offset, dst_offset, len);
++
++ start = clock();
++ optimized_memmove(buf1 + dst_offset, buf2 + src_offset, len);
++ new = clock() - start;
++ start = clock();
++ memmove(buf1_ref + dst_offset, buf2 + src_offset, len);
++ old = clock() - start;
++
++ if (memcmp(buf1, buf1_ref, BUF_SIZE) == 0)
++ printf("OK\n");
++ else {
++ printf("FAILED\n");
++ dump_mismatch(buf1, buf1_ref, BUF_SIZE);
++ }
++ printf("CPU time used: %d vs. %d\n", new, old);
++}
++
++int main(int argc, char *argv[])
++{
++ buf2 = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
++ if (buf2 == MAP_FAILED) {
++ perror("Failed to allocate memory for buf2");
++ return 1;
++ }
++ buf1 = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
++ if (buf1 == MAP_FAILED) {
++ perror("Failed to allocate memory for buf1");
++ return 1;
++ }
++ buf1_ref = mmap(NULL, BUF_SIZE, PROT_READ | PROT_WRITE,
++ MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
++ if (buf1_ref == MAP_FAILED) {
++ perror("Failed to allocate memory for buf1_ref");
++ return 1;
++ }
++ printf("\n === MEMCPY ===\n\n");
++
++ test_memcpy(0, 0, BUF_SIZE - 32);
++ test_memcpy(0, 0, 1);
++ test_memcpy(0, 0, 31);
++ test_memcpy(0, 0, 32);
++ test_memcpy(0, 0, 127);
++ test_memcpy(0, 0, 128);
++ test_memcpy(4, 4, BUF_SIZE - 32 - 4);
++ test_memcpy(1, 1, BUF_SIZE - 32 - 1);
++ test_memcpy(1, 1, 126);
++ test_memcpy(0, 3, 128);
++ test_memcpy(1, 4, 128);
++ test_memcpy(0, 0, 0);
++
++ printf("\n === MEMMOVE ===\n\n");
++
++ test_memmove(0, 0, BUF_SIZE - 32);
++ test_memmove(0, 0, 1);
++ test_memmove(0, 0, 31);
++ test_memmove(0, 0, 32);
++ test_memmove(0, 0, BUF_SIZE - 33);
++ test_memmove(0, 0, 128);
++ test_memmove(4, 4, BUF_SIZE - 32 - 4);
++ test_memmove(1, 1, BUF_SIZE - 32 - 1);
++ test_memmove(1, 1, BUF_SIZE - 130);
++ test_memmove(0, 3, BUF_SIZE - 128);
++ test_memmove(1, 4, BUF_SIZE - 128);
++ test_memmove(0, 0, 0);
++
++ return 0;
++}
+Index: uClibc-0.9.28-avr32/libc/string/avr32/strlen.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/strlen.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,52 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#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
+Index: uClibc-0.9.28-avr32/libc/string/avr32/strncpy.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/strncpy.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,77 @@
++/*
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define dst r9
++#define src r11
++
++ .text
++ .global strcpy
++ .type strncpy, @function
++strncpy:
++ mov dst, r12
++
++ pref src[0]
++ mov dst, r12
++
++ /*
++ * Check alignment. If src is aligned but dst isn't, we can't
++ * do much about it...
++ */
++ mov r8, src
++ andl r8, 3 COH
++ brne .Lunaligned_src
++
++.Laligned_copy:
++ sub r10, 4
++ brlt 3f
++1: ld.w r8, src++
++ tnbz r8
++ breq 2f
++ st.w dst++, r8
++ sub r10, 4
++ brne 1b
++
++3: sub r10, -4
++ reteq r12
++
++ /* This is safe as long as src is word-aligned and r10 > 0 */
++ ld.w r8, src++
++
++2: /*
++ * Ok, r8 now contains the terminating '\0'. Copy the
++ * remaining bytes individually.
++ */
++ bfextu r11, r8, 24, 8
++ st.b dst++, r11
++ cp.w r11, 0
++ reteq r12
++ sub r10, 1
++ reteq r12
++ bfextu r11, r8, 16, 8
++ st.b dst++, r11
++ cp.w r11, 0
++ reteq r12
++ sub r10, 1
++ reteq r12
++ bfextu r11, r8, 8, 8
++ st.b dst++, r11
++ cp.w r11, 0
++ reteq r12
++ sub r10, 1
++ reteq r12
++ st.b dst++, r8
++ retal r12
++
++.Lunaligned_src:
++ /* Copy bytes until we're aligned */
++ min r8, r8, r10
++ sub r10, r8
++ sub r8, 1
++ retlt r12
++1: ld.ub r10, src++
++ st.b dst++, r10
++ sub r8, 1
++ brge 1b
++
++ rjmp .Laligned_copy
+Index: uClibc-0.9.28-avr32/libc/string/avr32/test_memcpy.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libc/string/avr32/test_memcpy.c 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,66 @@
++
++#include <stdio.h>
++#include <string.h>
++
++#define BUF_SIZE 32768
++
++static char buf1[BUF_SIZE] __attribute__((aligned(32)));
++static char buf1_ref[BUF_SIZE] __attribute__((aligned(32)));
++static char buf2[BUF_SIZE] __attribute__((aligned(32)));
++
++extern void *new_memcpy(void *dest, void *src, size_t len);
++
++void dump_mismatch(char *buf, char *ref, size_t len)
++{
++ int i, j;
++
++ for (i = 0; i < len; i += 16) {
++ if (memcmp(buf + i, ref + i, 16) == 0)
++ continue;
++
++ printf("% 4x buf:", i);
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", buf[j]);
++ printf("\n ref:");
++ for (j = i; j < (i + 16); j++)
++ printf(" %02x", ref[j]);
++ printf("\n");
++ }
++}
++
++void test(int src_offset, int dst_offset, int len)
++{
++ memset(buf1, 0x55, sizeof(buf1));
++ memset(buf1_ref, 0x55, sizeof(buf1_ref));
++ memset(buf2, 0xaa, sizeof(buf2));
++
++ printf("Testing with offsets %d => %d and len %d...",
++ src_offset, dst_offset, len);
++
++ new_memcpy(buf1 + dst_offset, buf2 + src_offset, len);
++ memcpy(buf1_ref + dst_offset, buf2 + src_offset, len);
++
++ if (memcmp(buf1, buf1_ref, sizeof(buf1)) == 0)
++ printf("OK\n");
++ else {
++ printf("FAILED\n");
++ dump_mismatch(buf1, buf1_ref, sizeof(buf1));
++ }
++}
++
++int main(int argc, char *argv[])
++{
++ test(0, 0, BUF_SIZE);
++ test(0, 0, 1);
++ test(0, 0, 31);
++ test(0, 0, 32);
++ test(0, 0, 127);
++ test(0, 0, 128);
++ test(4, 4, BUF_SIZE - 4);
++ test(1, 1, BUF_SIZE - 1);
++ test(1, 1, 126);
++ test(0, 3, 128);
++ test(1, 4, 128);
++
++ return 0;
++}
+Index: uClibc-0.9.28-avr32/libc/sysdeps/linux/common/create_module.c
+===================================================================
+--- uClibc-0.9.28-avr32.orig/libc/sysdeps/linux/common/create_module.c 2006-10-19 15:05:48.000000000 +0200
++++ uClibc-0.9.28-avr32/libc/sysdeps/linux/common/create_module.c 2006-10-19 15:05:52.000000000 +0200
+@@ -61,7 +61,8 @@ unsigned long create_module(const char *
+ {
+ return __create_module(name, size, 0, 0);
+ }
+-#else
++/* create_module is obsolete in Linux 2.6, so AVR32 doesn't have it */
++#elif !defined(__avr32__)
+ /* Sparc, MIPS, etc don't mistake return values for errors. */
+ _syscall2(unsigned long, create_module, const char *, name, size_t, size);
+ #endif
+Index: uClibc-0.9.28-avr32/ldso/include/dl-string.h
+===================================================================
+--- uClibc-0.9.28-avr32.orig/ldso/include/dl-string.h 2006-10-19 15:05:48.000000000 +0200
++++ uClibc-0.9.28-avr32/ldso/include/dl-string.h 2006-10-19 15:05:52.000000000 +0200
+@@ -134,7 +134,7 @@ static inline char * _dl_strstr(const ch
+ } while (1);
+ }
+
+-static inline void * _dl_memcpy(void * dst, const void * src, size_t len)
++static __always_inline void * _dl_memcpy(void * dst, const void * src, size_t len)
+ {
+ register char *a = dst-1;
+ register const char *b = src-1;
+@@ -271,7 +271,8 @@ static __always_inline char * _dl_simple
+ /* On some arches constant strings are referenced through the GOT.
+ * This requires that load_addr must already be defined... */
+ #if defined(mc68000) || defined(__arm__) || defined(__mips__) \
+- || defined(__sh__) || defined(__powerpc__)
++ || defined(__sh__) || defined(__powerpc__) \
++ || defined(__avr32__)
+ # define CONSTANT_STRING_GOT_FIXUP(X) \
+ if ((X) < (const char *) load_addr) (X) += load_addr
+ # define NO_EARLY_SEND_STDERR
+Index: uClibc-0.9.28-avr32/ldso/include/dl-syscall.h
+===================================================================
+--- uClibc-0.9.28-avr32.orig/ldso/include/dl-syscall.h 2006-10-19 15:05:48.000000000 +0200
++++ uClibc-0.9.28-avr32/ldso/include/dl-syscall.h 2006-10-19 15:05:52.000000000 +0200
+@@ -60,59 +60,59 @@
+ dynamic linking at all, so we cannot return any error codes.
+ We just punt if there is an error. */
+ #define __NR__dl_exit __NR_exit
+-static inline _syscall1(void, _dl_exit, int, status);
++static __always_inline _syscall1(void, _dl_exit, int, status);
+
+ #define __NR__dl_close __NR_close
+-static inline _syscall1(int, _dl_close, int, fd);
++static __always_inline _syscall1(int, _dl_close, int, fd);
+
+ #define __NR__dl_open __NR_open
+-static inline _syscall3(int, _dl_open, const char *, fn, int, flags, __kernel_mode_t, mode);
++static __always_inline _syscall3(int, _dl_open, const char *, fn, int, flags, __kernel_mode_t, mode);
+
+ #define __NR__dl_write __NR_write
+-static inline _syscall3(unsigned long, _dl_write, int, fd,
++static __always_inline _syscall3(unsigned long, _dl_write, int, fd,
+ const void *, buf, unsigned long, count);
+
+ #define __NR__dl_read __NR_read
+-static inline _syscall3(unsigned long, _dl_read, int, fd,
++static __always_inline _syscall3(unsigned long, _dl_read, int, fd,
+ const void *, buf, unsigned long, count);
+
+ #define __NR__dl_mprotect __NR_mprotect
+-static inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, len, int, prot);
++static __always_inline _syscall3(int, _dl_mprotect, const void *, addr, unsigned long, len, int, prot);
+
+ #define __NR__dl_stat __NR_stat
+-static inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf);
++static __always_inline _syscall2(int, _dl_stat, const char *, file_name, struct stat *, buf);
+
+ #define __NR__dl_munmap __NR_munmap
+-static inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length);
++static __always_inline _syscall2(int, _dl_munmap, void *, start, unsigned long, length);
+
+ #define __NR__dl_getuid __NR_getuid
+-static inline _syscall0(uid_t, _dl_getuid);
++static __always_inline _syscall0(uid_t, _dl_getuid);
+
+ #define __NR__dl_geteuid __NR_geteuid
+-static inline _syscall0(uid_t, _dl_geteuid);
++static __always_inline _syscall0(uid_t, _dl_geteuid);
+
+ #define __NR__dl_getgid __NR_getgid
+-static inline _syscall0(gid_t, _dl_getgid);
++static __always_inline _syscall0(gid_t, _dl_getgid);
+
+ #define __NR__dl_getegid __NR_getegid
+-static inline _syscall0(gid_t, _dl_getegid);
++static __always_inline _syscall0(gid_t, _dl_getegid);
+
+ #define __NR__dl_getpid __NR_getpid
+-static inline _syscall0(gid_t, _dl_getpid);
++static __always_inline _syscall0(gid_t, _dl_getpid);
+
+ #define __NR__dl_readlink __NR_readlink
+-static inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, size_t, bufsiz);
++static __always_inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, size_t, bufsiz);
+
+ #ifdef __NR_mmap
+ #ifdef MMAP_HAS_6_ARGS
+ #define __NR__dl_mmap __NR_mmap
+-static inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
++static __always_inline _syscall6(void *, _dl_mmap, void *, start, size_t, length,
+ int, prot, int, flags, int, fd, off_t, offset);
+ #else
+ #define __NR__dl_mmap_real __NR_mmap
+-static inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
++static __always_inline _syscall1(void *, _dl_mmap_real, unsigned long *, buffer);
+
+-static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
++static __always_inline void * _dl_mmap(void * addr, unsigned long size, int prot,
+ int flags, int fd, unsigned long offset)
+ {
+ unsigned long buffer[6];
+@@ -128,11 +128,12 @@ static inline void * _dl_mmap(void * add
+ #endif
+ #elif defined __NR_mmap2
+ #define __NR___syscall_mmap2 __NR_mmap2
+-static inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
++static __always_inline _syscall6(__ptr_t, __syscall_mmap2, __ptr_t, addr,
+ size_t, len, int, prot, int, flags, int, fd, off_t, offset);
+ /*always 12, even on architectures where PAGE_SHIFT != 12 */
+ #define MMAP2_PAGE_SHIFT 12
+-static inline void * _dl_mmap(void * addr, unsigned long size, int prot,
++#define MAP_FAILED ((void *) -1)
++static __always_inline void * _dl_mmap(void * addr, unsigned long size, int prot,
+ int flags, int fd, unsigned long offset)
+ {
+ if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
+Index: uClibc-0.9.28-avr32/ldso/ldso/avr32/dl-debug.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/ldso/ldso/avr32/dl-debug.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,45 @@
++/*
++ * AVR32 ELF shared libary loader support
++ *
++ * Copyright (C) 2005 Atmel Norway
++ * 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.
++ */
++
++static const char *_dl_reltypes_tab[] = {
++ "R_AVR32_NONE",
++ "R_AVR32_32", "R_AVR32_16", "R_AVR32_8",
++ "R_AVR32_32_PCREL", "R_AVR32_16_PCREL", "R_AVR32_8_PCREL",
++ "R_AVR32_DIFF32", "R_AVR32_DIFF16", "R_AVR32_DIFF8",
++ "R_AVR32_GOT32", "R_AVR32_GOT16", "R_AVR32_GOT8",
++ "R_AVR32_21S", "R_AVR32_16U", "R_AVR32_16S", "R_AVR32_8S", "R_AVR32_8S_EXT",
++ "R_AVR32_22H_PCREL", "R_AVR32_18W_PCREL", "R_AVR32_16B_PCREL",
++ "R_AVR32_16N_PCREL", "R_AVR32_14UW_PCREL", "R_AVR32_11H_PCREL",
++ "R_AVR32_10UW_PCREL", "R_AVR32_9H_PCREL", "R_AVR32_9UW_PCREL",
++ "R_AVR32_HI16", "R_AVR32_LO16",
++ "R_AVR32_GOTPC", "R_AVR32_GOTCALL", "R_AVR32_LDA_GOT",
++ "R_AVR32_GOT21S", "R_AVR32_GOT18SW", "R_AVR32_GOT16S", "R_AVR32_GOT7UW",
++ "R_AVR32_32_CPENT", "R_AVR32_CPCALL", "R_AVR32_16_CP", "R_AVR32_9W_CP",
++ "R_AVR32_RELATIVE", "R_AVR32_GLOB_DAT", "R_AVR32_JMP_SLOT",
++ "R_AVR32_ALIGN",
++};
+Index: uClibc-0.9.28-avr32/ldso/ldso/avr32/dl-startup.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/ldso/ldso/avr32/dl-startup.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,110 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * Architecture specific code used by dl-startup.c
++ * Copyright (C) 2005 Atmel Norway
++ */
++
++/* This is the library loader's main entry point. Let _dl_boot2 do its
++ * initializations and jump to the application's entry point
++ * afterwards. */
++asm( " .text\n"
++ " .global _start\n"
++ " .type _start,@function\n"
++ "_start:\n"
++ /* All arguments are on the stack initially */
++ " mov r12, sp\n"
++ " rcall _dl_start\n"
++ /* Returns user entry point in r12. Save it. */
++ " mov r0, r12\n"
++ /* We're PIC, so get the Global Offset Table */
++ " lddpc r6, .L_GOT\n"
++ ".L_RGOT:\n"
++ " rsub r6, pc\n"
++ /* Adjust argc and argv according to _dl_skip_args */
++ " ld.w r1, r6[_dl_skip_args@got]\n"
++ " ld.w r1, r1[0]\n"
++ " ld.w r2, sp++\n"
++ " sub r2, r1\n"
++ " add sp, sp, r1 << 2\n"
++ " st.w --sp, r2\n"
++ /* Load the finalizer function */
++ " ld.w r12, r6[_dl_fini@got]\n"
++ /* Jump to the user's entry point */
++ " mov pc, r0\n\n"
++
++ " .align 2\n"
++ ".L_GOT:"
++ " .long .L_RGOT - _GLOBAL_OFFSET_TABLE_\n"
++ " .size _start, . - _start\n"
++ " .previous\n");
++
++/* Get a pointer to the argv array. On many platforms this can be just
++ * the address if the first argument, on other platforms we need to
++ * do something a little more subtle here. */
++#define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long *)ARGS + 1)
++
++
++/* We can't call functions before the GOT has been initialized */
++#define NO_FUNCS_BEFORE_BOOTSTRAP
++
++/*
++ * Relocate the GOT during dynamic loader bootstrap. This will add
++ * the load address to all entries in the GOT, which is necessary
++ * because the linker doesn't generate R_AVR32_RELATIVE relocs for the
++ * GOT.
++ */
++static __always_inline
++void PERFORM_BOOTSTRAP_GOT(struct elf_resolve *tpnt)
++{
++ Elf32_Addr i, nr_got;
++ register Elf32_Addr *__r6 __asm__("r6");
++ Elf32_Addr *got = __r6;
++
++ nr_got = tpnt->dynamic_info[DT_AVR32_GOTSZ_IDX] / sizeof(*got);
++ for (i = 2; i < nr_got; i++)
++ got[i] += tpnt->loadaddr;
++}
++
++#define PERFORM_BOOTSTRAP_GOT(tpnt) PERFORM_BOOTSTRAP_GOT(tpnt)
++
++/* Handle relocation of the symbols in the dynamic loader. */
++static __always_inline
++void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
++ unsigned long symbol_addr,
++ unsigned long load_addr, Elf32_Sym *symtab)
++{
++ switch(ELF32_R_TYPE(rpnt->r_info)) {
++ case R_AVR32_NONE:
++ break;
++ case R_AVR32_GLOB_DAT:
++ case R_AVR32_JMP_SLOT:
++ *reloc_addr = symbol_addr;
++ break;
++ case R_AVR32_RELATIVE:
++ SEND_STDERR_DEBUG("Applying RELATIVE relocation: ");
++ SEND_ADDRESS_STDERR_DEBUG(load_addr, 0);
++ SEND_STDERR_DEBUG(" + ");
++ SEND_ADDRESS_STDERR_DEBUG(rpnt->r_addend, 1);
++ *reloc_addr = load_addr + rpnt->r_addend;
++ break;
++ default:
++ SEND_STDERR("BOOTSTRAP_RELOC: unhandled reloc_type ");
++ SEND_NUMBER_STDERR(ELF32_R_TYPE(rpnt->r_info), 1);
++ SEND_STDERR("REL, SYMBOL, LOAD: ");
++ SEND_ADDRESS_STDERR(reloc_addr, 0);
++ SEND_STDERR(", ");
++ SEND_ADDRESS_STDERR(symbol_addr, 0);
++ SEND_STDERR(", ");
++ SEND_ADDRESS_STDERR(load_addr, 1);
++ _dl_exit(1);
++ }
++}
++
++/* Transfer control to the user's application, once the dynamic loader
++ * is done. This routine has to exit the current function, then call
++ * the _dl_elf_main function.
++ *
++ * Since our _dl_boot will simply call whatever is returned by
++ * _dl_boot2, we can just return the address we're supposed to
++ * call. */
++#define START() return _dl_elf_main;
+Index: uClibc-0.9.28-avr32/ldso/ldso/avr32/dl-syscalls.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/ldso/ldso/avr32/dl-syscalls.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,5 @@
++/* We can't use the real errno in ldso, since it has not yet
++ * been dynamicly linked in yet. */
++extern int _dl_errno;
++#define __set_errno(X) {(_dl_errno) = (X);}
++#include "sys/syscall.h"
+Index: uClibc-0.9.28-avr32/ldso/ldso/avr32/dl-sysdep.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/ldso/ldso/avr32/dl-sysdep.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,103 @@
++/* vi: set sw=4 ts=4: */
++/*
++ * Various assembly language/system dependent hacks that are required
++ * so that we can minimize the amount of platform specific code.
++ * Copyright (C) 2004-2005 Atmel Norway
++ */
++
++/* Define this if the system uses RELOCA. */
++#define ELF_USES_RELOCA
++
++#include <elf.h>
++
++#define ARCH_NUM 1
++#define DT_AVR32_GOTSZ_IDX (DT_NUM + OS_NUM)
++
++#define ARCH_DYNAMIC_INFO(dpnt, dynamic, debug_addr) \
++ do { \
++ if (dpnt->d_tag == DT_AVR32_GOTSZ) \
++ dynamic[DT_AVR32_GOTSZ_IDX] = dpnt->d_un.d_val; \
++ } while (0)
++
++/* Initialization sequence for the application/library GOT. */
++#define INIT_GOT(GOT_BASE,MODULE) \
++ do { \
++ unsigned long i, nr_got; \
++ \
++ GOT_BASE[0] = (unsigned long) _dl_linux_resolve; \
++ GOT_BASE[1] = (unsigned long) MODULE; \
++ \
++ /* Add load address displacement to all GOT entries */ \
++ nr_got = MODULE->dynamic_info[DT_AVR32_GOTSZ_IDX] / 4; \
++ for (i = 2; i < nr_got; i++) \
++ GOT_BASE[i] += (unsigned long)MODULE->loadaddr; \
++ } while (0)
++
++#define do_rem(result, n, base) ((result) = (n) % (base))
++
++/* Here we define the magic numbers that this dynamic loader should accept */
++#define MAGIC1 EM_AVR32
++#undef MAGIC2
++
++/* Used for error messages */
++#define ELF_TARGET "AVR32"
++
++unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got);
++
++/* 4096 bytes alignment */
++#define PAGE_ALIGN 0xfffff000
++#define ADDR_ALIGN 0xfff
++#define OFFS_ALIGN 0x7ffff000
++
++#define elf_machine_type_class(type) \
++ ((type == R_AVR32_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)
++
++/* AVR32 doesn't need any COPY relocs */
++#define DL_NO_COPY_RELOCS
++
++/* Return the link-time address of _DYNAMIC. Conveniently, this is the
++ first element of the GOT. This must be inlined in a function which
++ uses global data. */
++static inline Elf32_Addr
++elf_machine_dynamic (void)
++{
++ register Elf32_Addr *got asm ("r6");
++ return *got;
++}
++
++/* Return the run-time load address of the shared object. */
++static inline Elf32_Addr
++elf_machine_load_address (void)
++{
++ extern void __dl_start asm("_dl_start");
++ Elf32_Addr got_addr = (Elf32_Addr) &__dl_start;
++ Elf32_Addr pcrel_addr;
++
++ asm (" lddpc %0, 2f\n"
++ "1: add %0, pc\n"
++ " rjmp 3f\n"
++ " .align 2\n"
++ "2: .long _dl_start - 1b\n"
++ "3:\n"
++ : "=r"(pcrel_addr) : : "cc");
++
++ return pcrel_addr - got_addr;
++}
++
++/*
++ * Perform any RELATIVE relocations specified by DT_RELCOUNT.
++ * Currently, we don't use that tag, but we might in the future as
++ * this would reduce the startup time somewhat (although probably not by much).
++ */
++static inline void
++elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
++ Elf32_Word relative_count)
++{
++ Elf32_Rela *rpnt = (void *)rel_addr;
++
++ do {
++ Elf32_Addr *reloc_addr;
++ reloc_addr = (void *)(load_off + (rpnt++)->r_offset);
++ *reloc_addr = load_off + rpnt->r_addend;
++ } while (--relative_count);
++}
+Index: uClibc-0.9.28-avr32/ldso/ldso/avr32/elfinterp.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/ldso/ldso/avr32/elfinterp.c 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,191 @@
++/*
++ * AVR32 ELF shared library loader suppport
++ *
++ * Copyright (C) 2004-2006 Atmel Corporation
++ *
++ * 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.
++ */
++
++unsigned long _dl_linux_resolver(unsigned long got_offset, unsigned long *got)
++{
++ struct elf_resolve *tpnt = (struct elf_resolve *)got[1];
++ Elf32_Sym *sym;
++ unsigned long local_gotno;
++ unsigned long gotsym;
++ unsigned long new_addr;
++ char *strtab, *symname;
++ unsigned long *entry;
++ unsigned long sym_index = got_offset / 4;
++
++#if 0
++ local_gotno = tpnt->dynamic_info[DT_AVR32_LOCAL_GOTNO];
++ gotsym = tpnt->dynamic_info[DT_AVR32_GOTSYM];
++
++ sym = ((Elf32_Sym *)(tpnt->dynamic_info[DT_SYMTAB] + tpnt->loadaddr))
++ + sym_index;
++ strtab = (char *)(tpnt->dynamic_info[DT_STRTAB] + tpnt->loadaddr);
++ symname = strtab + sym->st_name;
++
++#if 0
++ new_addr = (unsigned long) _dl_find_hash(strtab + sym->st_name,
++ tpnt->symbol_scope, tpnt,
++ resolver);
++#endif
++
++ entry = (unsigned long *)(got + local_gotno + sym_index - gotsym);
++ *entry = new_addr;
++#endif
++
++ return new_addr;
++}
++
++static int
++_dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ unsigned long rel_addr, unsigned long rel_size,
++ int (*reloc_func)(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab))
++{
++ Elf32_Sym *symtab;
++ Elf32_Rela *rpnt;
++ char *strtab;
++ int i;
++
++ rpnt = (Elf32_Rela *)rel_addr;
++ rel_size /= sizeof(Elf32_Rela);
++ symtab = (Elf32_Sym *)tpnt->dynamic_info[DT_SYMTAB];
++ strtab = (char *)tpnt->dynamic_info[DT_STRTAB];
++
++ for (i = 0; i < rel_size; i++, rpnt++) {
++ int symtab_index, res;
++
++ symtab_index = ELF32_R_SYM(rpnt->r_info);
++
++ debug_sym(symtab, strtab, symtab_index);
++ debug_reloc(symtab, strtab, rpnt);
++
++ res = reloc_func(tpnt, scope, rpnt, symtab, strtab);
++
++ if (res == 0)
++ continue;
++
++ _dl_dprintf(2, "\n%s: ", _dl_progname);
++
++ if (symtab_index)
++ _dl_dprintf(2, "symbol '%s': ",
++ strtab + symtab[symtab_index].st_name);
++
++ if (res < 0) {
++ int reloc_type = ELF32_R_TYPE(rpnt->r_info);
++#if defined(__SUPPORT_LD_DEBUG__)
++ _dl_dprintf(2, "can't handle reloc type %s\n",
++ _dl_reltypes(reloc_type));
++#else
++ _dl_dprintf(2, "can't handle reloc type %x\n",
++ reloc_type);
++#endif
++ _dl_exit(-res);
++ } else {
++ _dl_dprintf(2, "can't resolve symbol\n");
++ return res;
++ }
++ }
++
++ return 0;
++}
++
++static int _dl_do_reloc(struct elf_resolve *tpnt, struct dyn_elf *scope,
++ Elf32_Rela *rpnt, Elf32_Sym *symtab, char *strtab)
++{
++ int reloc_type;
++ int symtab_index;
++ char *symname;
++ unsigned long *reloc_addr;
++ unsigned long symbol_addr;
++#if defined(__SUPPORT_LD_DEBUG__)
++ unsigned long old_val;
++#endif
++
++ reloc_addr = (unsigned long *)(tpnt->loadaddr + rpnt->r_offset);
++ reloc_type = ELF32_R_TYPE(rpnt->r_info);
++ symtab_index = ELF32_R_SYM(rpnt->r_info);
++ symbol_addr = 0;
++ symname = strtab + symtab[symtab_index].st_name;
++
++ if (symtab_index) {
++ symbol_addr = (unsigned long)
++ _dl_find_hash(strtab + symtab[symtab_index].st_name,
++ tpnt->symbol_scope, tpnt,
++ elf_machine_type_class(reloc_type));
++
++ /* Allow undefined references to weak symbols */
++ if (!symbol_addr &&
++ ELF32_ST_BIND(symtab[symtab_index].st_info) != STB_WEAK) {
++ _dl_dprintf(2, "%s: can't resolve symbol '%s'\n",
++ _dl_progname, symname);
++ return 0;
++ }
++ }
++
++#if defined(__SUPPORT_LD_DEBUG__)
++ old_val = *reloc_addr;
++#endif
++ switch (reloc_type) {
++ case R_AVR32_NONE:
++ break;
++ case R_AVR32_GLOB_DAT:
++ case R_AVR32_JMP_SLOT:
++ *reloc_addr = symbol_addr + rpnt->r_addend;
++ break;
++ case R_AVR32_RELATIVE:
++ *reloc_addr = (unsigned long)tpnt->loadaddr
++ + rpnt->r_addend;
++ break;
++ default:
++ return -1;
++ }
++
++#if defined(__SUPPORT_LD_DEBUG__)
++ if (_dl_debug_reloc && _dl_debug_detail)
++ _dl_dprintf(_dl_debug_file, "\tpatched: %x ==> %x @ %x\n",
++ old_val, *reloc_addr);
++#endif
++
++ return 0;
++}
++
++void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
++ unsigned long rel_addr,
++ unsigned long rel_size)
++{
++ /* TODO: Might want to support this in order to get faster
++ * startup times... */
++}
++
++int _dl_parse_relocation_information(struct dyn_elf *rpnt,
++ unsigned long rel_addr,
++ unsigned long rel_size)
++{
++ return _dl_parse(rpnt->dyn, rpnt->dyn->symbol_scope, rel_addr, rel_size,
++ _dl_do_reloc);
++}
+Index: uClibc-0.9.28-avr32/ldso/ldso/avr32/resolve.S
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/ldso/ldso/avr32/resolve.S 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,28 @@
++/*
++ * Linux dynamic resolving code for AVR32. Fixes up the GOT entry as
++ * indicated in register r12 and jumps to the resolved address.
++ *
++ * 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.
++ *
++ * Copyright (C) 2004 Atmel Norway
++ */
++
++#define ip r5
++
++ .text
++ .global _dl_linux_resolve
++ .type _dl_linux_resolve,@function
++_dl_linux_resolve:
++ /* The PLT code pushed r8 for us. It contains the address of this
++ function's GOT entry, that is entry 0. ip contains the address
++ of the GOT entry of the function we wanted to call. */
++ stm --sp, r9-r12, lr
++ mov r11, r8
++ sub r12, ip, r8
++ rcall _dl_linux_resolver
++ mov ip, r12
++ popm r8-r12,lr
++ mov pc, ip
++ .size _dl_linux_resolve, . - _dl_linux_resolve
+Index: uClibc-0.9.28-avr32/ldso/ldso/dl-startup.c
+===================================================================
+--- uClibc-0.9.28-avr32.orig/ldso/ldso/dl-startup.c 2006-10-19 15:05:48.000000000 +0200
++++ uClibc-0.9.28-avr32/ldso/ldso/dl-startup.c 2006-10-19 15:05:52.000000000 +0200
+@@ -217,7 +217,9 @@ static void * __attribute_used__ _dl_sta
+ /* some arches (like MIPS) we have to tweak the GOT before relocations */
+ PERFORM_BOOTSTRAP_GOT(tpnt);
+
+-#else
++#endif
++
++#if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__)
+
+ /* OK, now do the relocations. We do not do a lazy binding here, so
+ that once we are done, we have considerably more flexibility. */
+@@ -259,7 +261,7 @@ static void * __attribute_used__ _dl_sta
+ rel_addr += relative_count * sizeof(ELF_RELOC);;
+ }
+
+- rpnt = (ELF_RELOC *) (rel_addr + load_addr);
++ rpnt = (ELF_RELOC *) (rel_addr /* + load_addr */);
+ for (i = 0; i < rel_size; i += sizeof(ELF_RELOC), rpnt++) {
+ reloc_addr = (unsigned long *) (load_addr + (unsigned long) rpnt->r_offset);
+ symtab_index = ELF_R_SYM(rpnt->r_info);
+Index: uClibc-0.9.28-avr32/utils/ldd.c
+===================================================================
+--- uClibc-0.9.28-avr32.orig/utils/ldd.c 2006-10-19 15:05:48.000000000 +0200
++++ uClibc-0.9.28-avr32/utils/ldd.c 2006-10-19 15:05:52.000000000 +0200
+@@ -56,6 +56,11 @@
+ #define ELFCLASSM ELFCLASS32
+ #endif
+
++#if defined(__avr32__)
++#define MATCH_MACHINE(x) (x == EM_AVR32)
++#define ELFCLASSM ELFCLASS32
++#endif
++
+ #if defined(__s390__)
+ #define MATCH_MACHINE(x) (x == EM_S390)
+ #define ELFCLASSM ELFCLASS32
+Index: uClibc-0.9.28-avr32/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ uClibc-0.9.28-avr32/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h 2006-10-19 15:05:52.000000000 +0200
+@@ -0,0 +1,92 @@
++/* Machine-dependent pthreads configuration and inline functions.
++
++ Copyright (C) 2005 Atmel Norway
++ 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; see the file COPYING.LIB. If not,
++ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
++ Boston, MA 02111-1307, USA. */
++
++#ifndef _PT_MACHINE_H
++#define _PT_MACHINE_H 1
++
++#include <features.h>
++
++static inline int
++_test_and_set (int *p, int v) __THROW
++{
++ int result;
++
++ __asm__ __volatile__(
++ "/* Inline test and set */\n"
++ "1: ssrf 5\n"
++ " ld.w %0, %2\n"
++ " tst %0, %3\n"
++ " breq 2f\n"
++ " stcond %1, %3\n"
++ " brne 1b\n"
++ "2:"
++ : "=&r"(result), "=m"(*p)
++ : "m"(*p), "r"(v)
++ : "memory", "cc");
++
++ return result;
++}
++
++#ifndef PT_EI
++# define PT_EI extern inline
++#endif
++
++extern long int testandset (int *spinlock);
++extern int __compare_and_swap (long int *p, long int oldval, long int newval);
++
++/* Spinlock implementation; required. */
++PT_EI long int
++testandset (int *spinlock)
++{
++ return _test_and_set(spinlock, 1);
++}
++
++
++/* Get some notion of the current stack. Need not be exactly the top
++ of the stack, just something somewhere in the current frame. */
++#define CURRENT_STACK_FRAME stack_pointer
++register char * stack_pointer __asm__ ("sp");
++
++/* Compare-and-swap for semaphores. */
++
++#define HAS_COMPARE_AND_SWAP
++PT_EI int
++__compare_and_swap(long int *p, long int oldval, long int newval)
++{
++ long int result, tmp;
++
++ __asm__ __volatile__(
++ "/* Inline compare and swap */\n"
++ "1: ssrf 5\n"
++ " ld.w %1, %3\n"
++ " cp.w %1, %5\n"
++ " sreq %0\n"
++ " brne 2f\n"
++ " stcond %2, %4\n"
++ " brne 1b\n"
++ "2:"
++ : "=&r"(result), "=&r"(tmp), "=m"(*p)
++ : "m"(*p), "r"(newval), "r"(oldval)
++ : "cc", "memory");
++
++ return result;
++}
++
++#endif /* pt-machine.h */
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/uClibc.config b/packages/uclibc/uclibc-0.9.28/avr32/uClibc.config
index c59defd311..478c713cb8 100644
--- a/packages/uclibc/uclibc-0.9.28/avr32/uClibc.config
+++ b/packages/uclibc/uclibc-0.9.28/avr32/uClibc.config
@@ -32,23 +32,6 @@ ARCH_SUPPORTS_BIG_ENDIAN=y
UCLIBC_COMPLETELY_PIC=y
CONFIG_AP7000=y
LINKRELAX=y
-# CONFIG_GENERIC_386 is not set
-# CONFIG_386 is not set
-# CONFIG_486 is not set
-# CONFIG_586 is not set
-# CONFIG_586MMX is not set
-# CONFIG_686 is not set
-# CONFIG_PENTIUMII is not set
-# CONFIG_PENTIUMIII is not set
-# CONFIG_PENTIUM4 is not set
-# CONFIG_K6 is not set
-# CONFIG_K7 is not set
-# CONFIG_ELAN is not set
-# CONFIG_CRUSOE is not set
-# CONFIG_WINCHIPC6 is not set
-# CONFIG_WINCHIP2 is not set
-# CONFIG_CYRIXIII is not set
-# CONFIG_NEHEMIAH is not set
# ARCH_LITTLE_ENDIAN is not set
ARCH_BIG_ENDIAN=y
# ARCH_HAS_NO_MMU is not set
@@ -57,7 +40,7 @@ UCLIBC_HAS_FLOATS=y
# HAS_FPU is not set
UCLIBC_HAS_SOFT_FLOAT=y
DO_C99_MATH=y
-KERNEL_SOURCE="/usr/src/linux"
+KERNEL_SOURCE="/media/hda4/OE/build/tmp-new/angstrom/cross/avr32-angstrom-linux-uclibc"
C_SYMBOL_PREFIX=""
HAVE_DOT_CONFIG=y
@@ -86,7 +69,7 @@ UCLIBC_STATIC_LDCONFIG=y
# MALLOC is not set
# MALLOC_SIMPLE is not set
MALLOC_STANDARD=y
-# MALLOC_GLIBC_COMPAT is not set
+MALLOC_GLIBC_COMPAT=y
UCLIBC_DYNAMIC_ATEXIT=y
HAS_SHADOW=y
UNIX98PTY_ONLY=y
@@ -102,6 +85,7 @@ UCLIBC_TZ_FILE_PATH="/etc/TZ"
#
UCLIBC_HAS_IPV6=y
UCLIBC_HAS_RPC=y
+UCLIBC_HAS_FULL_RPC=y
#
# String and Stdio Support
@@ -113,11 +97,10 @@ UCLIBC_HAS_CTYPE_SIGNED=y
UCLIBC_HAS_CTYPE_UNSAFE=y
# UCLIBC_HAS_CTYPE_CHECKED is not set
# UCLIBC_HAS_CTYPE_ENFORCED is not set
-# UCLIBC_HAS_WCHAR is not set
+UCLIBC_HAS_WCHAR=y
# UCLIBC_HAS_LOCALE is not set
# UCLIBC_HAS_HEXADECIMAL_FLOATS is not set
# UCLIBC_HAS_GLIBC_CUSTOM_PRINTF is not set
-# USE_OLD_VFPRINTF is not set
UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9
# UCLIBC_HAS_SCANF_GLIBC_A_FLAG is not set
# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set
@@ -155,9 +138,9 @@ UCLIBC_HAS_GLOB=y
#
# Library Installation Options
#
-SHARED_LIB_LOADER_PREFIX="$(DEVEL_PREFIX)/lib"
-RUNTIME_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc/"
-DEVEL_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc/usr/"
+SHARED_LIB_LOADER_PREFIX="/lib"
+RUNTIME_PREFIX="/"
+DEVEL_PREFIX="//usr"
#
# uClibc security related options
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/uclibc-avr32-kernheaders.spec b/packages/uclibc/uclibc-0.9.28/avr32/uclibc-avr32-kernheaders.spec
new file mode 100644
index 0000000000..7d5541cf5a
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/uclibc-avr32-kernheaders.spec
@@ -0,0 +1,41 @@
+Name: uclibc-avr32-kernheaders
+Version: 2.6
+Release: 9
+License: GPL
+Group: Development/System
+Summary: AVR32 header files from the Linux kernel for use by uClibc
+BuildRoot: %{_tmppath}/uclibc-kernheaders-root
+Source: linux-2.6.16.tar.bz2
+Source1: linux-dot-config
+Patch0: linux-2.6.16.11.patch
+Patch1: linux-2.6.16.11-avr32-20060626.patch
+
+%description
+uclibc-avr32-kernheaders contain C header files from the Linux kernel
+which are necessary for building the uClibc library. These header
+files are also necessary for developing programs which use the standard
+C libraries.
+
+If you are developing programs which wil use the standard C libraries,
+you should install uclibc-avr32-kernheaders.
+
+%prep
+%setup -q -n linux-2.6.16
+%patch0 -p1
+%patch1 -p1
+cp %{SOURCE1} .config
+
+%build
+make prepare-all ARCH=avr32 CROSS_COMPILE=avr32-linux-
+
+%install
+mkdir -p %{buildroot}/usr/avr32-linux/include
+cp -a include/{linux,asm,asm-avr32,asm-generic} %{buildroot}/usr/avr32-linux/include
+
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root)
+/usr/avr32-linux/include
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/uclibc-avr32-no-msoft-float.patch b/packages/uclibc/uclibc-0.9.28/avr32/uclibc-avr32-no-msoft-float.patch
new file mode 100644
index 0000000000..0813c456b7
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/uclibc-avr32-no-msoft-float.patch
@@ -0,0 +1,14 @@
+--- uClibc-0.9.28/Rules.mak.orig 2006-03-30 10:23:05.000000000 +0200
++++ uClibc-0.9.28/Rules.mak 2006-03-30 10:23:07.000000000 +0200
+@@ -272,7 +272,11 @@
+ # If -msoft-float isn't supported, we want an error anyway.
+ # Hmm... might need to revisit this for arm since it has 2 different
+ # soft float encodings.
++ifeq ($(strip $(TARGET_ARCH)),avr32)
++# GCC on avr32 doesn't support -msoft-float, it's the default.
++else
+ CPU_CFLAGS += -msoft-float
++endif
+ ifeq ($(strip $(TARGET_ARCH)),arm)
+ # No longer needed with current toolchains, but leave it here for now.
+ # If anyone is actually still using gcc 2.95 (say), they can uncomment it.
diff --git a/packages/uclibc/uclibc-0.9.28/avr32/uclibc-makefile.patch b/packages/uclibc/uclibc-0.9.28/avr32/uclibc-makefile.patch
new file mode 100644
index 0000000000..97ed73471f
--- /dev/null
+++ b/packages/uclibc/uclibc-0.9.28/avr32/uclibc-makefile.patch
@@ -0,0 +1,16 @@
+Index: uclibc/Makefile
+===================================================================
+RCS file: /disk1/ic_group/design/I9980/REPOSITORY/I7413/source/uclibc/Makefile,v
+retrieving revision 1.1.1.3
+diff -u -r1.1.1.3 Makefile
+--- uclibc/Makefile 31 Aug 2005 13:08:25 -0000 1.1.1.3
++++ uclibc/Makefile 7 Dec 2005 06:38:39 -0000
+@@ -163,7 +163,7 @@
+ else \
+ extra_exclude="" ; \
+ fi ; \
+- tar -chf - include --exclude .svn --exclude CVS $$extra_exclude \
++ tar -chf - --exclude .svn --exclude CVS $$extra_exclude include \
+ | tar -xf - -C $(PREFIX)$(DEVEL_PREFIX)
+ ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
+ # Remove floating point related headers since float support is disabled.
diff --git a/packages/uclibc/uclibc.inc b/packages/uclibc/uclibc.inc
index 7fb8e5cf28..e57ef174a9 100644
--- a/packages/uclibc/uclibc.inc
+++ b/packages/uclibc/uclibc.inc
@@ -141,7 +141,7 @@ do_configure() {
echo "# CONFIG_ARM_EABI is not set" >> ${S}/.config
fi
- oe_runmake oldconfig
+ yes '' | oe_runmake oldconfig
}
do_stage() {
@@ -151,7 +151,6 @@ do_stage() {
RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
install_dev install_runtime
- oe_runmake utils
oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
install_utils
@@ -189,8 +188,14 @@ do_stage() {
}
do_install() {
+ # Install into the cross dir (this MUST be done first because we
+ # will install crt1.o in the install_dev stage and gcc needs it)
+ oe_runmake PREFIX= DEVEL_PREFIX=${UCLIBC_PREFIX}/ \
+ RUNTIME_PREFIX=${UCLIBC_PREFIX}/ \
+ install_dev install_runtime
+
oe_runmake PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
- install_dev install_runtime install_utils
+ install_dev install_runtime
# We don't really need this in ${includedir}
rm -f ${D}${prefix}/include/.cvsignore
@@ -216,5 +221,9 @@ do_install() {
mv ${D}/usr/bin/* ${D}${bindir}/
rmdir ${D}/usr/bin
fi
+
+ oe_runmake utils
+ oe_runmake PREFIX=${D} DEVEL_PREFIX=${prefix}/ RUNTIME_PREFIX=/ \
+ install_utils
}
diff --git a/packages/uclibc/uclibc_0.9.28.bb b/packages/uclibc/uclibc_0.9.28.bb
index 2c557ec606..d5d1bae4be 100644
--- a/packages/uclibc/uclibc_0.9.28.bb
+++ b/packages/uclibc/uclibc_0.9.28.bb
@@ -1,5 +1,5 @@
DEFAULT_PREFERENCE = "1"
-PR = "r9"
+PR = "r10"
require uclibc.inc
@@ -47,6 +47,30 @@ SRC_URI += " ${THUMB_INTERWORK_RESOLVE_PATCH}"
DEFAULT_PREFERENCE_avr32 = "6000"
-SRC_URI_append_avr32 = " http://avr32linux.org/twiki/pub/Main/MicroClibcPatches/uClibc-0.9.28-avr1.patch.bz2;patch=1 "
-
+SRC_URI_append_avr32 = " \
+ file://uclibc-makefile.patch;patch=1 \
+ file://remove-bogus-version-hack-and-just-use-asm-generic-if-it-exists.patch;patch=1 \
+ file://let-optimized-stringops-override-default-ones.patch;patch=1 \
+ file://fix-getrusage-argument-type.patch;patch=1 \
+ file://fix-__libc_fcntl64-varargs-prototype.patch;patch=1 \
+ file://fix-broken-__libc_open-declaration.patch;patch=1 \
+ file://avr32-arch-2.patch;patch=1 \
+ file://avr32-linkrelax-option.patch;patch=1 \
+ file://avr32-string-ops.patch;patch=1 \
+ file://no-create_module-on-avr32.patch;patch=1 \
+ file://ldso-always-inline-_dl_memcpy.patch;patch=1 \
+ file://ldso-define-MAP_FAILED.patch;patch=1 \
+ file://ldso-always-inline-syscalls.patch;patch=1 \
+ file://ldso-avr32-2.patch;patch=1 \
+ file://ldso-avr32-needs-CONSTANT_STRING_GOT_FIXUP.patch;patch=1 \
+ file://ldso-avr32-startup-hack.patch;patch=1 \
+ file://ldd-avr32-support.patch;patch=1 \
+ file://libpthread-avr32.patch;patch=1 \
+ file://sync-fcntl-h-with-linux-kernel.patch;patch=1 \
+ "
+
+
+#file://uClibc-0.9.28-avr32-20060621.patch;patch=1 \
+#file://uClibc-0.9.28-avr32-20061019.patch;patch=1 \
+#file://uclibc-avr32-no-msoft-float.patch;patch=1 \
diff --git a/packages/util-linux/files/fdiskbsdlabel-avr32.patch b/packages/util-linux/files/fdiskbsdlabel-avr32.patch
new file mode 100644
index 0000000000..4a7d8f4dc8
--- /dev/null
+++ b/packages/util-linux/files/fdiskbsdlabel-avr32.patch
@@ -0,0 +1,11 @@
+--- /tmp/fdiskbsdlabel.h 2007-09-14 08:52:56.188364759 +0200
++++ util-linux-2.12r/fdisk/fdiskbsdlabel.h 2007-09-14 08:53:31.279986639 +0200
+@@ -43,7 +43,7 @@
+
+ #define BSD_LINUX_BOOTDIR "/usr/ucb/mdec"
+
+-#if defined (i386) || defined (__sparc__) || defined (__arm__) || defined (__mips__) || defined (__s390__) || defined (__sh__) || defined(__x86_64__)
++#if defined (i386) || defined (__sparc__) || defined (__arm__) || defined (__mips__) || defined (__s390__) || defined (__sh__) || defined(__x86_64__) || defined(__avr32__)
+ #define BSD_LABELSECTOR 1
+ #define BSD_LABELOFFSET 0
+ #elif defined (__alpha__) || defined (__powerpc__) || defined (__ia64__) || defined (__hppa__)
diff --git a/packages/util-linux/util-linux_2.12r.bb b/packages/util-linux/util-linux_2.12r.bb
index 9d4b59c855..7f8c3dd9f8 100644
--- a/packages/util-linux/util-linux_2.12r.bb
+++ b/packages/util-linux/util-linux_2.12r.bb
@@ -3,5 +3,6 @@ require util-linux.inc
SRC_URI += "file://util-linux_2.12r-12.diff.gz;patch=1"
SRC_URI += "file://glibc-fix.patch;patch=1"
SRC_URI += "file://glibc-umount2.patch;patch=1"
+SRC_URI += "file://fdiskbsdlabel-avr32.patch;patch=1"
-PR = "r12"
+PR = "r13"
diff --git a/packages/xorg-font/xfonts-xorg_6.8.bb b/packages/xorg-font/xfonts-xorg_6.8.bb
index f6710dcd5b..e5d0271516 100644
--- a/packages/xorg-font/xfonts-xorg_6.8.bb
+++ b/packages/xorg-font/xfonts-xorg_6.8.bb
@@ -3,9 +3,10 @@ PR = "r1"
# XXX Is this true? These fonts are from X.org.
LICENSE = "XFree86"
-SRC_URI = "${FREEDESKTOP_CVS}/xorg;module=xc;tag=XORG-6_8_0;method=pserver \
- file://lexer.patch;patch=1"
+SRC_URI = "${FREEDESKTOP_CVS}/xorg;module=xc;tag=XORG-6_8_0;method=pserver"
+# not necessary, breaks things:
+#file://lexer.patch;patch=1"
PACKAGES = "${PN}-75dpi ${PN}-100dpi ${PN}-type1 ${PN}-cyrillic ${PN}-ttf ${PN}"
FILES_${PN}-75dpi = "${libdir}/X11/fonts/75dpi"
diff --git a/packages/xorg-lib/libx11-native_1.0.1.bb b/packages/xorg-lib/libx11-native_1.0.1.bb
index 7bc5fd3524..cc33aa30ba 100644
--- a/packages/xorg-lib/libx11-native_1.0.1.bb
+++ b/packages/xorg-lib/libx11-native_1.0.1.bb
@@ -3,6 +3,7 @@ SECTION = "x11/libs"
PRIORITY = "optional"
LICENSE = "XFree86"
PE = "1"
+PR = "r1"
FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/libx11"
@@ -11,7 +12,7 @@ PROVIDES = "x11-native"
XORG_PN = "libX11"
-SRC_URI = "${XORG_MIRROR}/individual/lib/${XORG_PN}-1.1.1.tar.bz2"
+SRC_URI = "${XORG_MIRROR}/individual/lib/${XORG_PN}-1.0.1.tar.bz2"
S = "${WORKDIR}/libX11-${PV}"
inherit native autotools pkgconfig
diff --git a/packages/xorg-xserver/xorg-xserver-common.inc b/packages/xorg-xserver/xorg-xserver-common.inc
index 2e8535ef30..94215aae7b 100644
--- a/packages/xorg-xserver/xorg-xserver-common.inc
+++ b/packages/xorg-xserver/xorg-xserver-common.inc
@@ -24,6 +24,7 @@ S = "${WORKDIR}/${XORG_PN}-${PV}"
inherit autotools pkgconfig
PACKAGES =+ "${PN}-xprint ${PN}-xvfb ${PN}-utils"
+#PACKAGES =+ "${PN}-xvfb ${PN}-utils"
FILES_${PN}-xprint = "${libdir}/X11/xserver/*/print"
FILES_${PN}-xvfb = "${bindir}/Xvfb"
diff --git a/packages/xorg-xserver/xserver-kdrive_1.3.0.0.bb b/packages/xorg-xserver/xserver-kdrive_1.3.0.0.bb
index 4367e40adf..71d0eccba8 100644
--- a/packages/xorg-xserver/xserver-kdrive_1.3.0.0.bb
+++ b/packages/xorg-xserver/xserver-kdrive_1.3.0.0.bb
@@ -29,6 +29,10 @@ SRC_URI = "${XORG_MIRROR}/individual/xserver/xorg-server-${PV}.tar.bz2 \
file://03-xglamo-no-vesa.patch;patch=1 \
"
+SRC_URI_append_avr32 = " \
+ file://xorg-avr32-support.diff;patch=1 \
+"
+
SRC_URI_append_tosa = "file://tosa-fbdev.patch;patch=1"
PACKAGE_ARCH_xserver-kdrive-fbdev_tosa = "${MACHINE_ARCH}"
diff --git a/packages/xorg-xserver/xserver-kdrive_1.4.bb b/packages/xorg-xserver/xserver-kdrive_1.4.bb
index 50b103495b..f2d9810ec4 100644
--- a/packages/xorg-xserver/xserver-kdrive_1.4.bb
+++ b/packages/xorg-xserver/xserver-kdrive_1.4.bb
@@ -19,7 +19,8 @@ SRC_URI = "${XORG_MIRROR}/individual/xserver/xorg-server-${PV}.tar.bz2 \
file://xcalibrate-new-input-world-order.patch;patch=1 \
file://tslib-default-device.patch;patch=1 \
file://fbdev-evdev.patch;patch=1 \
- "
+ file://xorg-avr32-support.diff;patch=1 \
+ "
S = "${WORKDIR}/xorg-server-${PV}"