Skip to content

Ghidra is a software reverse engineering (SRE) framework

Last chance attempt to find LOAD/STORE

caheckman72d6b1513305
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.cc
index 28f2db2cc2..359f3867c8 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/architecture.cc
@@ -1087,9 +1087,10 @@ void Architecture::parseProcessorConfig(DocumentStorage &store)
parseLaneSizes(*iter);
}
else if (elname == "data_space") {
- AddrSpace *spc = getSpaceByName(el->getAttributeValue("space"));
+ const string &spaceName( (*iter)->getAttributeValue("space"));
+ AddrSpace *spc = getSpaceByName(spaceName);
if (spc == (AddrSpace *)0)
- throw LowlevelError("Undefined space: "+el->getAttributeValue("space"));
+ throw LowlevelError("Undefined space: "+spaceName);
setDefaultDataSpace(spc->getIndex());
}
else if (elname == "segmented_address") {
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc
index 4ad61eaac8..cdc12218c0 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/coreaction.cc
@@ -964,6 +964,14 @@ AddrSpace *ActionConstantPtr::searchForLoadStore(Varnode *vn,PcodeOp *op)
}
if (op == (PcodeOp *)0) break;
}
+ for(list<PcodeOp *>::const_iterator iter=vn->beginDescend();iter!=vn->endDescend();++iter) {
+ op = *iter;
+ OpCode opc = op->code();
+ if (opc == CPUI_LOAD)
+ return Address::getSpaceFromConst(op->getIn(0)->getAddr());
+ else if (opc == CPUI_STORE && op->getIn(1) == vn)
+ return Address::getSpaceFromConst(op->getIn(0)->getAddr());
+ }
return (AddrSpace *)0;
}