Date: Sat, 17 Sep 2022 12:39:35 -0600 From: Warner Losh <imp@bsdimp.com> To: =?UTF-8?Q?T=C4=B3l_Coosemans?= <tijl@freebsd.org> Cc: Warner Losh <imp@freebsd.org>, src-committers <src-committers@freebsd.org>, "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, dev-commits-src-main@freebsd.org Subject: Re: git: 9758dd3de1cd - main - stand: Allocate bootinfo rather than have it be static Message-ID: <CANCZdfq=0sMgy%2B=O=64QywMwP=4v9B5ZXmNOc_9ZHyN66=GZSw@mail.gmail.com> In-Reply-To: <20220917190108.2b56bb39@FreeBSD.org> References: <202209161554.28GFs4aA086609@gitrepo.freebsd.org> <20220917190108.2b56bb39@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On Sat, Sep 17, 2022, 11:01 AM Tijl Coosemans <tijl@freebsd.org> wrote: > On Fri, 16 Sep 2022 15:54:04 GMT Warner Losh <imp@FreeBSD.org> wrote: > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=9758dd3de1cddc8271be8dd6fee69286c5c86535 > > > > commit 9758dd3de1cddc8271be8dd6fee69286c5c86535 > > Author: Warner Losh <imp@FreeBSD.org> > > AuthorDate: 2022-09-16 15:09:41 +0000 > > Commit: Warner Losh <imp@FreeBSD.org> > > CommitDate: 2022-09-16 15:18:57 +0000 > > > > stand: Allocate bootinfo rather than have it be static > > > > This saves 80 bytes (the new bootinfo structure was 84 bytes, and a > > pointer is 4 bytes). The bi_load32 code is the same size. > > > > Sponsored by: Netflix > > Reviewed by: tsoome > > Differential Revision: https://reviews.freebsd.org/D36575 > > --- > > stand/i386/libi386/bootinfo32.c | 29 +++++++++++++++-------------- > > 1 file changed, 15 insertions(+), 14 deletions(-) > > > > diff --git a/stand/i386/libi386/bootinfo32.c > b/stand/i386/libi386/bootinfo32.c > > index 372bced917d6..37a797289f2b 100644 > > --- a/stand/i386/libi386/bootinfo32.c > > +++ b/stand/i386/libi386/bootinfo32.c > > @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$"); > > #include "geliboot.h" > > #endif > > > > -static struct bootinfo bi; > > +static struct bootinfo *bi; > > > > /* > > * Load the information expected by an i386 kernel. > > @@ -91,11 +91,12 @@ bi_load32(char *args, int *howtop, int *bootdevp, > vm_offset_t *bip, vm_offset_t > > /* XXX - use a default bootdev of 0. Is this ok??? */ > > bootdevnr = 0; > > > > + bi = calloc(sizeof(*bi), 1); > > switch(rootdev->dd.d_dev->dv_type) { > > case DEVT_CD: > > case DEVT_DISK: > > /* pass in the BIOS device number of the current disk */ > > - bi.bi_bios_dev = bd_unit2bios(rootdev); > > + bi->bi_bios_dev = bd_unit2bios(rootdev); > > bootdevnr = bd_getdev(rootdev); > > break; > > > > @@ -172,22 +173,22 @@ bi_load32(char *args, int *howtop, int *bootdevp, > vm_offset_t *bip, vm_offset_t > > /* legacy bootinfo structure */ > > kernelname = getenv("kernelname"); > > i386_getdev(NULL, kernelname, &kernelpath); > > - bi.bi_version = BOOTINFO_VERSION; > > - bi.bi_size = sizeof(bi); > > - bi.bi_memsizes_valid = 1; > > - bi.bi_basemem = bios_basemem / 1024; > > - bi.bi_extmem = bios_extmem / 1024; > > - bi.bi_envp = envp; > > - bi.bi_modulep = *modulep; > > - bi.bi_kernend = kernend; > > - bi.bi_kernelname = VTOP(kernelpath); > > - bi.bi_symtab = ssym; /* XXX this is only the primary kernel > symtab */ > > - bi.bi_esymtab = esym; > > + bi->bi_version = BOOTINFO_VERSION; > > + bi->bi_size = sizeof(bi); > > sizeof(*bi) here and maybe make bi a function variable? > Damn. I even looked for those... :( Warner > + bi->bi_memsizes_valid = 1; > > + bi->bi_basemem = bios_basemem / 1024; > > + bi->bi_extmem = bios_extmem / 1024; > > + bi->bi_envp = envp; > > + bi->bi_modulep = *modulep; > > + bi->bi_kernend = kernend; > > + bi->bi_kernelname = VTOP(kernelpath); > > + bi->bi_symtab = ssym; /* XXX this is only the primary kernel > symtab */ > > + bi->bi_esymtab = esym; > > > > /* legacy boot arguments */ > > *howtop = howto | RB_BOOTINFO; > > *bootdevp = bootdevnr; > > - *bip = VTOP(&bi); > > + *bip = VTOP(bi); > > > > return(0); > > } > > [-- Attachment #2 --] <div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Sep 17, 2022, 11:01 AM Tijl Coosemans <<a href="mailto:tijl@freebsd.org">tijl@freebsd.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, 16 Sep 2022 15:54:04 GMT Warner Losh <imp@FreeBSD.org> wrote:<br> > The branch main has been updated by imp:<br> > <br> > URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=9758dd3de1cddc8271be8dd6fee69286c5c86535" rel="noreferrer noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=9758dd3de1cddc8271be8dd6fee69286c5c86535</a><br> > <br> > commit 9758dd3de1cddc8271be8dd6fee69286c5c86535<br> > Author: Warner Losh <imp@FreeBSD.org><br> > AuthorDate: 2022-09-16 15:09:41 +0000<br> > Commit: Warner Losh <imp@FreeBSD.org><br> > CommitDate: 2022-09-16 15:18:57 +0000<br> > <br> > stand: Allocate bootinfo rather than have it be static<br> > <br> > This saves 80 bytes (the new bootinfo structure was 84 bytes, and a<br> > pointer is 4 bytes). The bi_load32 code is the same size.<br> > <br> > Sponsored by: Netflix<br> > Reviewed by: tsoome<br> > Differential Revision: <a href="https://reviews.freebsd.org/D36575" rel="noreferrer noreferrer" target="_blank">https://reviews.freebsd.org/D36575</a><br> > ---<br> > stand/i386/libi386/bootinfo32.c | 29 +++++++++++++++--------------<br> > 1 file changed, 15 insertions(+), 14 deletions(-)<br> > <br> > diff --git a/stand/i386/libi386/bootinfo32.c b/stand/i386/libi386/bootinfo32.c<br> > index 372bced917d6..37a797289f2b 100644<br> > --- a/stand/i386/libi386/bootinfo32.c<br> > +++ b/stand/i386/libi386/bootinfo32.c<br> > @@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");<br> > #include "geliboot.h"<br> > #endif<br> > <br> > -static struct bootinfo bi;<br> > +static struct bootinfo *bi;<br> > <br> > /*<br> > * Load the information expected by an i386 kernel.<br> > @@ -91,11 +91,12 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t<br> > /* XXX - use a default bootdev of 0. Is this ok??? */<br> > bootdevnr = 0;<br> > <br> > + bi = calloc(sizeof(*bi), 1);<br> > switch(rootdev->dd.d_dev->dv_type) {<br> > case DEVT_CD:<br> > case DEVT_DISK:<br> > /* pass in the BIOS device number of the current disk */<br> > - bi.bi_bios_dev = bd_unit2bios(rootdev);<br> > + bi->bi_bios_dev = bd_unit2bios(rootdev);<br> > bootdevnr = bd_getdev(rootdev);<br> > break;<br> > <br> > @@ -172,22 +173,22 @@ bi_load32(char *args, int *howtop, int *bootdevp, vm_offset_t *bip, vm_offset_t<br> > /* legacy bootinfo structure */<br> > kernelname = getenv("kernelname");<br> > i386_getdev(NULL, kernelname, &kernelpath);<br> > - bi.bi_version = BOOTINFO_VERSION;<br> > - bi.bi_size = sizeof(bi);<br> > - bi.bi_memsizes_valid = 1;<br> > - bi.bi_basemem = bios_basemem / 1024;<br> > - bi.bi_extmem = bios_extmem / 1024;<br> > - bi.bi_envp = envp;<br> > - bi.bi_modulep = *modulep;<br> > - bi.bi_kernend = kernend;<br> > - bi.bi_kernelname = VTOP(kernelpath);<br> > - bi.bi_symtab = ssym; /* XXX this is only the primary kernel symtab */<br> > - bi.bi_esymtab = esym;<br> > + bi->bi_version = BOOTINFO_VERSION;<br> > + bi->bi_size = sizeof(bi);<br> <br> sizeof(*bi) here and maybe make bi a function variable?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Damn. I even looked for those... :(</div><div dir="auto"><br></div><div dir="auto">Warner </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> > + bi->bi_memsizes_valid = 1;<br> > + bi->bi_basemem = bios_basemem / 1024;<br> > + bi->bi_extmem = bios_extmem / 1024;<br> > + bi->bi_envp = envp;<br> > + bi->bi_modulep = *modulep;<br> > + bi->bi_kernend = kernend;<br> > + bi->bi_kernelname = VTOP(kernelpath);<br> > + bi->bi_symtab = ssym; /* XXX this is only the primary kernel symtab */<br> > + bi->bi_esymtab = esym;<br> > <br> > /* legacy boot arguments */<br> > *howtop = howto | RB_BOOTINFO;<br> > *bootdevp = bootdevnr;<br> > - *bip = VTOP(&bi);<br> > + *bip = VTOP(bi);<br> > <br> > return(0);<br> > }<br> <br> </blockquote></div></div></div>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfq=0sMgy%2B=O=64QywMwP=4v9B5ZXmNOc_9ZHyN66=GZSw>
