[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZPHh0duonHnyAX6C@biznet-home.integral.gnuweeb.org>
Date: Fri, 1 Sep 2023 20:06:25 +0700
From: Ammar Faizi <ammarfaizi2@...weeb.org>
To: Willy Tarreau <w@....eu>
Cc: David Laight <David.Laight@...lab.com>,
Thomas Weißschuh <linux@...ssschuh.net>,
Nicholas Rosenberg <inori@...x.org>,
Alviro Iskandar Setiawan <alviro.iskandar@...weeb.org>,
Michael William Jonathan <moe@...weeb.org>,
GNU/Weeb Mailing List <gwml@...r.gnuweeb.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH v1 0/5] nolibc x86-64 string functions
On Fri, Sep 01, 2023 at 01:46:44PM +0200, Willy Tarreau wrote:
> On Fri, Sep 01, 2023 at 11:34:18AM +0000, David Laight wrote:
> > Isn't that completely broken?
> >
> > You need to select between forwards and backwards moves.
> > Since forwards moves are preferred it is best to do
> > if (dst - src < len)
> > backards_copy()
> > else
> > formwards_copy()
> >
> > David
>
> 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"
" subq %rsi, %rdx\n"
" cmpq %rcx, %rdx\n"
" jnb .Lforward_copy\n"
" 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
Powered by blists - more mailing lists