Explorar el Código

[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>
tags/v1.20.1
Joshua Oreman hace 14 años
padre
commit
79e05875d3
Se han modificado 1 ficheros con 4 adiciones y 4 borrados
  1. 4
    4
      src/arch/x86/include/bits/string.h

+ 4
- 4
src/arch/x86/include/bits/string.h Ver fichero

@@ -198,12 +198,12 @@ return s;
198 198
 #define __HAVE_ARCH_MEMSWAP
199 199
 static inline void * memswap(void *dest, void *src, size_t n)
200 200
 {
201
-int d0, d1, d2, d3;
201
+long d0, d1, d2, d3;
202 202
 __asm__ __volatile__(
203 203
 	"\n1:\t"
204
-	"movb (%%edi),%%al\n\t"
205
-	"xchgb (%%esi),%%al\n\t"
206
-	"incl %%esi\n\t"
204
+	"movb (%2),%%al\n\t"
205
+	"xchgb (%1),%%al\n\t"
206
+	"inc %1\n\t"
207 207
 	"stosb\n\t"
208 208
 	"loop 1b"
209 209
 	: "=&c" (d0), "=&S" (d1), "=&D" (d2), "=&a" (d3)

Loading…
Cancelar
Guardar