Chameleon

Chameleon Svn Source Tree

Root/branches/rewrite/i386/modules/klibc/memmove.c

Source at commit 1146 created 12 years 11 months ago.
By azimutz, Sync with trunk (r1145). Add nVidia dev id's, 0DF4 for "GeForce GT 450M" (issue 99) and 1251 for "GeForce GTX 560M" (thanks to oSxFr33k for testing).
1/*
2 * memmove.c
3 */
4
5#include "libsaio.h"
6
7void *memmove(void *dst, const void *src, size_t n)
8{
9const char *p = src;
10char *q = dst;
11#if defined(__i386__) || defined(__x86_64__)
12if (q < p) {
13asm volatile("cld; rep; movsb"
14 : "+c" (n), "+S"(p), "+D"(q));
15} else {
16p += (n - 1);
17q += (n - 1);
18asm volatile("std; rep; movsb; cld"
19 : "+c" (n), "+S"(p), "+D"(q));
20}
21#else
22if (q < p) {
23while (n--) {
24*q++ = *p++;
25}
26} else {
27p += n;
28q += n;
29while (n--) {
30*--q = *--p;
31}
32}
33#endif
34
35return dst;
36}
37

Archive Download this file

Revision: 1146