From nobody Tue Jan 24 22:12:42 2023 X-Original-To: dev-commits-src-branches@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 4P1h6g2Khpz3bg9L; Tue, 24 Jan 2023 22:12:43 +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 4P1h6f6d1pz3DTL; Tue, 24 Jan 2023 22:12:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598362; 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=5AIko9Zg6Dk1zMtSGIFZXpeSM0VQuWdohzM8IWEBxok=; b=sOm/m1w+QvyV5GSv/vNXb3FdqGlT8px60bWMo0qDZt0pinJLWMasoNSzBYsN9TZHSxADmZ 4wXu3Q/1GwBjeR9WVDID0K+KTIrauHgoHGuRDSYhc/3hZ/lT/Y7nkD4R7lYC4rnMGlTiHS eoAMPVuGql0OPXe5oPa/GBJy/hCEzHyV7oiH1eXclbyXXk+vFmr5r4xVyPVEW6I5g9oELf ikE5gz7pbmU4DnCEb7KH3ITYcYwNFXwZ7DGmJfv+S2ZBZCURZPCNq3B2plqUuv8wJHBF3M zzty6vnP/DqrYMhoslaXuO5Irn4ZzfbRapDqVWUkCjasV2kUc+gScZxPl55Ivw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598362; 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=5AIko9Zg6Dk1zMtSGIFZXpeSM0VQuWdohzM8IWEBxok=; b=LeSOT20tpoqgvue6RCYeHoCRWwxvgIj3PKu4L++3csC8GT+fX7q/X1HiZF3kNhRwWkqMIi NvR4Z3ZYSYrRyZWTXSTeXErsxsvgHmOI5Qu3oG3Z8+ArimSM+Lt1lGBS9Xfa9om7YkQHV0 HFjqyiOigNJT2HuvY/vYnARpoc21vEW8o/w40xmE365P30xrWIh6VhWHxQX0quygIEwoDG jeD07Gkue2MN/Ia+4t0WtnyLWR6U72yIuI0Ug1QUmFtHLI46bGIlfFZQ5LARvR71/U8c8F 31PKuETnq+GwdJ9wFI8VZd2ru9BKuTEegguGOjO63SFJdJ2EMmBRexaaz0p2hA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598362; a=rsa-sha256; cv=none; b=D5aaEOaJa/xhLGgytuy/yqle4g6fUpc2l5bKWz5xztaapK/ywNRhIm99gItKADnxleXbwL SasDTzAIFTANAQqAk4WMvg55R01TG8QiDbyHPenK/jLcEALnDLXvX5PSRQ2UiJv8qpQC7V AriHW/PXnY/q9xft8x2vt2YHDaT3IJOuJyAHb2EK6n8JAEJpXaMAAXBtEAfopaCNy51Byh F81lWgxJbd6KMS/W8jOsH0e3lK6BLpY5d8O9tuq8Ilu5at6Zva1DpT6Jie5YA/mD+v51iI ShGZhWwSuen0m93a9Sq4ruAwiLfD75FrWBYcL40Tt4ikb3qTCaayMYhkHRtu3w== 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 4P1h6f5l6mzQgk; Tue, 24 Jan 2023 22:12:42 +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 30OMCgRC087410; Tue, 24 Jan 2023 22:12:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMCgU8087409; Tue, 24 Jan 2023 22:12:42 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:12:42 GMT Message-Id: <202301242212.30OMCgU8087409@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: f7f2e8226c52 - stable/13 - stand: Allocate bootinfo rather than have it be static List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: f7f2e8226c52f2d38b09fc0a5b76c35c0f70b253 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=f7f2e8226c52f2d38b09fc0a5b76c35c0f70b253 commit f7f2e8226c52f2d38b09fc0a5b76c35c0f70b253 Author: Warner Losh AuthorDate: 2022-09-16 15:09:41 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:35 +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 (cherry picked from commit 9758dd3de1cddc8271be8dd6fee69286c5c86535) stand: Pass in the proper size for bootinfo Missed one sizeof(bi) -> sizeof(*bi) in 9758dd3de1cdd conversion to allocating bootinfo. Noticed by: tijl@ Fixes: 9758dd3de1cdd Sponsored by: Netflix (cherry picked from commit 4a676571e382d0188b98134732f421df57a47a87) --- 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..169d2dfb81f4 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); }