ia64/xen-unstable

view xen/arch/x86/string.c @ 19835:edfdeb150f27

Fix buildsystem to detect udev > version 124

udev removed the udevinfo symlink from versions higher than 123 and
xen's build-system could not detect if udev is in place and has the
required version.

Signed-off-by: Marc-A. Dahlhaus <mad@wol.de>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 25 13:02:37 2009 +0100 (2009-06-25)
parents 2052364cb456
children
line source
1 /******************************************************************************
2 * string.c
3 *
4 * These provide something for compiler-emitted string operations to link
5 * against.
6 */
8 #include <xen/config.h>
9 #include <xen/lib.h>
11 #undef memcpy
12 void *memcpy(void *dest, const void *src, size_t n)
13 {
14 long d0, d1, d2;
16 asm volatile (
17 #ifdef __i386__
18 " rep movsl ; "
19 #else
20 " rep movsq ; "
21 " testb $4,%b4 ; "
22 " je 0f ; "
23 " movsl ; "
24 "0: ; "
25 #endif
26 " testb $2,%b4 ; "
27 " je 1f ; "
28 " movsw ; "
29 "1: testb $1,%b4 ; "
30 " je 2f ; "
31 " movsb ; "
32 "2: "
33 : "=&c" (d0), "=&D" (d1), "=&S" (d2)
34 : "0" (n/sizeof(long)), "q" (n), "1" (dest), "2" (src)
35 : "memory");
37 return dest;
38 }
40 #undef memset
41 void *memset(void *s, int c, size_t n)
42 {
43 long d0, d1;
45 asm volatile (
46 "rep stosb"
47 : "=&c" (d0), "=&D" (d1)
48 : "a" (c), "1" (s), "0" (n)
49 : "memory");
51 return s;
52 }
54 #undef memmove
55 void *memmove(void *dest, const void *src, size_t n)
56 {
57 long d0, d1, d2;
59 if ( dest < src )
60 return memcpy(dest, src, n);
62 asm volatile (
63 " std ; "
64 " rep movsb ; "
65 " cld "
66 : "=&c" (d0), "=&S" (d1), "=&D" (d2)
67 : "0" (n), "1" (n-1+(const char *)src), "2" (n-1+(char *)dest)
68 : "memory");
70 return dest;
71 }
73 /*
74 * Local variables:
75 * mode: C
76 * c-set-style: "BSD"
77 * c-basic-offset: 4
78 * tab-width: 4
79 * indent-tabs-mode: nil
80 * End:
81 */