diff options
Diffstat (limited to 'source/compiler')
-rw-r--r-- | source/compiler/aslcompile.c | 2 | ||||
-rw-r--r-- | source/compiler/aslerror.c | 6 | ||||
-rw-r--r-- | source/compiler/aslfileio.c | 72 | ||||
-rw-r--r-- | source/compiler/aslmain.c | 42 | ||||
-rw-r--r-- | source/compiler/aslmessages.h | 2 | ||||
-rw-r--r-- | source/compiler/asloptions.c | 1 | ||||
-rw-r--r-- | source/compiler/aslstubs.c | 2 | ||||
-rw-r--r-- | source/compiler/aslutils.c | 2 | ||||
-rw-r--r-- | source/compiler/dtcompiler.h | 4 | ||||
-rw-r--r-- | source/compiler/dtio.c | 14 | ||||
-rw-r--r-- | source/compiler/dtutils.c | 30 |
11 files changed, 67 insertions, 110 deletions
diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 1b077c003c53b..cc1a0eb6d08ee 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -390,7 +390,7 @@ FlCheckForAcpiTable ( /* Header length field must match the file size */ - FileSize = DtGetFileSize (Handle); + FileSize = CmGetFileSize (Handle); if (Table.Length != FileSize) { return (AE_ERROR); diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index a60f608f29b23..1fcb97efccf21 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -874,14 +874,14 @@ AslError ( * FUNCTION: AslCoreSubsystemError * * PARAMETERS: Op - Parse node where error happened - * Status - The ACPI CA Exception + * Status - The ACPICA Exception * ExtraMessage - additional error message * Abort - TRUE -> Abort compilation * * RETURN: None * - * DESCRIPTION: Error reporting routine for exceptions returned by the ACPI - * CA core subsystem. + * DESCRIPTION: Error reporting routine for exceptions returned by the ACPICA + * core subsystem. * ******************************************************************************/ diff --git a/source/compiler/aslfileio.c b/source/compiler/aslfileio.c index 90072f1fffe01..56d006b5ad7b4 100644 --- a/source/compiler/aslfileio.c +++ b/source/compiler/aslfileio.c @@ -42,14 +42,11 @@ */ #include "aslcompiler.h" +#include "acapps.h" #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslfileio") -long -UtGetFileSize ( - FILE *fp); - /******************************************************************************* * @@ -115,65 +112,6 @@ FlOpenFile ( /******************************************************************************* * - * FUNCTION: UtGetFileSize - * - * PARAMETERS: fp - Open file handle - * - * RETURN: File Size. -1 on error. - * - * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. - * TBD: This function should be used to replace other similar - * functions in ACPICA. - * - ******************************************************************************/ - -long -UtGetFileSize ( - FILE *fp) -{ - long FileSize; - long CurrentOffset; - - - CurrentOffset = ftell (fp); - if (CurrentOffset < 0) - { - goto OffsetError; - } - - if (fseek (fp, 0, SEEK_END)) - { - goto SeekError; - } - - FileSize = ftell (fp); - if (FileSize < 0) - { - goto OffsetError; - } - - /* Restore file pointer */ - - if (fseek (fp, CurrentOffset, SEEK_SET)) - { - goto SeekError; - } - - return (FileSize); - - -OffsetError: - perror ("Could not get file offset"); - return (-1); - -SeekError: - perror ("Could not seek file"); - return (-1); -} - - -/******************************************************************************* - * * FUNCTION: FlGetFileSize * * PARAMETERS: FileId - Index into file info array @@ -189,16 +127,16 @@ UINT32 FlGetFileSize ( UINT32 FileId) { - long FileSize; + UINT32 FileSize; - FileSize = UtGetFileSize (Gbl_Files[FileId].Handle); - if (FileSize == -1) + FileSize = CmGetFileSize (Gbl_Files[FileId].Handle); + if (FileSize == ACPI_UINT32_MAX) { AslAbort(); } - return ((UINT32) FileSize); + return (FileSize); } diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 6f81d21d2c05b..6e92d53d54e54 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -73,6 +73,36 @@ static void AslInitialize ( void); +UINT8 +AcpiIsBigEndianMachine ( + void); + + +/******************************************************************************* + * + * FUNCTION: AcpiIsBigEndianMachine + * + * PARAMETERS: None + * + * RETURN: TRUE if machine is big endian + * FALSE if machine is little endian + * + * DESCRIPTION: Detect whether machine is little endian or big endian. + * + ******************************************************************************/ + +UINT8 +AcpiIsBigEndianMachine ( + void) +{ + union { + UINT32 Integer; + UINT8 Bytes[4]; + } Overlay = {0xFF000000}; + + return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */ +} + /******************************************************************************* * @@ -299,6 +329,18 @@ main ( int Index2; + /* + * Big-endian machines are not currently supported. ACPI tables must + * be little-endian, and support for big-endian machines needs to + * be implemented. + */ + if (AcpiIsBigEndianMachine ()) + { + fprintf (stderr, + "iASL is not currently supported on big-endian machines.\n"); + return (-1); + } + ACPI_DEBUG_INITIALIZE (); /* For debug version only */ /* Initialize preprocessor and compiler before command line processing */ diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index a97766ce3b990..181838380908a 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -296,7 +296,7 @@ char *AslMessages [] = /* ASL_MSG_CONNECTION_INVALID */ "Invalid OpRegion SpaceId for use of Connection operator", /* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression", /* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced", -/* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem", +/* ASL_MSG_CORE_EXCEPTION */ "From ACPICA Subsystem", /* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file", /* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename", /* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",\ diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 7d73d20c49536..8d52826f1a91e 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -269,6 +269,7 @@ AslDoOptions ( /* Get entire list of external files */ AcpiGbl_Optind--; + argv[AcpiGbl_Optind] = AcpiGbl_Optarg; while (argv[AcpiGbl_Optind] && (argv[AcpiGbl_Optind][0] != '-')) diff --git a/source/compiler/aslstubs.c b/source/compiler/aslstubs.c index dd278d8e6fdb5..589edb21c1a3c 100644 --- a/source/compiler/aslstubs.c +++ b/source/compiler/aslstubs.c @@ -53,7 +53,7 @@ /* - * Stubs to simplify linkage to the ACPI CA core subsystem. + * Stubs to simplify linkage to the ACPICA core subsystem. * Things like Events, Global Lock, etc. are not used * by the compiler, so they are stubbed out here. */ diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 401d473f59805..7dc0697236b89 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -918,7 +918,7 @@ UtDoConstant ( } -/* TBD: use version in ACPI CA main code base? */ +/* TBD: use version in ACPICA main code base? */ /******************************************************************************* * diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 94083b5f75a7b..846e9c2f5e547 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -343,10 +343,6 @@ DtStrtoul64 ( char *String, UINT64 *ReturnInteger); -UINT32 -DtGetFileSize ( - FILE *Handle); - char* DtGetFieldValue ( DT_FIELD *Field); diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c index 5c57b5fa5ba79..25d84ab059cc0 100644 --- a/source/compiler/dtio.c +++ b/source/compiler/dtio.c @@ -45,6 +45,7 @@ #include "aslcompiler.h" #include "dtcompiler.h" +#include "acapps.h" #define _COMPONENT DT_COMPILER ACPI_MODULE_NAME ("dtio") @@ -737,7 +738,11 @@ DtScanFile ( /* Get the file size */ - Gbl_InputByteCount = DtGetFileSize (Handle); + Gbl_InputByteCount = CmGetFileSize (Handle); + if (Gbl_InputByteCount == ACPI_UINT32_MAX) + { + AslAbort (); + } Gbl_CurrentLineNumber = 0; Gbl_CurrentLineOffset = 0; @@ -816,7 +821,12 @@ DtOutputBinary ( /* Walk the entire parse tree, emitting the binary data */ DtWalkTableTree (RootTable, DtWriteBinary, NULL, NULL); - Gbl_TableLength = DtGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); + + Gbl_TableLength = CmGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle); + if (Gbl_TableLength == ACPI_UINT32_MAX) + { + AslAbort (); + } } diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index 7d7e430fe52e4..d394aff1575ff 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -286,36 +286,6 @@ DtStrtoul64 ( /****************************************************************************** * - * FUNCTION: DtGetFileSize - * - * PARAMETERS: Handle - Open file handler - * - * RETURN: Current file size - * - * DESCRIPTION: Get the current size of a file. Seek to the EOF and get the - * offset. Seek back to the original location. - * - *****************************************************************************/ - -UINT32 -DtGetFileSize ( - FILE *Handle) -{ - int CurrentOffset; - int LastOffset; - - - CurrentOffset = ftell (Handle); - fseek (Handle, 0, SEEK_END); - LastOffset = ftell (Handle); - fseek (Handle, CurrentOffset, SEEK_SET); - - return ((UINT32) LastOffset); -} - - -/****************************************************************************** - * * FUNCTION: DtGetFieldValue * * PARAMETERS: Field - Current field list pointer |