From owner-freebsd-current Wed Nov 29 15:20:34 2000 Delivered-To: freebsd-current@freebsd.org Received: from mail.interware.hu (mail.interware.hu [195.70.32.130]) by hub.freebsd.org (Postfix) with ESMTP id 3AACA37B404 for ; Wed, 29 Nov 2000 15:20:31 -0800 (PST) Received: from monrovia-58.budapest.interware.hu ([195.70.53.250] helo=elischer.org) by mail.interware.hu with esmtp (Exim 3.16 #1 (Debian)) id 141GWX-0004eH-00; Thu, 30 Nov 2000 00:20:26 +0100 Message-ID: <3A2525DD.3D1E8D5A@elischer.org> Date: Wed, 29 Nov 2000 07:50:53 -0800 From: Julian Elischer X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 5.0-CURRENT i386) X-Accept-Language: en, hu MIME-Version: 1.0 To: Bruce Evans Cc: current@FreeBSD.ORG Subject: Re: slight improvement in locore.s? References: Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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