Merge remote-tracking branch 'origin/GP-2714_ARM_external_issue--SQUASHED' into Ghidra_10.2

This commit is contained in:
ghidra1
2022-10-18 18:26:29 -04:00
5 changed files with 21 additions and 10 deletions
@@ -186,10 +186,11 @@ public class ArmAnalyzer extends ConstantPropagationAnalyzer {
return false;
}
}
else if (refType.isCall() && refType.isComputed()) {
else if (refType.isCall() && refType.isComputed() && !address.isExternalAddress()) {
// must disassemble right now, because TB flag could get set back at end of blx
doArmThumbDisassembly(program, instr, context, address, instr.getFlowType(),
true, monitor);
return false;
}
return super.evaluateReference(context, instr, pcodeop, address, size, refType);
@@ -826,8 +827,7 @@ public class ArmAnalyzer extends ConstantPropagationAnalyzer {
// this is here so the reference gets created, but not - disassembled if it is in a bad part of memory.
// something computed it into the memory
MemoryBlock block = program.getMemory().getBlock(target);
if (block == null || !block.isExecute() || !block.isInitialized() ||
block.getName().equals(MemoryBlock.EXTERNAL_BLOCK_NAME)) {
if (block == null || !block.isExecute() || !block.isInitialized() || block.isExternalBlock()) {
return;
}
@@ -273,7 +273,7 @@ public class MipsAddressAnalyzer extends ConstantPropagationAnalyzer {
if (target == (addr.getOffset() + 1) && !instr.getFlowType().isCall()) {
instr.setFlowOverride(FlowOverride.CALL);
// need to trigger disassembly below! if not already
MipsExtDisassembly(program, instr, context, addr.add(1), monitor);
mipsExtDisassembly(program, instr, context, addr.add(1), monitor);
// need to trigger re-function creation!
Function f = program.getFunctionManager().getFunctionContaining(
@@ -387,7 +387,7 @@ public class MipsAddressAnalyzer extends ConstantPropagationAnalyzer {
if ((refType.isJump() || refType.isCall()) & refType.isComputed()) {
//if (refType.isJump() || refType.isCall()) {
addr = MipsExtDisassembly(program, instr, context, address, monitor);
addr = mipsExtDisassembly(program, instr, context, address, monitor);
//addr = flowISA(program, instr, context, address);
if (addr == null) {
addr = address;
@@ -396,7 +396,7 @@ public class MipsAddressAnalyzer extends ConstantPropagationAnalyzer {
// if this is a call, some processors use the register value
// used in the call for PIC calculations
if (refType.isCall()) {
if (refType.isCall() && !addr.isExternalAddress()) {
// set the called function to have a constant value for this register
// WARNING: This might not always be the case, if called directly or with a different register
// But then it won't matter, because the function won't depend on the registers value.
@@ -501,17 +501,16 @@ public class MipsAddressAnalyzer extends ConstantPropagationAnalyzer {
return resultSet;
}
Address MipsExtDisassembly(Program program, Instruction instruction, VarnodeContext context,
Address mipsExtDisassembly(Program program, Instruction instruction, VarnodeContext context,
Address target, TaskMonitor monitor) {
if (target == null) {
if (target == null || target.isExternalAddress()) {
return null;
}
Address addr = flowISA(program, instruction, context, target);
if (addr != null) {
MemoryBlock block = program.getMemory().getBlock(addr);
if (block == null || !block.isExecute() || !block.isInitialized() ||
block.getName().equals(MemoryBlock.EXTERNAL_BLOCK_NAME)) {
if (block == null || !block.isExecute() || !block.isInitialized() || block.isExternalBlock()) {
return addr;
}
@@ -86,6 +86,10 @@ public class Pic16Analyzer extends ConstantPropagationAnalyzer {
int size, RefType refType) {
AddressSpace space = address.getAddressSpace();
if (address.isExternalAddress()) {
return true;
}
if (space.hasMappedRegisters()) {
return true;
}
@@ -82,6 +82,10 @@ public class SH4AddressAnalyzer extends ConstantPropagationAnalyzer {
public boolean evaluateReference(VarnodeContext context, Instruction instr, int pcodeop,
Address address, int size, RefType refType) {
if (address.isExternalAddress()) {
return true;
}
// if this is a call, some processors use the register value
// used in the call for PIC calculations
if (refType.isCall()) {
@@ -54,6 +54,10 @@ public class SH4EarlyAddressAnalyzer extends SH4AddressAnalyzer {
// if this is a call, some processors use the register value
// used in the call for PIC calculations
if (refType.isFlow()) {
if (address.isExternalAddress()) {
return true;
}
// set the called function to have a constant value for this register
// WARNING: This might not always be the case, if called directly or with a different register
// But then it won't matter, because the function won't depend on the registers value.