From nobody Fri Feb 03 15:50:46 2023 X-Original-To: dev-commits-src-main@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 4P7g9L3CDrz3kRxG; Fri, 3 Feb 2023 15:50:46 +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 4P7g9L2BYsz3J9t; Fri, 3 Feb 2023 15:50:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675439446; 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=rGAXJ09klKBjQR2R6x4WWibLjULvvSL4rJbJE6uWFyY=; b=Jkf17JVVMktRZ39GcRbT8N8mBC1LyrZu935+5R+oMJ6s6ZGcRR41SbKpIIMw6cPbF+hIdB ZJuUTS9JO3ZXJ+FL09fkOQiLarglCU0yKm90KhUsvHI56Sv2Pjn3lrcRknVHSIlTnFz9iT oh2mV5WrxU5TettHLnJHB7tbx3EQX9ukXd1ZyP6aKdg6IXZ9SW5QX192ly5cNwHyUgH2Yz tyay/+YJPT0ihKgoLQ07r3gIAt9PIXdSYmGsquT2j7msu7gv5sHprIG+mIOoJAQsIyP7T4 ZndtTwB9dIxC33EB0n/xoqdfYMnB9CASijTxccYY9J0y8mzqsT6ZTj9QO/w66w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675439446; 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=rGAXJ09klKBjQR2R6x4WWibLjULvvSL4rJbJE6uWFyY=; b=UAjSOBwgxTDINgZhpjAqB/l5HJui4tTn8h6K0CizRTBmCH3vXosNo/997FEdsJWeF9KD9s n73JIiRyeVFq1itk2NMBPEh6binbgMH7U9yH27MJLL3WdAtC9rAzr7+Yxer1nr6SH28psx YO6h+ibCb6avr1DgZODenYUqPrbtliNOr5D3En6vpg2MTXHPl8VbXZ6gs+clTj/0ZAaB93 Nod3epQeglOWZfhQJYaZOV0btEBLeBoSGl+shUj8L/I592b5Cd08SozdzSTbJpTjpV2qte Cgd5slydJd037Dy/CslLr6qX+DWq6xBs67ar3fcEk/0Cqj0LtQR2yU4Z5JdX4Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675439446; a=rsa-sha256; cv=none; b=PSNDvPqcifaodMmzh/+azq2MgxAPjc7eYYPPQN7kLMwv/9lFLVjHI7ty1vtBgYk02aellm KeksQ8H6k7eIT171t2Nvj9VFfhfyFHntbwJgfXQUWNUFRwZ12QZBY42aPxiK8M9ksAB1oH OQF0AjVoHo6lebe70O1UcAT8VtUUl9sChT54YmPUX2OfS0Q5Unf5ZcCuHO2AfqDcPI1XV6 7maJycXR4SVmiAG7vv49PtRWWNuYMpOljf/a+bmFzSqDvoX7lnbpqiM8np+aT7rXmGKqE5 zQHbbREml2axnQhbpNRlF4+9xj3zMTERJHm3PDaZX8t8iTX/MZaHEj+WLn4caw== 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 4P7g9L1CblzgC6; Fri, 3 Feb 2023 15:50:46 +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 313FokKg023166; Fri, 3 Feb 2023 15:50:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 313FokXm023165; Fri, 3 Feb 2023 15:50:46 GMT (envelope-from git) Date: Fri, 3 Feb 2023 15:50:46 GMT Message-Id: <202302031550.313FokXm023165@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: b6755eabcc39 - main - kboot: bi_loadsmap for amd64 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: b6755eabcc390c3107440e0847d06726c874bc1e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b6755eabcc390c3107440e0847d06726c874bc1e commit b6755eabcc390c3107440e0847d06726c874bc1e Author: Warner Losh AuthorDate: 2023-02-03 15:39:39 +0000 Commit: Warner Losh 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]); +}