Date: Thu, 04 Jun 2026 00:36:22 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: e5488ddf9b22 - stable/15 - amd64: explain in more details why the slop is needed Message-ID: <6a20c886.21eba.62f2c4f0@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e5488ddf9b22e8894cb0650f530abea5d10c4045 commit e5488ddf9b22e8894cb0650f530abea5d10c4045 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-05-31 19:15:37 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-06-04 00:34:43 +0000 amd64: explain in more details why the slop is needed (cherry picked from commit 963a92d63b7443d27588fb4260bd4226f7525117) --- stand/man/loader.efi.8 | 3 +++ sys/amd64/amd64/machdep.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/stand/man/loader.efi.8 b/stand/man/loader.efi.8 index 8bb88dd2e24f..9ff31b02dcb6 100644 --- a/stand/man/loader.efi.8 +++ b/stand/man/loader.efi.8 @@ -228,7 +228,10 @@ rootdev=disk0s1a .Ss Staging Slop The kernel must parse the firmware memory map tables to know what memory it can use. +It also needs to allocate memory for the kernel page tables. Since it must allocate memory to do this, +without overwriting important structures, +for instance the trampoline page table, .Nm ensures there's extra memory available, called .Dq slop , diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 0d4ed59a98b1..d51e5501aca9 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1273,6 +1273,13 @@ amd64_bsp_ist_init(struct pcpu *pc) * - there is a usable memory block right after the end of the * mapped kernel and all modules/metadata, pointed to by * physfree, for early allocations + * + * The memory block after the end of the kernel is important, loader + * must ensure that no critical data structures are put there. Among + * them is the trampoline page table, which must not be overwritten by + * the allocations until pmap_bootstrap() switches %cr3 to the initial + * version of the kernel page table. Size of the block is controlled + * by the 'staging_slop' command for loader.efi. */ vm_paddr_t __nosanitizeaddress __nosanitizememory amd64_loadaddr(void)home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a20c886.21eba.62f2c4f0>
