Take 2: CRIS/CRISv32 port, newlib part (first part)

Jeff Johnston jjohnstn@redhat.com
Fri Jan 28 00:26:00 GMT 2005


Newlib patch applied.  I believe the top-level configure.in has to applied to 
gcc as well.  I'm having trouble generating the new configure - I use autoconf 
2.13 in newlib and for some reason the copy of 2.59 I have around is kacking. 
    Therefore, you go ahead and check the top-level change in and I'll figure it 
out later.

-- Jeff J.

Hans-Peter Nilsson wrote:
>>Date: Thu, 27 Jan 2005 15:06:16 -0500
>>From: Jeff Johnston <jjohnstn@redhat.com>
> 
> 
>>Please resubmit the entire patch including your fix for memmove.c.  It makes my 
>>life easier as I need to reapply this elsewhere.  I have already accepted the 
>>top-level Makefile patch.  Once that is done, you have permission to directly 
>>change the newlib and libgloss cris-specific files.  Please submit the patches 
>>to this list even though you will be committing them directly.
> 
> 
> Thanks.  Here we go.  At the top is a toplevel configure.in
> patch needed to lift the disabling of newlib and libgloss.  I'll
> apply it after you've applied the newlib stuff, but feel free to
> apply it; you'll need it for devo anyway.
> 
> toplevel:
> 2005-01-28  Hans-Peter Nilsson  <hp@axis.com>
> 
> 	* configure.in (noconfigdirs) <crisv32-*-*>: Match like cris-*-*.
> 	<crisv32-*-*, cris-*-*>: Only disable target-newlib and
> 	target-libgloss when not *-*-elf and *-*-aout.
> 	* configure: Regenerate.
> 
> Index: configure.in
> ===================================================================
> RCS file: /cvs/gcc/gcc/configure.in,v
> retrieving revision 1.338
> diff -c -p -r1.338 configure.in
> *** configure.in	16 Dec 2004 19:50:41 -0000	1.338
> --- configure.in	27 Jan 2005 23:14:29 -0000
> *************** case "${target}" in
> *** 500,507 ****
>     c54x*-*-* | tic54x-*-*)
>       noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj} gcc gdb newlib"
>       ;;
> !   cris-*-*)
> !     noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss"
>       ;;
>     crx-*-*)
>       noconfigdirs="$noconfigdirs target-libstdc++-v3 target-mudflap ${libgcj}"
> --- 500,512 ----
>     c54x*-*-* | tic54x-*-*)
>       noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libgloss ${libgcj} gcc gdb newlib"
>       ;;
> !   cris-*-* | crisv32-*-*)
> !     case "${target}" in
> !       *-*-elf | *-*-aout)
> ! 	noconfigdirs="$noconfigdirs ${libgcj}";;
> !       *)
> ! 	noconfigdirs="$noconfigdirs ${libgcj} target-newlib target-libgloss";;
> !     esac
>       ;;
>     crx-*-*)
>       noconfigdirs="$noconfigdirs target-libstdc++-v3 target-mudflap ${libgcj}"
> 
> 
> newlib:
> 2005-01-28  Hans-Peter Nilsson  <hp@axis.com>
> 
> 	* configure.host: Add support for cris-*-* and crisv32-*-*.
> 	* libc/include/machine/ieeefp.h: Ditto.
> 	* libc/include/machine/setjmp.h: Ditto.
> 	* libc/machine/cris/configure.in, libc/machine/cris/Makefile.am,
> 	libc/machine/cris/libcdtor.c, libc/machine/cris/setjmp.c,
> 	libc/machine/cris/memmove.c, libc/machine/cris/memcpy.c,
> 	libc/machine/cris/memset.c, libc/machine/cris/include/pthread.h,
> 	libc/machine/cris/sys/signal.h, libc/machine/cris/sys/fcntl.h,
> 	libc/machine/cris/sys/errno.h, libc/machine/cris/aclocal.m4,
> 	libc/machine/cris/configure, libc/machine/cris/Makefile.in: New
> 	files.
> 
> Index: configure.host
> ===================================================================
> RCS file: /cvs/src/src/newlib/configure.host,v
> retrieving revision 1.66
> diff -c -p -r1.66 configure.host
> *** configure.host	5 Oct 2004 19:44:24 -0000	1.66
> --- configure.host	27 Jan 2005 23:25:36 -0000
> *************** case "${host_cpu}" in
> *** 93,98 ****
> --- 93,101 ----
>     avr*)
>   	newlib_cflags="${newlib_cflags} -DPREFER_SIZE_OVER_SPEED -mcall-prologues"
>   	;;
> +   cris | crisv32)
> + 	machine_dir=cris
> + 	;;
>     crx*)
>   	machine_dir=crx
>   	;;
> *************** case "${host}" in
> *** 502,507 ****
> --- 505,514 ----
>     avr*)
>   	newlib_cflags="${newlib_cflags} -DNO_EXEC -DSMALL_MEMORY -DMISSING_SYSCALL_NAMES"
>   	;;
> +   cris-*-* | crisv32-*-*)
> + 	newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DHAVE_GETTIMEOFDAY -D_USE_WRITE"
> + 	syscall_dir=syscalls
> + 	;;
>     crx-*-*)
>     	newlib_cflags="${newlib_cflags} -DHAVE_RENAME -DMISSING_SYSCALL_NAMES"
>   	syscall_dir=
> Index: libc/include/machine/ieeefp.h
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/include/machine/ieeefp.h,v
> retrieving revision 1.24
> diff -c -p -r1.24 ieeefp.h
> *** libc/include/machine/ieeefp.h	5 Oct 2004 19:44:24 -0000	1.24
> --- libc/include/machine/ieeefp.h	27 Jan 2005 23:25:36 -0000
> ***************
> *** 265,270 ****
> --- 265,274 ----
>   #endif /* __ARMEL__ */
>   #endif /* __MAVERICK__ */
>   
> + #ifdef __CRIS__
> + #define __IEEE_LITTLE_ENDIAN
> + #endif
> + 
>   #ifndef __IEEE_BIG_ENDIAN
>   #ifndef __IEEE_LITTLE_ENDIAN
>   #error Endianess not declared!!
> Index: libc/include/machine/setjmp.h
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/include/machine/setjmp.h,v
> retrieving revision 1.22
> diff -c -p -r1.22 setjmp.h
> *** libc/include/machine/setjmp.h	25 Oct 2004 17:53:19 -0000	1.22
> --- libc/include/machine/setjmp.h	27 Jan 2005 23:25:36 -0000
> *************** _BEGIN_STD_C
> *** 205,210 ****
> --- 205,214 ----
>   #define _JBLEN 8
>   #endif
>   
> + #ifdef __CRIS__
> + #define _JBLEN 18
> + #endif
> + 
>   #ifdef _JBLEN
>   #ifdef _JBTYPE
>   typedef	_JBTYPE jmp_buf[_JBLEN];
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/configure.in	Tue May  2 18:09:58 2000
> @@ -0,0 +1,12 @@
> +dnl This is the newlib/libc/machine/cris configure.in file.
> +dnl Process this file with autoconf to produce a configure script.
> +
> +AC_PREREQ(2.5)
> +AC_INIT(setjmp.c)
> +
> +dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake. 
> +AC_CONFIG_AUX_DIR(../../../..)
> +
> +NEWLIB_CONFIGURE(../../..)
> +
> +AC_OUTPUT(Makefile)
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/Makefile.am	Wed Jan  5 15:43:01 2005
> @@ -0,0 +1,21 @@
> +## Process this file with automake to generate Makefile.in
> +
> +AUTOMAKE_OPTIONS = cygnus
> +
> +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
> +
> +noinst_LIBRARIES = lib.a
> +
> +# We also make a library with just the useful
> +# machine-but-not-system-specific functions, usable as an add-on
> +# by itself together with e.g. uclibc.
> +toollib_LIBRARIES = libic.a
> +
> +lib_a_SOURCES = setjmp.c memcpy.c memset.c memmove.c libcdtor.c
> +
> +libic_a_SOURCES = setjmp.c memcpy.c memset.c memmove.c libcdtor.c
> +tooldir = $(exec_prefix)/$(host_alias)
> +toollibdir = $(tooldir)/lib$(MULTISUBDIR)
> +
> +ACLOCAL_AMFLAGS = -I ../../..
> +CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/libcdtor.c	Tue Jan 25 12:46:07 2005
> @@ -0,0 +1,88 @@
> +/* Call ctors and dtors from elinux a.out shared libraries.
> +   Copyright (C) 1999, 2000, 2003, 2004, 2005 Axis Communications.
> +   All rights reserved.
> +
> +   Redistribution and use in source and binary forms, with or without
> +   modification, are permitted provided that the following conditions
> +   are met:
> +
> +   1. Redistributions of source code must retain the above copyright
> +      notice, this list of conditions and the following disclaimer.
> +
> +   2. Neither the name of Axis Communications nor the names of its
> +      contributors may be used to endorse or promote products derived
> +      from this software without specific prior written permission.
> +
> +   THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
> +   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
> +   COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
> +   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> +   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> +   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> +   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> +   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
> +   IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> +   POSSIBILITY OF SUCH DAMAGE.  */
> +
> +typedef void (*vfnp) (void);
> +
> +/* The guts of the _Libctors and _Libdtors is "optimized" away into
> +   empty functions when the definition is visible as well.  Simplest
> +   solution is to emit the definitions as asm.  We have no .previous
> +   directive in a.out, so we rely on the fact that everything in this
> +   file goes into the .text section.  */
> +__asm__
> +(
> + ".text\n\t.global .$global.lib.ctors\n.$global.lib.ctors:\n\t.dword 0"
> +);
> +__asm__
> +(
> + ".text\n\t.global .$global.lib.dtors\n.$global.lib.dtors:\n\t.dword 0"
> +);
> +
> +extern vfnp * const _Ctors asm(".$global.lib.ctors");
> +extern vfnp * const _Dtors asm(".$global.lib.dtors");
> +
> +/* We better provide weak empty ctor and dtor lists, since they are not
> +   created if the main program does not have ctor/dtors.  */
> +
> +static vfnp const defaultors[] = {0, 0};
> +
> +extern vfnp * __CTOR_LIST__ __attribute__ ((weak, alias ("defaultors")));
> +extern vfnp * __DTOR_LIST__ __attribute__ ((weak, alias ("defaultors")));
> +
> +void
> +_Libctors (void)
> +{
> +  const vfnp *firstor = _Ctors;
> +  const vfnp *ctors;
> +
> +  /* Have to find the last ctor; they will run in opposite order as in
> +     the table. */
> +  if (firstor != 0 && *firstor != 0)
> +    {
> +      for (ctors = firstor; *ctors != 0; ctors++)
> +	;
> +
> +      while (--ctors != firstor)
> +	{
> +	  (**ctors)();
> +	}
> +
> +      (**ctors)();
> +    }
> +}
> +
> +void
> +_Libdtors(void)
> +{
> +  const vfnp *dtors = _Dtors;
> +
> +  if (dtors)
> +    while (*dtors != 0)
> +      {
> +	(**dtors++) ();
> +      }
> +}
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/setjmp.c	Tue Jan 25 12:47:57 2005
> @@ -0,0 +1,212 @@
> +/* A setjmp.c for CRIS
> +   Copyright (C) 1993-2005 Axis Communications.
> +   All rights reserved.
> +
> +   Redistribution and use in source and binary forms, with or without
> +   modification, are permitted provided that the following conditions
> +   are met:
> +
> +   1. Redistributions of source code must retain the above copyright
> +      notice, this list of conditions and the following disclaimer.
> +
> +   2. Neither the name of Axis Communications nor the names of its
> +      contributors may be used to endorse or promote products derived
> +      from this software without specific prior written permission.
> +
> +   THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
> +   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
> +   COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
> +   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> +   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> +   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> +   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> +   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
> +   IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> +   POSSIBILITY OF SUCH DAMAGE.  */
> +
> +/* For benefit of CRIS v0..v3, we save and restore CCR to be able to
> +   correctly handle DI/EI; otherwise there would be no reason to save it.
> +   Note also that the "move x,ccr" does NOT affect
> +   the DMA enable bits (E and D) of v0..v3.
> +
> +   We do not save mof; it is call-clobbered.  It also does not exist in
> +   v0..v8; it should be safe to read or write to it there, but better not.
> +
> +   jmp_buf[0] - PC
> +   jmp_buf[1] - SP (R14)
> +   jmp_buf[2] - R13
> +   jmp_buf[3] - R12
> +   jmp_buf[4] - R11
> +   jmp_buf[5] - R10
> +   jmp_buf[6] - R9
> +   jmp_buf[7] - R8
> +   jmp_buf[8] - R7
> +   jmp_buf[9] - R6
> +   jmp_buf[10] - R5
> +   jmp_buf[11] - R4
> +   jmp_buf[12] - R3
> +   jmp_buf[13] - R2
> +   jmp_buf[14] - R1
> +   jmp_buf[15] - R0
> +   jmp_buf[16] - SRP
> +   jmp_buf[17] - CCR
> +   */
> +
> +#include <setjmp.h>
> +
> +int
> +setjmp (jmp_buf buf)
> +{
> +  int ret;
> +#if defined (__arch_common_v10_v32) || defined (__arch_v32)
> +  /* No offsets in the compatibility mode.  Also, movem saves in
> +     different order on v10 than on v32, so we use single move
> +     instructions instead, this not being a speed-prioritized operation.
> +     And we don't save CCR or CCS; since long unuseful.  */
> +  __asm__ __volatile__
> +    ("move.d %1,$r13							\n\
> +      move 0f,$mof							\n\
> +      move $mof,[$r13+]							\n\
> +      move.d $sp,[$r13+]						\n\
> +      clear.d [$r13+]							\n\
> +      move.d $r12,[$r13+]						\n\
> +      move.d $r11,[$r13+]						\n\
> +      move.d $r10,[$r13+]						\n\
> +      moveq 1,$r9							\n\
> +      move.d $r9,[$r13+]						\n\
> +      move.d $r8,[$r13+]						\n\
> +      move.d $r7,[$r13+]						\n\
> +      move.d $r6,[$r13+]						\n\
> +      move.d $r5,[$r13+]						\n\
> +      move.d $r4,[$r13+]						\n\
> +      move.d $r3,[$r13+]						\n\
> +      move.d $r2,[$r13+]						\n\
> +      move.d $r1,[$r13+]						\n\
> +      move.d $r0,[$r13+]						\n\
> +      move $srp,[$r13+]							\n\
> +      clear.d [$r13+]							\n\
> +      clear.d $r9							\n\
> +0:									\n\
> +      move.d $r9,%0"
> +
> +     /* Output.  */
> +     : "=&r" (ret)
> +
> +     /* Input.  */
> +     : "r" (buf)
> +
> +     /* Clobber.  */
> +     : "r9", "r13", "memory");
> +#else /* not __arch_common_v10_v32 or __arch_v32 */
> +#ifdef __PIC__
> +  __asm__ __volatile__
> +    ("moveq 1,$r9							\n\
> +      movem $sp,[%1+1*4]						\n\
> +      move.d $pc,$r9							\n\
> +      addq 0f-.,$r9							\n\
> +      move.d $r9,[%1]							\n\
> +      move $srp,[%1+16*4]						\n\
> +      move $ccr,[%1+17*4]						\n\
> +      clear.d $r9							\n\
> +0:									\n\
> +      move.d $r9,%0"
> +
> +     /* Output.  */
> +     : "=&r" (ret)
> +
> +     /* Input.  */
> +     : "r" (buf)
> +
> +     /* Clobber.  */
> +     : "r9", "memory");
> +#else  /* not PIC */
> +  __asm__ __volatile__
> +    ("moveq 1,$r9							\n\
> +      movem $sp,[%1+1*4]						\n\
> +      move.d 0f,$r9							\n\
> +      move.d $r9,[%1]							\n\
> +      move $srp,[%1+16*4]						\n\
> +      move $ccr,[%1+17*4]						\n\
> +      clear.d $r9							\n\
> +0:									\n\
> +      move.d $r9,%0"
> +
> +     /* Output.  */
> +     : "=&r" (ret)
> +
> +     /* Input.  */
> +     : "r" (buf)
> +
> +     /* Clobber.  */
> +     : "r9");
> +#endif /* not PIC */
> +#endif /* not __arch_common_v10_v32 or __arch_v32 */
> +  return ret;
> +}
> +
> +void
> +longjmp(jmp_buf buf, int val)
> +{
> +#if defined (__arch_common_v10_v32) || defined (__arch_v32)
> +  __asm__ __volatile__
> +    ("cmpq 0,%1								\n\
> +      beq 0f								\n\
> +      move.d %0,$r13	; In delay-slot.				\n\
> +      addq 6*4,$r13							\n\
> +      move.d %1,[$r13]							\n\
> +      subq 6*4,$r13							\n\
> +0:\n"
> +#ifdef __arch_common_v10_v32
> +     /* Cater to branch offset difference between v32 and v10.  We
> +	assume the branch above is 8-bit.  */
> +"     setf\n"
> +#endif
> +"     move [$r13+],$mof							\n\
> +      move.d [$r13+],$sp						\n\
> +      addq 4,$r13							\n\
> +      move.d [$r13+],$r12						\n\
> +      move.d [$r13+],$r11						\n\
> +      move.d [$r13+],$r10						\n\
> +      move.d [$r13+],$r9						\n\
> +      move.d [$r13+],$r8						\n\
> +      move.d [$r13+],$r7						\n\
> +      move.d [$r13+],$r6						\n\
> +      move.d [$r13+],$r5						\n\
> +      move.d [$r13+],$r4						\n\
> +      move.d [$r13+],$r3						\n\
> +      move.d [$r13+],$r2						\n\
> +      move.d [$r13+],$r1						\n\
> +      move.d [$r13+],$r0						\n\
> +      move [$r13+],$srp							\n\
> +      move $mof,$r13							\n\
> +      jump $r13								\n\
> +      setf"
> +
> +     /* No outputs.  */
> +     :
> +
> +     /* Inputs.  */
> +     : "r" (buf), "r" (val)
> +     : "r13", "memory");
> +
> +#else /* not __arch_common_v10_v32 or __arch_v32 */
> +  __asm__ __volatile__
> +    ("move [%0+17*4],$ccr						\n\
> +      move [%0+16*4],$srp						\n\
> +      test.d %1								\n\
> +      beq 0f								\n\
> +      nop								\n\
> +      move.d %1,[%0+6*4]	; Offset for r9.			\n\
> +0:									\n\
> +      movem [%0],$pc"
> +
> +     /* No outputs.  */
> +     :
> +
> +     /* Inputs.  */
> +     : "r" (buf), "r" (val)
> +     : "memory");
> +#endif /* not __arch_common_v10_v32 or __arch_v32 */
> +}
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/memmove.c	Wed Jan 26 15:30:19 2005
> @@ -0,0 +1,257 @@
> +/* A memmove for CRIS.
> +   Copyright (C) 2000-2005 Axis Communications.
> +   All rights reserved.
> +
> +   Redistribution and use in source and binary forms, with or without
> +   modification, are permitted provided that the following conditions
> +   are met:
> +
> +   1. Redistributions of source code must retain the above copyright
> +      notice, this list of conditions and the following disclaimer.
> +
> +   2. Neither the name of Axis Communications nor the names of its
> +      contributors may be used to endorse or promote products derived
> +      from this software without specific prior written permission.
> +
> +   THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
> +   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
> +   COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
> +   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> +   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> +   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> +   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> +   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
> +   IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> +   POSSIBILITY OF SUCH DAMAGE.  */
> +
> +/* FIXME: This file should really only be used for reference, as the
> +   result is somewhat depending on gcc generating what we expect rather
> +   than what we describe.  An assembly file should be used instead.
> +
> +   Even worse, we base it on memcpy, on the assumption that overlapping
> +   moves are rare, and we will do no worse than the generic memmove.  */
> +
> +#include <stddef.h>
> +
> +/* Break even between movem and move16 is really at 38.7 * 2, but
> +   modulo 44, so up to the next multiple of 44, we use ordinary code.  */
> +#define MEMMOVE_BY_BLOCK_THRESHOLD (44 * 2)
> +
> +/* No name ambiguities in this file.  */
> +__asm__ (".syntax no_register_prefix");
> +
> +void *
> +memmove(void *pdst, const void *psrc, size_t pn)
> +{
> +  /* Now we want the parameters put in special registers.
> +     Make sure the compiler is able to make something useful of this.
> +     As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
> +
> +     If gcc was allright, it really would need no temporaries, and no
> +     stack space to save stuff on.  */
> +
> +  register void *return_dst __asm__ ("r10") = pdst;
> +  register unsigned char *dst __asm__ ("r13") = pdst;
> +  register unsigned const char *src __asm__ ("r11") = psrc;
> +  register int n __asm__ ("r12") = pn;
> +
> +  /* Check and handle overlap.  */
> +  if (src < dst && dst < src + n)
> +    {
> +      /* Destructive overlap.  We could optimize this, but we don't (for
> +	 the moment).  */
> +      src += n;
> +      dst += n;
> +      while (n--)
> +	{
> +	  *--dst = *--src;
> +	}
> +
> +      return return_dst;
> +    }
> +  /* Whew, no overlap.  Proceed as with memcpy.  We could call it instead
> +     of having a copy here.  That would spoil some of the optimization, so
> +     we take the trouble with having two copies.  */
> +
> +  /* When src is aligned but not dst, this makes a few extra needless
> +     cycles.  I believe it would take as many to check that the
> +     re-alignment was unnecessary.  */
> +  if (((unsigned long) dst & 3) != 0
> +      /* Don't align if we wouldn't copy more than a few bytes; so we
> +	 don't have to check further for overflows.  */
> +      && n >= 3)
> +  {
> +    if ((unsigned long) dst & 1)
> +      {
> +	n--;
> +	*dst = *src;
> +	src++;
> +	dst++;
> +      }
> +
> +    if ((unsigned long) dst & 2)
> +      {
> +	n -= 2;
> +	*(short *) dst = *(short *) src;
> +	src += 2;
> +	dst += 2;
> +      }
> +  }
> +
> +  /* Decide which copying method to use.  */
> +  if (n >= MEMMOVE_BY_BLOCK_THRESHOLD)
> +    {
> +      /* It is not optimal to tell the compiler about clobbering any
> +	 registers; that will move the saving/restoring of those registers
> +	 to the function prologue/epilogue, and make non-movem sizes
> +	 suboptimal.  */
> +      __asm__ volatile
> +	("\
> +	 ;; GCC does promise correct register allocations, but let's	\n\
> +	 ;; make sure it keeps its promises.				\n\
> +	 .ifnc %0-%1-%2,$r13-$r11-$r12					\n\
> +	 .error \"GCC reg alloc bug: %0-%1-%4 != $r13-$r12-$r11\"	\n\
> +	 .endif								\n\
> +									\n\
> +	 ;; Save the registers we'll use in the movem process		\n\
> +	 ;; on the stack.						\n\
> +	 subq	11*4,sp							\n\
> +	 movem	r10,[sp]						\n\
> +									\n\
> +	 ;; Now we've got this:						\n\
> +	 ;; r11 - src							\n\
> +	 ;; r13 - dst							\n\
> +	 ;; r12 - n							\n\
> +									\n\
> +	 ;; Update n for the first loop.				\n\
> +	 subq	 44,r12							\n\
> +0:									\n\
> +"
> +#ifdef __arch_common_v10_v32
> +	 /* Cater to branch offset difference between v32 and v10.  We
> +	    assume the branch below has an 8-bit offset.  */
> +"	 setf\n"
> +#endif
> +"	 movem	[r11+],r10						\n\
> +	 subq	44,r12							\n\
> +	 bge	 0b							\n\
> +	 movem	r10,[r13+]						\n\
> +									\n\
> +	 ;; Compensate for last loop underflowing n.			\n\
> +	 addq	44,r12							\n\
> +									\n\
> +	 ;; Restore registers from stack.				\n\
> +	 movem [sp+],r10"
> +
> +	 /* Outputs.  */
> +	 : "=r" (dst), "=r" (src), "=r" (n)
> +
> +	 /* Inputs.  */
> +	 : "0" (dst), "1" (src), "2" (n));
> +    }
> +
> +  while (n >= 16)
> +    {
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +
> +      n -= 16;
> +    }
> +
> +  switch (n)
> +    {
> +    case 0:
> +      break;
> +
> +    case 1:
> +      *dst = *src;
> +      break;
> +
> +    case 2:
> +      *(short *) dst = *(short *) src;
> +      break;
> +
> +    case 3:
> +      *(short *) dst = *(short *) src; dst += 2; src += 2;
> +      *dst = *src;
> +      break;
> +
> +    case 4:
> +      *(long *) dst = *(long *) src;
> +      break;
> +
> +    case 5:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *dst = *src;
> +      break;
> +
> +    case 6:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src;
> +      break;
> +
> +    case 7:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src; dst += 2; src += 2;
> +      *dst = *src;
> +      break;
> +
> +    case 8:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src;
> +      break;
> +
> +    case 9:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *dst = *src;
> +      break;
> +
> +    case 10:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src;
> +      break;
> +
> +    case 11:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src; dst += 2; src += 2;
> +      *dst = *src;
> +      break;
> +
> +    case 12:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src;
> +      break;
> +
> +    case 13:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *dst = *src;
> +      break;
> +
> +    case 14:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src;
> +      break;
> +
> +    case 15:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src; dst += 2; src += 2;
> +      *dst = *src;
> +      break;
> +    }
> +
> +  return return_dst;
> +}
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/memcpy.c	Tue Jan 25 12:46:38 2005
> @@ -0,0 +1,236 @@
> +/* A memcpy for CRIS.
> +   Copyright (C) 1994-2005 Axis Communications.
> +   All rights reserved.
> +
> +   Redistribution and use in source and binary forms, with or without
> +   modification, are permitted provided that the following conditions
> +   are met:
> +
> +   1. Redistributions of source code must retain the above copyright
> +      notice, this list of conditions and the following disclaimer.
> +
> +   2. Neither the name of Axis Communications nor the names of its
> +      contributors may be used to endorse or promote products derived
> +      from this software without specific prior written permission.
> +
> +   THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
> +   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
> +   COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
> +   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> +   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> +   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> +   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> +   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
> +   IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> +   POSSIBILITY OF SUCH DAMAGE.  */
> +
> +/* FIXME: This file should really only be used for reference, as the
> +   result is somewhat depending on gcc generating what we expect rather
> +   than what we describe.  An assembly file should be used instead.  */
> +
> +#include <stddef.h>
> +
> +/* Break even between movem and move16 is really at 38.7 * 2, but
> +   modulo 44, so up to the next multiple of 44, we use ordinary code.  */
> +#define MEMCPY_BY_BLOCK_THRESHOLD (44 * 2)
> +
> +/* No name ambiguities in this file.  */
> +__asm__ (".syntax no_register_prefix");
> +
> +void *
> +memcpy(void *pdst, const void *psrc, size_t pn)
> +{
> +  /* Now we want the parameters put in special registers.
> +     Make sure the compiler is able to make something useful of this.
> +     As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
> +
> +     If gcc was allright, it really would need no temporaries, and no
> +     stack space to save stuff on.  */
> +
> +  register void *return_dst __asm__ ("r10") = pdst;
> +  register unsigned char *dst __asm__ ("r13") = pdst;
> +  register unsigned const char *src __asm__ ("r11") = psrc;
> +  register int n __asm__ ("r12") = pn;
> +
> +  /* When src is aligned but not dst, this makes a few extra needless
> +     cycles.  I believe it would take as many to check that the
> +     re-alignment was unnecessary.  */
> +  if (((unsigned long) dst & 3) != 0
> +      /* Don't align if we wouldn't copy more than a few bytes; so we
> +	 don't have to check further for overflows.  */
> +      && n >= 3)
> +  {
> +    if ((unsigned long) dst & 1)
> +      {
> +	n--;
> +	*dst = *src;
> +	src++;
> +	dst++;
> +      }
> +
> +    if ((unsigned long) dst & 2)
> +      {
> +	n -= 2;
> +	*(short *) dst = *(short *) src;
> +	src += 2;
> +	dst += 2;
> +      }
> +  }
> +
> +  /* Decide which copying method to use.  */
> +  if (n >= MEMCPY_BY_BLOCK_THRESHOLD)
> +    {
> +      /* It is not optimal to tell the compiler about clobbering any
> +	 registers; that will move the saving/restoring of those registers
> +	 to the function prologue/epilogue, and make non-movem sizes
> +	 suboptimal.  */
> +      __asm__ volatile
> +	("\
> +	 ;; GCC does promise correct register allocations, but let's	\n\
> +	 ;; make sure it keeps its promises.				\n\
> +	 .ifnc %0-%1-%2,$r13-$r11-$r12					\n\
> +	 .error \"GCC reg alloc bug: %0-%1-%4 != $r13-$r12-$r11\"	\n\
> +	 .endif								\n\
> +									\n\
> +	 ;; Save the registers we'll use in the movem process		\n\
> +	 ;; on the stack.						\n\
> +	 subq	11*4,sp							\n\
> +	 movem	r10,[sp]						\n\
> +									\n\
> +	 ;; Now we've got this:						\n\
> +	 ;; r11 - src							\n\
> +	 ;; r13 - dst							\n\
> +	 ;; r12 - n							\n\
> +									\n\
> +	 ;; Update n for the first loop.				\n\
> +	 subq	 44,r12							\n\
> +0:									\n\
> +"
> +#ifdef __arch_common_v10_v32
> +	 /* Cater to branch offset difference between v32 and v10.  We
> +	    assume the branch below has an 8-bit offset.  */
> +"	 setf\n"
> +#endif
> +"	 movem	[r11+],r10						\n\
> +	 subq	44,r12							\n\
> +	 bge	 0b							\n\
> +	 movem	r10,[r13+]						\n\
> +									\n\
> +	 ;; Compensate for last loop underflowing n.			\n\
> +	 addq	44,r12							\n\
> +									\n\
> +	 ;; Restore registers from stack.				\n\
> +	 movem [sp+],r10"
> +
> +	 /* Outputs.  */
> +	 : "=r" (dst), "=r" (src), "=r" (n)
> +
> +	 /* Inputs.  */
> +	 : "0" (dst), "1" (src), "2" (n));
> +    }
> +
> +  while (n >= 16)
> +    {
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +
> +      n -= 16;
> +    }
> +
> +  switch (n)
> +    {
> +    case 0:
> +      break;
> +
> +    case 1:
> +      *dst = *src;
> +      break;
> +
> +    case 2:
> +      *(short *) dst = *(short *) src;
> +      break;
> +
> +    case 3:
> +      *(short *) dst = *(short *) src; dst += 2; src += 2;
> +      *dst = *src;
> +      break;
> +
> +    case 4:
> +      *(long *) dst = *(long *) src;
> +      break;
> +
> +    case 5:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *dst = *src;
> +      break;
> +
> +    case 6:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src;
> +      break;
> +
> +    case 7:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src; dst += 2; src += 2;
> +      *dst = *src;
> +      break;
> +
> +    case 8:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src;
> +      break;
> +
> +    case 9:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *dst = *src;
> +      break;
> +
> +    case 10:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src;
> +      break;
> +
> +    case 11:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src; dst += 2; src += 2;
> +      *dst = *src;
> +      break;
> +
> +    case 12:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src;
> +      break;
> +
> +    case 13:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *dst = *src;
> +      break;
> +
> +    case 14:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src;
> +      break;
> +
> +    case 15:
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(long *) dst = *(long *) src; dst += 4; src += 4;
> +      *(short *) dst = *(short *) src; dst += 2; src += 2;
> +      *dst = *src;
> +      break;
> +    }
> +
> +  return return_dst;
> +}
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/memset.c	Wed Jan 26 15:33:12 2005
> @@ -0,0 +1,259 @@
> +/* A memset for CRIS.
> +   Copyright (C) 1999-2005 Axis Communications.
> +   All rights reserved.
> +
> +   Redistribution and use in source and binary forms, with or without
> +   modification, are permitted provided that the following conditions
> +   are met:
> +
> +   1. Redistributions of source code must retain the above copyright
> +      notice, this list of conditions and the following disclaimer.
> +
> +   2. Neither the name of Axis Communications nor the names of its
> +      contributors may be used to endorse or promote products derived
> +      from this software without specific prior written permission.
> +
> +   THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
> +   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
> +   COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
> +   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> +   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> +   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> +   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> +   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
> +   IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> +   POSSIBILITY OF SUCH DAMAGE.  */
> +
> +/* FIXME: This file should really only be used for reference, as the
> +   result is somewhat depending on gcc generating what we expect rather
> +   than what we describe.  An assembly file should be used instead.  */
> +
> +/* Note the multiple occurrence of the expression "12*4", including the
> +   asm.  It is hard to get it into the asm in a good way.  Thus better to
> +   expose the problem everywhere: no macro.  */
> +
> +/* Assuming one cycle per dword written or read (ok, not really true; the
> +   world is not ideal), and one cycle per instruction, then 43+3*(n/48-1)
> +   <= 24+24*(n/48-1) so n >= 45.7; n >= 0.9; we win on the first full
> +   48-byte block to set.  */
> +
> +#define MEMSET_BY_BLOCK_THRESHOLD (1 * 48)
> +
> +/* No name ambiguities in this file.  */
> +__asm__ (".syntax no_register_prefix");
> +
> +void *memset(void *pdst, int c, unsigned int plen)
> +{
> +  /* Now we want the parameters in special registers.  Make sure the
> +     compiler does something usable with this.  */
> +
> +  register char *return_dst __asm__ ("r10") = pdst;
> +  register int n __asm__ ("r12") = plen;
> +  register int lc __asm__ ("r11") = c;
> +
> +  /* Most apps use memset sanely.  Memsetting about 3..4 bytes or less get
> +     penalized here compared to the generic implementation.  */
> +
> +  /* This is fragile performancewise at best.  Check with newer GCC
> +     releases, if they compile cascaded "x |= x << 8" to sane code.  */
> +  __asm__("movu.b %0,r13						\n\
> +	   lslq 8,r13							\n\
> +	   move.b %0,r13						\n\
> +	   move.d r13,%0						\n\
> +	   lslq 16,r13							\n\
> +	   or.d r13,%0"
> +          : "=r" (lc)		/* Inputs.  */
> +	  : "0" (lc)		/* Outputs.  */
> +	  : "r13");		/* Trash.  */
> +
> +  {
> +    register char *dst __asm__ ("r13") = pdst;
> +
> +    if (((unsigned long) pdst & 3) != 0
> +	/* Oops! n = 0 must be a valid call, regardless of alignment.  */
> +	&& n >= 3)
> +      {
> +	if ((unsigned long) dst & 1)
> +	  {
> +	    *dst = (char) lc;
> +	    n--;
> +	    dst++;
> +	  }
> +
> +	if ((unsigned long) dst & 2)
> +	  {
> +	    *(short *) dst = lc;
> +	    n -= 2;
> +	    dst += 2;
> +	  }
> +      }
> +
> +    /* Decide which setting method to use.  */
> +    if (n >= MEMSET_BY_BLOCK_THRESHOLD)
> +      {
> +	/* It is not optimal to tell the compiler about clobbering any
> +	   registers; that will move the saving/restoring of those registers
> +	   to the function prologue/epilogue, and make non-block sizes
> +	   suboptimal.  */
> +	__asm__ volatile
> +	  ("\
> +	   ;; GCC does promise correct register allocations, but let's	\n\
> +	   ;; make sure it keeps its promises.				\n\
> +	   .ifnc %0-%1-%4,$r13-$r12-$r11				\n\
> +	   .error \"GCC reg alloc bug: %0-%1-%4 != $r13-$r12-$r11\"	\n\
> +	   .endif							\n\
> +									\n\
> +	   ;; Save the registers we'll clobber in the movem process	\n\
> +	   ;; on the stack.  Don't mention them to gcc, it will only be	\n\
> +	   ;; upset.							\n\
> +	   subq	   11*4,sp						\n\
> +	   movem   r10,[sp]						\n\
> +									\n\
> +	   move.d  r11,r0						\n\
> +	   move.d  r11,r1						\n\
> +	   move.d  r11,r2						\n\
> +	   move.d  r11,r3						\n\
> +	   move.d  r11,r4						\n\
> +	   move.d  r11,r5						\n\
> +	   move.d  r11,r6						\n\
> +	   move.d  r11,r7						\n\
> +	   move.d  r11,r8						\n\
> +	   move.d  r11,r9						\n\
> +	   move.d  r11,r10						\n\
> +									\n\
> +	   ;; Now we've got this:					\n\
> +	   ;; r13 - dst							\n\
> +	   ;; r12 - n							\n\
> +									\n\
> +	   ;; Update n for the first loop				\n\
> +	   subq	   12*4,r12						\n\
> +0:									\n\
> +"
> +#ifdef __arch_common_v10_v32
> +	   /* Cater to branch offset difference between v32 and v10.  We
> +	      assume the branch below has an 8-bit offset.  */
> +"	   setf\n"
> +#endif
> +"	   subq	  12*4,r12						\n\
> +	   bge	   0b							\n\
> +	   movem	r11,[r13+]					\n\
> +									\n\
> +	   ;; Compensate for last loop underflowing n.			\n\
> +	   addq	  12*4,r12						\n\
> +									\n\
> +	   ;; Restore registers from stack.				\n\
> +	   movem [sp+],r10"
> +
> +	   /* Outputs.	*/
> +	   : "=r" (dst), "=r" (n)
> +
> +	   /* Inputs.  */
> +	   : "0" (dst), "1" (n), "r" (lc));
> +      }
> +
> +    /* An ad-hoc unroll, used for 4*12-1..16 bytes. */
> +    while (n >= 16)
> +      {
> +	*(long *) dst = lc; dst += 4;
> +	*(long *) dst = lc; dst += 4;
> +	*(long *) dst = lc; dst += 4;
> +	*(long *) dst = lc; dst += 4;
> +	n -= 16;
> +      }
> +
> +    switch (n)
> +      {
> +      case 0:
> +        break;
> +
> +      case 1:
> +        *dst = (char) lc;
> +        break;
> +
> +      case 2:
> +        *(short *) dst = (short) lc;
> +        break;
> +
> +      case 3:
> +        *(short *) dst = (short) lc; dst += 2;
> +        *dst = (char) lc;
> +        break;
> +
> +      case 4:
> +        *(long *) dst = lc;
> +        break;
> +
> +      case 5:
> +        *(long *) dst = lc; dst += 4;
> +        *dst = (char) lc;
> +        break;
> +
> +      case 6:
> +        *(long *) dst = lc; dst += 4;
> +        *(short *) dst = (short) lc;
> +        break;
> +
> +      case 7:
> +        *(long *) dst = lc; dst += 4;
> +        *(short *) dst = (short) lc; dst += 2;
> +        *dst = (char) lc;
> +        break;
> +
> +      case 8:
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc;
> +        break;
> +
> +      case 9:
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc; dst += 4;
> +        *dst = (char) lc;
> +        break;
> +
> +      case 10:
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc; dst += 4;
> +        *(short *) dst = (short) lc;
> +        break;
> +
> +      case 11:
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc; dst += 4;
> +        *(short *) dst = (short) lc; dst += 2;
> +        *dst = (char) lc;
> +        break;
> +
> +      case 12:
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc;
> +        break;
> +
> +      case 13:
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc; dst += 4;
> +        *dst = (char) lc;
> +        break;
> +
> +      case 14:
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc; dst += 4;
> +        *(short *) dst = (short) lc;
> +        break;
> +
> +      case 15:
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc; dst += 4;
> +        *(long *) dst = lc; dst += 4;
> +        *(short *) dst = (short) lc; dst += 2;
> +        *dst = (char) lc;
> +        break;
> +      }
> +  }
> +
> +  return return_dst;
> +}
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/include/pthread.h	Tue Jan 25 12:48:31 2005
> @@ -0,0 +1,93 @@
> +/* pthread.h dummy.
> +   Copyright (C) 2001, 2004, 2005 Axis Communications AB.
> +   All rights reserved.
> +
> +   Redistribution and use in source and binary forms, with or without
> +   modification, are permitted provided that the following conditions
> +   are met:
> +
> +   1. Redistributions of source code must retain the above copyright
> +      notice, this list of conditions and the following disclaimer.
> +
> +   2. Neither the name of Axis Communications nor the names of its
> +      contributors may be used to endorse or promote products derived
> +      from this software without specific prior written permission.
> +
> +   THIS SOFTWARE IS PROVIDED BY AXIS COMMUNICATIONS AND ITS CONTRIBUTORS
> +   ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AXIS
> +   COMMUNICATIONS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
> +   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> +   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> +   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> +   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
> +   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
> +   IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
> +   POSSIBILITY OF SUCH DAMAGE.  */
> +
> +/* Simple fallback-include to enable thread-enabled exception support
> +   for libgcc, but with posix-interface to a default-dummy, so a posix
> +   library can optionally be linked in, which isn't possible if
> +   gthr-single.h is used.  No other use is supported; *DO NOT* think
> +   this gives you a valid pthread interface to use in your applications.  */
> +
> +#ifndef _PTHREAD_FAKE
> +#define _PTHREAD_FAKE
> +
> +#ifdef __cplusplus
> +extern "C" {
> +# ifndef __THROW
> +#  define __THROW throw ()
> +# endif
> +#else
> +# ifndef __THROW
> +#  define __THROW
> +# endif
> +#endif
> +
> +typedef int pthread_once_t;
> +typedef unsigned int pthread_key_t;
> +
> +/* This must be layout-compatible with the linuxthreads type.  */
> +typedef struct
> +{
> +  int a, b;
> +  void *c;
> +  int d;
> +  struct { long int e; int f; } g;
> +} pthread_mutex_t;
> +
> +/* This give bits equal to the linuxthreads initializer.  */
> +#define PTHREAD_MUTEX_INITIALIZER \
> +  {0, 0, 0, 0, {0, 0}}
> +
> +#define PTHREAD_ONCE_INIT 0
> +
> +/* This isn't the right prototype, but it let's us get away with not
> +   defining a lot of datatypes.  */
> +extern int pthread_create (void) __THROW;
> +
> +extern int pthread_once (pthread_once_t *, void (*) (void)) __THROW;
> +
> +extern int pthread_key_create (pthread_key_t *, void (*) (void *)) __THROW;
> +
> +extern int pthread_setspecific (pthread_key_t, const void *) __THROW;
> +
> +extern void *pthread_getspecific (pthread_key_t) __THROW;
> +
> +extern int pthread_mutex_lock (pthread_mutex_t *) __THROW;
> +
> +extern int pthread_key_delete (pthread_key_t) __THROW;
> +
> +extern int pthread_mutex_trylock (pthread_mutex_t *) __THROW;
> +
> +extern int pthread_mutex_unlock (pthread_mutex_t *) __THROW;
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#undef __THROW
> +
> +#endif /* not _PTHREAD_FAKE */
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/sys/signal.h	Mon Jan 24 01:44:18 2005
> @@ -0,0 +1,89 @@
> +/* This file is to be kept in sync (well, reasonably so, it's quite
> +   different) with newlib/libc/include/sys/signal.h on which it is
> +   based, except values used or returned by syscalls must be those of
> +   the Linux/CRIS kernel.  */
> +
> +/* sys/signal.h */
> +
> +#ifndef _SYS_SIGNAL_H
> +#define _SYS_SIGNAL_H
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#include "_ansi.h"
> +
> +typedef unsigned long sigset_t;
> +
> +/* Adjusted to linux, has unused sa_restorer field and unsigned long
> +   sa_flags; relatively unimportant though.  */
> +/* Type of a signal handler.  */
> +typedef void (*__sighandler_t)(int);
> +
> +/* The type used in newlib sources.  */
> +typedef __sighandler_t _sig_func_ptr;
> +
> +struct sigaction {
> +	__sighandler_t sa_handler;
> +	sigset_t sa_mask;
> +	unsigned long sa_flags;
> +	void (*sa_restorer)(void);
> +};
> +
> +/* Adjusted to glibc; other values.  */
> +#define SA_NOCLDSTOP 1	/* only value supported now for sa_flags */
> +#define SIG_SETMASK 2	/* set mask with sigprocmask() */
> +#define SIG_BLOCK 0	/* set of signals to block */
> +#define SIG_UNBLOCK 1	/* set of signals to, well, unblock */
> +
> +/* These depend upon the type of sigset_t, which right now
> +   is always a long.. They're in the POSIX namespace, but
> +   are not ANSI. */
> +#define sigaddset(what,sig) (*(what) |= (1<<(sig)))
> +#define sigemptyset(what)   (*(what) = 0)
> +
> +int sigprocmask (int __how, const sigset_t *__a, sigset_t *__b);
> +
> +#define SIGHUP		 1
> +#define SIGINT		 2
> +#define SIGQUIT		 3
> +#define SIGILL		 4
> +#define SIGTRAP		 5
> +#define SIGABRT		 6
> +#define SIGIOT		 6
> +#define SIGBUS		 7
> +#define SIGFPE		 8
> +#define SIGKILL		 9
> +#define SIGUSR1		10
> +#define SIGSEGV		11
> +#define SIGUSR2		12
> +#define SIGPIPE		13
> +#define SIGALRM		14
> +#define SIGTERM		15
> +#define SIGSTKFLT	16
> +#define SIGCHLD		17
> +#define SIGCONT		18
> +#define SIGSTOP		19
> +#define SIGTSTP		20
> +#define SIGTTIN		21
> +#define SIGTTOU		22
> +#define SIGURG		23
> +#define SIGXCPU		24
> +#define SIGXFSZ		25
> +#define SIGVTALRM	26
> +#define SIGPROF		27
> +#define SIGWINCH	28
> +#define SIGIO		29
> +#define SIGPOLL		SIGIO
> +#define SIGPWR		30
> +#define	NSIG 31
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +#ifndef _SIGNAL_H_
> +/* Some applications take advantage of the fact that <sys/signal.h>
> + * and <signal.h> are equivalent in glibc.  Allow for that here.  */
> +#include <signal.h>
> +#endif
> +#endif /* _SYS_SIGNAL_H */
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/sys/fcntl.h	Mon Jan 24 01:41:29 2005
> @@ -0,0 +1,163 @@
> +/* This file is to be kept in sync with newlib/libc/include/sys/fcntl.h,
> +   on which it is based, except values used or returned by syscalls must
> +   be those of the Linux/CRIS kernel.  */
> +
> +#ifndef	_FCNTL_
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +#define	_FCNTL_
> +#include <_ansi.h>
> +#define	_FOPEN		(-1)	/* from sys/file.h, kernel use only */
> +#define	_FREAD		0x0001	/* read enabled */
> +#define	_FWRITE		0x0002	/* write enabled */
> +#define	_FNDELAY	0x0800	/* non blocking I/O (4.2 style) */
> +#define	_FAPPEND	0x0400	/* append (writes guaranteed at the end) */
> +#define	_FMARK		0x0010	/* internal; mark during gc() */
> +#define	_FDEFER		0x0020	/* internal; defer for next gc pass */
> +#define	_FASYNC		0x2000	/* signal pgrp when data ready */
> +#define	_FCREAT		0x0040	/* open with file create */
> +#define	_FTRUNC		0x0200	/* open with truncation */
> +#define	_FEXCL		0x0080	/* error on open if file exists */
> +#define	_FNBIO	    _FNONBLOCK	/* non blocking I/O (sys5 style) */
> +#define	_FSYNC		0x1000	/* do all writes synchronously */
> +#define	_FNONBLOCK	0x0800	/* non blocking I/O (POSIX style) */
> +#define	_FNOCTTY	0x0100	/* don't assign a ctty on this open */
> +
> +#define	O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
> +
> +/*
> + * Flag values for open(2) and fcntl(2)
> + * The kernel adds 1 to the open modes to turn it into some
> + * combination of FREAD and FWRITE.
> + */
> +#define	O_RDONLY	0		/* +1 == FREAD */
> +#define	O_WRONLY	1		/* +1 == FWRITE */
> +#define	O_RDWR		2		/* +1 == FREAD|FWRITE */
> +#define	O_APPEND	_FAPPEND
> +#define	O_CREAT		_FCREAT
> +#define	O_TRUNC		_FTRUNC
> +#define	O_EXCL		_FEXCL
> +/*	O_SYNC		_FSYNC		not posix, defined below */
> +/*	O_NDELAY	_FNDELAY 	set in include/fcntl.h */
> +/*	O_NDELAY	_FNBIO 		set in 5include/fcntl.h */
> +#define	O_NONBLOCK	_FNONBLOCK
> +#define	O_NOCTTY	_FNOCTTY
> +
> +#ifndef	_POSIX_SOURCE
> +
> +#define	O_SYNC		_FSYNC
> +
> +/*
> + * Flags that work for fcntl(fd, F_SETFL, FXXXX)
> + */
> +#define	FAPPEND		_FAPPEND
> +#define	FSYNC		_FSYNC
> +#define	FASYNC		_FASYNC
> +#define	FNBIO		_FNBIO
> +#define	FNONBIO		_FNONBLOCK	/* XXX fix to be NONBLOCK everywhere */
> +#define	FNDELAY		_FNDELAY
> +
> +/*
> + * Flags that are disallowed for fcntl's (FCNTLCANT);
> + * used for opens, internal state, or locking.
> + */
> +#define	FREAD		_FREAD
> +#define	FWRITE		_FWRITE
> +#define	FMARK		_FMARK
> +#define	FDEFER		_FDEFER
> +#define	FSHLOCK		_FSHLOCK
> +#define	FEXLOCK		_FEXLOCK
> +
> +/*
> + * The rest of the flags, used only for opens
> + */
> +#define	FOPEN		_FOPEN
> +#define	FCREAT		_FCREAT
> +#define	FTRUNC		_FTRUNC
> +#define	FEXCL		_FEXCL
> +#define	FNOCTTY		_FNOCTTY
> +
> +#endif	/* !_POSIX_SOURCE */
> +
> +/* XXX close on exec request; must match UF_EXCLOSE in user.h */
> +#define	FD_CLOEXEC	1	/* posix */
> +
> +/* fcntl(2) requests */
> +#define F_DUPFD		0	/* dup */
> +#define F_GETFD		1	/* get f_flags */
> +#define F_SETFD		2	/* set f_flags */
> +#define F_GETFL		3	/* more flags (cloexec) */
> +#define F_SETFL		4
> +#define F_GETLK		5
> +#define F_SETLK		6
> +#define F_SETLKW	7
> +
> +#define F_SETOWN	8	/*  for sockets. */
> +#define F_GETOWN	9	/*  for sockets. */
> +
> +/* 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 */
> +
> +/* 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 */
> +
> +/* file segment locking set data type - information passed to system by user */
> +struct flock {
> +	short	l_type;		/* F_RDLCK, F_WRLCK, or F_UNLCK */
> +	short	l_whence;	/* flag to choose starting offset */
> +	long	l_start;	/* relative offset, in bytes */
> +	long	l_len;		/* length, in bytes; 0 means lock to EOF */
> +	short	l_pid;		/* returned with F_GETLK */
> +	short	l_xxx;		/* reserved for future use */
> +};
> +
> +#ifndef	_POSIX_SOURCE
> +/* extended file segment locking set data type */
> +struct eflock {
> +	short	l_type;		/* F_RDLCK, F_WRLCK, or F_UNLCK */
> +	short	l_whence;	/* flag to choose starting offset */
> +	long	l_start;	/* relative offset, in bytes */
> +	long	l_len;		/* length, in bytes; 0 means lock to EOF */
> +	short	l_pid;		/* returned with F_GETLK */
> +	short	l_xxx;		/* reserved for future use */
> +	long	l_rpid;		/* Remote process id wanting this lock */
> +	long	l_rsys;		/* Remote system id wanting this lock */
> +};
> +#endif	/* !_POSIX_SOURCE */
> +
> +
> +#include <sys/types.h>
> +#include <sys/stat.h>		/* sigh. for the mode bits for open/creat */
> +
> +extern int open _PARAMS ((const char *, int, ...));
> +extern int creat _PARAMS ((const char *, mode_t));
> +extern int fcntl _PARAMS ((int, int, ...));
> +
> +/* Provide _<systemcall> prototypes for functions provided by some versions
> +   of newlib.  */
> +#ifdef _COMPILING_NEWLIB
> +extern int _open _PARAMS ((const char *, int, ...));
> +extern int _fcntl _PARAMS ((int, int, ...));
> +#ifdef __LARGE64_FILES
> +extern int _open64 _PARAMS ((const char *, int, ...));
> +#endif
> +#endif
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +#endif	/* !_FCNTL_ */
> --- /dev/null	Tue Oct 29 15:57:07 2002
> +++ libc/machine/cris/sys/errno.h	Mon Jan 24 01:40:17 2005
> @@ -0,0 +1,166 @@
> +/* This file is to be kept in sync with newlib/libc/include/sys/errno.h
> +   on which it is based, except values used or returned by syscalls must
> +   be those of the Linux/CRIS kernel.  */
> +
> +/* errno is not a global variable, because that would make using it
> +   non-reentrant.  Instead, its address is returned by the function
> +   __errno.  */
> +
> +#ifndef _SYS_ERRNO_H_
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +#define _SYS_ERRNO_H_
> +
> +#include <sys/reent.h>
> +
> +#ifndef _REENT_ONLY
> +#define errno (*__errno())
> +extern int *__errno _PARAMS ((void));
> +#endif
> +
> +/* Please don't use these variables directly.
> +   Use strerror instead. */
> +extern _CONST char * _CONST _sys_errlist[];
> +extern int _sys_nerr;
> +
> +#define __errno_r(ptr) ((ptr)->_errno)
> +
> +/* Adjusted to the linux asm/errno.h */
> +#define	EPERM		 1	/* Operation not permitted */
> +#define	ENOENT		 2	/* No such file or directory */
> +#define	ESRCH		 3	/* No such process */
> +#define	EINTR		 4	/* Interrupted system call */
> +#define	EIO		 5	/* I/O error */
> +#define	ENXIO		 6	/* No such device or address */
> +#define	E2BIG		 7	/* Arg list too long */
> +#define	ENOEXEC		 8	/* Exec format error */
> +#define	EBADF		 9	/* Bad file number */
> +#define	ECHILD		10	/* No child processes */
> +#define	EAGAIN		11	/* Try again */
> +#define	ENOMEM		12	/* Out of memory */
> +#define	EACCES		13	/* Permission denied */
> +#define	EFAULT		14	/* Bad address */
> +#define	ENOTBLK		15	/* Block device required */
> +#define	EBUSY		16	/* Device or resource busy */
> +#define	EEXIST		17	/* File exists */
> +#define	EXDEV		18	/* Cross-device link */
> +#define	ENODEV		19	/* No such device */
> +#define	ENOTDIR		20	/* Not a directory */
> +#define	EISDIR		21	/* Is a directory */
> +#define	EINVAL		22	/* Invalid argument */
> +#define	ENFILE		23	/* File table overflow */
> +#define	EMFILE		24	/* Too many open files */
> +#define	ENOTTY		25	/* Not a typewriter */
> +#define	ETXTBSY		26	/* Text file busy */
> +#define	EFBIG		27	/* File too large */
> +#define	ENOSPC		28	/* No space left on device */
> +#define	ESPIPE		29	/* Illegal seek */
> +#define	EROFS		30	/* Read-only file system */
> +#define	EMLINK		31	/* Too many links */
> +#define	EPIPE		32	/* Broken pipe */
> +#define	EDOM		33	/* Math argument out of domain of func */
> +#define	ERANGE		34	/* Math result not representable */
> +#define	EDEADLK		35	/* Resource deadlock would occur */
> +#define	ENAMETOOLONG	36	/* File name too long */
> +#define	ENOLCK		37	/* No record locks available */
> +#define	ENOSYS		38	/* Function not implemented */
> +#define	ENOTEMPTY	39	/* Directory not empty */
> +#define	ELOOP		40	/* Too many symbolic links encountered */
> +#define	EWOULDBLOCK	EAGAIN	/* Operation would block */
> +#define	ENOMSG		42	/* No message of desired type */
> +#define	EIDRM		43	/* Identifier removed */
> +#define	ECHRNG		44	/* Channel number out of range */
> +#define	EL2NSYNC	45	/* Level 2 not synchronized */
> +#define	EL3HLT		46	/* Level 3 halted */
> +#define	EL3RST		47	/* Level 3 reset */
> +#define	ELNRNG		48	/* Link number out of range */
> +#define	EUNATCH		49	/* Protocol driver not attached */
> +#define	ENOCSI		50	/* No CSI structure available */
> +#define	EL2HLT		51	/* Level 2 halted */
> +#define	EBADE		52	/* Invalid exchange */
> +#define	EBADR		53	/* Invalid request descriptor */
> +#define	EXFULL		54	/* Exchange full */
> +#define	ENOANO		55	/* No anode */
> +#define	EBADRQC		56	/* Invalid request code */
> +#define	EBADSLT		57	/* Invalid slot */
> +
> +#define	EDEADLOCK	EDEADLK
> +
> +#define	EBFONT		59	/* Bad font file format */
> +/* This is only used internally in newlib; not returned by the kernel.
> +   EBFONT seems the closest match for a "bad file format" error.  */
> +#define EFTYPE		EBFONT	/* Inappropriate file type or format */
> +#define	ENOSTR		60	/* Device not a stream */
> +#define	ENODATA		61	/* No data available */
> +#define	ETIME		62	/* Timer expired */
> +#define	ENOSR		63	/* Out of streams resources */
> +#define	ENONET		64	/* Machine is not on the network */
> +#define	ENOPKG		65	/* Package not installed */
> +#define	EREMOTE		66	/* Object is remote */
> +#define	ENOLINK		67	/* Link has been severed */
> +#define	EADV		68	/* Advertise error */
> +#define	ESRMNT		69	/* Srmount error */
> +#define	ECOMM		70	/* Communication error on send */
> +#define	EPROTO		71	/* Protocol error */
> +#define	EMULTIHOP	72	/* Multihop attempted */
> +#define	EDOTDOT		73	/* RFS specific error */
> +#define	EBADMSG		74	/* Not a data message */
> +#define	EOVERFLOW	75	/* Value too large for defined data type */
> +#define	ENOTUNIQ	76	/* Name not unique on network */
> +#define	EBADFD		77	/* File descriptor in bad state */
> +#define	EREMCHG		78	/* Remote address changed */
> +#define	ELIBACC		79	/* Can not access a needed shared library */
> +#define	ELIBBAD		80	/* Accessing a corrupted shared library */
> +#define	ELIBSCN		81	/* .lib section in a.out corrupted */
> +#define	ELIBMAX		82	/* Attempting to link in too many shared libraries */
> +#define	ELIBEXEC	83	/* Cannot exec a shared library directly */
> +#define	EILSEQ		84	/* Illegal byte sequence */
> +#define	ERESTART	85	/* Interrupted system call should be restarted */
> +#define	ESTRPIPE	86	/* Streams pipe error */
> +#define	EUSERS		87	/* Too many users */
> +#define	ENOTSOCK	88	/* Socket operation on non-socket */
> +#define	EDESTADDRREQ	89	/* Destination address required */
> +#define	EMSGSIZE	90	/* Message too long */
> +#define	EPROTOTYPE	91	/* Protocol wrong type for socket */
> +#define	ENOPROTOOPT	92	/* Protocol not available */
> +#define	EPROTONOSUPPORT	93	/* Protocol not supported */
> +#define	ESOCKTNOSUPPORT	94	/* Socket type not supported */
> +#define	EOPNOTSUPP	95	/* Operation not supported on transport endpoint */
> +#define	EPFNOSUPPORT	96	/* Protocol family not supported */
> +#define	EAFNOSUPPORT	97	/* Address family not supported by protocol */
> +#define	EADDRINUSE	98	/* Address already in use */
> +#define	EADDRNOTAVAIL	99	/* Cannot assign requested address */
> +#define	ENETDOWN	100	/* Network is down */
> +#define	ENETUNREACH	101	/* Network is unreachable */
> +#define	ENETRESET	102	/* Network dropped connection because of reset */
> +#define	ECONNABORTED	103	/* Software caused connection abort */
> +#define	ECONNRESET	104	/* Connection reset by peer */
> +#define	ENOBUFS		105	/* No buffer space available */
> +#define	EISCONN		106	/* Transport endpoint is already connected */
> +#define	ENOTCONN	107	/* Transport endpoint is not connected */
> +#define	ESHUTDOWN	108	/* Cannot send after transport endpoint shutdown */
> +#define	ETOOMANYREFS	109	/* Too many references: cannot splice */
> +#define	ETIMEDOUT	110	/* Connection timed out */
> +#define	ECONNREFUSED	111	/* Connection refused */
> +#define	EHOSTDOWN	112	/* Host is down */
> +#define	EHOSTUNREACH	113	/* No route to host */
> +#define	EALREADY	114	/* Operation already in progress */
> +#define	EINPROGRESS	115	/* Operation now in progress */
> +#define	ESTALE		116	/* Stale NFS file handle */
> +#define	EUCLEAN		117	/* Structure needs cleaning */
> +#define	ENOTNAM		118	/* Not a XENIX named type file */
> +#define	ENAVAIL		119	/* No XENIX semaphores available */
> +#define	EISNAM		120	/* Is a named type file */
> +#define	EREMOTEIO	121	/* Remote I/O error */
> +#define	EDQUOT		122	/* Quota exceeded */
> +
> +#define	ENOMEDIUM	123	/* No medium found */
> +#define	EMEDIUMTYPE	124	/* Wrong medium type */
> +
> +#define __ELASTERROR 2000	/* Users can add values starting here */
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +#endif /* _SYS_ERRNO_H */
> 
> brgds, H-P



More information about the Newlib mailing list