tracking both isPredicate and isPredicateAndNotExecuted
This commit is contained in:
parent
353eb5f018
commit
32a69d259e
|
@ -204,7 +204,8 @@ public class RunnableThread implements Encoding, Runnable {
|
|||
iNew.setDestinationOperandMemValue(Long.parseLong(splited[i+2]));
|
||||
iNew.setBranchTargetAddress(Long.parseLong(splited[i+3]));
|
||||
iNew.setBranchTaken(Boolean.parseBoolean(splited[i+4]));
|
||||
iNew.setPredicateAndNotExecuted(Boolean.parseBoolean(splited[i+7]));
|
||||
iNew.setPredicate(Boolean.parseBoolean(splited[i+7]));
|
||||
iNew.setPredicateAndNotExecuted(Boolean.parseBoolean(splited[i+8]));
|
||||
//iNew.setSerialNo(Long.parseLong(splited[i+6]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,16 +41,20 @@ public class ConditionalLoop implements X86StaticInstructionHandler
|
|||
Operand counterRegister = Registers.getCounterRegister();
|
||||
|
||||
//cx=cx-1
|
||||
instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(counterRegister,
|
||||
Registers.getEFlagsRegister(), counterRegister));
|
||||
Instruction newInstruction1 = Instruction.getIntALUInstruction(counterRegister,
|
||||
Registers.getEFlagsRegister(), counterRegister);
|
||||
newInstruction1.setPredicate(true);
|
||||
instructionArrayList.appendInstruction(newInstruction1);
|
||||
|
||||
//Perform a conditional jump
|
||||
instructionArrayList.appendInstruction(Instruction.getBranchInstruction(operand1, Registers.getEFlagsRegister()));
|
||||
Instruction newInstruction2 = Instruction.getBranchInstruction(operand1, Registers.getEFlagsRegister());
|
||||
newInstruction2.setPredicate(true);
|
||||
instructionArrayList.appendInstruction(newInstruction2);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
misc.Error.invalidOperation("Loop", operand1, operand2, operand3);
|
||||
misc.Error.invalidOperation("Conditional Loop", operand1, operand2, operand3);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -45,8 +45,12 @@ public class ConditionalMove implements X86StaticInstructionHandler
|
|||
(operand3==null))
|
||||
{
|
||||
Operand temp = Registers.getTempIntReg(tempRegisterNum);
|
||||
instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(Registers.getEFlagsRegister(), operand1, temp));
|
||||
instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(operand2, temp, operand1));
|
||||
Instruction newInstruction1 = Instruction.getIntALUInstruction(Registers.getEFlagsRegister(), operand1, temp);
|
||||
newInstruction1.setPredicate(true);
|
||||
instructionArrayList.appendInstruction(newInstruction1);
|
||||
Instruction newInstruction2 = Instruction.getIntALUInstruction(operand2, temp, operand1);
|
||||
newInstruction2.setPredicate(true);
|
||||
instructionArrayList.appendInstruction(newInstruction2);
|
||||
}
|
||||
|
||||
//if operand1 = register and operand2 = memory - load
|
||||
|
@ -55,9 +59,13 @@ public class ConditionalMove implements X86StaticInstructionHandler
|
|||
operand3==null)
|
||||
{
|
||||
Operand temp = Registers.getTempIntReg(tempRegisterNum);
|
||||
instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(Registers.getEFlagsRegister(), operand1, temp));
|
||||
Instruction newInstruction1 = Instruction.getIntALUInstruction(Registers.getEFlagsRegister(), operand1, temp);
|
||||
newInstruction1.setPredicate(true);
|
||||
instructionArrayList.appendInstruction(newInstruction1);
|
||||
Operand sourceOperand = OperandTranslator.processSourceMemoryOperand(operand2, instructionArrayList, tempRegisterNum, true);
|
||||
instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(sourceOperand, temp, operand1));
|
||||
Instruction newInstruction2 = Instruction.getIntALUInstruction(sourceOperand, temp, operand1);
|
||||
newInstruction2.setPredicate(true);
|
||||
instructionArrayList.appendInstruction(newInstruction2);
|
||||
}
|
||||
|
||||
// //if operand1 = memory and operand2 = memory - store
|
||||
|
|
|
@ -18,14 +18,18 @@ public class ConditionalSet implements X86StaticInstructionHandler
|
|||
if((operand1.isIntegerRegisterOperand()) &&
|
||||
operand2==null && operand3==null)
|
||||
{
|
||||
instructionArrayList.appendInstruction(Instruction.getIntALUInstruction(Registers.getEFlagsRegister(),
|
||||
operand1, operand1));
|
||||
Instruction newInstruction = Instruction.getIntALUInstruction(Registers.getEFlagsRegister(),
|
||||
operand1, operand1);
|
||||
newInstruction.setPredicate(true);
|
||||
instructionArrayList.appendInstruction(newInstruction);
|
||||
}
|
||||
|
||||
else if(operand1.isMemoryOperand())
|
||||
{
|
||||
instructionArrayList.appendInstruction(Instruction.getStoreInstruction(operand1,
|
||||
Registers.getEFlagsRegister()));
|
||||
Instruction newInstruction = Instruction.getStoreInstruction(operand1,
|
||||
Registers.getEFlagsRegister());
|
||||
newInstruction.setPredicate(true);
|
||||
instructionArrayList.appendInstruction(newInstruction);
|
||||
}
|
||||
|
||||
else
|
||||
|
|
|
@ -599,7 +599,7 @@ public class InstructionClassTable {
|
|||
for (int i = 0; i < loop.length; i++)
|
||||
instructionClassTable.put(loop[i], InstructionClass.UNCONDITIONAL_LOOP);
|
||||
|
||||
String conditionalLoop[] = "loop|loopw|loopd|loope|looped|loopew|loopne|loopned|loopnew|loopz|loopzd|loopzw|loopnz|loopnzd|loopnzw"
|
||||
String conditionalLoop[] = "loopw|loopd|loope|looped|loopew|loopne|loopned|loopnew|loopz|loopzd|loopzw|loopnz|loopnzd|loopnzw"
|
||||
.split("\\|");
|
||||
for (int i = 0; i < conditionalLoop.length; i++)
|
||||
instructionClassTable.put(conditionalLoop[i], InstructionClass.CONDITIONAL_LOOP);
|
||||
|
|
|
@ -44,6 +44,7 @@ public class Instruction implements Serializable
|
|||
private long serialNo;
|
||||
private int threadID;
|
||||
|
||||
private boolean isPredicate;
|
||||
private boolean isPredicateAndNotExecuted;
|
||||
|
||||
public Instruction()
|
||||
|
@ -51,6 +52,7 @@ public class Instruction implements Serializable
|
|||
this.sourceOperand1 = null;
|
||||
this.sourceOperand2 = null;
|
||||
this.destinationOperand = null;
|
||||
isPredicate = false;
|
||||
isPredicateAndNotExecuted = false;
|
||||
}
|
||||
|
||||
|
@ -60,6 +62,7 @@ public class Instruction implements Serializable
|
|||
this.sourceOperand1 = null;
|
||||
this.sourceOperand2 = null;
|
||||
this.destinationOperand = null;
|
||||
isPredicate = false;
|
||||
isPredicateAndNotExecuted = false;
|
||||
}
|
||||
|
||||
|
@ -70,6 +73,7 @@ public class Instruction implements Serializable
|
|||
this.sourceOperand1 = sourceOperand1;
|
||||
this.sourceOperand2 = sourceOperand2;
|
||||
this.destinationOperand = destinationOperand;
|
||||
isPredicate = false;
|
||||
isPredicateAndNotExecuted = false;
|
||||
}
|
||||
|
||||
|
@ -80,6 +84,7 @@ public class Instruction implements Serializable
|
|||
this.sourceOperand1 = sourceOperand1;
|
||||
this.sourceOperand2 = sourceOperand2;
|
||||
this.destinationOperand = destinationOperand;
|
||||
isPredicate = false;
|
||||
isPredicateAndNotExecuted = false;
|
||||
}
|
||||
|
||||
|
@ -130,6 +135,7 @@ public class Instruction implements Serializable
|
|||
this.serialNo = sourceInstruction.serialNo;
|
||||
this.threadID = sourceInstruction.threadID;
|
||||
|
||||
this.isPredicate = sourceInstruction.isPredicate;
|
||||
this.isPredicateAndNotExecuted = sourceInstruction.isPredicateAndNotExecuted;
|
||||
}
|
||||
|
||||
|
@ -500,6 +506,14 @@ public class Instruction implements Serializable
|
|||
this.destinationOperandMemValue = destinationOperandMemValue;
|
||||
}
|
||||
|
||||
public boolean isPredicate() {
|
||||
return isPredicate;
|
||||
}
|
||||
|
||||
public void setPredicate(boolean isPredicate) {
|
||||
this.isPredicate = isPredicate;
|
||||
}
|
||||
|
||||
public boolean isPredicateAndNotExecuted() {
|
||||
return isPredicateAndNotExecuted;
|
||||
}
|
||||
|
|
|
@ -448,7 +448,7 @@ public class ReorderBuffer extends SimulationElement{
|
|||
else bw.write(" null null null");
|
||||
bw.write(" "+tmp.getSourceOperand1MemValue()+" "+
|
||||
tmp.getSourceOperand2MemValue()+" "+tmp.getDestinationOperandMemValue()+" "+
|
||||
tmp.getBranchTargetAddress()+" "+tmp.isBranchTaken()+" "+tmp.getThreadID()+" "+tmp.getSerialNo()+" "+tmp.isPredicateAndNotExecuted()+"\n");
|
||||
tmp.getBranchTargetAddress()+" "+tmp.isBranchTaken()+" "+tmp.getThreadID()+" "+tmp.getSerialNo()+" "+tmp.isPredicate()+" "+tmp.isPredicateAndNotExecuted()+"\n");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue