From nobody Tue Jan 24 22:12:09 2023 X-Original-To: dev-commits-src-all@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 4P1h622jMfz3bfNV; Tue, 24 Jan 2023 22:12:10 +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 4P1h620g38z3BqS; Tue, 24 Jan 2023 22:12:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598330; 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=kQvwRmefQQOneL6qEeRT70eg2QStCYwL+WxfNq526SQ=; b=m55rNVnNNBaEf2xJkCTepoEn2o7B7Vau907aB5HF9FFyGjLM6jYqM1k2GT/2VmWOVRkGDo ImAC+JBWJiv8kIR2IUQuxBkweqoxB08VvqCHkGnZvVwcBm0NCYToawq5qLHolS9Ue5BU4o 99qasEuBGo4ARmorQiW9G3AID2rE7vXOtAYmJCDPPf9wWggOB12DCdnPSNCfhPztwxYWup 1Aw+kcoDlP1/usozo57FvvCSWyZ4UN+cF/cGM5qe4PN2e7/jNiROBQssAeQZinUllZvhTW MPD0TrAZhX3A60mPNWknqTrmI5Y4krBuUgHZBNWIZY0F/xI4IMMHKPwhlGwd9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598330; 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=kQvwRmefQQOneL6qEeRT70eg2QStCYwL+WxfNq526SQ=; b=hc6HDP5HTH821y9vkZ0mCsxu3DBJACvRT5A3fYogVZ7RYW0Pw5xYXdk/P51dQDvpUWDKgs 0eRlXS3k989IVM2t82D0S19u2+ub2IeptW+DKCpA+3LoQb6O2DQupSngVAiCezD5v80kD2 e8B+jd1UjmFmDZptVK0pYRw/Kvj9fjOkQLYoVhJ11wGG0y3PwpreaVbULmxwF+2U4LD41Z rOhyw/z+as3GQXNQgL38FbOgnNjByT7qOJbIowEutDekYV35cMCaSu7mF2wNCeQL0KgGQp fbIpGWJm+OhrnW7RyJU1tk6UyF8xvfWeA1yauzTG7p+JkpVh01EdwMQFkYYkLg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598330; a=rsa-sha256; cv=none; b=fRXFV7KWmbkQqJ9SS158YPZffoOqeJxOIwJziZKYM9PHR4Efq7Jm9mJe8kkmdQp9jDSFP2 5/6XcvgrxX8ZsYPVHzS34ynconu5MBTiOWe6aYxt6BppApSMEDZmRHpEc3WiBODXPl+I7m UW/1YfmrVzMBjWgS5bNaxuFMeXazp72WWt9eRoNFb1bGXHZUS21E2zyMqivor64crZzW93 JWddxpvRxRq/qRLbnmw0CvcKm6ToST8Sbq1hplMnOvqX58tXT1a6Xfz2MVhY285H8sclVT GiBJX6zZ4BLcT+4Cl/x8McIVrdMq7HerFMn94qh24Q7326qVRnbs69WBclpAvA== 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 4P1h616v24zQcM; Tue, 24 Jan 2023 22:12:09 +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 30OMC9lF086648; Tue, 24 Jan 2023 22:12:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMC9j1086647; Tue, 24 Jan 2023 22:12:09 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:12:09 GMT Message-Id: <202301242212.30OMC9j1086647@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: 6760e8df9dc6 - stable/13 - stand: Raise limit to 550,000 bytes for loader List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: 6760e8df9dc63db2d24e07882c49bb4e9da1602e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6760e8df9dc63db2d24e07882c49bb4e9da1602e commit 6760e8df9dc63db2d24e07882c49bb4e9da1602e Author: Warner Losh AuthorDate: 2022-08-12 04:59:51 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:31 +0000 stand: Raise limit to 550,000 bytes for loader Raise the limit for /boot/loader to be 550k. The IBM PC imposes a limit of 640k of RAM below 1MB, which is needed for real mode calls. BTX takes 40k of that. The BIOS takes some amount (25k seems a good "99% take less than or equal to this" estimate for that, though some systems consume more). Most typical setups need 25k of stack. This leaves 550k for code. We set the limit to 550,000 which gives about an extra 13,000 bytes of buffer for machines that whose setups use a little more stack or whose BIOS reserves a bit more... Add this derivation in the Makefile. Also recommend setting LOADERSIZE lower in /etc/src.conf when the loader has to run on a system whose BIOS takes up more space, or for a complex setup. Add a recipe for how to find how much RAM your BIOS uses as well (thanks to jhb@ for the trick). Network cards that boot via PXE and HBAs with their BIOS enabled are known to be large consumers of lomem space. Sponsored by: Netflix Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D36152 (cherry picked from commit f8a199f28f9de46fe7360c3a4a0e19e71be72721) stand: Fix a couple of comment typos in f8a199f28f9d The commit message documented it as /etc/src.conf but the comment in the source mentioned the non-existent /etc/loader.conf. Fixes: f8a199f28f9d ("stand: Raise limit to 550,000 bytes for loader") (cherry picked from commit 3179bb2737493bc4191c3239226bda50f0b64b8f) --- stand/i386/loader/Makefile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index 539c736af38f..3195cb00c6be 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -19,8 +19,22 @@ PROG= ${LOADER}.sym INTERNALPROG= NEWVERSWHAT?= "bootstrap loader" x86 VERSION_FILE= ${.CURDIR}/../loader/version -LOADERSIZE?= 508000 # Largest known safe size for loader.bin - +# +# There's 640k - 40k maximum space, less however much memory the BIOS uses. A +# non-random survey suggests that 20k-25k is a good value for 'most' machines. +# We also need to subtract maximum stack usage (20-25k). +# +# So 640k - 40k - 25k - 25k = 550k = 563,200 bytes, but use 550,000 below for +# some extra buffer for more complex setups and/or wider BIOS lomem variation. +# +# Some systems use more stack or have BIOS reserve more RAM (or both), and will +# need to set this lower in /etc/src.conf if the above buffer is too small. +# +# sudo dd if=/dev/mem bs=1 iseek=0x413 count=2 | hd -d +# +# will tell you how many kiB of lomem are available. +# +LOADERSIZE?= 550000 # Largest known safe size for loader.bin .PATH: ${BOOTSRC}/i386/loader