Skip to content

Commit

Permalink
iASL/Disassembler: Add option to assume table contains valid AML.
Browse files Browse the repository at this point in the history
For dynamically loaded tables that have unknown ACPI signatures,
this option (-df) forces the disassembler to treat the table as if
it contains valid AML code (like a DSDT or SSDT). Otherwise, the
disassembler will treat the table as an unkown data table and
simply do a hex dump of the table.
  • Loading branch information
acpibob committed Mar 12, 2015
1 parent 1d438e1 commit f5d2ff3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
6 changes: 4 additions & 2 deletions source/common/adisasm.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,9 @@ AdAmlDisassemble (

*OutFilename = DisasmFilename;

if (!AcpiUtIsAmlTable (Table))
/* ForceAmlDisassembly means to assume the table contains valid AML */

if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table))
{
AdDisassemblerHeader (Filename);
AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n",
Expand Down Expand Up @@ -592,7 +594,7 @@ AdAmlDisassemble (

Cleanup:

if (Table && !AcpiUtIsAmlTable (Table))
if (Table && !AcpiGbl_ForceAmlDisassembly &&!AcpiUtIsAmlTable (Table))
{
ACPI_FREE (Table);
}
Expand Down
14 changes: 12 additions & 2 deletions source/common/dmtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,20 @@ AcpiDmDumpDataTable (
}
else
{
AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
AcpiOsPrintf ("\n**** Unknown ACPI table signature [%4.4s]\n\n",
Table->Signature);
fprintf (stderr, "Unknown ACPI table signature [%4.4s], decoding header only\n",

fprintf (stderr, "Unknown ACPI table signature [%4.4s], ",
Table->Signature);

if (!AcpiGbl_ForceAmlDisassembly)
{
fprintf (stderr, "decoding ACPI table header only\n");
}
else
{
fprintf (stderr, "assuming table contains valid AML code\n");
}
}
}
else if (TableData->TableHandler)
Expand Down
1 change: 1 addition & 0 deletions source/compiler/aslmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ Usage (
ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates");
ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)");
ACPI_OPTION ("-df", "Force disassembler to assume table contains valid AML");
ACPI_OPTION ("-dl", "Emit legacy ASL code only (no C-style operators)");
ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file");
Expand Down
5 changes: 5 additions & 0 deletions source/compiler/asloptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,11 @@ AslDoOptions (

break;

case 'f':

AcpiGbl_ForceAmlDisassembly = TRUE;
break;

case 'l': /* Use legacy ASL code (not ASL+) for disassembly */

Gbl_DoCompile = FALSE;
Expand Down
1 change: 1 addition & 0 deletions source/include/acglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_O
ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE);
ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE);
ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CstyleDisassembly, TRUE);
ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE);

ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_Disasm);
ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_Verbose);
Expand Down

0 comments on commit f5d2ff3

Please sign in to comment.