This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Broken memcpy() in 68K
- From: Robert Morin <robert dot morin at gmail dot com>
- To: newlib at sources dot redhat dot com
- Date: Sat, 5 Dec 2009 13:57:52 -0500
- Subject: Broken memcpy() in 68K
Hi,
I am porting some 68K C source code from HP-UX to GCC/Cygwin and I
found out the memcpy.S in newlib/libc/machine/m68k/memcpy.S is not
working when the src is not aligned.
I did a quick fix like this until I can submit a more clean fix-up
(and learn too on how to do it).
SYM(memcpy):
??????? move.l? 4(sp),a0??????? | dest ptr
??????? move.l? 8(sp),a1??????? | src ptr
??????? move.l? 12(sp),d1?????? | len
1:
??????? move.b? (a1)+,(a0)+???? | move single byte
#if !defined (__mcoldfire__)
??????? dbra??? d1,1b?????????? | loop until done
#else
??????? subq.l? #1,d1
??????? bpl???? 1b
#endif
??????? move.l? 4(sp),d0??????? | return value
??????? rts
Robert Morin
Montreal