Package org.jakstab.cfa

Examples of org.jakstab.cfa.Location


          @Override
          public int compare(AbstractState o1, AbstractState o2) {
            return ((CompositeState)o1).getLocation().compareTo(((CompositeState)o2).getLocation());
          }
        });
        Location lastLoc = null;
        for (AbstractState s : stateArray) {
          if (!s.getLocation().equals(lastLoc)) {
            lastLoc = s.getLocation();
            logger.fatal("");
          }
View Full Code Here


    }
   
    int rtlId = 0;
    for (RTLStatement stmt : seq) {
      stmt.setLabel(address, rtlId++);
      stmt.setNextLabel(new Location(address, rtlId));
    }
    seq.getLast().setNextLabel(null);

    // add stub statements to program
    for (RTLStatement s : seq)
View Full Code Here

    instrRTL = instrRTL.evaluate(instrParamContext);
    if (instrRTL != null) {
      // we need to label only after evaluation, as some instructions might disappear
      for (RTLStatement stmt : instrRTL) {
        stmt.setLabel(address, rtlId++);
        stmt.setNextLabel(new Location(address, rtlId));
      }
    } else {
      logger.debug("Detected semantic nop during instantiation: " + address);
      instrRTL = new StatementSequence();
      RTLSkip nop = new RTLSkip();
      nop.setLabel(address, 0);
      instrRTL.addFirst(nop);
    }
    // set next label of the last statement to fall-through instruction
    instrRTL.getLast().setNextLabel(new Location(new AbsoluteAddress(address.getValue() + instr.getSize()), 0));
   
    // infer missing bit widths:
    try {
      for (RTLStatement s : instrRTL)
        s.inferTypes(this);
View Full Code Here

 
  private void putSequence(Program program, StatementSequence seq, AbsoluteAddress address) {
    int rtlId = 0;
    for (RTLStatement stmt : seq) {
      stmt.setLabel(address, rtlId++);
      stmt.setNextLabel(new Location(address, rtlId));
    }
    seq.getLast().setNextLabel(null);

    // add stub statements to program
    for (RTLStatement s : seq)
View Full Code Here

    }
   
    int rtlId = 0;
    for (RTLStatement stmt : seq) {
      stmt.setLabel(address, rtlId++);
      stmt.setNextLabel(new Location(address, rtlId));
    }
    seq.getLast().setNextLabel(null);

    // add stub statements to program
    for (RTLStatement s : seq)
View Full Code Here

 
  private void putSequence(Program program, StatementSequence seq, AbsoluteAddress address) {
    int rtlId = 0;
    for (RTLStatement stmt : seq) {
      stmt.setLabel(address, rtlId++);
      stmt.setNextLabel(new Location(address, rtlId));
    }
    seq.getLast().setNextLabel(null);

    // add stub statements to program
    for (RTLStatement s : seq)
View Full Code Here

        if (gotoStmt.getType() == RTLGoto.Type.RETURN) {
          postStack = new LinkedList<Location>(callStack);
          if (postStack.isEmpty()) {
            logger.warn("Return instruction on empty call stack!");
          } else {
            Location target = postStack.pop();
            logger.debug("Call stack: Return to " + target + ". Remaining stack " + postStack);
          }
        }
        // Prologue Call
        else if (Program.getProgram().getHarness().contains(stmt.getAddress())) {
          postStack = new LinkedList<Location>(callStack);
          postStack.push(new Location(Program.getProgram().getHarness().getFallthroughAddress(stmt.getAddress())));
        }
        // Call
        else if (gotoStmt.getType() == RTLGoto.Type.CALL) {
          Location returnLabel;
          if (instr == null) {
            // Happens in import stubs containing a call
            logger.info("No instruction at address " + stmt.getLabel());
            returnLabel = gotoStmt.getNextLabel();
          } else {
            returnLabel = new Location(new AbsoluteAddress(addressValue + instr.getSize()));
          }

          postStack = new LinkedList<Location>();
          for (Iterator<Location> iter = callStack.descendingIterator(); iter.hasNext();) {
            Location exRetLoc = iter.next();
            if (exRetLoc.equals(returnLabel)) {
              logger.verbose("Recursion detected in call at " + stmt.getAddress());
              break;
            } else {
              postStack.push(exRetLoc);
            }
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.cfa.Location

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.