static void LsDoHexOutputC ( void) { UINT32 j; UINT8 FileByte[HEX_TABLE_LINE_SIZE]; UINT8 Buffer[4]; UINT32 Offset = 0; FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n *\n */\n"); FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n"); /* Start at the beginning of the AML file */ FlSeekFile (ASL_FILE_AML_OUTPUT, 0); /* Process all AML bytes in the AML file */ j = 0; while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK) { if (j == 0) { FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); } /* Convert each AML byte to hex */ UtConvertByteToHex (FileByte[j], Buffer); FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4); FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); /* An occasional linefeed improves readability */ Offset++; j++; if (j >= HEX_TABLE_LINE_SIZE) { /* End of line, emit the ascii dump of the entire line */ FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset - HEX_TABLE_LINE_SIZE); /* Write the ASCII character associated with each of the bytes */ LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, HEX_TABLE_LINE_SIZE, FileByte); FlPrintFile (ASL_FILE_HEX_OUTPUT, " */\n"); /* Start new line */ j = 0; } } FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n};\n"); FlCloseFile (ASL_FILE_HEX_OUTPUT); }
static void ACPI_SYSTEM_XFACE AslSignalHandler ( int Sig) { UINT32 i; signal (Sig, SIG_IGN); printf ("Aborting\n\n"); /* Close all open files */ Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .i file is same as source file */ for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { FlCloseFile (i); } /* Delete any output files */ for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++) { FlDeleteFile (i); } exit (0); }
void PrDoPreprocess ( void) { BOOLEAN MoreInputFiles; DbgPrint (ASL_DEBUG_OUTPUT, "Starting preprocessing phase\n\n"); FlSeekFile (ASL_FILE_INPUT, 0); PrDumpPredefinedNames (); /* Main preprocessor loop, handles include files */ do { PrPreprocessInputFile (); MoreInputFiles = PrPopInputFileStack (); } while (MoreInputFiles); /* Point compiler input to the new preprocessor output file (.i) */ FlCloseFile (ASL_FILE_INPUT); Gbl_Files[ASL_FILE_INPUT].Handle = Gbl_Files[ASL_FILE_PREPROCESSOR].Handle; AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; /* Reset globals to allow compiler to run */ FlSeekFile (ASL_FILE_INPUT, 0); Gbl_CurrentLineNumber = 1; DbgPrint (ASL_DEBUG_OUTPUT, "Preprocessing phase complete \n\n"); }
BOOLEAN PrDoPreprocess ( void) { BOOLEAN MoreInputFiles; DbgPrint (ASL_DEBUG_OUTPUT, "Starting preprocessing phase\n\n"); FlSeekFile (ASL_FILE_INPUT, 0); PrDumpPredefinedNames (); /* Main preprocessor loop, handles include files */ do { PrPreprocessInputFile (); MoreInputFiles = PrPopInputFileStack (); } while (MoreInputFiles); /* * TBD: is this necessary? (Do we abort on any preprocessing errors?) */ if (Gbl_PreprocessorError) { /* TBD: can't use source_output file for preprocessor error reporting */ Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle = NULL; PrTerminatePreprocessor (); return (TRUE); } /* Point compiler input to the new preprocessor file (.i) */ FlCloseFile (ASL_FILE_INPUT); Gbl_Files[ASL_FILE_INPUT].Handle = Gbl_Files[ASL_FILE_PREPROCESSOR].Handle; AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; /* Reset globals to allow compiler to run */ FlSeekFile (ASL_FILE_INPUT, 0); Gbl_CurrentLineNumber = 1; DbgPrint (ASL_DEBUG_OUTPUT, "Preprocessing phase complete \n\n"); return (FALSE); }
static void CmFinishFiles( BOOLEAN DeleteAmlFile) { UINT32 i; /* * Take care with the preprocessor file (.pre), it might be the same * as the "input" file, depending on where the compiler has terminated * or aborted. Prevent attempt to close the same file twice in * loop below. */ if (AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle == AslGbl_Files[ASL_FILE_INPUT].Handle) { AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; } /* Close the standard I/O files */ for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { /* * Some files such as debug output files could be pointing to * stderr or stdout. Leave these alone. */ if (AslGbl_Files[i].Handle != stderr && AslGbl_Files[i].Handle != stdout) { FlCloseFile (i); } } /* Delete AML file if there are errors */ if (DeleteAmlFile) { FlDeleteFile (ASL_FILE_AML_OUTPUT); } /* Delete the preprocessor temp file unless full debug was specified */ if (AslGbl_PreprocessFlag && !AslGbl_KeepPreprocessorTempFile) { FlDeleteFile (ASL_FILE_PREPROCESSOR); } /* * Delete intermediate ("combined") source file (if -ls flag not set) * This file is created during normal ASL/AML compiles. It is not * created by the data table compiler. * * If the -ls flag is set, then the .SRC file should not be deleted. * In this case, Gbl_SourceOutputFlag is set to TRUE. * * Note: Handles are cleared by FlCloseFile above, so we look at the * filename instead, to determine if the .SRC file was actually * created. */ if (!AslGbl_SourceOutputFlag) { FlDeleteFile (ASL_FILE_SOURCE_OUTPUT); } }
void CmCleanupAndExit ( void) { UINT32 i; BOOLEAN DeleteAmlFile = FALSE; AePrintErrorLog (ASL_FILE_STDERR); if (Gbl_DebugFlag) { /* Print error summary to stdout also */ AePrintErrorLog (ASL_FILE_STDOUT); } /* Emit compile times if enabled */ CmDumpAllEvents (); if (Gbl_CompileTimesFlag) { printf ("\nMiscellaneous compile statistics\n\n"); printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); printf ("%11u : %s\n", TotalNamedObjects, "Named objects"); printf ("%11u : %s\n", TotalMethods, "Control methods"); printf ("%11u : %s\n", TotalAllocations, "Memory Allocations"); printf ("%11u : %s\n", TotalAllocated, "Total allocated memory"); printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded"); printf ("\n"); } if (Gbl_NsLookupCount) { DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n"); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u\n", "Total Namespace searches", Gbl_NsLookupCount); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u usec\n", "Time per search", ((UINT32) (AslGbl_Events[AslGbl_NamespaceEvent].EndTime - AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) / Gbl_NsLookupCount); } if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) { printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT); } UtDisplaySummary (ASL_FILE_STDOUT); /* * We will delete the AML file if there are errors and the * force AML output option has not been used. */ if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors) && Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) { DeleteAmlFile = TRUE; } /* Close all open files */ /* * Take care with the preprocessor file (.i), it might be the same * as the "input" file, depending on where the compiler has terminated * or aborted. Prevent attempt to close the same file twice in * loop below. */ if (Gbl_Files[ASL_FILE_PREPROCESSOR].Handle == Gbl_Files[ASL_FILE_INPUT].Handle) { Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; } /* Close the standard I/O files */ for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { FlCloseFile (i); } /* Delete AML file if there are errors */ if (DeleteAmlFile) { FlDeleteFile (ASL_FILE_AML_OUTPUT); } /* Delete the preprocessor output file (.i) unless -li flag is set */ if (!Gbl_PreprocessorOutputFlag && Gbl_PreprocessFlag) { FlDeleteFile (ASL_FILE_PREPROCESSOR); } /* * Delete intermediate ("combined") source file (if -ls flag not set) * This file is created during normal ASL/AML compiles. It is not * created by the data table compiler. * * If the -ls flag is set, then the .SRC file should not be deleted. * In this case, Gbl_SourceOutputFlag is set to TRUE. * * Note: Handles are cleared by FlCloseFile above, so we look at the * filename instead, to determine if the .SRC file was actually * created. * * TBD: SourceOutput should be .TMP, then rename if we want to keep it? */ if (!Gbl_SourceOutputFlag) { FlDeleteFile (ASL_FILE_SOURCE_OUTPUT); } /* Final cleanup after compiling one file */ CmDeleteCaches (); }
ACPI_STATUS AslDoOneFile ( char *Filename) { ACPI_STATUS Status; /* Re-initialize "some" compiler/preprocessor globals */ AslInitializeGlobals (); PrInitializeGlobals (); /* * Extract the directory path. This path is used for possible include * files and the optional AML filename embedded in the input file * DefinitionBlock declaration. */ Status = FlSplitInputPathname (Filename, &AslGbl_DirectoryPath, NULL); if (ACPI_FAILURE (Status)) { return (Status); } /* Take a copy of the input filename, convert any backslashes */ AslGbl_Files[ASL_FILE_INPUT].Filename = UtLocalCacheCalloc (strlen (Filename) + 1); strcpy (AslGbl_Files[ASL_FILE_INPUT].Filename, Filename); UtConvertBackslashes (AslGbl_Files[ASL_FILE_INPUT].Filename); /* * AML Disassembly (Optional) */ if (AcpiGbl_DisasmFlag) { Status = AslDoDisassembly (); if (Status != AE_CTRL_CONTINUE) { return (Status); } } /* * Open the input file. Here, this should be an ASCII source file, * either an ASL file or a Data Table file */ Status = FlOpenInputFile (AslGbl_Files[ASL_FILE_INPUT].Filename); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return (AE_ERROR); } AslGbl_OriginalInputFileSize = FlGetFileSize (ASL_FILE_INPUT); /* Determine input file type */ AslGbl_FileType = AslDetectSourceFileType (&AslGbl_Files[ASL_FILE_INPUT]); if (AslGbl_FileType == ASL_INPUT_TYPE_BINARY) { return (AE_ERROR); } /* * If -p not specified, we will use the input filename as the * output filename prefix */ if (AslGbl_UseDefaultAmlFilename) { AslGbl_OutputFilenamePrefix = AslGbl_Files[ASL_FILE_INPUT].Filename; } /* Open the optional output files (listings, etc.) */ Status = FlOpenMiscOutputFiles (AslGbl_OutputFilenamePrefix); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return (AE_ERROR); } /* * Compilation of ASL source versus DataTable source uses different * compiler subsystems */ switch (AslGbl_FileType) { /* * Data Table Compilation */ case ASL_INPUT_TYPE_ASCII_DATA: Status = DtDoCompile (); if (ACPI_FAILURE (Status)) { return (Status); } if (AslGbl_Signature) { AslGbl_Signature = NULL; } /* Check if any errors occurred during compile */ Status = AslCheckForErrorExit (); if (ACPI_FAILURE (Status)) { return (Status); } /* Cleanup (for next source file) and exit */ AeClearErrorLog (); PrTerminatePreprocessor (); return (Status); /* * ASL Compilation */ case ASL_INPUT_TYPE_ASCII_ASL: /* ACPICA subsystem initialization */ Status = AdInitialize (); if (ACPI_FAILURE (Status)) { return (Status); } (void) CmDoCompile (); (void) AcpiTerminate (); /* Check if any errors occurred during compile */ Status = AslCheckForErrorExit (); if (ACPI_FAILURE (Status)) { return (Status); } /* Cleanup (for next source file) and exit */ AeClearErrorLog (); PrTerminatePreprocessor (); /* ASL-to-ASL+ conversion - Perform immediate disassembly */ if (AslGbl_DoAslConversion) { /* * 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; CvDbgPrint ("OUTPUTFILENAME: %s\n", AslGbl_OutputFilenamePrefix); AslGbl_Files[ASL_FILE_INPUT].Filename = AslGbl_Files[ASL_FILE_AML_OUTPUT].Filename; AcpiGbl_DisasmFlag = TRUE; fprintf (stderr, "\n"); AslDoDisassembly (); /* delete the AML file. This AML file should never be utilized by AML interpreters. */ FlDeleteFile (ASL_FILE_AML_OUTPUT); } return (AE_OK); /* * Binary ACPI table was auto-detected, disassemble it */ case ASL_INPUT_TYPE_BINARY_ACPI_TABLE: /* We have what appears to be an ACPI table, disassemble it */ FlCloseFile (ASL_FILE_INPUT); AslGbl_DoCompile = FALSE; AcpiGbl_DisasmFlag = TRUE; Status = AslDoDisassembly (); return (Status); /* Unknown binary table */ case ASL_INPUT_TYPE_BINARY: AePrintErrorLog (ASL_FILE_STDERR); return (AE_ERROR); default: printf ("Unknown file type %X\n", AslGbl_FileType); return (AE_ERROR); } }
void CmCleanupAndExit ( void) { UINT32 i; AePrintErrorLog (ASL_FILE_STDOUT); if (Gbl_DebugFlag) { /* Print error summary to the debug file */ AePrintErrorLog (ASL_FILE_STDERR); } DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); for (i = 0; i < AslGbl_NextEvent; i++) { CmDumpEvent (&AslGbl_Events[i]); } if (Gbl_CompileTimesFlag) { printf ("\nElapsed time for major events\n\n"); for (i = 0; i < AslGbl_NextEvent; i++) { CmDumpEvent (&AslGbl_Events[i]); } printf ("\nMiscellaneous compile statistics\n\n"); printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); printf ("%11u : %s\n", TotalNamedObjects, "Named objects"); printf ("%11u : %s\n", TotalMethods, "Control methods"); printf ("%11u : %s\n", TotalAllocations, "Memory Allocations"); printf ("%11u : %s\n", TotalAllocated, "Total allocated memory"); printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded"); printf ("\n"); } if (Gbl_NsLookupCount) { DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n"); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u\n", "Total Namespace searches", Gbl_NsLookupCount); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %u usec\n", "Time per search", ((UINT32) (AslGbl_Events[AslGbl_NamespaceEvent].EndTime - AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) / Gbl_NsLookupCount); } if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) { printf ("\nMaximum error count (%u) exceeded\n", ASL_MAX_ERROR_COUNT); } UtDisplaySummary (ASL_FILE_STDOUT); /* Close all open files */ for (i = 2; i < ASL_MAX_FILE_TYPE; i++) { FlCloseFile (i); } /* Delete AML file if there are errors */ if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors) && Gbl_Files[ASL_FILE_AML_OUTPUT].Handle) { if (remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename)) { printf ("%s: ", Gbl_Files[ASL_FILE_AML_OUTPUT].Filename); perror ("Could not delete AML file"); } } /* * Delete intermediate ("combined") source file (if -ls flag not set) * This file is created during normal ASL/AML compiles. It is not * created by the data table compiler. * * If the -ls flag is set, then the .SRC file should not be deleted. * In this case, Gbl_SourceOutputFlag is set to TRUE. * * Note: Handles are cleared by FlCloseFile above, so we look at the * filename instead, to determine if the .SRC file was actually * created. * * TBD: SourceOutput should be .TMP, then rename if we want to keep it? */ if (!Gbl_SourceOutputFlag && Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename) { if (remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename)) { printf ("%s: ", Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); perror ("Could not delete SRC file"); } } }
ACPI_STATUS AslDoOneFile ( char *Filename) { ACPI_STATUS Status; /* Re-initialize "some" compiler/preprocessor globals */ AslInitializeGlobals (); PrInitializeGlobals (); /* * Extract the directory path. This path is used for possible include * files and the optional AML filename embedded in the input file * DefinitionBlock declaration. */ Status = FlSplitInputPathname (Filename, &Gbl_DirectoryPath, NULL); if (ACPI_FAILURE (Status)) { return (Status); } Gbl_Files[ASL_FILE_INPUT].Filename = Filename; UtConvertBackslashes (Filename); /* * AML Disassembly (Optional) */ if (Gbl_DisasmFlag) { Status = AslDoDisassembly (); if (Status != AE_CTRL_CONTINUE) { return (Status); } } /* * Open the input file. Here, this should be an ASCII source file, * either an ASL file or a Data Table file */ Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return (AE_ERROR); } /* Determine input file type */ Gbl_FileType = AslDetectSourceFileType (&Gbl_Files[ASL_FILE_INPUT]); if (Gbl_FileType == ASL_INPUT_TYPE_BINARY) { return (AE_ERROR); } /* * If -p not specified, we will use the input filename as the * output filename prefix */ if (Gbl_UseDefaultAmlFilename) { Gbl_OutputFilenamePrefix = Gbl_Files[ASL_FILE_INPUT].Filename; } /* Open the optional output files (listings, etc.) */ Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); if (ACPI_FAILURE (Status)) { AePrintErrorLog (ASL_FILE_STDERR); return (AE_ERROR); } /* * Compilation of ASL source versus DataTable source uses different * compiler subsystems */ switch (Gbl_FileType) { /* * Data Table Compilation */ case ASL_INPUT_TYPE_ASCII_DATA: Status = DtDoCompile (); if (ACPI_FAILURE (Status)) { return (Status); } if (Gbl_Signature) { ACPI_FREE (Gbl_Signature); Gbl_Signature = NULL; } /* Check if any errors occurred during compile */ Status = AslCheckForErrorExit (); if (ACPI_FAILURE (Status)) { return (Status); } /* Cleanup (for next source file) and exit */ AeClearErrorLog (); PrTerminatePreprocessor (); return (Status); /* * ASL Compilation */ case ASL_INPUT_TYPE_ASCII_ASL: /* ACPICA subsystem initialization */ Status = AdInitialize (); if (ACPI_FAILURE (Status)) { return (Status); } (void) CmDoCompile (); (void) AcpiTerminate (); /* Check if any errors occurred during compile */ Status = AslCheckForErrorExit (); if (ACPI_FAILURE (Status)) { return (Status); } /* Cleanup (for next source file) and exit */ AeClearErrorLog (); PrTerminatePreprocessor (); return (AE_OK); /* * Binary ACPI table was auto-detected, disassemble it */ case ASL_INPUT_TYPE_ACPI_TABLE: /* We have what appears to be an ACPI table, disassemble it */ FlCloseFile (ASL_FILE_INPUT); Gbl_DoCompile = FALSE; Gbl_DisasmFlag = TRUE; Status = AslDoDisassembly (); return (Status); /* Unknown binary table */ case ASL_INPUT_TYPE_BINARY: AePrintErrorLog (ASL_FILE_STDERR); return (AE_ERROR); default: printf ("Unknown file type %X\n", Gbl_FileType); return (AE_ERROR); } }
static void LsDoHexOutputAsm ( void) { UINT32 j; UINT8 FileByte[HEX_TABLE_LINE_SIZE]; UINT8 Buffer[4]; UINT32 Offset = 0; BOOLEAN DoComma = FALSE; FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n;\n"); /* Start at the beginning of the AML file */ FlSeekFile (ASL_FILE_AML_OUTPUT, 0); /* Process all AML bytes in the AML file */ j = 0; while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK) { if (j == 0) { FlPrintFile (ASL_FILE_HEX_OUTPUT, " db "); } else if (DoComma) { FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); DoComma = FALSE; } /* Convert each AML byte to hex */ UtConvertByteToAsmHex (FileByte[j], Buffer); FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4); /* An occasional linefeed improves readability */ Offset++; j++; if (j >= HEX_TABLE_LINE_SIZE) { FlPrintFile (ASL_FILE_HEX_OUTPUT, " ;%8.8X", Offset - HEX_TABLE_LINE_SIZE); /* Write the ASCII character associated with each of the bytes */ LsDumpAscii (ASL_FILE_HEX_OUTPUT, HEX_TABLE_LINE_SIZE, FileByte); FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); j = 0; } else { DoComma = TRUE; } } FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); FlCloseFile (ASL_FILE_HEX_OUTPUT); }
void CmCleanupAndExit ( void) { UINT32 i; AePrintErrorLog (ASL_FILE_STDOUT); if (Gbl_DebugFlag) { /* Print error summary to the debug file */ AePrintErrorLog (ASL_FILE_STDERR); } DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); for (i = 0; i < AslGbl_NextEvent; i++) { CmDumpEvent (&AslGbl_Events[i]); } if (Gbl_CompileTimesFlag) { printf ("\nElapsed time for major events\n\n"); for (i = 0; i < AslGbl_NextEvent; i++) { CmDumpEvent (&AslGbl_Events[i]); } printf ("\nMiscellaneous compile statistics\n\n"); printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); printf ("%11u : %s\n", TotalNamedObjects, "Named objects"); printf ("%11u : %s\n", TotalMethods, "Control methods"); printf ("%11u : %s\n", TotalAllocations, "Memory Allocations"); printf ("%11u : %s\n", TotalAllocated, "Total allocated memory"); printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded"); printf ("\n"); } if (Gbl_NsLookupCount) { DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n"); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Total Namespace searches", Gbl_NsLookupCount); DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d usec\n", "Time per search", ((UINT32) (AslGbl_Events[AslGbl_NamespaceEvent].EndTime - AslGbl_Events[AslGbl_NamespaceEvent].StartTime) / 10) / Gbl_NsLookupCount); } /* Close all open files */ for (i = 2; i < ASL_MAX_FILE_TYPE; i++) { FlCloseFile (i); } /* * TBD: SourceOutput should be .TMP, then rename if we want to keep it? */ if (!Gbl_SourceOutputFlag) { remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); } /* Delete AML file if there are errors */ if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors)) { remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename); } if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) { printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT); } UtDisplaySummary (ASL_FILE_STDOUT); }
static void LsDoHexOutputAsm ( void) { UINT8 FileData[HEX_TABLE_LINE_SIZE]; UINT32 LineLength; UINT32 Offset = 0; UINT32 AmlFileSize; UINT32 i; /* Get AML size, seek back to start */ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n"); FlPrintFile (ASL_FILE_HEX_OUTPUT, "; AML code block contains 0x%X bytes\n;\n", AmlFileSize); while (Offset < AmlFileSize) { /* Read enough bytes needed for one output line */ LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); if (!LineLength) { break; } FlPrintFile (ASL_FILE_HEX_OUTPUT, " db "); for (i = 0; i < LineLength; i++) { /* * Print each hex byte. * Add a comma until the last byte of the line */ FlPrintFile (ASL_FILE_HEX_OUTPUT, "0%2.2Xh", FileData[i]); if ((i + 1) < LineLength) { FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); } } FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); /* Add fill spaces if needed for last line */ if (LineLength < HEX_TABLE_LINE_SIZE) { FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s", 5 * (HEX_TABLE_LINE_SIZE - LineLength), " "); } /* Emit the offset and ascii dump for the entire line */ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset); LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); Offset += LineLength; } FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); FlCloseFile (ASL_FILE_HEX_OUTPUT); }
static void LsDoHexOutputAsl ( void) { UINT8 FileData[HEX_TABLE_LINE_SIZE]; UINT32 LineLength; UINT32 Offset = 0; UINT32 AmlFileSize; UINT32 i; /* Get AML size, seek back to start */ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT); FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n"); FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n", AmlFileSize); FlPrintFile (ASL_FILE_HEX_OUTPUT, " Name (BUF1, Buffer()\n {\n"); while (Offset < AmlFileSize) { /* Read enough bytes needed for one output line */ LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE, Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); if (!LineLength) { break; } FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); for (i = 0; i < LineLength; i++) { /* * Print each hex byte. * Add a comma until the very last byte of the AML file * (Some C compilers complain about a trailing comma) */ FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]); if ((Offset + i + 1) < AmlFileSize) { FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); } else { FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); } } /* Add fill spaces if needed for last line */ if (LineLength < HEX_TABLE_LINE_SIZE) { FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s", 5 * (HEX_TABLE_LINE_SIZE - LineLength), " "); } /* Emit the offset and ascii dump for the entire line */ FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset); LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData); FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n", HEX_TABLE_LINE_SIZE - LineLength + 1, " "); Offset += LineLength; } FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n"); FlCloseFile (ASL_FILE_HEX_OUTPUT); }