mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-2830 Parsing pspec symbols
This commit is contained in:
parent
3cf13c2533
commit
8f2450e625
13 changed files with 274 additions and 82 deletions
|
@ -29,6 +29,7 @@ vector<ArchitectureCapability *> ArchitectureCapability::thelist;
|
|||
const uint4 ArchitectureCapability::majorversion = 5;
|
||||
const uint4 ArchitectureCapability::minorversion = 0;
|
||||
|
||||
AttributeId ATTRIB_ADDRESS = AttributeId("address",148);
|
||||
AttributeId ATTRIB_ADJUSTVMA = AttributeId("adjustvma",103);
|
||||
AttributeId ATTRIB_ENABLE = AttributeId("enable",104);
|
||||
AttributeId ATTRIB_GROUP = AttributeId("group",105);
|
||||
|
@ -583,15 +584,6 @@ void Architecture::buildAction(DocumentStorage &store)
|
|||
allacts.resetDefaults();
|
||||
}
|
||||
|
||||
/// This builds the database which holds the status registers setings and other
|
||||
/// information that can affect disassembly depending on context.
|
||||
/// \param store may hold configuration information
|
||||
void Architecture::buildContext(DocumentStorage &store)
|
||||
|
||||
{
|
||||
context = new ContextInternal();
|
||||
}
|
||||
|
||||
/// Create the database object, which currently doesn't not depend on any configuration
|
||||
/// data. Then create the root (global) scope and attach it to the database.
|
||||
/// \param store is the storage for any configuration data
|
||||
|
@ -605,72 +597,6 @@ Scope *Architecture::buildDatabase(DocumentStorage &store)
|
|||
return globscope;
|
||||
}
|
||||
|
||||
/// This builds the TypeFactory object specific to this architecture and
|
||||
/// prepopulates it with the \e core types. Core types may be pulled
|
||||
/// from the configuration information, or default core types are used.
|
||||
/// \param store contains possible configuration information
|
||||
void Architecture::buildTypegrp(DocumentStorage &store)
|
||||
|
||||
{
|
||||
const Element *el = store.getTag("coretypes");
|
||||
types = new TypeFactory(this); // Initialize the object
|
||||
if (el != (const Element *)0) {
|
||||
XmlDecode decoder(this,el);
|
||||
types->decodeCoreTypes(decoder);
|
||||
}
|
||||
else {
|
||||
// Put in the core types
|
||||
types->setCoreType("void",1,TYPE_VOID,false);
|
||||
types->setCoreType("bool",1,TYPE_BOOL,false);
|
||||
types->setCoreType("uint1",1,TYPE_UINT,false);
|
||||
types->setCoreType("uint2",2,TYPE_UINT,false);
|
||||
types->setCoreType("uint4",4,TYPE_UINT,false);
|
||||
types->setCoreType("uint8",8,TYPE_UINT,false);
|
||||
types->setCoreType("int1",1,TYPE_INT,false);
|
||||
types->setCoreType("int2",2,TYPE_INT,false);
|
||||
types->setCoreType("int4",4,TYPE_INT,false);
|
||||
types->setCoreType("int8",8,TYPE_INT,false);
|
||||
types->setCoreType("float4",4,TYPE_FLOAT,false);
|
||||
types->setCoreType("float8",8,TYPE_FLOAT,false);
|
||||
types->setCoreType("float10",10,TYPE_FLOAT,false);
|
||||
types->setCoreType("float16",16,TYPE_FLOAT,false);
|
||||
types->setCoreType("xunknown1",1,TYPE_UNKNOWN,false);
|
||||
types->setCoreType("xunknown2",2,TYPE_UNKNOWN,false);
|
||||
types->setCoreType("xunknown4",4,TYPE_UNKNOWN,false);
|
||||
types->setCoreType("xunknown8",8,TYPE_UNKNOWN,false);
|
||||
types->setCoreType("code",1,TYPE_CODE,false);
|
||||
types->setCoreType("char",1,TYPE_INT,true);
|
||||
types->setCoreType("wchar2",2,TYPE_INT,true);
|
||||
types->setCoreType("wchar4",4,TYPE_INT,true);
|
||||
types->cacheCoreTypes();
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the container that holds comments for executable in this Architecture.
|
||||
/// \param store may hold configuration information
|
||||
void Architecture::buildCommentDB(DocumentStorage &store)
|
||||
|
||||
{
|
||||
commentdb = new CommentDatabaseInternal();
|
||||
}
|
||||
|
||||
/// Build container that holds decoded strings
|
||||
/// \param store may hold configuration information
|
||||
void Architecture::buildStringManager(DocumentStorage &store)
|
||||
|
||||
{
|
||||
stringManager = new StringManagerUnicode(this,2048);
|
||||
}
|
||||
|
||||
/// Some processor models (Java byte-code) need a database of constants.
|
||||
/// The database is always built, but may remain empty.
|
||||
/// \param store may hold configuration information
|
||||
void Architecture::buildConstantPool(DocumentStorage &store)
|
||||
|
||||
{
|
||||
cpool = new ConstantPoolInternal();
|
||||
}
|
||||
|
||||
/// This registers the OpBehavior objects for all known p-code OpCodes.
|
||||
/// The Translate and TypeFactory object should already be built.
|
||||
/// \param store may hold configuration information
|
||||
|
@ -1257,6 +1183,7 @@ void Architecture::parseProcessorConfig(DocumentStorage &store)
|
|||
}
|
||||
else if (subId == ELEM_DEFAULT_SYMBOLS) {
|
||||
decoder.openElement();
|
||||
store.registerTag(decoder.getCurrentXmlElement());
|
||||
decoder.closeElementSkipping(subId);
|
||||
}
|
||||
else if (subId == ELEM_DEFAULT_MEMORY_BLOCKS) {
|
||||
|
@ -1449,6 +1376,7 @@ void Architecture::init(DocumentStorage &store)
|
|||
restoreFromSpec(store);
|
||||
print->initializeFromArchitecture();
|
||||
symboltab->adjustCaches(); // In case the specs created additional address spaces
|
||||
buildSymbols(store);
|
||||
postSpecFile(); // Let subclasses do things after translate is ready
|
||||
|
||||
buildInstructions(store); // Must be called after translate is built
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue