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:
691 bytes
|
Line | |
---|
1 | /* |
---|
2 | * C library strcpy routine |
---|
3 | * |
---|
4 | * This routine has been optimized for the CPU32+. |
---|
5 | * It should run on all 68k machines. |
---|
6 | * |
---|
7 | * W. Eric Norum |
---|
8 | * Saskatchewan Accelerator Laboratory |
---|
9 | * University of Saskatchewan |
---|
10 | * Saskatoon, Saskatchewan, CANADA |
---|
11 | * eric@skatter.usask.ca |
---|
12 | */ |
---|
13 | |
---|
14 | #include <string.h> |
---|
15 | |
---|
16 | /* |
---|
17 | * Copy bytes using CPU32+ loop mode if possible |
---|
18 | */ |
---|
19 | |
---|
20 | char * |
---|
21 | strcpy (char *to, const char *from) |
---|
22 | { |
---|
23 | char *pto = to; |
---|
24 | unsigned int n = 0xFFFF; |
---|
25 | |
---|
26 | asm volatile ("1:\n" |
---|
27 | "\tmove.b (%0)+,(%1)+\n" |
---|
28 | #if defined(__mcpu32__) |
---|
29 | "\tdbeq %2,1b\n" |
---|
30 | #endif |
---|
31 | "\tbne.b 1b\n" : |
---|
32 | "=a" (from), "=a" (pto), "=d" (n) : |
---|
33 | "0" (from), "1" (pto), "2" (n) : |
---|
34 | "cc", "memory"); |
---|
35 | return to; |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.