Last change
on this file since 444 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
705 bytes
|
Line | |
---|
1 | .file "memcpy.S" |
---|
2 | |
---|
3 | .section .text |
---|
4 | .global _memcpy |
---|
5 | .type _memcpy,@function |
---|
6 | _memcpy: |
---|
7 | #ifdef __RX_DISALLOW_STRING_INSNS__ |
---|
8 | /* Do not use the string instructions - they might prefetch |
---|
9 | bytes from outside of valid memory. This is particularly |
---|
10 | dangerous in I/O space. */ |
---|
11 | |
---|
12 | ;; FIXME: It would be more space efficient to just branch to _memmove... |
---|
13 | |
---|
14 | cmp #0, r3 ; If the count is zero, do nothing |
---|
15 | beq 1f |
---|
16 | |
---|
17 | mov r1, r14 ; Save a copy of DEST |
---|
18 | |
---|
19 | 2: mov.b [r2+], r5 |
---|
20 | mov.b r5, [r14+] |
---|
21 | sub #1, r3 |
---|
22 | bne 2b |
---|
23 | |
---|
24 | 1: rts |
---|
25 | #else |
---|
26 | mov r1, r4 ; Save a copy of DEST |
---|
27 | smovf ; Copy R2 (source) to R1 (dest). Stop after R3 bytes. |
---|
28 | mov r4, r1 ; Return DEST |
---|
29 | rts |
---|
30 | #endif |
---|
31 | .size _memcpy, . - _memcpy |
---|
Note: See
TracBrowser
for help on using the repository browser.