Skip to content

Commit

Permalink
VEXIRSBConverter: Hack Syscall onto Call translation
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson committed Dec 5, 2023
1 parent 95be4be commit 2b99faa
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ailment/converter_vex.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,7 @@ def convert(irsb, manager): # pylint:disable=arguments-differ
pass

manager.vex_stmt_idx = DEFAULT_STATEMENT
if irsb.jumpkind == "Ijk_Call":
# call

if irsb.jumpkind == "Ijk_Call" or irsb.jumpkind.startswith("Ijk_Sys"):
# FIXME: Move ret_expr and fp_ret_expr creation into angr because we cannot reliably determine which
# expressions can be returned from the call without performing further analysis
ret_reg_offset = manager.arch.ret_offset
Expand All @@ -705,10 +703,17 @@ def convert(irsb, manager): # pylint:disable=arguments-differ
else:
fp_ret_expr = None

if irsb.jumpkind == "Ijk_Call":
target = VEXExprConverter.convert(irsb.next, manager)
elif irsb.jumpkind.startswith("Ijk_Sys"):
target = DirtyExpression(manager.next_atom(), "syscall", manager.arch.bits)
else:
raise NotImplementedError("Unsupported jumpkind")

statements.append(
Call(
manager.next_atom(),
VEXExprConverter.convert(irsb.next, manager),
target,
ret_expr=ret_expr,
fp_ret_expr=fp_ret_expr,
ins_addr=manager.ins_addr,
Expand Down Expand Up @@ -744,5 +749,7 @@ def convert(irsb, manager): # pylint:disable=arguments-differ
vex_stmt_idx=DEFAULT_STATEMENT,
)
)
else:
raise NotImplementedError("Unsupported jumpkind")

return Block(addr, irsb.size, statements=statements)

0 comments on commit 2b99faa

Please sign in to comment.