OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [machine/] [m68k/] [strcpy.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 56 joel
/*
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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.