From owner-freebsd-current Tue Nov 28 23:31: 1 2000 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id F23F937B401 for ; Tue, 28 Nov 2000 23:30:56 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id SAA24578; Wed, 29 Nov 2000 18:30:40 +1100 Date: Wed, 29 Nov 2000 18:31:12 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Julian Elischer Cc: current@FreeBSD.ORG Subject: Re: slight improvement in locore.s? In-Reply-To: <3A1D47C6.D35464F0@elischer.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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, 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 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message