Skip to content

Commit 1d52fff

Browse files
committed
Binary: Add subtypes related to unconditional jumps.
1 parent 2a2ef2b commit 1d52fff

4 files changed

Lines changed: 26 additions & 0 deletions

File tree

binary/ql/lib/semmle/code/binary/ast/ir/internal/Instruction0/Instruction.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ class CJumpInstruction extends Instruction {
121121
ConditionJumpTargetOperand getJumpTargetOperand() { result = this.getAnOperand() }
122122
}
123123

124+
class JumpInstruction extends Instruction {
125+
override Opcode::Jump opcode;
126+
127+
JumpTargetOperand getJumpTargetOperand() { result = this.getAnOperand() }
128+
}
129+
124130
class RetInstruction extends Instruction {
125131
override Opcode::Ret opcode;
126132
}

binary/ql/lib/semmle/code/binary/ast/ir/internal/Instruction0/Operand.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,8 @@ class ConditionJumpTargetOperand extends Operand {
6464
override Tags::CondJumpTargetTag operandTag;
6565
}
6666

67+
class JumpTargetOperand extends Operand {
68+
override Tags::JumpTargetTag operandTag;
69+
}
70+
6771
class OperandTag = Tags::OperandTag;

binary/ql/lib/semmle/code/binary/ast/ir/internal/InstructionSig.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ signature module InstructionSig {
4040

4141
class ConditionJumpTargetOperand extends Operand;
4242

43+
class JumpTargetOperand extends Operand;
44+
4345
class LeftOperand extends Operand;
4446

4547
class RightOperand extends Operand;
@@ -142,6 +144,10 @@ signature module InstructionSig {
142144
ConditionJumpTargetOperand getJumpTargetOperand();
143145
}
144146

147+
class JumpInstruction extends Instruction {
148+
JumpTargetOperand getJumpTargetOperand();
149+
}
150+
145151
class CopyInstruction extends Instruction {
146152
UnaryOperand getOperand();
147153
}

binary/ql/lib/semmle/code/binary/ast/ir/internal/TransformInstruction/TransformInstruction.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,12 @@ module Transform<InstructionSig Input> {
381381
ConditionJumpTargetOperand getJumpTargetOperand() { result = this.getAnOperand() }
382382
}
383383

384+
class JumpInstruction extends Instruction {
385+
JumpInstruction() { this.getOpcode() instanceof Opcode::Jump }
386+
387+
JumpTargetOperand getJumpTargetOperand() { result = this.getAnOperand() }
388+
}
389+
384390
class BinaryInstruction extends Instruction {
385391
BinaryInstruction() { this.getOpcode() instanceof Opcode::BinaryOpcode }
386392

@@ -650,6 +656,10 @@ module Transform<InstructionSig Input> {
650656
ConditionJumpTargetOperand() { this.getOperandTag() instanceof Tags::CondJumpTargetTag }
651657
}
652658

659+
class JumpTargetOperand extends Operand {
660+
JumpTargetOperand() { this.getOperandTag() instanceof Tags::JumpTargetTag }
661+
}
662+
653663
class LeftOperand extends Operand {
654664
LeftOperand() { this.getOperandTag() instanceof Tags::LeftTag }
655665
}

0 commit comments

Comments
 (0)