mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 12:12:16 +00:00
board_inspector: always defer parsing of method bodies
The current ACPI AML parser can generate incorrect AST if a DSDT/SSDT satisfies the following: 1. The body of a method invokes a NameString that is defined later. 2. Before the method that NameString is also defined but in an outer scope and with a different number of parameter. Since method bodies hardly define any further symbol that is referenced outside the method itself, this patch forces the parsing of method bodies to be deferred to the second pass when all symbols have been declared. Tracked-On: #6298 Signed-off-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
0395a8adf9
commit
6e79479a0a
@ -293,6 +293,14 @@ class SequenceFactory(Factory):
|
||||
factory.parse(context, child)
|
||||
tree.append_child(child)
|
||||
else:
|
||||
# It is likely that a method body has forward definitions, while typically it does not define
|
||||
# symbols that are referred later. Thus always defer the parsing of method bodies to the second
|
||||
# phase.
|
||||
#
|
||||
# In second phase the labels of sequence factories always have the ".deferred" suffix. Thus it is
|
||||
# safe to check self.label against "DefMethod" here.
|
||||
if elem == "TermList" and self.label == "DefMethod":
|
||||
raise DeferLater(self.label, [elem])
|
||||
factory = globals()[elem]
|
||||
child = Tree()
|
||||
factory.parse(context, child)
|
||||
|
Loading…
Reference in New Issue
Block a user