4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-23 23:47:22 +08:00
Jeff Johnston 82095e79cf 2003-05-28 Dhananjay Deshpande <dhananjayd@kpitcummins.com>
* newlib/libc/machine/h8300/memcpy.S: Use .h8300hn and .h8300sn for
        normal mode
        * newlib/libc/machine/h8300/memset.S: Likewise
        * newlib/lib/machine/h8300/reg_memcpy.S: Likewise
        * newlib/lib/machine/h8300/reg_memset.S: Likewise
        * newlib/lib/machine/h8300/setjmp.S: Likewise
        * newlib/lib/machine/h8300/strcmp.S: Likewise
        * newlib/lib/sys/h8300hms/crt0.S: Likewise
2003-05-28 18:00:17 +00:00

57 lines
993 B
ArmAsm

#include "defines.h"
#ifdef __H8300H__
#ifdef __NORMAL_MODE__
.h8300hn
#else
.h8300h
#endif
#endif
#ifdef __H8300S__
#ifdef __NORMAL_MODE__
.h8300sn
#else
.h8300s
#endif
#endif
.global _memcpy
_memcpy:
; MOVP @(2/4,r7),A0P ; dst
; MOVP @(4/8,r7),A1P ; src
; MOVP @(6/12,r7),A2P ; len
MOVP A0P,A3P ; keep copy of final dst
ADDP A2P,A0P ; point to end of dst
CMPP A0P,A3P ; see if anything to do
beq quit
ADDP A2P,A1P ; point to end of src
; lets see if we can do this in words
or A0L,A2L ; or in the dst address
or A3L,A2L ; or the length
or A1L,A2L ; or the src address
btst #0,A2L ; see if the lsb is zero
bne byteloop
wordloop:
subs #2,A1P ; point to word
mov.w @A1P,A2 ; get word
mov.w A2,@-A0P ; save word
CMPP A0P,A3P ; at the front again ?
bne wordloop
rts
byteloop:
subs #1,A1P ; point to byte
mov.b @A1P,A2L ; get byte
mov.b A2L,@-A0P ; save byte
CMPP A0P,A3P ; at the front again ?
bne byteloop
; return with A0 pointing to dst
quit: rts