Package org.jakstab.asm

Examples of org.jakstab.asm.Instruction


    this(code, new X86InstructionFactoryImpl());
  }
 
  @Override
  public final Instruction decodeInstruction(long index) {
    Instruction instr = null;
    InstructionDecoder instrDecoder = null;
    byteIndex = (int)index; // For 64bit systems, this needs to be fixed
    //int len = byteIndex;
    int instrStartIndex = 0;
View Full Code Here


    int rm = ModRM & 7;

    FPInstructionDecoder instrDecoder = null;
    instrDecoder = floatGRPMap[number][rm];

    Instruction instr = null;
    if(instrDecoder != null) {
      instr = instrDecoder.decode(bytesArray, byteIndex, instrStartIndex, segmentOverride, prefixes, factory);
      byteIndex = instrDecoder.getCurrentIndex();
    }
    return instr;
View Full Code Here

      int ModRM = readByte(bytesArray, byteIndex);
      int reg = (ModRM >> 3) & 7;

      InstructionDecoder instrDecoder = grpTable[number][reg];
      Instruction instr = null;
      if(instrDecoder != null) {
         instr = instrDecoder.decode(bytesArray, byteIndex, instrStartIndex, segmentOverride, prefixes, factory);
         byteIndex = instrDecoder.getCurrentIndex();
      }
      return instr;
View Full Code Here

   
    try {
      FileWriter out = new FileWriter(filename);
      for (Map.Entry<AbsoluteAddress,Instruction> entry : program.getAssemblyMap().entrySet()) {
        AbsoluteAddress pc = entry.getKey();
        Instruction instr = entry.getValue();
        StringBuilder sb = new StringBuilder();
        SymbolFinder symFinder = program.getModule(pc).getSymbolFinder();
        if (symFinder.hasSymbolFor(pc)) {
          sb.append(Characters.NEWLINE);
          sb.append(symFinder.getSymbolFor(pc));
          sb.append(":").append(Characters.NEWLINE);
        }
        sb.append(pc).append(":\t");
        sb.append(instr.toString(pc.getValue(), symFinder));
       
        if (instr instanceof BranchInstruction) {
          Set<CFAEdge> targets = branchEdges.get(pc);
          sb.append("\t; targets: ");
          if (targets.isEmpty()) {
View Full Code Here

    logger.info("Writing assembly CFG to " + gwriter.getFilename());
    try {
      for (Location node : nodes) {
        AbsoluteAddress nodeAddr = node.getAddress();
        Instruction instr = program.getInstruction(nodeAddr);
        String nodeName = nodeAddr.toString();
        String nodeLabel = program.getSymbolFor(nodeAddr);
       
        if (instr != null) {
          String instrString = instr.toString(nodeAddr.getValue(), program.getModule(nodeAddr).getSymbolFinder());
          instrString = instrString.replace("\t", " ");
          gwriter.writeNode(nodeName, nodeLabel + "\\n" + instrString, getNodeProperties(node));
        } else {
          gwriter.writeNode(nodeName, nodeLabel, getNodeProperties(node));
        }
      }

      for (CFAEdge e : edges) {
        if (e.getKind() == null) logger.error("Null kind? " + e);
        AbsoluteAddress sourceAddr = e.getSource().getAddress();
        AbsoluteAddress targetAddr = e.getTarget().getAddress();
       
        String label = null;
        Instruction instr = program.getInstruction(sourceAddr);
       
        if (instr instanceof BranchInstruction) {
          BranchInstruction bi = (BranchInstruction)instr;
          if (bi.isConditional()) {
            // Get the original goto from the program (not the converted assume)
View Full Code Here

    }
    else {
      instrDecoder = floatMapTwo[floatOpcode - 0xd8][reg];
    }

    Instruction instr = null;
    if(instrDecoder != null) {
      instr = instrDecoder.decode(bytesArray, byteIndex, instrStartIndex, segmentOverride, prefixes, factory);
      byteIndex = instrDecoder.getCurrentIndex();
    }
View Full Code Here

TOP

Related Classes of org.jakstab.asm.Instruction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.