Broken memcpy() in 68K

Robert Morin
Mon Dec 7 18:51:00 GMT 2009


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).

        move.l  4(sp),a0        | dest ptr
        move.l  8(sp),a1        | src ptr
        move.l  12(sp),d1       | len
        move.b  (a1)+,(a0)+     | move single byte

#if !defined (__mcoldfire__)
        dbra    d1,1b           | loop until done
        subq.l  #1,d1
        bpl     1b
        move.l  4(sp),d0        | return value

Robert Morin

More information about the Newlib mailing list