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
This commit is contained in:
Warner Losh 2023-02-03 08:39:39 -07:00
parent 6e99dc1375
commit b6755eabcc

View File

@ -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]);
}