[klibc] memmove: when we do std, we need to also cld
After doing std, we absolutely need to cld afterwards (the compiler
has the right to assume DF=0, and we do elsewhere.)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
diff --git a/usr/klibc/memmove.c b/usr/klibc/memmove.c
index 659c778..a398cd8 100644
--- a/usr/klibc/memmove.c
+++ b/usr/klibc/memmove.c
@@ -10,12 +10,12 @@
char *q = dst;
#if defined(__i386__) || defined(__x86_64__)
if (q < p) {
- asm volatile("cld ; rep ; movsb"
+ asm volatile("cld; rep; movsb"
: "+c" (n), "+S"(p), "+D"(q));
} else {
p += (n - 1);
q += (n - 1);
- asm volatile("std ; rep ; movsb"
+ asm volatile("std; rep; movsb; cld"
: "+c" (n), "+S"(p), "+D"(q));
}
#else