summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorJoshua Oreman2010-07-30 18:52:03 +0200
committerMichael Brown2010-08-01 18:31:14 +0200
commit79e05875d3d59ee3578a6a0ddc5b7cf5281708d7 (patch)
tree2d82d198550f8f43071f0bbb90164c6ca2003220 /src/arch
parent[802.11] Fix a use-after-free (diff)
downloadipxe-79e05875d3d59ee3578a6a0ddc5b7cf5281708d7.tar.gz
ipxe-79e05875d3d59ee3578a6a0ddc5b7cf5281708d7.tar.xz
ipxe-79e05875d3d59ee3578a6a0ddc5b7cf5281708d7.zip
[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 <oremanj@rwcr.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/include/bits/string.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/arch/x86/include/bits/string.h b/src/arch/x86/include/bits/string.h
index a68868ac9..f35cdab1c 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)