Date: Tue, 29 Nov 2022 13:58:00 GMT From: =?utf-8?Q?Corvin=20K=C3=B6hne?= <corvink@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 598177ab3916 - stable/13 - bhyve: add table dump functions for basl Message-ID: <202211291358.2ATDw0nM029379@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=598177ab39164e3d4ff23cec380146fedd6e97e2 commit 598177ab39164e3d4ff23cec380146fedd6e97e2 Author: Corvin Köhne <corvink@FreeBSD.org> AuthorDate: 2022-11-04 11:26:34 +0000 Commit: Corvin Köhne <corvink@FreeBSD.org> CommitDate: 2022-11-29 13:53:49 +0000 bhyve: add table dump functions for basl Developing an ACPI table compiler isn't quite easy. It's helpful if you can take a look at the ACPI tables created by the compiler. The dump functions can either dump a ACPI table which was copied into guest memory or a ACPI table provided for qemu's ACPI table loader. Reviewed by: jhb, markj Approved by: manu (mentor) MFC after: 2 weeks Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D36985 (cherry picked from commit ac3c2b3e38fb03b0d0e26ffa0527735575984ba2) --- usr.sbin/bhyve/basl.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c index f24d8c009110..655c6e509dc4 100644 --- a/usr.sbin/bhyve/basl.c +++ b/usr.sbin/bhyve/basl.c @@ -14,6 +14,7 @@ #include <assert.h> #include <err.h> +#include <libutil.h> #include <stddef.h> #include <stdio.h> #include <vmmapi.h> @@ -32,6 +33,41 @@ struct basl_table { static STAILQ_HEAD(basl_table_list, basl_table) basl_tables = STAILQ_HEAD_INITIALIZER( basl_tables); +static int +basl_dump_table(const struct basl_table *const table, const bool mem) +{ + const ACPI_TABLE_HEADER *const header = table->data; + const uint8_t *data; + + if (!mem) { + data = table->data; + } else { + data = vm_map_gpa(table->ctx, BHYVE_ACPI_BASE + table->off, + table->len); + if (data == NULL) { + return (ENOMEM); + } + } + + printf("%.4s @ %8x (%s)\n", header->Signature, + BHYVE_ACPI_BASE + table->off, mem ? "Memory" : "FwCfg"); + hexdump(data, table->len, NULL, 0); + + return (0); +} + +static int +basl_dump(const bool mem) +{ + struct basl_table *table; + + STAILQ_FOREACH(table, &basl_tables, chain) { + BASL_EXEC(basl_dump_table(table, mem)); + } + + return (0); +} + static int basl_finish_install_guest_tables(struct basl_table *const table) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202211291358.2ATDw0nM029379>