Date: Thu, 17 Feb 2011 09:28:04 +0100 From: Roman Divacky <rdivacky@freebsd.org> To: Alexander Best <arundel@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Warner Losh <imp@freebsd.org> Subject: Re: svn commit: r218745 - head/sys/boot/i386/boot2 Message-ID: <20110217082804.GA94566@freebsd.org> In-Reply-To: <20110217015211.GA67933@freebsd.org> References: <201102161805.p1GI5ABX078768@svn.freebsd.org> <20110217015211.GA67933@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
I have some more WIP patches that shrink stuff some more, plus I have clang/llvm changes that help too.. this will get fixed On Thu, Feb 17, 2011 at 01:52:11AM +0000, 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 tight > > on space for clang and a.out support is only needed for /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. We > > gain about 100 bytes of space this way. > > sorry for my crappy previous attempt to reduce boot2's size. obviously > the *.S files aren't the problem, because even with clang we're using GAS. > so working on boot2.c is the only way of reducing the size. > > i've managed to do so (even with another 4 bytes to spare) with the attached > patch. > > i did > > otaku% grep -r bi_basemem * > sys/boot/i386/boot2/boot2.c: bootinfo.bi_basemem = 0; /* XXX will be filled by loader or kernel */ > sys/boot/i386/boot2/machine/bootinfo.h: u_int32_t bi_basemem; > sys/boot/i386/gptboot/gptboot.c: bootinfo.bi_basemem = 0; /* XXX will be filled by loader or kernel */ > sys/boot/i386/libi386/bootinfo32.c: bi.bi_basemem = bios_basemem / 1024; > sys/boot/i386/loader/main.c: initial_bootinfo->bi_basemem = bios_basemem / 1024; > sys/boot/i386/zfsboot/zfsboot.c: bootinfo.bi_basemem = bios_basemem / 1024; > sys/boot/pc98/boot2/boot2.c: bootinfo.bi_basemem = 0; /* XXX will be filled by loader or kernel */ > sys/boot/pc98/loader/main.c: initial_bootinfo->bi_basemem = bios_basemem / 1024; > sys/i386/include/bootinfo.h: u_int32_t bi_basemem; > sys/mips/include/bootinfo.h: u_int32_t bi_basemem; > > which led me to the conclusion that bootinfo.bi_basemem doesn't need to > initialised, because it will always be set by the loader (as the XXX comment > says). > > turning ioctrl from uint8_t to int also saves a few bytes for whatever reason). > removing x doesn't save any bytes, but gets rid of a warning (as noted in one > of my messages). > > cheers. > alex > > ...and sorry for the previous noise. :( > > > > > Reviewed by: rdivacky@ > > > > Modified: > > head/sys/boot/i386/boot2/boot2.c > > > > Modified: head/sys/boot/i386/boot2/boot2.c > > ============================================================================== > > --- head/sys/boot/i386/boot2/boot2.c Wed Feb 16 17:50:21 2011 (r218744) > > +++ head/sys/boot/i386/boot2/boot2.c Wed Feb 16 18:05:10 2011 (r218745) > > @@ -347,23 +347,6 @@ load(void) > > p += roundup2(hdr.ex.a_text, PAGE_SIZE); > > if (xfsread(ino, p, hdr.ex.a_data)) > > return; > > - p += hdr.ex.a_data + roundup2(hdr.ex.a_bss, PAGE_SIZE); > > - bootinfo.bi_symtab = VTOP(p); > > - *(uint32_t*)p = hdr.ex.a_syms; > > - p += sizeof(hdr.ex.a_syms); > > - if (hdr.ex.a_syms) { > > - if (xfsread(ino, p, hdr.ex.a_syms)) > > - return; > > - p += hdr.ex.a_syms; > > - if (xfsread(ino, p, sizeof(int))) > > - return; > > - x = *(uint32_t *)p; > > - p += sizeof(int); > > - x -= sizeof(int); > > - if (xfsread(ino, p, x)) > > - return; > > - p += x; > > - } > > } else { > > fs_off = hdr.eh.e_phoff; > > for (j = i = 0; i < hdr.eh.e_phnum && j < 2; i++) { > > @@ -395,8 +378,8 @@ load(void) > > } > > } > > addr = hdr.eh.e_entry & 0xffffff; > > + bootinfo.bi_esymtab = VTOP(p); > > } > > - bootinfo.bi_esymtab = VTOP(p); > > bootinfo.bi_kernelname = VTOP(kname); > > bootinfo.bi_bios_dev = dsk.drive; > > __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), > > -- > a13x > diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c > index 3849725..d572700 100644 > --- a/sys/boot/i386/boot2/boot2.c > +++ b/sys/boot/i386/boot2/boot2.c > @@ -135,7 +135,7 @@ static char kname[1024]; > static uint16_t opts; > static int comspeed = SIOSPD; > static struct bootinfo bootinfo; > -static uint8_t ioctrl = IO_KEYBOARD; > +static int ioctrl = IO_KEYBOARD; > > void exit(int); > static void load(void); > @@ -245,7 +245,7 @@ main(void) > dsk.slice = *(uint8_t *)PTOV(ARGS + 1) + 1; > bootinfo.bi_version = BOOTINFO_VERSION; > bootinfo.bi_size = sizeof(bootinfo); > - bootinfo.bi_basemem = 0; /* XXX will be filled by loader or kernel */ > + /* bootinfo.bi_basemem = 0; XXX will be filled by loader or kernel */ > bootinfo.bi_extmem = memsize(); > bootinfo.bi_memsizes_valid++; > > @@ -319,7 +319,7 @@ load(void) > static Elf32_Shdr es[2]; > caddr_t p; > ino_t ino; > - uint32_t addr, x; > + uint32_t addr; > int i, j; > uint8_t fmt; >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110217082804.GA94566>