diff options
author | Robert Moore <Robert.Moore@intel.com> | 2012-10-12 12:11:12 -0700 |
---|---|---|
committer | Robert Moore <Robert.Moore@intel.com> | 2012-10-12 12:11:12 -0700 |
commit | 7f4976610592ce4fe5b1c2895daa7f6410970d55 (patch) | |
tree | c1a395422514e44b6a9c8a457be0a3ae4ce1cbf3 | |
parent | 80328e4bf7afab135d6373924372a9019f3043bd (diff) | |
download | acpica-7f4976610592ce4fe5b1c2895daa7f6410970d55.tar.gz |
Enhance error reporting for invalid opcodes and bad ACPI_NAMEs.
For disassembler, dump the 48 bytes surrounding the invalid opcode.
Fix incorrect table offset reported for invalid opcodes.
Report original 32-bit value for bad ACPI_NAMEs.
-rw-r--r-- | source/components/namespace/nsutils.c | 9 | ||||
-rw-r--r-- | source/components/parser/psloop.c | 33 | ||||
-rw-r--r-- | source/components/utilities/utmisc.c | 9 | ||||
-rw-r--r-- | source/components/utilities/utxferror.c | 2 |
4 files changed, 39 insertions, 14 deletions
diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 507106ba5..19cd39c1d 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -727,10 +727,11 @@ AcpiNsExternalizeName ( (*ConvertedName)[j++] = '.'; } - (*ConvertedName)[j++] = InternalName[NamesIndex++]; - (*ConvertedName)[j++] = InternalName[NamesIndex++]; - (*ConvertedName)[j++] = InternalName[NamesIndex++]; - (*ConvertedName)[j++] = InternalName[NamesIndex++]; + ACPI_MOVE_NAME (*ConvertedName, InternalName); + AcpiUtRepairName (*ConvertedName); + + j += ACPI_NAME_SIZE; + NamesIndex += ACPI_NAME_SIZE; } } diff --git a/source/components/parser/psloop.c b/source/components/parser/psloop.c index a38aa055a..c251f8ff9 100644 --- a/source/components/parser/psloop.c +++ b/source/components/parser/psloop.c @@ -227,15 +227,34 @@ AcpiPsGetAmlOpcode ( /* The opcode is unrecognized. Just skip unknown opcodes */ - ACPI_ERROR ((AE_INFO, - "Found unknown opcode 0x%X at AML address %p offset 0x%X, ignoring", - WalkState->Opcode, WalkState->ParserState.Aml, WalkState->AmlOffset)); + if (WalkState->PassNumber == 2) + { + ACPI_ERROR ((AE_INFO, + "Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring", + WalkState->Opcode, WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER))); + + ACPI_DUMP_BUFFER (WalkState->ParserState.Aml, 128); + +#ifdef ACPI_ASL_COMPILER + + AcpiOsPrintf ("/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n", + WalkState->Opcode, WalkState->AmlOffset + sizeof (ACPI_TABLE_HEADER)); + + /* TBD: Pass current offset to DumpBuffer */ - ACPI_DUMP_BUFFER (WalkState->ParserState.Aml, 128); + AcpiUtDumpBuffer2 (((UINT8 *) WalkState->ParserState.Aml - 16), 48, DB_BYTE_DISPLAY); + AcpiOsPrintf (" */\n"); +#endif + } - /* Assume one-byte bad opcode */ + /* Increment past one or two-byte opcode */ WalkState->ParserState.Aml++; + if (WalkState->Opcode > 0xFF) + { + WalkState->ParserState.Aml++; + } + return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE); default: @@ -623,8 +642,8 @@ AcpiPsGetArguments ( (!Arg)) { ACPI_WARNING ((AE_INFO, - "Detected an unsupported executable opcode " - "at module-level: [0x%.4X] at table offset 0x%.4X", + "Unsupported module-level executable opcode " + "0x%.2X at table offset 0x%.4X", Op->Common.AmlOpcode, (UINT32) (ACPI_PTR_DIFF (AmlOpStart, WalkState->ParserState.AmlStart) + diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index c74fd31fa..152ea21db 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -897,11 +897,14 @@ AcpiUtRepairName ( { UINT32 i; BOOLEAN FoundBadChar = FALSE; + UINT32 OriginalName; ACPI_FUNCTION_NAME (UtRepairName); + ACPI_MOVE_NAME (&OriginalName, Name); + /* Check each character in the name */ for (i = 0; i < ACPI_NAME_SIZE; i++) @@ -927,12 +930,14 @@ AcpiUtRepairName ( if (!AcpiGbl_EnableInterpreterSlack) { ACPI_WARNING ((AE_INFO, - "Found bad character(s) in name, repaired: [%4.4s]\n", Name)); + "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]", + OriginalName, Name)); } else { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Found bad character(s) in name, repaired: [%4.4s]\n", Name)); + "Invalid character(s) in name (0x%.8X), repaired: [%4.4s]", + OriginalName, Name)); } } } diff --git a/source/components/utilities/utxferror.c b/source/components/utilities/utxferror.c index 5867ed375..711e294ad 100644 --- a/source/components/utilities/utxferror.c +++ b/source/components/utilities/utxferror.c @@ -544,7 +544,7 @@ AcpiUtNamespaceError ( /* There is a non-ascii character in the name */ ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName)); - AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName); + AcpiOsPrintf ("[0x%.8X] (NON-ASCII)", BadName); } else { |