Root/
Source at commit 1077 created 13 years 1 month ago. By azimutz, Removing this info from DEBUG's realm. This will be enabled by default until i gather enough feedback to decide whether it will stay On or Off by default. This info display, is only available on Gui; ShowInfo=No disables it. For the Gui minimalist, "Boot Banner"=No also disables it. Ok, "house cleaning" is suspended until i figure out what Meklort's cooking over at that new branch... "rewrite" :-o just the name sounds scary :-D | |
---|---|
1 | /*␊ |
2 | * memmove.c␊ |
3 | */␊ |
4 | ␊ |
5 | #include "libsaio.h"␊ |
6 | ␊ |
7 | void *memmove(void *dst, const void *src, size_t n)␊ |
8 | {␊ |
9 | ␉const char *p = src;␊ |
10 | ␉char *q = dst;␊ |
11 | #if defined(__i386__) || defined(__x86_64__)␊ |
12 | ␉if (q < p) {␊ |
13 | ␉␉asm volatile("cld; rep; movsb"␊ |
14 | ␉␉␉ : "+c" (n), "+S"(p), "+D"(q));␊ |
15 | ␉} else {␊ |
16 | ␉␉p += (n - 1);␊ |
17 | ␉␉q += (n - 1);␊ |
18 | ␉␉asm volatile("std; rep; movsb; cld"␊ |
19 | ␉␉␉ : "+c" (n), "+S"(p), "+D"(q));␊ |
20 | ␉}␊ |
21 | #else␊ |
22 | ␉if (q < p) {␊ |
23 | ␉␉while (n--) {␊ |
24 | ␉␉␉*q++ = *p++;␊ |
25 | ␉␉}␊ |
26 | ␉} else {␊ |
27 | ␉␉p += n;␊ |
28 | ␉␉q += n;␊ |
29 | ␉␉while (n--) {␊ |
30 | ␉␉␉*--q = *--p;␊ |
31 | ␉␉}␊ |
32 | ␉}␊ |
33 | #endif␊ |
34 | ␊ |
35 | ␉return dst;␊ |
36 | }␊ |
37 |