2009-10-26 18:05:23 +08:00
|
|
|
.file "memcpy.S"
|
|
|
|
|
|
|
|
.section .text
|
|
|
|
.global _memcpy
|
|
|
|
.type _memcpy,@function
|
|
|
|
_memcpy:
|
2015-04-09 16:20:00 +08:00
|
|
|
#ifdef __RX_DISALLOW_STRING_INSNS__
|
|
|
|
/* Do not use the string instructions - they might prefetch
|
|
|
|
bytes from outside of valid memory. This is particularly
|
|
|
|
dangerous in I/O space. */
|
|
|
|
|
|
|
|
;; FIXME: It would be more space efficient to just branch to _memmove...
|
|
|
|
|
|
|
|
cmp #0, r3 ; If the count is zero, do nothing
|
|
|
|
beq 1f
|
|
|
|
|
|
|
|
mov r1, r14 ; Save a copy of DEST
|
|
|
|
|
|
|
|
2: mov.b [r2+], r5
|
|
|
|
mov.b r5, [r14+]
|
|
|
|
sub #1, r3
|
|
|
|
bne 2b
|
|
|
|
|
|
|
|
1: rts
|
|
|
|
#else
|
2009-10-26 18:05:23 +08:00
|
|
|
mov r1, r4 ; Save a copy of DEST
|
|
|
|
smovf ; Copy R2 (source) to R1 (dest). Stop after R3 bytes.
|
|
|
|
mov r4, r1 ; Return DEST
|
|
|
|
rts
|
2015-04-09 16:20:00 +08:00
|
|
|
#endif
|
|
|
|
.size _memcpy, . - _memcpy
|