* libc/machine/arm/aeabi_memmove.c: New file to support

aeabi_memmove.
	* libc/machine/arm/aeabi_memmove-soft.S: Ditto.
	* libc/machine/arm/aeabi_memmove-arm.S: Ditto.
	* libc/machine/arm/aeabi_memmove-thumb.S: Ditto.
	* libc/machine/arm/aeabi_memmove-thumb2.S: Ditto.
	* libc/machine/arm/Makefile.am: Add dependencies.
	* libc/machine/arm/Makefile.in: Regenerated.
This commit is contained in:
Corinna Vinschen 2015-02-17 09:06:51 +00:00
parent b5d4a40465
commit 554f33c48d
8 changed files with 351 additions and 3 deletions

View File

@ -1,3 +1,14 @@
2015-02-17 Hale Wang <hale.wang@arm.com>
* libc/machine/arm/aeabi_memmove.c: New file to support
aeabi_memmove.
* libc/machine/arm/aeabi_memmove-soft.S: Ditto.
* libc/machine/arm/aeabi_memmove-arm.S: Ditto.
* libc/machine/arm/aeabi_memmove-thumb.S: Ditto.
* libc/machine/arm/aeabi_memmove-thumb2.S: Ditto.
* libc/machine/arm/Makefile.am: Add dependencies.
* libc/machine/arm/Makefile.in: Regenerated.
2015-02-06 Nick Clifton <nickc@redhat.com>
* libc/include/complex.h (cabsl): Add prototype.

View File

@ -49,7 +49,8 @@ endif !OPT_SIZE
lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c \
$(MEMCPY_SRC) $(MEMCHR_SRC) $(STRLEN_SRC) \
strlen-armv7.S aeabi_memcpy.c aeabi_memcpy-armv7a.S
strlen-armv7.S aeabi_memcpy.c aeabi_memcpy-armv7a.S \
aeabi_memmove.c aeabi_memmove-soft.S
lib_a_CCASFLAGS=$(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
@ -62,6 +63,8 @@ CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
MEMCPY_DEP=memcpy-armv7a.S memcpy-armv7m.S
STRCMP_DEP=strcmp-arm-tiny.S strcmp-armv4.S strcmp-armv4t.S strcmp-armv6.S \
strcmp-armv6m.S strcmp-armv7.S strcmp-armv7m.S
AEABI_MEMMOVE_DEP=aeabi_memmove-thumb.S aeabi_memmove-thumb2.S \
aeabi_memmove-arm.S
$(lpfx)memcpy.o: $(MEMCPY_DEP)
@ -70,3 +73,7 @@ $(lpfx)memcpy.obj: $(MEMCPY_DEP)
$(lpfx)strcmp.o: $(STRCMP_DEP)
$(lpfx)strcmp.obj: $(STRCMP_DEP)
$(lpfx)aeabi_memmove.o: $(AEABI_MEMMOVE_DEP)
$(lpfx)aeabi_memmove.obj: $(AEABI_MEMMOVE_DEP)

View File

@ -85,7 +85,9 @@ am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-access.$(OBJEXT) \
lib_a-strcmp.$(OBJEXT) lib_a-strcpy.$(OBJEXT) $(am__objects_1) \
$(am__objects_2) $(am__objects_3) lib_a-strlen-armv7.$(OBJEXT) \
lib_a-aeabi_memcpy.$(OBJEXT) \
lib_a-aeabi_memcpy-armv7a.$(OBJEXT)
lib_a-aeabi_memcpy-armv7a.$(OBJEXT) \
lib_a-aeabi_memmove.$(OBJEXT) \
lib_a-aeabi_memmove-soft.$(OBJEXT)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp =
@ -232,7 +234,8 @@ noinst_LIBRARIES = lib.a
@OPT_SIZE_TRUE@MEMCPY_OBJ =
lib_a_SOURCES = setjmp.S access.c strcmp.S strcpy.c \
$(MEMCPY_SRC) $(MEMCHR_SRC) $(STRLEN_SRC) \
strlen-armv7.S aeabi_memcpy.c aeabi_memcpy-armv7a.S
strlen-armv7.S aeabi_memcpy.c aeabi_memcpy-armv7a.S \
aeabi_memmove.c aeabi_memmove-soft.S
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
@ -244,6 +247,9 @@ MEMCPY_DEP = memcpy-armv7a.S memcpy-armv7m.S
STRCMP_DEP = strcmp-arm-tiny.S strcmp-armv4.S strcmp-armv4t.S strcmp-armv6.S \
strcmp-armv6m.S strcmp-armv7.S strcmp-armv7m.S
AEABI_MEMMOVE_DEP = aeabi_memmove-thumb.S aeabi_memmove-thumb2.S \
aeabi_memmove-arm.S
all: all-am
.SUFFIXES:
@ -338,6 +344,12 @@ lib_a-aeabi_memcpy-armv7a.o: aeabi_memcpy-armv7a.S
lib_a-aeabi_memcpy-armv7a.obj: aeabi_memcpy-armv7a.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-aeabi_memcpy-armv7a.obj `if test -f 'aeabi_memcpy-armv7a.S'; then $(CYGPATH_W) 'aeabi_memcpy-armv7a.S'; else $(CYGPATH_W) '$(srcdir)/aeabi_memcpy-armv7a.S'; fi`
lib_a-aeabi_memmove-soft.o: aeabi_memmove-soft.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-aeabi_memmove-soft.o `test -f 'aeabi_memmove-soft.S' || echo '$(srcdir)/'`aeabi_memmove-soft.S
lib_a-aeabi_memmove-soft.obj: aeabi_memmove-soft.S
$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-aeabi_memmove-soft.obj `if test -f 'aeabi_memmove-soft.S'; then $(CYGPATH_W) 'aeabi_memmove-soft.S'; else $(CYGPATH_W) '$(srcdir)/aeabi_memmove-soft.S'; fi`
.c.o:
$(COMPILE) -c $<
@ -368,6 +380,12 @@ lib_a-aeabi_memcpy.o: aeabi_memcpy.c
lib_a-aeabi_memcpy.obj: aeabi_memcpy.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_memcpy.obj `if test -f 'aeabi_memcpy.c'; then $(CYGPATH_W) 'aeabi_memcpy.c'; else $(CYGPATH_W) '$(srcdir)/aeabi_memcpy.c'; fi`
lib_a-aeabi_memmove.o: aeabi_memmove.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_memmove.o `test -f 'aeabi_memmove.c' || echo '$(srcdir)/'`aeabi_memmove.c
lib_a-aeabi_memmove.obj: aeabi_memmove.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-aeabi_memmove.obj `if test -f 'aeabi_memmove.c'; then $(CYGPATH_W) 'aeabi_memmove.c'; else $(CYGPATH_W) '$(srcdir)/aeabi_memmove.c'; fi`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@ -547,6 +565,10 @@ $(lpfx)strcmp.o: $(STRCMP_DEP)
$(lpfx)strcmp.obj: $(STRCMP_DEP)
$(lpfx)aeabi_memmove.o: $(AEABI_MEMMOVE_DEP)
$(lpfx)aeabi_memmove.obj: $(AEABI_MEMMOVE_DEP)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2015 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.arm
.syntax divided
.global __aeabi_memmove
.type __aeabi_memmove, %function
ASM_ALIAS __aeabi_memmove4 __aeabi_memmove
ASM_ALIAS __aeabi_memmove8 __aeabi_memmove
__aeabi_memmove:
.cfi_startproc
cmp r0, r1
add r3, r1, r2
bhi .L2
.L4:
sub r2, r0, #1
b .L3
.L2:
cmp r0, r3
addcc r1, r0, r2
rsbcc r2, r3, r2
bcs .L4
.L5:
cmn r3, r2
ldrneb ip, [r3, #-1]!
strneb ip, [r1, #-1]!
bne .L5
.L11:
bx lr
.L3:
cmp r1, r3
ldrneb ip, [r1], #1
strneb ip, [r2, #1]!
bne .L3
.L12:
bx lr
.cfi_endproc
.size __aeabi_memmove, . - __aeabi_memmove

View File

@ -0,0 +1,52 @@
/*
* Copyright (c) 2015 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "arm_asm.h"
.macro ASM_ALIAS new old
.global \new
.type \new, %function
#if defined (__thumb__)
.thumb_set \new, \old
#else
.set \new, \old
#endif
.endm
/* NOTE: This ifdef MUST match the one in aeabi_memmove.c. */
#if !defined (__SOFTFP__)
# if defined (__thumb2__)
# include "aeabi_memmove-thumb2.S"
# elif defined (__thumb__)
# include "aeabi_memmove-thumb.S"
# else
# include "aeabi_memmove-arm.S"
# endif
#endif

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 2015 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.thumb
.syntax unified
.global __aeabi_memmove
.type __aeabi_memmove, %function
ASM_ALIAS __aeabi_memmove4 __aeabi_memmove
ASM_ALIAS __aeabi_memmove8 __aeabi_memmove
__aeabi_memmove:
.cfi_startproc
push {r4, lr}
cmp r0, r1
bls .L9
adds r3, r1, r2
cmp r0, r3
bcc .L3
.L9:
movs r3, #0
b .L4
.L3:
subs r3, r3, r2
.L5:
subs r2, r2, #1
bcc .L10
ldrb r1, [r3, r2]
strb r1, [r0, r2]
b .L5
.L4:
cmp r3, r2
beq .L10
ldrb r4, [r1, r3]
strb r4, [r0, r3]
adds r3, r3, #1
b .L4
.L10:
pop {r4, pc}
.cfi_endproc
.size __aeabi_memmove, . - __aeabi_memmove

View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2015 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
.thumb
.syntax unified
.global __aeabi_memmove
.type __aeabi_memmove, %function
ASM_ALIAS __aeabi_memmove4 __aeabi_memmove
ASM_ALIAS __aeabi_memmove8 __aeabi_memmove
__aeabi_memmove:
.cfi_startproc
cmp r0, r1
add r3, r1, r2
push {r4, lr}
bhi .L2
.L4:
subs r2, r0, #1
b .L3
.L2:
cmp r0, r3
bcs .L4
adds r1, r0, r2
subs r2, r2, r3
.L5:
cmn r3, r2
beq .L12
ldrb r4, [r3, #-1]!
strb r4, [r1, #-1]!
b .L5
.L12:
pop {r4, pc}
.L3:
cmp r1, r3
beq .L13
ldrb r4, [r1], #1
strb r4, [r2, #1]!
b .L3
.L13:
pop {r4, pc}
.cfi_endproc
.size __aeabi_memmove, . - __aeabi_memmove

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2015 ARM Ltd
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the company may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stddef.h>
#include <_ansi.h>
/* According to the run-time ABI for the ARM Architecture, this
function is allowed to corrupt only the integer core register
permitted to be corrupted by the [AAPCS] (r0-r3, ip, lr, and
CPSR).
Therefore, we can't just simply use alias to support the function
aeabi_memmove for the targets with FP register. Instead, versions
for these specific targets are written in assembler (in
aeabi_memmove-soft.S). */
/* NOTE: This ifdef MUST match the one in aeabi_memmove-soft.S. */
#if !defined (__SOFTFP__)
/* Defined in aeabi_memmove-soft.S. */
#else
/* Support the alias for the __aeabi_memmove which may
assume memory alignment. */
void __aeabi_memmove4 (void *dest, const void *source, size_t n)
_ATTRIBUTE ((alias ("__aeabi_memmove")));
void __aeabi_memmove8 (void *dest, const void *source, size_t n)
_ATTRIBUTE ((alias ("__aeabi_memmove")));
/* Support the routine __aeabi_memmove. Can't alias to memmove
because it's not defined in the same translation unit. */
void __aeabi_memmove (void *dest, const void *source, size_t n)
{
extern void memmove (void *dest, const void *source, size_t n);
memmove (dest, source, n);
}
#endif