git: b6755eabcc39 - main - kboot: bi_loadsmap for amd64
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 03 Feb 2023 15:50:46 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b6755eabcc390c3107440e0847d06726c874bc1e commit b6755eabcc390c3107440e0847d06726c874bc1e Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2023-02-03 15:39:39 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2023-02-03 15:41:40 +0000 kboot: bi_loadsmap for amd64 Copy the EFI memory tables we were able to get into the MODINFOMD_SMAP metadata area for the kernel. Sponsored by: Netflix Reviewed by: tsoome, kevans Differential Revision: https://reviews.freebsd.org/D38254 --- stand/kboot/arch/amd64/load_addr.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/stand/kboot/arch/amd64/load_addr.c b/stand/kboot/arch/amd64/load_addr.c index 528b4dba6758..4bd2a19dab48 100644 --- a/stand/kboot/arch/amd64/load_addr.c +++ b/stand/kboot/arch/amd64/load_addr.c @@ -160,3 +160,22 @@ kboot_get_phys_load_segment(void) } return (base_seg); } + +void +bi_loadsmap(struct preloaded_file *kfp) +{ + struct bios_smap smap[32], *sm; + struct memory_segments *s; + int smapnum, len; + + for (smapnum = 0; smapnum < min(32, nr_seg); smapnum++) { + sm = &smap[smapnum]; + s = &segs[smapnum]; + sm->base = s->start; + sm->length = s->end - s->start + 1; + sm->type = SMAP_TYPE_MEMORY; + } + + len = smapnum * sizeof(struct bios_smap); + file_addmetadata(kfp, MODINFOMD_SMAP, len, &smap[0]); +}