Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/iFabio/Chameleon/i386/modules/klibc/memmove.c

Source at commit 307 created 13 years 4 hours ago.
By ifabio, merge changes from trunk (929). Also merge the module changes from Azimutz branche (fix compile error) Also edited the info.plist into AHCIPortInjector.kext: http://forum.voodooprojects.org/index.php/topic,1170.0.html
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: 307