Broken memcpy() in 68K

Robert Morin robert.morin@gmail.com
Mon Dec 7 18:51:00 GMT 2009


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



More information about the Newlib mailing list