diff options
Diffstat (limited to 'source/compiler/aslmain.c')
-rw-r--r-- | source/compiler/aslmain.c | 81 |
1 files changed, 64 insertions, 17 deletions
diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 26f4a0c4973d..81f634e678ff 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -255,6 +255,14 @@ main ( } } + /* ACPICA subsystem initialization */ + + Status = AdInitialize (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + /* Process each pathname/filename in the list, with possible wildcards */ @@ -280,17 +288,71 @@ main ( Index2++; } + /* + * At this point, compilation of a data table or disassembly is complete. + */ + if (AslGbl_FileType == ASL_INPUT_TYPE_ASCII_DATA || AcpiGbl_DisasmFlag) + { + goto CleanupAndExit; + } + + CmDoAslMiddleAndBackEnd (); + + /* + * At this point, all semantic analysis has been completed. Check + * expected error messages before cleanup or conversion. + */ + AslCheckExpectedExceptions (); + + /* ASL-to-ASL+ conversion - Perform immediate disassembly */ + + if (AslGbl_DoAslConversion) + { + /* re-initialize ACPICA subsystem for disassembler */ + + Status = AdInitialize (); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* + * New input file is the output AML file from above. + * New output is from the input ASL file from above. + */ + AslGbl_OutputFilenamePrefix = AslGbl_Files[ASL_FILE_INPUT].Filename; + AslGbl_Files[ASL_FILE_INPUT].Filename = + AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename; + + CvDbgPrint ("Output filename: %s\n", AslGbl_OutputFilenamePrefix); + fprintf (stderr, "\n"); + + AcpiGbl_DisasmFlag = TRUE; + AslDoDisassembly (); + AcpiGbl_DisasmFlag = FALSE; + + /* delete the AML file. This AML file should never be utilized by AML interpreters. */ + + FlDeleteFile (ASL_FILE_AML_OUTPUT); + } + + CleanupAndExit: UtFreeLineBuffers (); AslParserCleanup (); + AcpiDmClearExternalFileList(); + (void) AcpiTerminate (); + + /* CmCleanupAndExit is intended for the compiler only */ - if (AcpiGbl_ExternalFileList) + if (!AcpiGbl_DisasmFlag) { - AcpiDmClearExternalFileList(); + CmCleanupAndExit (); } + return (ReturnStatus); } @@ -372,9 +434,6 @@ static void AslInitialize ( void) { - UINT32 i; - - AcpiGbl_DmOpt_Verbose = FALSE; /* Default integer width is 32 bits */ @@ -382,16 +441,4 @@ AslInitialize ( AcpiGbl_IntegerBitWidth = 32; AcpiGbl_IntegerNybbleWidth = 8; AcpiGbl_IntegerByteWidth = 4; - - for (i = 0; i < ASL_NUM_FILES; i++) - { - AslGbl_Files[i].Handle = NULL; - AslGbl_Files[i].Filename = NULL; - } - - AslGbl_Files[ASL_FILE_STDOUT].Handle = stdout; - AslGbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT"; - - AslGbl_Files[ASL_FILE_STDERR].Handle = stderr; - AslGbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; } |