Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Nov 2000 07:50:53 -0800
From:      Julian Elischer <julian@elischer.org>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        current@FreeBSD.ORG
Subject:   Re: slight improvement in locore.s?
Message-ID:  <3A2525DD.3D1E8D5A@elischer.org>
References:  <Pine.BSF.4.21.0011291824440.2767-100000@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans wrote:
> 
> On Thu, 23 Nov 2000, Julian Elischer wrote:
> 
> > locore.s includes:
> > #define ALLOCPAGES(foo) \
> >         movl    R(physfree), %esi ; \
> >         movl    $((foo)*PAGE_SIZE), %eax ; \
> >         addl    %esi, %eax ; \
> >         movl    %eax, R(physfree) ; \
> >         movl    %esi, %edi ; \
> >         movl    $((foo)*PAGE_SIZE),%ecx ; \
> >         xorl    %eax,%eax ; \
> >         cld ; \
> >         rep ; \
> >         stosb
> >
> >
> > might it be a very slight optimisation to change this to:
> > #define ALLOCPAGES(foo) \
> >         movl    R(physfree), %esi ; \
> >         movl    $((foo)*PAGE_SIZE), %eax ; \
> >         movl    %eax, %ecx ; \
> >         addl    %esi, %eax ; \
> >         movl    %eax, R(physfree) ; \
> >         movl    %esi, %edi ; \
> >         xorl    %eax,%eax ; \
> >         cld ; \
> >         rep ; \
> >         stosb
> 
> This can be improved more (3 instructions) by not loading physfree into
> the wrong register, and depending on stosb to increment the register,


so your assembly code would look like? (just curious).

> but it should be written in C anyway.  A relocation macro like R()
> should work just as well in C as in asm.  In C, the above is:
> 
>         bzero(R(physfree), (foo) * PAGE_SIZE);
>         R(physfree) += (foo) * PAGE_SIZE);
>         return (R(physfree));   /* In unusual as well as wrong reg %esi. */
> 
> Bruce

-- 
      __--_|\  Julian Elischer
     /       \ julian@elischer.org
    (   OZ    ) World tour 2000
---> X_.---._/  presently in:  Budapest
            v




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A2525DD.3D1E8D5A>