From 79e05875d3d59ee3578a6a0ddc5b7cf5281708d7 Mon Sep 17 00:00:00 2001 From: Joshua Oreman Date: Fri, 30 Jul 2010 09:52:03 -0700 Subject: [PATCH] [string] Use 64-bit registers in assembly memswap() on x86_64 An assembly version of memswap() is in an x86 word-length-agnostic header file, but it used 32-bit registers to store pointers, leading to memory errors responding to ARP queries on 64-bit systems. Signed-off-by: Joshua Oreman Signed-off-by: Michael Brown --- src/arch/x86/include/bits/string.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/arch/x86/include/bits/string.h b/src/arch/x86/include/bits/string.h index a68868ac..f35cdab1 100644 --- a/src/arch/x86/include/bits/string.h +++ b/src/arch/x86/include/bits/string.h @@ -198,12 +198,12 @@ return s; #define __HAVE_ARCH_MEMSWAP static inline void * memswap(void *dest, void *src, size_t n) { -int d0, d1, d2, d3; +long d0, d1, d2, d3; __asm__ __volatile__( "\n1:\t" - "movb (%%edi),%%al\n\t" - "xchgb (%%esi),%%al\n\t" - "incl %%esi\n\t" + "movb (%2),%%al\n\t" + "xchgb (%1),%%al\n\t" + "inc %1\n\t" "stosb\n\t" "loop 1b" : "=&c" (d0), "=&S" (d1), "=&D" (d2), "=&a" (d3)