Package org.jakstab.asm

Examples of org.jakstab.asm.AbsoluteAddress


    return Collections.emptySet();
  }

  @Override
  public AbsoluteAddress getVirtualAddress(long fp) {
    return new AbsoluteAddress(baseAddress.getValue() + fp);
  }
View Full Code Here


    if (function.equals("exit")) {
      returns = false;
    }
   
    impId += 0x10;
    AbsoluteAddress address = new AbsoluteAddress(STUB_BASE + impId);
   
    // pop PC
    stackIncrement += arch.programCounter().getBitWidth() / 8;
   
    StatementSequence seq = new StatementSequence();
View Full Code Here

   * @see org.jakstab.loader.StubProvider#resolveSymbol(java.lang.String, java.lang.String)
   */
  @Override
  public AbsoluteAddress resolveSymbol(String library, String symbol) {
    if (library == null) return null;
    AbsoluteAddress functionAddress;
    if (activeStubs.containsKey(symbol))
      functionAddress = activeStubs.get(symbol);
    else {
      // create a new stub instance
      functionAddress = createStubInstance(library, symbol);
View Full Code Here

      return cell.contents;

    } else if (region == MemoryRegion.GLOBAL) {

      // Check if the memory location references the program's data area or imports
      AbsoluteAddress a = new AbsoluteAddress(offset);
      ExecutableImage module = Program.getProgram().getModule(a);
      // only read memory from image if we havn't overapproximated yet or it's a read only section
      if (module != null && (!dataIsTop || module.isReadOnly(a))) {
        RTLNumber mValue;
        try {
View Full Code Here

        for (int i = 0; i < procedureHeads[patternIdx].length; i++) {
          if (data[filePtr + i] != procedureHeads[patternIdx][i])
            continue patternLoop;
        }
        // Pattern matched!
        AbsoluteAddress newEntryPoint = program.getMainModule().getVirtualAddress(filePtr);
        entryPoints.add(newEntryPoint);
        logger.verbose("Found possible procedure entry at " + newEntryPoint);
        filePtr += procedureHeads[patternIdx].length;
        break;
      }
View Full Code Here

  public void install(Program program) {

    StatementSequence seq = new StatementSequence();
    seq.addLast(new RTLVariableAssignment(1, ExpressionFactory.createVariable("%DF", 1), ExpressionFactory.FALSE));

    AbsoluteAddress currentAddress = prologueAddress;
    AbsoluteAddress fallthroughAddress = new AbsoluteAddress(currentAddress.getValue() + CALL_INSTR_DISTANCE);
   
    // Call the entry point of the executable
    push32(seq, ExpressionFactory.createNumber(fallthroughAddress.getValue(), 32));
    seq.addLast(new RTLGoto(ExpressionFactory.createNumber(program.getStart().getAddress().getValue(), 32), RTLGoto.Type.CALL));
    putSequence(program, seq, currentAddress);
    program.setEntryAddress(currentAddress);
   
    // Now call all procedures that were heuristically detected

    for (Iterator<AbsoluteAddress> iter = entryPoints.iterator(); iter.hasNext();) {
      AbsoluteAddress entryPoint = iter.next();
      currentAddress = fallthroughAddress;
      fallthroughAddress = iter.hasNext() ? new AbsoluteAddress(currentAddress.getValue() + 1) : prologueAddress;
      seq = new StatementSequence();

      for (RTLVariable v : program.getArchitecture().getRegisters()) {
        if (!v.equals(esp))
          clearReg(seq, v);
      }
      push32(seq, ExpressionFactory.createNumber(fallthroughAddress.getValue(), 32));
      seq.addLast(new RTLGoto(ExpressionFactory.createNumber(entryPoint.getValue(), 32), RTLGoto.Type.CALL));
      putSequence(program, seq, currentAddress);
    }
   
    lastAddress = currentAddress;
View Full Code Here

  }

  @Override
  public AbsoluteAddress getFallthroughAddress(AbsoluteAddress a) {
    if (a.getValue() >= PROLOGUE_BASE && a.getValue() < lastAddress.getValue())
      return new AbsoluteAddress(a.getValue() + CALL_INSTR_DISTANCE);
    else if (a.equals(lastAddress))
      return epilogueAddress;
    else
      return null;
  }
View Full Code Here

    symbols.put(this.module.getEntryPoint(), "start");
  }

  @Override
  public String getSymbolFor(long address) {
    return getSymbolFor(new AbsoluteAddress(address));
  }
View Full Code Here

 
  @Before
  public void setUp() throws Exception {
    Program.createProgram(new Architecture("ssl/pentium.ssl"));

    l1 = new Location(new AbsoluteAddress(0x12345678));
    l2 = new Location(new AbsoluteAddress(0xFF241111));
    l3 = new Location(new AbsoluteAddress(0xEE345678));
    l4 = new Location(new AbsoluteAddress(0xDD345678));
   
    s1 = new CallStackState(new LinkedList<Location>(Arrays.asList(l1, l2, l3, l4)));
    s2 = new CallStackState(new LinkedList<Location>(Arrays.asList(l1, l2, l3, l4)));
    s3 = new CallStackState(new LinkedList<Location>(Arrays.asList(l3, l2)));
    s4 = new CallStackState(new LinkedList<Location>());
View Full Code Here

TOP

Related Classes of org.jakstab.asm.AbsoluteAddress

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.