[PATCH] sh4: use optimized asm version of memcpy - add config option to support backward copying

Carmelo AMOROSO carmelo.amoroso at st.com
Wed Mar 21 10:29:32 UTC 2007


Hi All,
I'm currently using on uClibc-nptl for sh4 an optimized version
of the memcpy function (from Stuart Menefy @STMicroelectronics).
This implementation is based on 'backward copying'
and brakes the current implementation of 'memmove' 
(libc/string/generic/memmove.c)
that, as clearly stated, assumes memcpy does a forward copying.

The attached patch provides a solution for this adding a config option
to specify what kind of memcpy implementation the architecture provides.
In this way the memmove works with both implementation.

A brief explanation of the changes follows:

extra/Configs/Config.in.arch    -> add the new option ARCH_HAS_BWD_MEMCPY
extra/Configs/Config.in.sh      ->  set on the ARCH_HAS_BWD_MEMCPY for 
sh4 architecture

libc/string/sh                  -> new file memcpy.S
libc/string/generic/memmove.c   -> use the new macro 
__ARCH_HAS_BWD_MEMCPY__ instead of #if 1
libc/string/generic/memcpy.c    ->  move static function from C source 
to common header file
libc/string/generic/memcopy.h   ->  "" 

It has been fully tested on uClibc-nptl for sh4, even if it is not 
TLS/nptl related.

Even if the new memcpy will not be included into uClibc, may be worth to 
add the new option.
Any comments are welcome.

Best regards,
Carmelo

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: backward_memcpy.patch
Url: http://lists.busybox.net/pipermail/uclibc/attachments/20070321/4013bdfa/attachment-0002.diff 


More information about the uClibc mailing list