From nobody Tue Nov 28 17:07:39 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 4Sfpmm5NtGz52F1D for ; Tue, 28 Nov 2023 17:07:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sfpmm22GJz3brk for ; Tue, 28 Nov 2023 17:07:52 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-54af0eca12dso6196626a12.3 for ; Tue, 28 Nov 2023 09:07:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1701191270; x=1701796070; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Xmu6lW92P0Xvcv5xiCgYuY6sUcaHCFlPigwe+KmHy0I=; b=eXZehRHItSJs3wWM4B7PUAVCv3CGY2vvirJ+zsBHaRf2ne6EpYWG6Xe2w+OqvxYgxs eftLwP2rnvMeAv7iZp02PMmhevKC06XclZl3LTbKWb1vukbW8NFTLpltkXKDxunKSves 54w2llVJBNVDFWmecnLpRe3305l+P5+0j9sWizDAcylDGJdliQPA7hw25EDsof0wwiSf sI7CfHqVeJzMk9SqU1rcPyMfy/TFLs8FP40Vz7IsHYaFRgpxJ3vPfiftvccY9bZDtRUf QE0wTfTfqXVwUjC6W2fkHjYpcDur49bLgEqdenOVwSGkdL4LxE4tOSuSTiRlN6av1IOY Xbwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701191270; x=1701796070; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Xmu6lW92P0Xvcv5xiCgYuY6sUcaHCFlPigwe+KmHy0I=; b=Q7dM+Lka0NLg9hxbmGjbhIE8lde5bfIoiBMiwtImBZSmNbmN9mQ6Tg/FkMzSyhnoYP J328WuMS7E0sPGTd/qcP1K+Y8mzt3FXFbLXmPx41wtMi1wNbPgn0xYdwepXwrEN+B8ZO QPGeG/KvWa5KqLGtoFnNCrX66//8tx94mklAx2go7X4acDL8jbNBVm3Fm85aCW3yHHKf YhJS+3I4apEhW6++1dzJjsW+eBeaGmfq7jpyAEBHEKTIjSrn0EvP2lnvw6/+q8nbhxxv YIgzsKPESOvy5Qk97ENo5Mp2WfLYU9dtXi+RaAOnB/jB4s+kLdN6m6JVmXk3ujre43hw s1UA== X-Gm-Message-State: AOJu0Yx3MUdFiM8TfZMMrcXeMlrvwDlwK7PgoDcC9NbXicebIS7urATA 2dL1cSWgU9krKHXMXTTZX2AC1TXaXkXYXnGY3EyMEw== X-Google-Smtp-Source: AGHT+IEwPjGuZNhIz6XUiaINklQMQYVIas8eLVbXwk4v5CSJ9QmguS7yzgohyxLQyi5fVL3bk38HW1/9YkLXr1PNY/E= X-Received: by 2002:a50:d681:0:b0:54b:24d6:de03 with SMTP id r1-20020a50d681000000b0054b24d6de03mr8123318edi.6.1701191270200; Tue, 28 Nov 2023 09:07:50 -0800 (PST) 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 References: <202311272246.3ARMkNS1037267@gitrepo.freebsd.org> <8fa6ed4d-c26b-4dd6-86f2-c3751f86d426@FreeBSD.org> In-Reply-To: <8fa6ed4d-c26b-4dd6-86f2-c3751f86d426@FreeBSD.org> From: Warner Losh Date: Tue, 28 Nov 2023 10:07:39 -0700 Message-ID: Subject: Re: git: c596126a5d3d - main - pmbr: Only load the first 545k rather than error out To: John Baldwin Cc: Warner Losh , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000005b0afd060b3975b2" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4Sfpmm22GJz3brk --0000000000005b0afd060b3975b2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hey John, On Tue, Nov 28, 2023 at 9:06=E2=80=AFAM John Baldwin wrot= e: > On 11/27/23 2:46 PM, Warner Losh wrote: > > The branch main has been updated by imp: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3Dc596126a5d3d2ee015ee6807b4041ef= a5b9d9b07 > > > > commit c596126a5d3d2ee015ee6807b4041efa5b9d9b07 > > Author: Warner Losh > > AuthorDate: 2023-11-27 22:40:40 +0000 > > Commit: Warner Losh > > CommitDate: 2023-11-27 22:45:56 +0000 > > > > pmbr: Only load the first 545k rather than error out > > > > It would be nice to have larger boot partitions for ESPs to live i= n > one > > day. It's trivial to carve out 5M 10M or 200M when provisioning, b= ut > > logistical issues may make it hard to do it after the fact. So onl= y > warn > > when the partition is > 545k. If we ever grow the boot loader larg= er > > than that, then it will be responsible for loading the rest anyway= . > > > > Sponsored by: Netflix > > Reviewed by: tsoome > > Differential Revision: https://reviews.freebsd.org/D42774 > > --- > > stand/i386/pmbr/pmbr.S | 24 +++++++++++++++--------- > > 1 file changed, 15 insertions(+), 9 deletions(-) > > > > diff --git a/stand/i386/pmbr/pmbr.S b/stand/i386/pmbr/pmbr.S > > index c61acbe261bd..60b26df15720 100644 > > --- a/stand/i386/pmbr/pmbr.S > > +++ b/stand/i386/pmbr/pmbr.S > > @@ -155,8 +155,10 @@ next_boot: addl $1,(%si) # > Next LBA > > mov %es,%ax # Adjust segment for next > > addw $SECSIZE/16,%ax # sector > > cmp $0x9000,%ax # Don't load past 0x90000= , > > - jae err_big # 545k should be enough > for > > - mov %ax,%es # any boot code. :) > > + jb sz_ok # 545k should be enough > for > > + call err_big # any boot code, but war= n > > + mov $0x9000-SECSIZE/16,%ax # and truncate > > +sz_ok: mov %ax,%es > > jmp load_boot > > # > > # Move to the next partition. If we walk off the end of the sector, > load > > @@ -203,17 +205,21 @@ getdrvparams: > > # > > # Various error message entry points. > > # > > -err_big: movw $msg_big,%si # "Boot loader too > > - jmp putstr # large" > > +err_big: movw $msg_big,%si # "Truncated > > + call putstr # to 545k" > > + ret > > Hmm, the comment here and the text string don't match. > Yea, size related message churn. > > err_pt: movw $msg_pt,%si # "Invalid partition > > - jmp putstr # table" > > + call putstr # table" > > +err_pt.1: jmp err_pt.1 # Await reset > > > > err_rd: movw $msg_rd,%si # "I/O error loading > > - jmp putstr # boot loader" > > + call putstr # boot loader" > > + jmp err_pt.1 > > > > err_noboot: movw $msg_noboot,%si # "Missing boot > > - jmp putstr # loader" > > + call putstr # loader" > > + jmp err_pt.1 > > # > > # Output an ASCIZ string to the console via the BIOS. > > # > > @@ -223,9 +229,9 @@ putstr.0: movw $0x7,%bx # > Page:attribute > > putstr: lodsb # Get character > > testb %al,%al # End of string? > > jnz putstr.0 # No > > -putstr.1: jmp putstr.1 # Await reset > > + ret > > > > -msg_big: .asciz "Boot loader too large" > > +msg_big: .asciz "Loaded only 545k" > > msg_pt: .asciz "Invalid partition table" > > msg_rd: .asciz "I/O error loading boot loader" > > msg_noboot: .asciz "Missing boot loader" > > I wonder if it would save a few bytes by having a common 'puterr' > that does 'call putstr' and then the jmp to itself that the other err > targets use rahter than adding the jmp to each one of those. > Yea, I started to do that, but that's 12 bytes of possible savings at the cost of at least 8 bytes of new assembler, maybe more, so when I got another too full message I punted. > But also, can't you just leave a gap in the partitions to leave room > for a future ESP? It might not always be safe to load a full 545k > depending on if the firmware has reserved some of memory just below > 640k. 545k is an upper bound on how much can be loaded in terms of > 640k - the load address, but the practical limit might be lower. It is > probably safer as a general rule to keep the boot partition closer to > the size of the boot loader and leave a gap in place instead. > Today we load 512k always. This likely is a bad idea on some really bloated with BIOS data system (though they are rare). I'll concede that this may up the number of systems that conflict. It looks like there's a BTX header of sorts just after the gpt loader. In an ideal world, we'd load only the first sector of gptboot and it would load the rest, but that has a legacy problem. We could also enforce a different limit that's much smaller (say 256k or 200k) and just load up to that and force gptboot to cope if it's larger than that (smaller) size. pmbr then starts to be a little less generic, but freebsd-boot was always intended to boot gptboot or gptzfsboot (before they were unified). We can put that limit minus 30-50k into the build system to trigger an error so we at least have some warning before we hit it. Warner --0000000000005b0afd060b3975b2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hey John,

On Tue, Nov 28, 2023 at 9:06= =E2=80=AFAM John Baldwin <jhb@freebsd= .org> wrote:
On 11/27/23 2:46 PM, Warner Losh wrote:
> The branch main has been updated by imp:
>
> URL: https://= cgit.FreeBSD.org/src/commit/?id=3Dc596126a5d3d2ee015ee6807b4041efa5b9d9b07<= /a>
>
> commit c596126a5d3d2ee015ee6807b4041efa5b9d9b07
> Author:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2023-11-27 22:40:40 +0000
> Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh <imp@FreeBSD.org>
> CommitDate: 2023-11-27 22:45:56 +0000
>
>=C2=A0 =C2=A0 =C2=A0 pmbr: Only load the first 545k rather than error o= ut
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0 It would be nice to have larger boot partitions fo= r ESPs to live in one
>=C2=A0 =C2=A0 =C2=A0 day. It's trivial to carve out 5M 10M or 200M = when provisioning, but
>=C2=A0 =C2=A0 =C2=A0 logistical issues may make it hard to do it after = the fact. So only warn
>=C2=A0 =C2=A0 =C2=A0 when the partition is > 545k. If we ever grow t= he boot loader larger
>=C2=A0 =C2=A0 =C2=A0 than that, then it will be responsible for loading= the rest anyway.
>=C2=A0 =C2=A0 =C2=A0
>=C2=A0 =C2=A0 =C2=A0 Sponsored by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Netflix
>=C2=A0 =C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 tsoome
>=C2=A0 =C2=A0 =C2=A0 Differential Revision:=C2=A0
https://revi= ews.freebsd.org/D42774
> ---
>=C2=A0 =C2=A0stand/i386/pmbr/pmbr.S | 24 +++++++++++++++---------
>=C2=A0 =C2=A01 file changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/stand/i386/pmbr/pmbr.S b/stand/i386/pmbr/pmbr.S
> index c61acbe261bd..60b26df15720 100644
> --- a/stand/i386/pmbr/pmbr.S
> +++ b/stand/i386/pmbr/pmbr.S
> @@ -155,8 +155,10 @@ next_boot:=C2=A0 =C2=A0 =C2=A0 =C2=A0addl $1,(%si= )=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Nex= t LBA
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mov %es,%ax=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# = Adjust segment for next
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0addw $SECSIZE/16= ,%ax=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #=C2=A0 sector
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cmp $0x9000,%ax= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Don't l= oad past 0x90000,
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jae err_big=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#=C2=A0 5= 45k should be enough for
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mov %ax,%es=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#=C2=A0 a= ny boot code. :)
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jb sz_ok=C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #=C2= =A0 545k should be enough for
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0call err_big=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #=C2=A0 any = boot code, but warn
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mov $0x9000-SECSIZE/1= 6,%ax=C2=A0 =C2=A0 =C2=A0 #=C2=A0 and truncate
> +sz_ok:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mov %ax,= %es
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jmp load_boot >=C2=A0 =C2=A0#
>=C2=A0 =C2=A0# Move to the next partition.=C2=A0 If we walk off the end= of the sector, load
> @@ -203,17 +205,21 @@ getdrvparams:
>=C2=A0 =C2=A0#
>=C2=A0 =C2=A0# Various error message entry points.
>=C2=A0 =C2=A0#
> -err_big:=C2=A0 =C2=A0 =C2=A0movw $msg_big,%si=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# "Boot loader too
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jmp putstr=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #=C2=A0 = large"
> +err_big:=C2=A0 =C2=A0 =C2=A0movw $msg_big,%si=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# "Truncated
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0call putstr=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#=C2=A0 t= o 545k"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ret

Hmm, the comment here and the text string don't match.
=

Yea, size related message churn.
=C2=A0
=
>=C2=A0 =C2=A0err_pt:=C2=A0 =C2=A0 =C2=A0movw $msg_pt,%si=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # "Invalid partition
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jmp putstr=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #=C2=A0 = table"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0call putstr=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#=C2=A0 t= able"
> +err_pt.1:=C2=A0 =C2=A0 jmp err_pt.1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # Await reset
>=C2=A0 =C2=A0
>=C2=A0 =C2=A0err_rd:=C2=A0 =C2=A0 =C2=A0movw $msg_rd,%si=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # "I/O error loading
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jmp putstr=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #=C2=A0 = boot loader"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0call putstr=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#=C2=A0 b= oot loader"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jmp err_pt.1
>=C2=A0 =C2=A0
>=C2=A0 =C2=A0err_noboot:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0movw $msg_nob= oot,%si=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # "Missing boot
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jmp putstr=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #=C2=A0 = loader"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0call putstr=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#=C2=A0 l= oader"
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jmp err_pt.1
>=C2=A0 =C2=A0#
>=C2=A0 =C2=A0# Output an ASCIZ string to the console via the BIOS.
>=C2=A0 =C2=A0#
> @@ -223,9 +229,9 @@ putstr.0: movw $0x7,%bx=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# Page:attribute
>=C2=A0 =C2=A0putstr:=C2=A0 =C2=A0 =C2=A0lodsb=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# = Get character
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0testb %al,%al=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# End of = string?
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0jnz putstr.0=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # No
> -putstr.1:=C2=A0 =C2=A0 jmp putstr.1=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 # Await reset
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ret
>=C2=A0 =C2=A0
> -msg_big:=C2=A0 =C2=A0 =C2=A0.asciz "Boot loader too large"<= br> > +msg_big:=C2=A0 =C2=A0 =C2=A0.asciz "Loaded only 545k"
>=C2=A0 =C2=A0msg_pt:=C2=A0 =C2=A0 =C2=A0.asciz "Invalid partition = table"
>=C2=A0 =C2=A0msg_rd:=C2=A0 =C2=A0 =C2=A0.asciz "I/O error loading = boot loader"
>=C2=A0 =C2=A0msg_noboot:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0.asciz "= Missing boot loader"

I wonder if it would save a few bytes by having a common 'puterr' that does 'call putstr' and then the jmp to itself that the other e= rr
targets use rahter than adding the jmp to each one of those.

Yea, I started to do that, but that's 12 bytes of= possible savings at the cost of at least 8 bytes of new assembler, maybe m= ore, so when I got another too full message I punted.
=C2=A0
But also, can't you just leave a gap in the partitions to leave room for a future ESP?=C2=A0 It might not always be safe to load a full 545k
depending on if the firmware has reserved some of memory just below
640k.=C2=A0 545k is an upper bound on how much can be loaded in terms of 640k - the load address, but the practical limit might be lower.=C2=A0 It i= s
probably safer as a general rule to keep the boot partition closer to
the size of the=C2=A0 boot loader and leave a gap in place instead.

Today we load 512k always. This likely is a ba= d idea on some really bloated with BIOS data system (though they are rare).= I'll concede that this may up the number of systems that conflict.=C2= =A0 It looks like there's a BTX header of sorts just after the gpt load= er. In an ideal world, we'd load only the first sector of gptboot and i= t would load the rest, but that has a legacy problem. We could also enforce= a different limit that's much smaller (say 256k or 200k) and just load= up to that and force gptboot to cope if it's larger than that (smaller= ) size. pmbr then starts to be a little less generic, but freebsd-boot was = always intended to boot gptboot or gptzfsboot (before they were unified). W= e can put that limit minus 30-50k into the build system to trigger an error= so we at least have some warning before we hit it.

Warner
--0000000000005b0afd060b3975b2--