diff --git a/usr.sbin/bhyve/basl.c b/usr.sbin/bhyve/basl.c --- a/usr.sbin/bhyve/basl.c +++ b/usr.sbin/bhyve/basl.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -32,6 +33,42 @@ 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("%c%c%c%c @ %8x (%s)\n", header->Signature[0], + header->Signature[1], header->Signature[2], header->Signature[3], + 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) {