From nobody Fri Sep 16 15:54:04 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 4MTdsm4FBFz4cLF2; Fri, 16 Sep 2022 15:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MTdsm2qQZz3jBj; Fri, 16 Sep 2022 15:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663343644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PiIJGEMQ2QP7JeQA16btKjbwoeJK6JG577xM36SEjao=; b=G/1147kK0qdiOQQtnVxx6RYr9ENEjxvGe36++qI+/JSzxguyjv2bO4WVN5Z/kXKgx2H9oR XKB6pUpJ64DvUiqkE73nUYth7RfODhWvYO7WRclZTVYLhJE7EgNWVdjhfgUMvhTxz4rlxB P/gs6l6f4gDSQm8E1e6VJe8248C9GNh7s0KZUvvSUpBvSiuDB7Y3FN97LVlpgRKOt1A192 WtvFMXe7SYDWhZ7XuVB3mQuyLTm4OqFjt6NdnbloRCmyCIQEU2gvH+G+cZNLcYn5FL1ZFf WaAhLjysXF5mpbqEwbeC7TYQooqElre7uII0EEBPC04KD2QzfLG4IIPo+OhScA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MTdsm1XT1zPtJ; Fri, 16 Sep 2022 15:54:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28GFs4lJ086610; Fri, 16 Sep 2022 15:54:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28GFs4aA086609; Fri, 16 Sep 2022 15:54:04 GMT (envelope-from git) Date: Fri, 16 Sep 2022 15:54:04 GMT Message-Id: <202209161554.28GFs4aA086609@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9758dd3de1cd - main - stand: Allocate bootinfo rather than have it be static 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=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9758dd3de1cddc8271be8dd6fee69286c5c86535 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1663343644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PiIJGEMQ2QP7JeQA16btKjbwoeJK6JG577xM36SEjao=; b=qtFmWOJljuNWPQWNDwlhWfX5HrF/ZKzJy55RGPpiFOauH+d/i7UCxW5x6JCGyogZErquyG k3Ch+Zg7L7qtCAd5RMUkgckzwWq5VXkhn4bhFF44f2lH3PxalZQrqZ+glo10VmssSCbfkl gh7ibt+hZANtSmUsh7jroj+i9QoycTtEm1IG0UKS0RT3htKahn8773FZGDG6e2fLsPJvJw KVOUeqFa5EkOPKYSdT/j5jI+nodTezoq46DBSq/MyMdOrwUEjHxyvA/pKOBKZOx97/0YXz TvHausbOgaJrJmrHBx53VTg1weiFEHjjQPdfCQbW5xd7KcMpCQiiSqoWvoo73Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1663343644; a=rsa-sha256; cv=none; b=w/LVaOtbCvyRsjn6vGiOMhrMhpho5olnMUPyYpxU2/KHLb5WUdsnPpzmfLzG8BIoVKHHXH eylVqw+lM9gsQCJRvsp5xik7spZXV3Uq+tIzQuHVOVMIhA8rPsJ7jgr5PPBcY/4avzlio3 5zZa7RCs8GGtK+BQNaDLqwMg1OQI/6PmgC89bFvBZCHcMcVw4YJEEdop7HlfJF8+EHBAVX nBmZzcwvKnl4jXxIna4SYmhFsp3Jad1tYBdwgY4LY3NpHHNl+CRaE//V42iRNmjqIgL0/D Mf1Bh6I5S8Mxb8+s7acf/FkwaEIZmW5eDBE3AF3Fxfn3yeQ95IWe5P0B8Ay/Dg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N 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); + 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); }