Chameleon

Chameleon Svn Source Tree

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

Source at commit 1129 created 12 years 11 months ago.
By meklort, Change options.o so that it reloads the system config as well. Also change it so that it uses that config for variables (NOTE: if the calue exists in chameleonConfig, it's used instead.
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: 1129