Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 24 Feb 2015 00:36:45 -0500
From: Rich Felker <dalias@...c.org>
To: Denys Vlasenko <vda.linux@...glemail.com>
Cc: musl <musl@...ts.openwall.com>
Subject: Re: Re: Draft of improved memset.s for i386

On Mon, Feb 23, 2015 at 10:18:11PM -0500, Rich Felker wrote:
> On Tue, Feb 24, 2015 at 04:06:06AM +0100, Denys Vlasenko wrote:
> > On Tue, Feb 24, 2015 at 4:02 AM, Denys Vlasenko
> > <vda.linux@...glemail.com> wrote:
> > > On Tue, Feb 24, 2015 at 2:09 AM, Rich Felker <dalias@...c.org> wrote:
> > >>   mov %edi,12(%esp)
> > >
> > > Shouldn't this be "mov 12(%esp),%edi"?
> > > It's a load of dst pointer from stack, right?
> > 
> > Erm... no it is not, 12(%esp) is size param.
> > 
> > Looks like this insn serves no purpose?
> > This will simply trash size param on stack,
> > since %edi is not initialized.
> 
> The purpose is saving %edi, since %edi is not call-clobbered on the
> i386 ABI. I'm just storing it over top of an argument we already
> loaded (argument space belongs to the callee per the ABI) instead of
> adjusting the stack pointer.

But I'm missing the instruction to restore it before return.

Based on your comment about an immediate in the imul, it might make
more sense just to load the dest addr into edx rather than edi, then
schedule push at a reasonable place and pop at the end. The sub
$4,%edi can then be replaced with a lea -4(%edx),%edi.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.