Disassembler: skip parsing of incorrect external declarations

Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
This commit is contained in:
Erik Schmauss 2017-06-23 14:18:53 -07:00
parent b4be602bc2
commit ed25461901

View File

@ -487,6 +487,31 @@ AcpiPsCreateOp (
{
Status = AcpiPsBuildNamedOp (WalkState, AmlOpStart, Op, &NamedOp);
AcpiPsFreeOp (Op);
#ifdef ACPI_ASL_COMPILER
if (AcpiGbl_DisasmFlag && WalkState->Opcode == AML_EXTERNAL_OP &&
Status == AE_NOT_FOUND)
{
/*
* If parsing of AML_EXTERNAL_OP's name path fails, then skip
* past this opcode and keep parsing. This is a much better
* alternative than to abort the entire disassembler. At this
* point, the ParserState is at the end of the namepath of the
* external declaration opcode. Setting WalkState->Aml to
* WalkState->ParserState.Aml + 2 moves increments the
* WalkState->Aml past the object type and the paramcount of the
* external opcode. For the error message, only print the AML
* offset. We could attempt to print the name but this may cause
* a segmentation fault when printing the namepath because the
* AML may be incorrect.
*/
AcpiOsPrintf (
"// Invalid external declaration at AML offset 0x%x.\n",
WalkState->Aml - WalkState->ParserState.AmlStart);
WalkState->Aml = WalkState->ParserState.Aml + 2;
return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE);
}
#endif
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);