mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
Added direct references to MemoryBlock.EXTERNAL_BLOCK_NAME instead of
hard-coded string
This commit is contained in:
parent
e4f61fa06d
commit
b83f327e47
10 changed files with 19 additions and 14 deletions
|
@ -192,7 +192,7 @@ public class OperandReferenceAnalyzer extends AbstractAnalyzer {
|
|||
|
||||
processorAlignment = program.getLanguage().getInstructionAlignment();
|
||||
|
||||
externalBlock = program.getMemory().getBlock("EXTERNAL");
|
||||
externalBlock = program.getMemory().getBlock(MemoryBlock.EXTERNAL_BLOCK_NAME);
|
||||
|
||||
newCodeFound = false;
|
||||
int count = NOTIFICATION_INTERVAL;
|
||||
|
|
|
@ -363,7 +363,8 @@ public class CoffLoader extends AbstractLibrarySupportLoader {
|
|||
if (!externalAddressStart.equals(externalAddress)) {
|
||||
long size = externalAddress.subtract(externalAddressStart);
|
||||
try {
|
||||
MemoryBlock block = program.getMemory().createUninitializedBlock("EXTERNAL",
|
||||
MemoryBlock block = program.getMemory()
|
||||
.createUninitializedBlock(MemoryBlock.EXTERNAL_BLOCK_NAME,
|
||||
externalAddressStart, size, false);
|
||||
|
||||
// assume any value in external is writable.
|
||||
|
|
|
@ -1133,8 +1133,8 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Create EXTERNAL memory block based upon start of {@link #freeAddressRange} and the
|
||||
* current {@link #nextFreeAddress}.
|
||||
* Create EXTERNAL memory block based upon {@link #externalBlockLimits} and
|
||||
* {@link #lastExternalBlockEntryAddress}.
|
||||
*/
|
||||
private void createExternalBlock() {
|
||||
if (lastExternalBlockEntryAddress == null) {
|
||||
|
@ -1144,7 +1144,8 @@ class ElfProgramBuilder extends MemorySectionResolver implements ElfLoadHelper {
|
|||
long size = lastExternalBlockEntryAddress.subtract(externalBlockAddress) + 1;
|
||||
try {
|
||||
MemoryBlock block =
|
||||
memory.createUninitializedBlock("EXTERNAL", externalBlockAddress, size, false);
|
||||
memory.createUninitializedBlock(MemoryBlock.EXTERNAL_BLOCK_NAME,
|
||||
externalBlockAddress, size, false);
|
||||
|
||||
// assume any value in external is writable.
|
||||
block.setWrite(true);
|
||||
|
|
|
@ -607,8 +607,8 @@ public class MachoProgramBuilder {
|
|||
}
|
||||
Address start = getAddress();
|
||||
try {
|
||||
MemoryBlock block = memory.createUninitializedBlock("EXTERNAL", start,
|
||||
undefinedSymbols.size() * machoHeader.getAddressSize(), false);
|
||||
MemoryBlock block = memory.createUninitializedBlock(MemoryBlock.EXTERNAL_BLOCK_NAME,
|
||||
start, undefinedSymbols.size() * machoHeader.getAddressSize(), false);
|
||||
// assume any value in external is writable.
|
||||
block.setWrite(true);
|
||||
block.setSourceName(BLOCK_SOURCE_NAME);
|
||||
|
|
|
@ -524,8 +524,9 @@ public class OmfLoader extends AbstractLibrarySupportLoader {
|
|||
if (!externalAddressStart.equals(externalAddress)) {
|
||||
long size = externalAddress.subtract(externalAddressStart);
|
||||
try {
|
||||
MemoryBlock block = program.getMemory().createUninitializedBlock("EXTERNAL",
|
||||
externalAddressStart, size, false);
|
||||
MemoryBlock block = program.getMemory()
|
||||
.createUninitializedBlock(MemoryBlock.EXTERNAL_BLOCK_NAME,
|
||||
externalAddressStart, size, false);
|
||||
|
||||
// assume any value in external is writable.
|
||||
block.setWrite(true);
|
||||
|
|
|
@ -25,6 +25,7 @@ import ghidra.program.model.lang.CompilerSpec;
|
|||
import ghidra.program.model.lang.PrototypeModel;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.model.pcode.HighFunction;
|
||||
import ghidra.program.model.symbol.*;
|
||||
import ghidra.util.Msg;
|
||||
|
@ -111,7 +112,7 @@ public class DecompilerParallelConventionAnalysisCmd extends BackgroundCommand {
|
|||
*/
|
||||
private boolean funcIsExternalGlue(Function func) {
|
||||
String blockName = program.getMemory().getBlock(func.getEntryPoint()).getName();
|
||||
return (blockName.equals("EXTERNAL") || blockName.equals(".plt") ||
|
||||
return (blockName.equals(MemoryBlock.EXTERNAL_BLOCK_NAME) || blockName.equals(".plt") ||
|
||||
blockName.equals("__stub_helper"));
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import ghidra.program.model.data.DataType;
|
|||
import ghidra.program.model.data.VoidDataType;
|
||||
import ghidra.program.model.lang.CompilerSpec;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.mem.MemoryBlock;
|
||||
import ghidra.program.model.pcode.*;
|
||||
import ghidra.program.model.symbol.SourceType;
|
||||
import ghidra.program.model.util.AcyclicCallGraphBuilder;
|
||||
|
@ -116,7 +117,7 @@ public class DecompilerParameterIdCmd extends BackgroundCommand {
|
|||
*/
|
||||
private boolean funcIsExternalGlue(Function func) {
|
||||
String blockName = program.getMemory().getBlock(func.getEntryPoint()).getName();
|
||||
return (blockName.equals("EXTERNAL") || blockName.equals(".plt") ||
|
||||
return (blockName.equals(MemoryBlock.EXTERNAL_BLOCK_NAME) || blockName.equals(".plt") ||
|
||||
blockName.equals("__stub_helper"));
|
||||
}
|
||||
|
||||
|
|
|
@ -629,7 +629,7 @@ public class PseudoDisassembler {
|
|||
// it is probably a JUMP to an external function.
|
||||
MemoryBlock block = memory.getBlock(target);
|
||||
if (block == null || block.isInitialized() ||
|
||||
!block.getName().equals("EXTERNAL")) {
|
||||
!block.getName().equals(MemoryBlock.EXTERNAL_BLOCK_NAME)) {
|
||||
return false;
|
||||
}
|
||||
targetList.remove(target);
|
||||
|
|
|
@ -810,7 +810,7 @@ public class ArmAnalyzer extends ConstantPropagationAnalyzer {
|
|||
// something computed it into the memory
|
||||
MemoryBlock block = program.getMemory().getBlock(target);
|
||||
if (block == null || !block.isExecute() || !block.isInitialized() ||
|
||||
block.getName().equals("EXTERNAL")) {
|
||||
block.getName().equals(MemoryBlock.EXTERNAL_BLOCK_NAME)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -505,7 +505,7 @@ public class MipsAddressAnalyzer extends ConstantPropagationAnalyzer {
|
|||
if (addr != null) {
|
||||
MemoryBlock block = program.getMemory().getBlock(addr);
|
||||
if (block == null || !block.isExecute() || !block.isInitialized() ||
|
||||
block.getName().equals("EXTERNAL")) {
|
||||
block.getName().equals(MemoryBlock.EXTERNAL_BLOCK_NAME)) {
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue