From 8c63550eb71c28d31c4c80a385ef0950e7f389e8 Mon Sep 17 00:00:00 2001 From: Junjie Mao Date: Tue, 22 Jun 2021 11:16:36 +0800 Subject: [PATCH] board_inspector: interpret DefDivide in DSDT/SSDT DefDevide is now enountered when interpreting host DSDT/SSDT. This patch implements the interpretation of the integer division operation. Tracked-On: #6298 Signed-off-by: Junjie Mao --- .../board_inspector/acpiparser/aml/interpreter.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/misc/config_tools/board_inspector/acpiparser/aml/interpreter.py b/misc/config_tools/board_inspector/acpiparser/aml/interpreter.py index 72e1be5bb..a3a53b4e5 100644 --- a/misc/config_tools/board_inspector/acpiparser/aml/interpreter.py +++ b/misc/config_tools/board_inspector/acpiparser/aml/interpreter.py @@ -452,6 +452,20 @@ class ConcreteInterpreter(Interpreter): logging.warn(f"Attempt to dereference an object of type {ref.__class__.__name__}") return ref + def DefDivide(self, tree): + dividend = self.interpret(tree.children[0]).get() + divisor = self.interpret(tree.children[1]).get() + if len(tree.children) >= 3: + remainer = self.interpret(tree.children[2]) + if remainer: + remainer.set(Integer(dividend % divisor)) + res = Integer(dividend // divisor) + if len(tree.children) >= 4: + target = self.interpret(tree.children[3]) + if target: + target.set(res) + return res + def DefIncrement(self, tree): obj = self.interpret(tree.children[0]) obj.set(Integer(obj.get() + 1))