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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [arch/] [x86_64/] [lib/] [memmove.c] - Blame information for rev 1781

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

Line No. Rev Author Line
1 1275 phoenix
/* Normally compiler builtins are used, but sometimes the compiler calls out
2
   of line code. Based on asm-i386/string.h.
3
 */
4
#define _STRING_C
5
#include <linux/string.h>
6
 
7
#undef memmove
8
void *memmove(void * dest,const void *src,size_t count)
9
{
10
        if (dest < src) {
11
                __inline_memcpy(dest,src,count);
12
        } else {
13
                /* Could be more clever and move longs */
14
                unsigned long d0, d1, d2;
15
                __asm__ __volatile__(
16
                        "std\n\t"
17
                        "rep\n\t"
18
                        "movsb\n\t"
19
                        "cld"
20
                        : "=&c" (d0), "=&S" (d1), "=&D" (d2)
21
                        :"0" (count),
22
                        "1" (count-1+(const char *)src),
23
                        "2" (count-1+(char *)dest)
24
                        :"memory");
25
        }
26
        return dest;
27
}

powered by: WebSVN 2.1.0

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