Flags RSI, RDI, ECX as RW operands so that GCC does not assume const
authorDavide Libenzi <dlibenzi@google.com>
Thu, 10 Dec 2015 03:55:47 +0000 (19:55 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 10 Dec 2015 15:38:44 +0000 (10:38 -0500)
Flags RSI, RDI, ECX as RW operands so that GCC does not assume const.

Signed-off-by: Davide Libenzi <dlibenzi@google.com>
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/uaccess.h

index cba0ef5..4d3792e 100644 (file)
@@ -94,6 +94,7 @@ struct extable_ip_fixup {
 
 #define __user_memcpy(dst, src, count, err, errret)                                            \
        asm volatile(ASM_STAC "\n"                                                                                      \
+                                "              cld\n"                                                                          \
                                 "1:            rep movsb\n"                                                            \
                                 "2: " ASM_CLAC "\n"                                                                    \
                                 ".section .fixup,\"ax\"\n"                                                             \
@@ -101,8 +102,8 @@ struct extable_ip_fixup {
                                 "      jmp 2b\n"                                                                                       \
                                 ".previous\n"                                                                                  \
                                 _ASM_EXTABLE(1b, 3b)                                                                   \
-                                : "=r"(err)                                                                                    \
-                                : "D" (dst), "S" (src), "c" (count), "i" (errret), "0" (err) \
+                                : "=r"(err), "+D" (dst), "+S" (src), "+c" (count)              \
+                                : "i" (errret), "0" (err)                                                              \
                                 : "memory")
 
 static inline int __put_user(void *dst, const void *src, unsigned int count)