mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GT-2906_emteere Fixed placement of references on instructions with a
delayslot.
This commit is contained in:
parent
89a4496a2e
commit
50cb71a8a6
1 changed files with 7 additions and 2 deletions
|
@ -76,6 +76,7 @@ public class MultiInstructionMemReference extends GhidraScript {
|
||||||
private Object[] resultObjects;
|
private Object[] resultObjects;
|
||||||
private Register singleRegister;
|
private Register singleRegister;
|
||||||
private boolean registerInOut;
|
private boolean registerInOut;
|
||||||
|
private boolean targetInDelaySlot = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
|
@ -171,6 +172,9 @@ public class MultiInstructionMemReference extends GhidraScript {
|
||||||
|
|
||||||
private boolean checkContext(boolean input, final int opIndex, VarnodeContext context, Instruction instr) {
|
private boolean checkContext(boolean input, final int opIndex, VarnodeContext context, Instruction instr) {
|
||||||
if (instr.getMinAddress().equals(curInstrloc)) {
|
if (instr.getMinAddress().equals(curInstrloc)) {
|
||||||
|
if (targetInDelaySlot && instr.getDelaySlotDepth() > 0) {
|
||||||
|
instr = instr.getNext();
|
||||||
|
}
|
||||||
if (checkInstructionMatch(opIndex, input, context, instr)) {
|
if (checkInstructionMatch(opIndex, input, context, instr)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -351,6 +355,7 @@ public class MultiInstructionMemReference extends GhidraScript {
|
||||||
instr = instr.getPrevious();
|
instr = instr.getPrevious();
|
||||||
if (instr != null) {
|
if (instr != null) {
|
||||||
curInstrloc = instr.getMinAddress();
|
curInstrloc = instr.getMinAddress();
|
||||||
|
targetInDelaySlot = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,12 +389,12 @@ public class MultiInstructionMemReference extends GhidraScript {
|
||||||
* @param scalar used as offset into address space
|
* @param scalar used as offset into address space
|
||||||
*/
|
*/
|
||||||
private void makeReference(Instruction instruction, int opIndex, Address addr) {
|
private void makeReference(Instruction instruction, int opIndex, Address addr) {
|
||||||
if (instruction.getPrototype().hasDelaySlots()) {
|
if (targetInDelaySlot && instruction.getPrototype().hasDelaySlots()) {
|
||||||
instruction = instruction.getNext();
|
instruction = instruction.getNext();
|
||||||
if (instruction == null) {
|
if (instruction == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (opIndex == -1) {
|
if (opIndex == -1) {
|
||||||
for (int i = 0; i < instruction.getNumOperands(); i++) {
|
for (int i = 0; i < instruction.getNumOperands(); i++) {
|
||||||
int opType = instruction.getOperandType(i);
|
int opType = instruction.getOperandType(i);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue