From owner-svn-src-head@FreeBSD.ORG Tue Aug 31 19:54:01 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB37D1065695; Tue, 31 Aug 2010 19:54:01 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 6BF128FC14; Tue, 31 Aug 2010 19:54:01 +0000 (UTC) Received: from [IPv6:2001:7b8:3a7:0:c4ac:5d43:43f8:c580] (unknown [IPv6:2001:7b8:3a7:0:c4ac:5d43:43f8:c580]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id B35C75C59; Tue, 31 Aug 2010 21:53:58 +0200 (CEST) Message-ID: <4C7D5DD2.40407@FreeBSD.org> Date: Tue, 31 Aug 2010 21:53:54 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.2.10pre) Gecko/20100831 Lanikai/3.1.4pre MIME-Version: 1.0 To: John Baldwin References: <201008311811.o7VIBoC5037894@svn.freebsd.org> <201008311537.51825.jhb@freebsd.org> In-Reply-To: <201008311537.51825.jhb@freebsd.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r212064 - head/sys/boot/pc98/boot2 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 19:54:01 -0000 On 2010-08-31 21:37, John Baldwin wrote: >> - return *(p + 0x401) * 128 * 1024 + *(u_int16_t *)(p + 0x594) * 1024 * 1024; >> + return *p * 128 * 1024 + *(u_int16_t *)(p + (0x594 - 0x401)) * 1024 * 1024; >> } > > Perhaps replace '(p + 0x594 - 0x401)' with just 'PTOV(0x594)'? > > I would actually find it cleaner to remove 'p' altogether perhaps: > > return (*(u_char *)PTOV(0x401) * 128 * 1024 + > *(uint16_t *)PTOV(0x594) * 1024 * 1024); Yes, I attempted this variation at first, but it made the code bigger, which I wanted to avoid: it went from "11 bytes available" to "7 bytes" available. I tried several semantically equivalent permutations of the expression, and the one I committed gave no increase or decrease in code size. Apparently the code size produced by gcc is very sensitive to even minimal changes. For example, a lot of the PTOV() pointer dereferences should really be qualified with 'volatile', but that even causes boot2 to become too big to fit! If the 4 extra bytes are no problem, then I would be glad to change it to the above expression, though. It is certainly clearer. :)