From nobody Sat Sep 17 17:01:08 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MVHJn38xMz3tddR; Sat, 17 Sep 2022 17:01:13 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MVHJn2jSCz3YXH; Sat, 17 Sep 2022 17:01:13 +0000 (UTC) (envelope-from tijl@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663434073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w9pNzDpREIiQ6zi4ANKYAcArWgPoJ4CTQdEw1dmIxQc=; b=hbOBA86m/HSvCY+cttq3u2t7QXnd7edxeKnoUg3ToVaQyBEQhaDanU4GJJz/gd8yD/JVvv enzBcXPGcWNrogSQgdgA/eA3WrdsrGDLol2/7P7fIeUxATDSvTZzL3PNI8TRnfGfz53Zgl nVX83n5BTfwLuiRVY/b8eitAv/HWw7E6cgz55JmbeM+24bBujMTDK8UIg1LBZPJnemYcGM apphfnEvPmVqaIiTXme4rxFWlP1IwBQZeehFk1l8LTfYPp5yM4BSuL7pbKQYd7S0mWFKs/ opSW+vqB7RwfoKavv9Oe61y56v+dPQezXxHfKjq2hepB2LqWuAJU5OVFuy3KBw== Received: from localhost (unknown [IPv6:2a02:a03f:894b:4700:c82b:1a03:3bba:d68a]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: tijl) by smtp.freebsd.org (Postfix) with ESMTPSA id 4MVHJm4bX5zwjr; Sat, 17 Sep 2022 17:01:12 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Date: Sat, 17 Sep 2022 19:01:08 +0200 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Warner Losh Cc: src-committers@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: <20220917190108.2b56bb39@FreeBSD.org> In-Reply-To: <202209161554.28GFs4aA086609@gitrepo.freebsd.org> References: <202209161554.28GFs4aA086609@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663434073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w9pNzDpREIiQ6zi4ANKYAcArWgPoJ4CTQdEw1dmIxQc=; b=RrVXNTMxzx/mxsU+Sg3oDwWnpZ4I0UZd82R8NQIr1jbv2pxDWtb9udcRENObFaHE58tWhF pQhRKT4NURCUu0ekfAoGLHk0q93sGvUVUxefoyAtYpx1v74clpyl9fu4tIMMrQhjG+qWhf XWkQ0UsoBgeEafSIZq9zB62rPcq+3VxeqiiDt1TbcGk86HywlybhCZ0HBtQukvNxSzh3uw 75vsQMyO0MSu1wH7aCcLzvNWWQFV37LcuQPRd2e0iEo1719yISvdJFHF6oRG1H+j9PvyZP fRMsQ39RkZuXrEpon6Iqa086+lKma5EeF+4A2xPOlxo4TDe/v/xI8YuF97Qhlw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663434073; a=rsa-sha256; cv=none; b=TliZoLTOuiQYZfhtKeDQ6kxfu5iOHYxQLcaEzhGxSuyAgN+8IWWtu5R7bK9IXCOjJcUt9t F8Ch1Uf5gx7BmJ2D+jqpNP+iS3002q9WeHYa4ZidJ6Tm0v8b6uawBbXDw6402nqm4DH+x6 Ot3LTR9dEfFNPrapf3L5+ehDgYYeItFCY9ggrrJCTb4vJ79RH5GT+uQblNCI0aANlOz/jm Hru9zIkAv7G7Co7z2NhLEHCxyZV2p34u0vppE/mHUjq6WM7fv8345cdlXWy61Zmp/j0ykz 0X+9fCIrYn31syMlO9E3/bTa7Rww5iyywIjkwwVplTWRIcj0EmZM8xpFDv1vCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Fri, 16 Sep 2022 15:54:04 GMT Warner Losh wrote: > The branch main has been updated by imp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=9758dd3de1cddc8271be8dd6fee69286c5c86535 > > commit 9758dd3de1cddc8271be8dd6fee69286c5c86535 > Author: Warner Losh > AuthorDate: 2022-09-16 15:09:41 +0000 > Commit: Warner Losh > 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? > + 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); > }