diff options
Diffstat (limited to 'source/compiler')
-rw-r--r-- | source/compiler/aslcompiler.h | 5 | ||||
-rw-r--r-- | source/compiler/aslcompiler.l | 4 | ||||
-rw-r--r-- | source/compiler/asldebug.c | 87 | ||||
-rw-r--r-- | source/compiler/aslerror.c | 20 | ||||
-rw-r--r-- | source/compiler/aslhelp.c | 2 | ||||
-rw-r--r-- | source/compiler/aslmain.c | 8 | ||||
-rw-r--r-- | source/compiler/aslmessages.c | 5 | ||||
-rw-r--r-- | source/compiler/aslmessages.h | 1 | ||||
-rw-r--r-- | source/compiler/aslresource.c | 8 | ||||
-rw-r--r-- | source/compiler/aslrules.y | 3 | ||||
-rw-r--r-- | source/compiler/asltree.c | 33 | ||||
-rw-r--r-- | source/compiler/aslutils.c | 17 | ||||
-rw-r--r-- | source/compiler/dtcompile.c | 2 | ||||
-rw-r--r-- | source/compiler/dtcompiler.h | 4 | ||||
-rw-r--r-- | source/compiler/dtfield.c | 8 | ||||
-rw-r--r-- | source/compiler/dtparser.y | 17 | ||||
-rw-r--r-- | source/compiler/dtutils.c | 32 | ||||
-rw-r--r-- | source/compiler/prparser.y | 4 |
18 files changed, 217 insertions, 43 deletions
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index fdf4dbf7de52..3b6a9c1dc1c2 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -890,6 +890,11 @@ void TrSetOpCurrentFilename ( ACPI_PARSE_OBJECT *Op); +void +TrSetOpIntegerWidth ( + ACPI_PARSE_OBJECT *TableSignature, + ACPI_PARSE_OBJECT *Revision); + ACPI_PARSE_OBJECT * TrLinkOpChildren ( ACPI_PARSE_OBJECT *Op, diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index b49233be7f14..5fcfc1886770 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -195,6 +195,7 @@ count (int type); LeadNameChar [A-Za-z_] DigitChar [0-9] +OctalChar [0-7] HexDigitChar [A-Fa-f0-9] RootChar [\\] Nothing [] @@ -278,8 +279,7 @@ NamePathTail [.]{NameSeg} /* * Begin standard ASL grammar */ -0[xX]{HexDigitChar}+ | -{DigitChar}+ { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext); +[0-9][a-zA-Z0-9]* { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext); count (1); return (PARSEOP_INTEGER); } "Include" { count (1); return (PARSEOP_INCLUDE); } diff --git a/source/compiler/asldebug.c b/source/compiler/asldebug.c index b0b386408498..684e222485bf 100644 --- a/source/compiler/asldebug.c +++ b/source/compiler/asldebug.c @@ -165,6 +165,10 @@ UtDumpParseOpName ( UINT32 Level, UINT32 DataLength); +static char * +UtCreateEscapeSequences ( + char *InString); + /******************************************************************************* * @@ -272,7 +276,6 @@ UtDumpStringOp ( String = Op->Asl.Value.String; - if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL) { /* @@ -294,6 +297,8 @@ UtDumpStringOp ( return; } + String = UtCreateEscapeSequences (String); + /* Emit the ParseOp name, leaving room for the string */ UtDumpParseOpName (Op, Level, strlen (String)); @@ -303,6 +308,86 @@ UtDumpStringOp ( /******************************************************************************* * + * FUNCTION: UtCreateEscapeSequences + * + * PARAMETERS: InString - ASCII string to be expanded + * + * RETURN: Expanded string + * + * DESCRIPTION: Expand all non-printable ASCII bytes (0-0x1F) to escape + * sequences. For example, hex 14 becomes \x14 + * + * NOTE: Since this function is used for debug output only, it does + * not attempt to translate into the "known" escape sequences + * such as \a, \f, \t, etc. + * + ******************************************************************************/ + +static char * +UtCreateEscapeSequences ( + char *InString) +{ + char *String = InString; + char *OutString; + char *OutStringPtr; + UINT32 InStringLength = 0; + UINT32 EscapeCount = 0; + + + /* + * Determine up front how many escapes are within the string. + * Obtain the input string length while doing so. + */ + while (*String) + { + if ((*String <= 0x1F) || (*String >= 0x7F)) + { + EscapeCount++; + } + + InStringLength++; + String++; + } + + if (!EscapeCount) + { + return (InString); /* No escapes, nothing to do */ + } + + /* New string buffer, 3 extra chars per escape (4 total) */ + + OutString = UtLocalCalloc (InStringLength + (EscapeCount * 3)); + OutStringPtr = OutString; + + /* Convert non-ascii or non-printable chars to escape sequences */ + + while (*InString) + { + if ((*InString <= 0x1F) || (*InString >= 0x7F)) + { + /* Insert a \x hex escape sequence */ + + OutStringPtr[0] = '\\'; + OutStringPtr[1] = 'x'; + OutStringPtr[2] = AcpiUtHexToAsciiChar (*InString, 4); + OutStringPtr[3] = AcpiUtHexToAsciiChar (*InString, 0); + OutStringPtr += 4; + } + else /* Normal ASCII character */ + { + *OutStringPtr = *InString; + OutStringPtr++; + } + + InString++; + } + + return (OutString); +} + + +/******************************************************************************* + * * FUNCTION: UtDumpBasicOp * * PARAMETERS: Op - Current parse op diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index ec91ca3e7d06..56b5cabb9476 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -757,6 +757,11 @@ AslCommonError ( ASL_ERROR_MSG *Enode; + if (AslIsExceptionIgnored (Level, MessageId)) + { + return; + } + Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); if (ExtraMessage) @@ -949,9 +954,9 @@ AslDisableException ( MessageId = (UINT32) strtoul (MessageIdString, NULL, 0); - if ((MessageId < 2000) || (MessageId > 5999)) + if ((MessageId < 2000) || (MessageId > 6999)) { - printf ("\"%s\" is not a valid warning/remark ID\n", + printf ("\"%s\" is not a valid warning/remark/error ID\n", MessageIdString); return (AE_BAD_PARAMETER); } @@ -1050,8 +1055,9 @@ AslIsExceptionDisabled ( case ASL_WARNING: case ASL_REMARK: + case ASL_ERROR: /* - * Ignore this warning/remark if it has been disabled by + * Ignore this error/warning/remark if it has been disabled by * the user (-vw option) */ EncodedMessageId = AeBuildFullExceptionCode (Level, MessageId); @@ -1097,14 +1103,6 @@ AslError ( ACPI_PARSE_OBJECT *Op, char *ExtraMessage) { - - /* Check if user wants to ignore this exception */ - - if (AslIsExceptionIgnored (Level, MessageId)) - { - return; - } - if (Op) { AslCommonError (Level, MessageId, Op->Asl.LineNumber, diff --git a/source/compiler/aslhelp.c b/source/compiler/aslhelp.c index 18eab858c213..e1266dc864ef 100644 --- a/source/compiler/aslhelp.c +++ b/source/compiler/aslhelp.c @@ -204,7 +204,7 @@ Usage ( ACPI_OPTION ("-ve", "Report only errors (ignore warnings and remarks)"); ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs"); ACPI_OPTION ("-vr", "Disable remarks"); - ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark"); + ACPI_OPTION ("-vw <messageid>", "Ignore specific error, warning or remark"); ACPI_OPTION ("-vx <messageid>", "Expect a specific warning, remark, or error"); ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level"); ACPI_OPTION ("-we", "Report warnings as errors"); diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 10251fb2a80f..e4ac4229eb8f 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -386,11 +386,11 @@ AslInitialize ( AcpiGbl_DmOpt_Verbose = FALSE; - /* Default integer width is 64 bits */ + /* Default integer width is 32 bits */ - AcpiGbl_IntegerBitWidth = 64; - AcpiGbl_IntegerNybbleWidth = 16; - AcpiGbl_IntegerByteWidth = 8; + AcpiGbl_IntegerBitWidth = 32; + AcpiGbl_IntegerNybbleWidth = 8; + AcpiGbl_IntegerByteWidth = 4; for (i = 0; i < ASL_NUM_FILES; i++) { diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c index b87d54991f7b..159f9d23f859 100644 --- a/source/compiler/aslmessages.c +++ b/source/compiler/aslmessages.c @@ -238,7 +238,7 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_HID_SUFFIX */ "_HID suffix must be all hex digits", /* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file", /* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file", -/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating (DSDT or SSDT version < 2)", +/* ASL_MSG_INTEGER_LENGTH */ "Truncating 64-bit constant found in 32-bit table", /* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode", /* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)", /* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)", @@ -349,7 +349,8 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used", /* ASL_MSG_CONSTANT_REQUIRED */ "Non-reducible expression", /* ASL_MSG_CROSS_TABLE_SCOPE */ "Illegal open scope on external object from within DSDT", -/* ASL_MSG_EXCEPTION_NOT_RECEIVED */ "Expected remark, warning, or error did not occur. Message ID:" +/* ASL_MSG_EXCEPTION_NOT_RECEIVED */ "Expected remark, warning, or error did not occur. Message ID:", +/* ASL_MSG_NULL_RESOURCE_TEMPLATE */ "Empty Resource Template (END_TAG only)" }; /* Table compiler */ diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index 68216e5c0756..d69c05a176c6 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -352,6 +352,7 @@ typedef enum ASL_MSG_CONSTANT_REQUIRED, ASL_MSG_CROSS_TABLE_SCOPE, ASL_MSG_EXCEPTION_NOT_RECEIVED, + ASL_MSG_NULL_RESOURCE_TEMPLATE, /* These messages are used by the Data Table compiler only */ diff --git a/source/compiler/aslresource.c b/source/compiler/aslresource.c index eb0c22a1b692..b052c1ed8bbc 100644 --- a/source/compiler/aslresource.c +++ b/source/compiler/aslresource.c @@ -1148,6 +1148,14 @@ RsDoResourceTemplate ( DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp); + /* DEFAULT_ARG indicates null template - ResourceTemplate(){} */ + + if (DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + AslError (ASL_WARNING, ASL_MSG_NULL_RESOURCE_TEMPLATE, + DescriptorTypeOp, DescriptorTypeOp->Asl.Value.String); + } + /* * Process all resource descriptors in the list * Note: It is assumed that the EndTag node has been automatically diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y index f26ea874b3ab..3b8e4839892e 100644 --- a/source/compiler/aslrules.y +++ b/source/compiler/aslrules.y @@ -199,7 +199,8 @@ DefinitionBlockTerm String ',' String ',' DWordConst - PARSEOP_CLOSE_PAREN {TrSetOpEndLineNumber ($<n>3); COMMENT_CAPTURE_ON;} + PARSEOP_CLOSE_PAREN {TrSetOpIntegerWidth ($6,$8); + TrSetOpEndLineNumber ($<n>3); COMMENT_CAPTURE_ON;} '{' TermList '}' {$$ = TrLinkOpChildren ($<n>3,7, $4,$6,$8,$10,$12,$14,$18);} ; diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index 8b709df72745..084bc4d59ac9 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -378,6 +378,39 @@ TrSetOpCurrentFilename ( /******************************************************************************* * + * FUNCTION: TrSetOpIntegerWidth + * + * PARAMETERS: Op - An existing parse op + * + * RETURN: None + * + * DESCRIPTION: + * + ******************************************************************************/ + +void +TrSetOpIntegerWidth ( + ACPI_PARSE_OBJECT *TableSignatureOp, + ACPI_PARSE_OBJECT *RevisionOp) +{ + + /* TBD: Check table sig? (DSDT vs. SSDT) */ + + /* Handle command-line version override */ + + if (Gbl_RevisionOverride) + { + AcpiUtSetIntegerWidth (Gbl_RevisionOverride); + } + else + { + AcpiUtSetIntegerWidth ((UINT8) RevisionOp->Asl.Value.Integer); + } +} + + +/******************************************************************************* + * * FUNCTION: TrSetOpEndLineNumber * * PARAMETERS: Op - An existing parse op diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index c5ff42c0156c..8b46d38bb532 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -1004,11 +1004,11 @@ UtAttachNamepathToOwner ( * * FUNCTION: UtDoConstant * - * PARAMETERS: String - Hexadecimal or decimal string + * PARAMETERS: String - Hex/Decimal/Octal * * RETURN: Converted Integer * - * DESCRIPTION: Convert a string to an integer, with error checking. + * DESCRIPTION: Convert a string to an integer, with overflow/error checking. * ******************************************************************************/ @@ -1017,17 +1017,20 @@ UtDoConstant ( char *String) { ACPI_STATUS Status; - UINT64 Converted; + UINT64 ConvertedInteger; char ErrBuf[64]; - Status = AcpiUtStrtoul64 (String, ACPI_STRTOUL_64BIT, &Converted); + Status = AcpiUtStrtoul64 (String, &ConvertedInteger); if (ACPI_FAILURE (Status)) { - sprintf (ErrBuf, "%s %s\n", "Conversion error:", + sprintf (ErrBuf, "While creating 64-bit constant: %s\n", AcpiFormatException (Status)); - AslCompilererror (ErrBuf); + + AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber, + Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, + Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename, ErrBuf); } - return (Converted); + return (ConvertedInteger); } diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c index e74fed517315..5344562433c2 100644 --- a/source/compiler/dtcompile.c +++ b/source/compiler/dtcompile.c @@ -319,6 +319,8 @@ DtInitialize ( return (Status); } + AcpiUtSetIntegerWidth (2); /* Set width to 64 bits */ + Gbl_FieldList = NULL; Gbl_RootTable = NULL; Gbl_SubtableStack = NULL; diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 1e81c5800c5c..90fad8896f8a 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -481,6 +481,10 @@ DtFatal ( DT_FIELD *FieldObject, char *ExtraMessage); +UINT64 +DtDoConstant ( + char *String); + char* DtGetFieldValue ( DT_FIELD *Field); diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index 13e8b6388019..b06877a8f84a 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -628,15 +628,9 @@ DtCompileFlag ( UINT64 Value = 0; UINT32 BitLength = 1; UINT8 BitPosition = 0; - ACPI_STATUS Status; - Status = AcpiUtStrtoul64 (Field->Value, - (ACPI_STRTOUL_64BIT | ACPI_STRTOUL_BASE16), &Value); - if (ACPI_FAILURE (Status)) - { - DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, NULL); - } + Value = AcpiUtImplicitStrtoul64 (Field->Value); switch (Info->Opcode) { diff --git a/source/compiler/dtparser.y b/source/compiler/dtparser.y index a2943cccec74..d5990fe45fe5 100644 --- a/source/compiler/dtparser.y +++ b/source/compiler/dtparser.y @@ -275,17 +275,24 @@ Expression | EXPOP_LABEL { $$ = DtResolveLabel (DtParsertext);} - /* Default base for a non-prefixed integer is 16 */ + /* + * All constants for the data table compiler are in hex, whether a (optional) 0x + * prefix is present or not. For example, these two input strings are equivalent: + * 1234 + * 0x1234 + */ - | EXPOP_NUMBER { AcpiUtStrtoul64 (DtParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);} + /* Non-prefixed hex number */ + + | EXPOP_NUMBER { $$ = DtDoConstant (DtParsertext);} /* Standard hex number (0x1234) */ - | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (DtParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);} + | EXPOP_HEX_NUMBER { $$ = DtDoConstant (DtParsertext);} - /* TBD: Decimal number with prefix (0d1234) - Not supported by strtoul64 at this time */ + /* Possible TBD: Decimal number with prefix (0d1234) - Not supported this time */ - | EXPOP_DECIMAL_NUMBER { AcpiUtStrtoul64 (DtParsertext, ACPI_STRTOUL_64BIT, &$$);} + | EXPOP_DECIMAL_NUMBER { $$ = DtDoConstant (DtParsertext);} ; %% diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index 6edcf637c3fd..c6c89eaa7d20 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -303,6 +303,38 @@ DtFatal ( } +/******************************************************************************* + * + * FUNCTION: DtDoConstant + * + * PARAMETERS: String - Only hex constants are supported, + * regardless of whether the 0x prefix + * is used + * + * RETURN: Converted Integer + * + * DESCRIPTION: Convert a string to an integer, with overflow/error checking. + * + ******************************************************************************/ + +UINT64 +DtDoConstant ( + char *String) +{ + UINT64 ConvertedInteger; + + + /* + * TBD: The ImplicitStrtoul64 function does not report overflow + * conditions. The input string is simply truncated. If it is + * desired to report overflow to the table compiler, this should + * somehow be added here. Note: integers that are prefixed with 0x + * or not are both hex integers. + */ + ConvertedInteger = AcpiUtImplicitStrtoul64 (String); + return (ConvertedInteger); +} + /****************************************************************************** * * FUNCTION: DtGetFieldValue diff --git a/source/compiler/prparser.y b/source/compiler/prparser.y index 2ad79e45964c..d24a5bbee04f 100644 --- a/source/compiler/prparser.y +++ b/source/compiler/prparser.y @@ -290,11 +290,11 @@ Expression /* Default base for a non-prefixed integer is 10 */ - | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, ACPI_STRTOUL_64BIT, &$$);} + | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, &$$);} /* Standard hex number (0x1234) */ - | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);} + | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, &$$);} ; %% |