diff options
author | Erik Schmauss <erik.schmauss@intel.com> | 2018-10-16 14:44:30 -0700 |
---|---|---|
committer | Erik Schmauss <erik.schmauss@intel.com> | 2018-10-17 14:16:07 -0700 |
commit | 28ff1407e9db8241c4e6d0aa326c941f3a3470ee (patch) | |
tree | 7004c96490d5232c9ad86a75aad09d38385c20b5 | |
parent | 316dd2c5a0ef0765def988b26e89dc7ac8e42849 (diff) | |
download | acpica-28ff1407e9db8241c4e6d0aa326c941f3a3470ee.tar.gz |
AML Parser: fix parse loop to correctly skip erroneous extended opcodes
AML opcodes come in two lengths: 1-byte opcodes and 2-byte, extended opcodes.
If an error occurs due to illegal opcodes during table load, the AML parser
needs to continue loading the table. In order to do this, it needs to skip
parsing of the offending opcode and operands associated with that opcode.
This change fixes the AML parse loop to correctly skip parsing of incorrect
extended opcodes. Previously, only the short opcodes were skipped correctly.
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
-rw-r--r-- | source/components/parser/psloop.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/components/parser/psloop.c b/source/components/parser/psloop.c index ef517b54d..f955f126d 100644 --- a/source/components/parser/psloop.c +++ b/source/components/parser/psloop.c @@ -566,6 +566,7 @@ AcpiPsParseLoop ( ACPI_PARSE_OBJECT *Op = NULL; /* current op */ ACPI_PARSE_STATE *ParserState; UINT8 *AmlOpStart = NULL; + UINT8 OpcodeLength; ACPI_FUNCTION_TRACE_PTR (PsParseLoop, WalkState); @@ -688,7 +689,18 @@ AcpiPsParseLoop ( */ ACPI_ERROR ((AE_INFO, "Skip parsing opcode %s", AcpiPsGetOpcodeName (WalkState->Opcode))); - WalkState->ParserState.Aml = WalkState->Aml + 1; + + /* + * Determine the opcode length before skipping the opcode. + * An opcode can be 1 byte or 2 bytes in length. + */ + OpcodeLength = 1; + if ((WalkState->Opcode & 0xFF00) == AML_EXTENDED_OPCODE) + { + OpcodeLength = 2; + } + WalkState->ParserState.Aml = WalkState->Aml + OpcodeLength; + WalkState->ParserState.Aml = AcpiPsGetNextPackageEnd(&WalkState->ParserState); WalkState->Aml = WalkState->ParserState.Aml; |