File bob_noop.patch of Package acpica
diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l
index 6737c80..f981796 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/aslerror.c b/source/compiler/aslerror.c
index 99e4a41..e515fda 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -732,7 +732,6 @@ AslCommonError (
Gbl_SourceLine = 0;
Gbl_NextError = Gbl_ErrorLog;
- CmDoOutputFiles ();
CmCleanupAndExit ();
exit(1);
}
diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c
index 991ef17..0247040 100644
--- a/source/compiler/asllisting.c
+++ b/source/compiler/asllisting.c
@@ -189,6 +189,8 @@ LsTreeWriteWalk (
UINT32 Level,
void *Context);
+#define ASL_LISTING_LINE_PREFIX ": "
+
/*******************************************************************************
*
@@ -737,7 +739,8 @@ LsWriteListingHexBytes (
{
case ASL_FILE_LISTING_OUTPUT:
- FlPrintFile (FileId, "%8.8X....", Gbl_CurrentAmlOffset);
+ FlPrintFile (FileId, "%8.8X%s", Gbl_CurrentAmlOffset,
+ ASL_LISTING_LINE_PREFIX);
break;
case ASL_FILE_ASM_SOURCE_OUTPUT:
@@ -797,6 +800,24 @@ LsWriteOneSourceLine (
Gbl_SourceLine++;
Gbl_ListingNode->LineNumber++;
+ /* Ignore lines that are completely blank (but count the line above) */
+
+ if (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) != AE_OK)
+ {
+ return (0);
+ }
+ if (FileByte == '\n')
+ {
+ return (1);
+ }
+
+ /*
+ * This is a non-empty line, we will print the entire line with
+ * the line number and possibly other prefixes and transforms.
+ */
+
+ /* Line prefixes for special files, C and ASM output */
+
if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
{
FlPrintFile (FileId, " *");
@@ -812,19 +833,21 @@ LsWriteOneSourceLine (
* This file contains "include" statements, print the current
* filename and line number within the current file
*/
- FlPrintFile (FileId, "%12s %5d....",
- Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber);
+ FlPrintFile (FileId, "%12s %5d%s",
+ Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber,
+ ASL_LISTING_LINE_PREFIX);
}
else
{
/* No include files, just print the line number */
- FlPrintFile (FileId, "%8d....", Gbl_SourceLine);
+ FlPrintFile (FileId, "%8u%s", Gbl_SourceLine,
+ ASL_LISTING_LINE_PREFIX);
}
- /* Read one line (up to a newline or EOF) */
+ /* Read the rest of this line (up to a newline or EOF) */
- while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK)
+ do
{
if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
{
@@ -838,13 +861,15 @@ LsWriteOneSourceLine (
if (FileByte == '\n')
{
/*
+ * This line has been completed.
* Check if an error occurred on this source line during the compile.
* If so, we print the error message after the source line.
*/
LsCheckException (Gbl_SourceLine, FileId);
return (1);
}
- }
+
+ } while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK);
/* EOF on the input file was reached */
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 5243024..d4e18aa 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 93e6b2f..a924830 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 d17082a..7a71c33 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;