@Override
  public Collection<CSpecialInstruction> visit(
      final ReilFunction reilCode, final ListMultimap<IAddress, INaviInstruction> instructionMap) {
    final Collection<CSpecialInstruction> instructions = new ArrayList<CSpecialInstruction>();

    final Set<INaviInstruction> calls = new HashSet<INaviInstruction>();

    for (final ReilBlock block : reilCode.getGraph()) {
      for (final ReilInstruction reilInstruction : block) {
        if (ReilHelpers.isFunctionCall(reilInstruction)) {
          calls.addAll(
              instructionMap.get(ReilHelpers.toNativeAddress(reilInstruction.getAddress())));
        }
      }
    }

    for (final ReilBlock block : reilCode.getGraph()) {
      for (final ReilInstruction reilInstruction : block) {
        if (reilInstruction.getMnemonic().equals(ReilHelpers.OPCODE_STM)) {
          final List<INaviInstruction> firstInstructions =
              instructionMap.get(ReilHelpers.toNativeAddress(reilInstruction.getAddress()));

          if (isAnyCall(firstInstructions, calls)) {
            continue;
          }

          final List<INaviInstruction> nativeInstructions =
              instructionMap.get(ReilHelpers.toNativeAddress(reilInstruction.getAddress()));

          for (final INaviInstruction naviInstruction : nativeInstructions) {
            instructions.add(new CSpecialInstruction(this, naviInstruction));
          }
        }
      }
    }

    return instructions;
  }
Exemple #2
0
 /**
  * Returns the name of the REIL function.
  *
  * @return The name of the REIL function.
  */
 public String getName() {
   return m_function.getName();
 }
Exemple #3
0
  // / @endcond
  public ReilFunction(final com.google.security.zynamics.reil.ReilFunction function) {
    m_function = function;

    m_graph = ReilGraphConverter.createReilGraph(function.getGraph());
  }