summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2013-01-11 13:18:52 -0800
committerRobert Moore <Robert.Moore@intel.com>2013-01-11 13:18:52 -0800
commit789175a1a8afa19da8f388fc7f944eeb5298ac5c (patch)
tree31c952e2c37b2e9d7dd63e759517e6adf8c2354c
parent0e1413de5dfeb865187ee4cafd0f29088257bcce (diff)
iASL/Disassembler: Add option to ignore NOOP opcodes/operators.
Implemented for both the compiler and the disassembler. Often, the NOOP opcode is used as padding for packages that are changed dynamically by the BIOS. When disassembled, these NOOPs will cause syntax errors. This option causes the disassembler to ignore the NOOP opcode, and it also causes the compiler to ignore NOOP statements as well.
-rw-r--r--source/compiler/aslcompiler.l2
-rw-r--r--source/compiler/aslmain.c9
-rw-r--r--source/components/disassembler/dmwalk.c25
-rw-r--r--source/include/acglobal.h4
4 files changed, 37 insertions, 3 deletions
diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l
index 6737c80e5..f98179678 100644
--- a/source/compiler/aslcompiler.l
+++ b/source/compiler/aslcompiler.l
@@ -273,7 +273,7 @@ NamePathTail [.]{NameSeg}
"Mutex" { count (2); return (PARSEOP_MUTEX); }
"Name" { count (2); return (PARSEOP_NAME); }
"NAnd" { count (3); return (PARSEOP_NAND); }
-"Noop" { count (3); return (PARSEOP_NOOP); }
+"Noop" { if (!AcpiGbl_IgnoreNoopOperator) {count (3); return (PARSEOP_NOOP);} }
"NOr" { count (3); return (PARSEOP_NOR); }
"Not" { count (3); return (PARSEOP_NOT); }
"Notify" { count (3); return (PARSEOP_NOTIFY); }
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 5243024af..d4e18aada 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -225,6 +225,7 @@ Options (
ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones");
ACPI_OPTION ("-on", "Disable named reference string optimization");
ACPI_OPTION ("-cr", "Disable Resource Descriptor error checking");
+ ACPI_OPTION ("-in", "Ignore NoOp operators");
ACPI_OPTION ("-r <revision>", "Override table header Revision (1-255)");
printf ("\nASL Listing Files:\n");
@@ -244,6 +245,7 @@ Options (
ACPI_OPTION ("", "(Obtain DSDT from current system if no input file)");
ACPI_OPTION ("-e [f1,f2]", "Include ACPI table(s) for external symbol resolution");
ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)");
+ ACPI_OPTION ("-in", "Ignore NoOp opcodes");
ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
printf ("\nHelp:\n");
@@ -694,6 +696,13 @@ AslDoOptions (
Gbl_C_IncludeOutputFlag = TRUE;
break;
+ case 'n':
+
+ /* Compiler/Disassembler: Ignore the NOOP operator */
+
+ AcpiGbl_IgnoreNoopOperator = TRUE;
+ break;
+
default:
printf ("Unknown option: -i%s\n", AcpiGbl_Optarg);
return (-1);
diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c
index 93e6b2fe6..a9248302e 100644
--- a/source/components/disassembler/dmwalk.c
+++ b/source/components/disassembler/dmwalk.c
@@ -513,7 +513,30 @@ AcpiDmDescendingOp (
* This is a first-level element of a term list,
* indent a new line
*/
- AcpiDmIndent (Level);
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_NOOP_OP:
+ /*
+ * Optionally just ignore this opcode. Some tables use
+ * NoOp opcodes for "padding" out packages that the BIOS
+ * changes dynamically. This can leave hundreds or
+ * thousands of NoOp opcodes that if disassembled,
+ * cannot be compiled because they are syntactically
+ * incorrect.
+ */
+ if (AcpiGbl_IgnoreNoopOperator)
+ {
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ return (AE_OK);
+ }
+
+ /* Fallthrough */
+
+ default:
+ AcpiDmIndent (Level);
+ break;
+ }
+
Info->LastLevel = Level;
Info->Count = 0;
}
diff --git a/source/include/acglobal.h b/source/include/acglobal.h
index d17082a03..7a71c33da 100644
--- a/source/include/acglobal.h
+++ b/source/include/acglobal.h
@@ -484,7 +484,7 @@ ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer;
/*****************************************************************************
*
- * Debugger globals
+ * Debugger and Disassembler globals
*
****************************************************************************/
@@ -492,6 +492,8 @@ ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags;
#ifdef ACPI_DISASSEMBLER
+BOOLEAN ACPI_INIT_GLOBAL (AcpiGbl_IgnoreNoopOperator, FALSE);
+
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm;
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose;
ACPI_EXTERN ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList;