Skip to content

Commit 56a6e20

Browse files
committed
ASTI: upgrade ast conversion of conditional expression
1 parent 0dfa882 commit 56a6e20

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed

chb/astinterface/ASTInterfaceBasicBlock.py

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -226,24 +226,12 @@ def trampoline_payload_ast(self, astree: "ASTInterface") -> AST.ASTStmt:
226226
condition = chkinstr2.get_instruction_condition()
227227
rstmt = astree.mk_return_stmt(None)
228228
estmt = astree.mk_instr_sequence([])
229-
aexprs = XU.xxpr_to_ast_exprs(
230-
condition, chkinstr2.xdata, chkinstr2.iaddr, astree)
231-
if len(aexprs) == 1:
232-
cc = aexprs[0]
233-
brstmt = astree.mk_branch(cc, rstmt, estmt, "0x0")
234-
return brstmt
235-
elif len(aexprs) == 0:
236-
chklogger.logger.critical(
237-
"trampoline payload cannot be lifted: "
238-
+ "no dispatch condition found. "
239-
+ "Contact system maintainer for support.")
240-
else:
241-
chklogger.logger.critical(
242-
"trampoline payload cannot be lifted: "
243-
+ "multiple dispatch conditions found: %s. "
244-
+ "Contact system maintainer for support.",
245-
", ".join(str(x) for x in aexprs)
246-
)
229+
cc = XU.xxpr_to_ast_def_expr(condition,
230+
chkinstr2.xdata,
231+
chkinstr2.iaddr,
232+
astree)
233+
brstmt = astree.mk_branch(cc, rstmt, estmt, "0x0")
234+
return brstmt
247235
else:
248236
chklogger.logger.critical(
249237
"trampoline payload cannot be lifted: "
@@ -263,18 +251,11 @@ def trampoline_payload_ast(self, astree: "ASTInterface") -> AST.ASTStmt:
263251
condition, chkinstr3.xdata, chkinstr3.iaddr, astree)
264252
brstmt = astree.mk_branch(cc, cstmt, estmt, "0x0")
265253
return brstmt
266-
elif len(aexprs) == 0:
267-
chklogger.logger.critical(
268-
"trampoline payload cannot be lifted: "
269-
+ " no dispatch condition found. "
270-
+ "Contact system maintainer for support")
271254
else:
272255
chklogger.logger.critical(
273256
"trampoline payload cannot be lifted: "
274-
+ "multiple dispatch conditions found: %s. "
275-
+ "Contact system maintainer for support.",
276-
", ".join(str(x) for x in aexprs)
277-
)
257+
+ "expected to find conditional MOV instruction. "
258+
+ "Contact system maintainer for support.")
278259
else:
279260
chklogger.logger.critical(
280261
"trampoline payload cannot be lifted: "

0 commit comments

Comments
 (0)