This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [Newlib] [ARM] Support __aeabi_memmove for the arm backend in newlib.


Hi,

This patch is used to support the function __aeabi_memmove for the arm
backend in newlib.

According to the run-time ABI for ARM architecture, this function is allowed
to corrupt only the integer core registers permitted to be corrupted by the
[AAPCS] (r0-r3, ip, lr, and CPSR). So we can't just simply use the
memmove()(in the string library in newlib) to implement this function.

This patch divides this issue into two cases:
1. For the targets with FP registers, implemment this function by assembly
code. The assembly code is generated by compile the source code of memmove()
with the option '-mfloat-abi=soft' which means no FP registers will be used.
The versions for thumb mode, thumb2 mode and arm mode are all supported. 
2. For the targets without FP registers, call memmove() to implement this
function.

Newlib build passed. The function aeabi_memmove() can link correctly with
different arm targets.
Make check passed for arm mode, thumb mode and thumb2 mode.

Is it ok?

Thanks
Hale

newlib/ChangeLog:

2015-02-12  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.


diff --git a/newlib/libc/machine/arm/Makefile.am
b/newlib/libc/machine/arm/Makefile.am
index dc17690..e1d768a 100644
--- a/newlib/libc/machine/arm/Makefile.am
+++ b/newlib/libc/machine/arm/Makefile.am
@@ -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)
diff --git a/newlib/libc/machine/arm/Makefile.in
b/newlib/libc/machine/arm/Makefile.in
index db65405..6c44fef 100644
--- a/newlib/libc/machine/arm/Makefile.in
+++ b/newlib/libc/machine/arm/Makefile.in
@@ -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:
diff --git a/newlib/libc/machine/arm/aeabi_memmove-arm.S
b/newlib/libc/machine/arm/aeabi_memmove-arm.S
new file mode 100644
index 0000000..371f215
--- /dev/null
+++ b/newlib/libc/machine/arm/aeabi_memmove-arm.S
@@ -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
diff --git a/newlib/libc/machine/arm/aeabi_memmove-soft.S
b/newlib/libc/machine/arm/aeabi_memmove-soft.S
new file mode 100644
index 0000000..010e266
--- /dev/null
+++ b/newlib/libc/machine/arm/aeabi_memmove-soft.S
@@ -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
diff --git a/newlib/libc/machine/arm/aeabi_memmove-thumb.S
b/newlib/libc/machine/arm/aeabi_memmove-thumb.S
new file mode 100644
index 0000000..52e9e07
--- /dev/null
+++ b/newlib/libc/machine/arm/aeabi_memmove-thumb.S
@@ -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
diff --git a/newlib/libc/machine/arm/aeabi_memmove-thumb2.S
b/newlib/libc/machine/arm/aeabi_memmove-thumb2.S
new file mode 100644
index 0000000..d408f85
--- /dev/null
+++ b/newlib/libc/machine/arm/aeabi_memmove-thumb2.S
@@ -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
diff --git a/newlib/libc/machine/arm/aeabi_memmove.c
b/newlib/libc/machine/arm/aeabi_memmove.c
new file mode 100644
index 0000000..1e2bbaf
--- /dev/null
+++ b/newlib/libc/machine/arm/aeabi_memmove.c
@@ -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

Attachment: aeabi_memmove.patch-3
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]