Skip to content

Commit 3d643ca

Browse files
committed
ARM: emit error if lifting support is missing
1 parent ed081af commit 3d643ca

File tree

5 files changed

+33
-3
lines changed

5 files changed

+33
-3
lines changed

chb/arm/ARMOpcode.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ def ast_prov(
167167
List[AST.ASTInstruction], List[AST.ASTInstruction]]:
168168
"""Return default; should be overridden by instruction opcodes."""
169169

170+
chklogger.logger.error(
171+
"no lifting support available for instruction %s at address %s",
172+
self.mnemonic, iaddr)
170173
instrs = self.ast(astree, iaddr, bytestring, xdata)
171174
return (instrs, instrs)
172175

chb/arm/opcodes/ARMBranch.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,9 @@ def ast_prov(
178178
return self.ast_call_prov(
179179
astree, iaddr, bytestring, "Branch (B.W)", xdata)
180180
else:
181-
return ARMOpcode.ast_prov(
181+
instrs = ARMOpcode.assembly_ast(
182182
self, astree, iaddr, bytestring, xdata)
183+
return (instrs, instrs)
183184

184185
def ast_call_prov(
185186
self,

chb/arm/opcodes/ARMCompareBranchNonzero.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,17 @@ def annotation(self, xdata: InstrXData) -> str:
9595
tgt = str(xdata.xprs[5])
9696
return "if " + xpr + " != 0 goto " + tgt
9797

98+
def ast_prov(
99+
self,
100+
astree: ASTInterface,
101+
iaddr: str,
102+
bytestring: str,
103+
xdata: InstrXData) -> Tuple[
104+
List[AST.ASTInstruction], List[AST.ASTInstruction]]:
105+
instrs = ARMOpcode.assembly_ast(
106+
self, astree, iaddr, bytestring, xdata)
107+
return (instrs, instrs)
108+
98109
def ast_condition_prov(
99110
self,
100111
astree: ASTInterface,

chb/arm/opcodes/ARMCompareBranchZero.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ def annotation(self, xdata: InstrXData) -> str:
9393
tgt = str(xdata.xprs[5])
9494
return "if " + xpr + " goto " + tgt
9595

96+
def ast_prov(
97+
self,
98+
astree: ASTInterface,
99+
iaddr: str,
100+
bytestring: str,
101+
xdata: InstrXData) -> Tuple[
102+
List[AST.ASTInstruction], List[AST.ASTInstruction]]:
103+
instrs = ARMOpcode.assembly_ast(
104+
self, astree, iaddr, bytestring, xdata)
105+
return (instrs, instrs)
106+
96107
def ast_condition_prov(
97108
self,
98109
astree: ASTInterface,

chb/arm/opcodes/ARMSignedMultiplyWordT.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ------------------------------------------------------------------------------
55
# The MIT License (MIT)
66
#
7-
# Copyright (c) 2023 Aarno Labs LLC
7+
# Copyright (c) 2023-2024 Aarno Labs LLC
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a copy
1010
# of this software and associated documentation files (the "Software"), to deal
@@ -67,4 +67,8 @@ def operands(self) -> List[ARMOperand]:
6767
return [self.armd.arm_operand(i) for i in self.args]
6868

6969
def annotation(self, xdata: InstrXData) -> str:
70-
return "pending"
70+
lhs = str(xdata.vars[0])
71+
result = xdata.xprs[2]
72+
rresult = xdata.xprs[3]
73+
xresult = simplify_result(xdata.args[3], xdata.args[4], result, rresult)
74+
return lhs + " := " + xresult

0 commit comments

Comments
 (0)