Messages in this thread | | | From | David Laight <> | Subject | RE: [RFC PATCH v1 0/5] nolibc x86-64 string functions | Date | Fri, 1 Sep 2023 14:23:28 +0000 |
| |
From: Ammar Faizi > Sent: 01 September 2023 14:06 ... > > You're completely right indeed, reminds me about the copy_up/copy_down > > that were not used anymore :-) > > I'm an idiot, will fix that. Another attempt as suggested below: > > __asm__ ( > ".section .text.nolibc_memmove\n" > ".weak memmove\n" > "memmove:\n" > " movq %rdx, %rcx\n" > " movq %rdi, %rdx\n" > " movq %rdi, %rax\n"
You seem to have confused yourself about whether you are using %eax or %edx.
> " subq %rsi, %rdx\n" > " cmpq %rcx, %rdx\n" > " jnb .Lforward_copy\n"
I think I'd fall through to the forwards copy and not worry about replicating the 'reps movsb' and 'ret'. IIRC 'cld' can be slow as well.
> " leaq -1(%rdi, %rcx, 1), %rdi\n" > " leaq -1(%rsi, %rcx, 1), %rsi\n" > " std\n" > ".Lforward_copy:\n" > " rep movsb\n" > " cld\n" > " ret\n" > ); > > -- > Ammar Faizi
David
- Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
| |