Merge remote-tracking branch 'origin/patch'

This commit is contained in:
ghidra1 2022-11-07 21:19:54 -05:00
commit 757534705d

View file

@ -606,6 +606,7 @@ public class SleighInstructionPrototype implements InstructionPrototype {
VarnodeTpl vn = rec.op.getInput()[0];
AddressSpace spc = vn.getSpace().fixSpace(walker);
Address addr = spc.getTruncatedAddress(vn.getOffset().fix(walker), false);
addr = handleOverlayAddress(context, addr);
SleighParserContext crosscontext =
(SleighParserContext) context.getParserContext(addr);
int newsecnum = (int) rec.op.getInput()[1].getOffset().getReal();
@ -620,6 +621,15 @@ public class SleighInstructionPrototype implements InstructionPrototype {
return curflags;
}
private Address handleOverlayAddress(InstructionContext context, Address addr) {
AddressSpace addressSpace = context.getAddress().getAddressSpace();
if (addressSpace.isOverlaySpace()) {
OverlayAddressSpace ospace = (OverlayAddressSpace) addressSpace;
addr = ospace.getOverlayAddress(addr);
}
return addr;
}
/**
* Gather all the flow records (perhaps across multiple InstructionPrototypes via crossbuilds)
* and convert to Addresses
@ -653,6 +663,7 @@ public class SleighInstructionPrototype implements InstructionPrototype {
VarnodeTpl vn = rec.op.getInput()[0];
AddressSpace spc = vn.getSpace().fixSpace(walker);
Address addr = spc.getTruncatedAddress(vn.getOffset().fix(walker), false);
addr = handleOverlayAddress(context, addr);
SleighParserContext crosscontext =
(SleighParserContext) context.getParserContext(addr);
int newsecnum = (int) rec.op.getInput()[1].getOffset().getReal();
@ -1544,6 +1555,11 @@ public class SleighInstructionPrototype implements InstructionPrototype {
return null;
}
Address newaddr = hand.space.getTruncatedAddress(hand.offset_offset, false);
// if we are in an address space, translate it
if (curSpace.isOverlaySpace()) {
newaddr = curSpace.getOverlayAddress(newaddr);
}
return newaddr;
}