From owner-svn-src-all@FreeBSD.ORG Wed Feb 16 23:04:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B907106564A; Wed, 16 Feb 2011 23:04:31 +0000 (UTC) (envelope-from ronald-freebsd8@klop.yi.org) Received: from smtp-out0.tiscali.nl (smtp-out0.tiscali.nl [195.241.79.175]) by mx1.freebsd.org (Postfix) with ESMTP id 2B59F8FC0C; Wed, 16 Feb 2011 23:04:30 +0000 (UTC) Received: from [212.123.145.58] (helo=sjakie.klop.ws) by smtp-out0.tiscali.nl with esmtp (Exim) (envelope-from ) id 1PpqCF-0004Sz-JT; Wed, 16 Feb 2011 23:50:07 +0100 Received: from 212-123-145-58.ip.telfort.nl (localhost [127.0.0.1]) by sjakie.klop.ws (Postfix) with ESMTP id 9002FF0B3; Wed, 16 Feb 2011 23:50:00 +0100 (CET) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes To: "Warner Losh" , "Alexander Best" References: <201102161805.p1GI5ABX078768@svn.freebsd.org> <20110216221014.GA43296@freebsd.org> <20110216221712.GA44796@freebsd.org> <20110216224126.GA47777@freebsd.org> Date: Wed, 16 Feb 2011 23:50:00 +0100 MIME-Version: 1.0 From: "Ronald Klop" Message-ID: In-Reply-To: <20110216224126.GA47777@freebsd.org> User-Agent: Opera Mail/11.01 (FreeBSD) Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r218745 - head/sys/boot/i386/boot2 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Feb 2011 23:04:31 -0000 On Wed, 16 Feb 2011 23:41:26 +0100, Alexander Best = =20 wrote: > On Wed Feb 16 11, Alexander Best wrote: >> On Wed Feb 16 11, Alexander Best wrote: >> > On Wed Feb 16 11, Warner Losh wrote: >> > > Author: imp >> > > Date: Wed Feb 16 18:05:10 2011 >> > > New Revision: 218745 >> > > URL: http://svn.freebsd.org/changeset/base/218745 >> > > >> > > Log: >> > > Remove reading of symbols from a.out loaded files. Since we are= =20 >> tight >> > > on space for clang and a.out support is only needed for =20 >> /boot/loader, >> > > they are excess bytes that serve no useful purpose other than to >> > > support really old kernels (FreeBSD < 3.2 or so). Prefer clang >> > > support over support for these old kernels and remove this code.= =20 >> We >> > > gain about 100 bytes of space this way. >> > >> > i think without this code uint32_t x serves no purpose any longer: >> > >> > /usr/git-freebsd-head/sys/boot/i386/boot2/boot2.c:322:20: warning: =20 >> unused variable 'x' [-Wunused-variable] >> > uint32_t addr, x; >> > ^ >> >> also due to >> >> /usr/git-freebsd-head/sys/boot/i386/boot2/boot2.c:631:8: warning: cast= =20 >> from 'caddr_t' (aka 'char *') to 'uint32_t *' (aka 'unsigned int *') =20 >> increases required alignment from 1 to 4 [-Wcast-align] >> t1 =3D *(uint32_t *)PTOV(0x46c); >> ^~~~~~~~~~~~~~~~~~~~~~~ >> >> i think t0 and t1 can be turned into uint8_t's and PTOV(0x46c); can be= =20 >> casted >> to (uint8_t *), instead of (uint32_t *). > > with this additional change the code fits when compiled with clang: > > diff --git a/sys/boot/i386/boot2/sio.S b/sys/boot/i386/boot2/sio.S > index 7b8e9eb..d745129 100644 > --- a/sys/boot/i386/boot2/sio.S > +++ b/sys/boot/i386/boot2/sio.S > @@ -29,11 +29,11 @@ > sio_init: movw $SIO_PRT+0x3,%dx # Data format reg > movb $SIO_FMT|0x80,%al # Set format > outb %al,(%dx) # and DLAB > - pushl %edx # Save > + pushb %dl # Save > subb $0x3,%dl # Divisor latch reg > movl 0x8(%esp),%eax # Set > outw %ax,(%dx) # BPS > - popl %edx # Restore > + popb %dl # Restore > movb $SIO_FMT,%al # Clear > outb %al,(%dx) # DLAB > incl %edx # Modem control reg > > ...since we're only modifying %dl in subb $0x3,%dl, we don't need to =20 > push/pop > a 32 bit value, but only 8 bits. You guys are kings. :-) I heard they don't even teach assembly anymore at= =20 a lot of universities. > > cheers. > alex > >> >> cheers. >> alex >> >> > >> > cheers. >> > alex >> > >> > > >> > > Reviewed by: rdivacky@ >> > > >> > > Modified: >> > > head/sys/boot/i386/boot2/boot2.c >> > > >> > > Modified: head/sys/boot/i386/boot2/boot2.c >> > > =20 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> > > --- head/sys/boot/i386/boot2/boot2.c Wed Feb 16 17:50:21 =20 >> 2011 (r218744) >> > > +++ head/sys/boot/i386/boot2/boot2.c Wed Feb 16 18:05:10 =20 >> 2011 (r218745) >> > > @@ -347,23 +347,6 @@ load(void) >> > > p +=3D roundup2(hdr.ex.a_text, PAGE_SIZE); >> > > if (xfsread(ino, p, hdr.ex.a_data)) >> > > return; >> > > - p +=3D hdr.ex.a_data + roundup2(hdr.ex.a_bss, PAGE_SIZE); >> > > - bootinfo.bi_symtab =3D VTOP(p); >> > > - *(uint32_t*)p =3D hdr.ex.a_syms; >> > > - p +=3D sizeof(hdr.ex.a_syms); >> > > - if (hdr.ex.a_syms) { >> > > - if (xfsread(ino, p, hdr.ex.a_syms)) >> > > - return; >> > > - p +=3D hdr.ex.a_syms; >> > > - if (xfsread(ino, p, sizeof(int))) >> > > - return; >> > > - x =3D *(uint32_t *)p; >> > > - p +=3D sizeof(int); >> > > - x -=3D sizeof(int); >> > > - if (xfsread(ino, p, x)) >> > > - return; >> > > - p +=3D x; >> > > - } >> > > } else { >> > > fs_off =3D hdr.eh.e_phoff; >> > > for (j =3D i =3D 0; i < hdr.eh.e_phnum && j < 2; i++) { >> > > @@ -395,8 +378,8 @@ load(void) >> > > } >> > > } >> > > addr =3D hdr.eh.e_entry & 0xffffff; >> > > + bootinfo.bi_esymtab =3D VTOP(p); >> > > } >> > > - bootinfo.bi_esymtab =3D VTOP(p); >> > > bootinfo.bi_kernelname =3D VTOP(kname); >> > > bootinfo.bi_bios_dev =3D dsk.drive; >> > > __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), >> > >> > -- >> > a13x >> >> -- >> a13x