mirror of
https://github.com/xcat2/xNBA.git
synced 2025-02-05 13:31:47 +00:00
[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>
This commit is contained in:
parent
73aea88a62
commit
79e05875d3
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user