diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2010-12-09 20:04:14 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2010-12-09 20:04:14 +0000 |
commit | 0f70714e43f23ff5f3e72fa406814e26bdad006a (patch) | |
tree | c88f8fbca7e5c63afb07147d504c55311683cb5d /compiler | |
parent | 11641cd290cbb4765d39dadd5a4eee278b8769ee (diff) |
Import ACPICA 20101209.vendor/acpica/20101209
Notes
Notes:
svn path=/vendor-sys/acpica/dist/; revision=216331
svn path=/vendor-sys/acpica/20101209/; revision=216332; tag=vendor/acpica/20101209
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/aslanalyze.c | 41 | ||||
-rw-r--r-- | compiler/aslerror.c | 65 | ||||
-rw-r--r-- | compiler/aslmessages.h | 7 | ||||
-rw-r--r-- | compiler/dtutils.c | 1 |
4 files changed, 84 insertions, 30 deletions
diff --git a/compiler/aslanalyze.c b/compiler/aslanalyze.c index 1087bca67107..396c126f7134 100644 --- a/compiler/aslanalyze.c +++ b/compiler/aslanalyze.c @@ -684,19 +684,45 @@ AnCheckId ( UINT32 AlphaPrefixLength; + /* Only care about string versions of _HID/_CID (integers are legal) */ + if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL) { return; } + /* For both _HID and _CID, the string must be non-null */ + Length = strlen (Op->Asl.Value.String); + if (!Length) + { + AslError (ASL_ERROR, ASL_MSG_NULL_STRING, + Op, NULL); + return; + } /* - * If _HID/_CID is a string, all characters must be alphanumeric. - * One of the things we want to catch here is the use of - * a leading asterisk in the string -- an odd construct - * that certain platform manufacturers are fond of. + * One of the things we want to catch here is the use of a leading + * asterisk in the string -- an odd construct that certain platform + * manufacturers are fond of. Technically, a leading asterisk is OK + * for _CID, but a valid use of this has not been seen. */ + if (*Op->Asl.Value.String == '*') + { + AslError (ASL_ERROR, ASL_MSG_LEADING_ASTERISK, + Op, Op->Asl.Value.String); + return; + } + + /* _CID strings are bus-specific, no more checks can be performed */ + + if (Type == ASL_TYPE_CID) + { + return; + } + + /* For _HID, all characters must be alphanumeric */ + for (i = 0; Op->Asl.Value.String[i]; i++) { if (!isalnum ((int) Op->Asl.Value.String[i])) @@ -707,13 +733,6 @@ AnCheckId ( } } - if (Type == ASL_TYPE_CID) - { - /* _CID strings are bus-specific, no more checks can be performed */ - - return; - } - /* _HID String must be of the form "XXX####" or "ACPI####" */ if ((Length < 7) || (Length > 8)) diff --git a/compiler/aslerror.c b/compiler/aslerror.c index 59d3d20b6fb7..af20368c2aa0 100644 --- a/compiler/aslerror.c +++ b/compiler/aslerror.c @@ -241,6 +241,8 @@ AePrintException ( UINT32 ErrorColumn; FILE *OutputFile; FILE *SourceFile; + long FileSize; + BOOLEAN PrematureEOF = FALSE; if (Gbl_NoErrors) @@ -289,6 +291,19 @@ AePrintException ( SourceFile = Gbl_Files[ASL_FILE_INPUT].Handle; } + if (SourceFile) + { + /* Determine if the error occurred at source file EOF */ + + fseek (SourceFile, 0, SEEK_END); + FileSize = ftell (SourceFile); + + if ((long) Enode->LogicalByteOffset >= FileSize) + { + PrematureEOF = TRUE; + } + } + if (Header) { fprintf (OutputFile, "%s", Header); @@ -307,33 +322,42 @@ AePrintException ( fprintf (OutputFile, " %6u: ", Enode->LineNumber); /* - * Seek to the offset in the combined source file, read the source - * line, and write it to the output. + * If not at EOF, get the corresponding source code line and + * display it. Don't attempt this if we have a premature EOF + * condition. */ - Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, - (int) SEEK_SET); - if (Actual) - { - fprintf (OutputFile, - "[*** iASL: Seek error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - else + if (!PrematureEOF) { - RActual = fread (&SourceByte, 1, 1, SourceFile); - if (!RActual) + /* + * Seek to the offset in the combined source file, read + * the source line, and write it to the output. + */ + Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, + (int) SEEK_SET); + if (Actual) { fprintf (OutputFile, - "[*** iASL: Read error on source code temp file %s ***]", + "[*** iASL: Seek error on source code temp file %s ***]", Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); } - - else while (RActual && SourceByte && (SourceByte != '\n')) + else { - fwrite (&SourceByte, 1, 1, OutputFile); RActual = fread (&SourceByte, 1, 1, SourceFile); + if (!RActual) + { + fprintf (OutputFile, + "[*** iASL: Read error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + } + + else while (RActual && SourceByte && (SourceByte != '\n')) + { + fwrite (&SourceByte, 1, 1, OutputFile); + RActual = fread (&SourceByte, 1, 1, SourceFile); + } } } + fprintf (OutputFile, "\n"); } } @@ -376,7 +400,7 @@ AePrintException ( ExtraMessage = NULL; } - if (Gbl_VerboseErrors) + if (Gbl_VerboseErrors && !PrematureEOF) { SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; @@ -406,6 +430,11 @@ AePrintException ( fprintf (OutputFile, " (%s)", ExtraMessage); } + if (PrematureEOF) + { + fprintf (OutputFile, " and premature End-Of-File"); + } + fprintf (OutputFile, "\n"); if (Gbl_VerboseErrors) { diff --git a/compiler/aslmessages.h b/compiler/aslmessages.h index 04578003df94..c69f7a22945d 100644 --- a/compiler/aslmessages.h +++ b/compiler/aslmessages.h @@ -258,6 +258,9 @@ typedef enum ASL_MSG_NULL_DESCRIPTOR, ASL_MSG_UPPER_CASE, ASL_MSG_HID_LENGTH, + ASL_MSG_NULL_STRING, + ASL_MSG_LEADING_ASTERISK, + ASL_MSG_INVALID_FIELD_NAME, ASL_MSG_INTEGER_SIZE, ASL_MSG_INVALID_HEX_INTEGER, @@ -382,7 +385,7 @@ char *AslMessages [] = { /* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)", /* ASL_MSG_WRITE */ "Could not write file", /* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct", -/* ASL_MSG_TIMEOUT */ "Possible operator timeout is ignored", +/* ASL_MSG_TIMEOUT */ "Result is not used, possible operator timeout will be missed", /* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect", /* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced", /* ASL_MSG_NON_ZERO */ "Operand evaluates to zero", @@ -403,6 +406,8 @@ char *AslMessages [] = { /* ASL_MSG_NULL_DESCRIPTOR */ "Min/Max/Length/Gran are all zero, but no resource tag", /* ASL_MSG_UPPER_CASE */ "Non-hex letters must be upper case", /* ASL_MSG_HID_LENGTH */ "_HID string must be exactly 7 or 8 characters", +/* ASL_MSG_NULL_STRING */ "Invalid zero-length (null) string", +/* ASL_MSG_LEADING_ASTERISK */ "Invalid leading asterisk", /* These messages are used by the data table compiler only */ diff --git a/compiler/dtutils.c b/compiler/dtutils.c index 2394b300868b..9f71036c61cf 100644 --- a/compiler/dtutils.c +++ b/compiler/dtutils.c @@ -573,6 +573,7 @@ DtGetFieldLength ( case ACPI_DMT_UINT8: case ACPI_DMT_CHKSUM: case ACPI_DMT_SPACEID: + case ACPI_DMT_ACCWIDTH: case ACPI_DMT_IVRS: case ACPI_DMT_MADT: case ACPI_DMT_SRAT: |