mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
Candidate release of source code.
This commit is contained in:
parent
db81e6b3b0
commit
79d8f164f8
12449 changed files with 2800756 additions and 16 deletions
|
@ -0,0 +1,40 @@
|
|||
Design Steps:
|
||||
Format Opinion(s) for use in XFormatService, where X is the new Format:
|
||||
|
||||
1. Either locate formats.opinion file or create a new *.opinion file and place under the Ghidra/core/languages folder.
|
||||
a. In this XML based file, the following structure is required (attributes in italics are optional):
|
||||
|
||||
<format_opinions>
|
||||
<format name=”X”>
|
||||
<opinion magic=”(magic_string_for_binary)”
|
||||
processor=”(processor_for_X)”
|
||||
endian=”(endian_of_processor)”
|
||||
size=”(size_of_processor)”
|
||||
variant=”(variant_of_processor)” />
|
||||
</format>
|
||||
...
|
||||
</format_opinions>
|
||||
|
||||
b. Add information about X into this file.
|
||||
|
||||
2. Create a new class XFormatService implementing FormatService
|
||||
a. Methods to implement:
|
||||
i. getName:
|
||||
1. Written to return the X name/id of the format service. (Currently id & name are equal).
|
||||
ii. getDescription:
|
||||
1. Written to return a verbose description of format service X.
|
||||
iii. getRegisteredFormats:
|
||||
1. Written to return the list of Formats registered for the X name/id stored in the formatInstances map.
|
||||
iv. registerFormat:
|
||||
1. Written to gather information from the ByteProvider (binary) and generate the X Format
|
||||
2. Register the Format in the formatInstances map (which takes a X name/id key and a list of Formats)
|
||||
3. Make sure the magic string matches the magic string found in the *.opinion’s file.
|
||||
4. Return whether or not the registration has been successful.
|
||||
v. getFormatOpinions:
|
||||
1. Written to be called by AutoImporter in order to gather the XFormatService’s Format Opinions.
|
||||
2. Essentially follow the formula in other *FormatServices, where:
|
||||
a. Register the Format via the ByteProvider (binary), (if not already done).
|
||||
b. Run through the list of Formats from the formatInstances map and gather FormatOpinions either via the QueryFormatOpinionServiceManager.getXMLFormatOpinionList(Format X) method (which queries the *.opinion file), or FormatOpinions existing programmatically.
|
||||
c. Optionally (although, strongly recommended), add a warning message for a valid Format X from the ByteProvider with no existing “magic string” and Format Opinion.
|
||||
|
||||
|
|
@ -0,0 +1,460 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
|
||||
|
||||
<include href="language_common.rxg" />
|
||||
|
||||
<!-- compiler_spec files have extension .cspec -->
|
||||
|
||||
<define name="value_type">
|
||||
<attribute name="value"/>
|
||||
</define>
|
||||
|
||||
<start>
|
||||
<element name="compiler_spec">
|
||||
<interleave>
|
||||
<optional>
|
||||
<ref name="properties_type"/>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="data_organization">
|
||||
<interleave>
|
||||
<optional>
|
||||
<element name="absolute_max_alignment"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="machine_alignment"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="default_alignment"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="default_pointer_alignment"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="pointer_size"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="pointer_shift"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="char_type">
|
||||
<attribute name="signed">
|
||||
<ref name="boolean_type"/>
|
||||
</attribute>
|
||||
</element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="char_size"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="wchar_size"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="short_size"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="integer_size"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="long_size"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="long_long_size"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="float_size"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="double_size"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="long_double_size"><ref name="value_type"/></element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="size_alignment_map">
|
||||
<zeroOrMore>
|
||||
<element name="entry">
|
||||
<attribute name="size"/>
|
||||
<attribute name="alignment"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<zeroOrMore>
|
||||
<element name="callfixup">
|
||||
<attribute name="name"/>
|
||||
<zeroOrMore>
|
||||
<element name="target">
|
||||
<attribute name="name"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
<element name="pcode"><ref name="pcode_type"/></element>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<zeroOrMore>
|
||||
<element name="callotherfixup">
|
||||
<attribute name="targetop"/>
|
||||
<element name="pcode"><ref name="pcode_type"/></element>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<!-- see language_common.rxg -->
|
||||
<optional>
|
||||
<element name="context_data">
|
||||
<ref name="context_data_type"/>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="enum">
|
||||
<attribute name="size"/>
|
||||
<optional>
|
||||
<attribute name="signed">
|
||||
<ref name="boolean_type"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="global">
|
||||
<oneOrMore>
|
||||
<ref name="memory_tags_type"/>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="prefersplit">
|
||||
<attribute name="style"/>
|
||||
<oneOrMore>
|
||||
<ref name="varnode_tags_type"/>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="aggressivetrim">
|
||||
<optional>
|
||||
<attribute name="signext"/>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="nohighptr">
|
||||
<oneOrMore>
|
||||
<ref name="memory_tags_type"/>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="readonly">
|
||||
<oneOrMore>
|
||||
<ref name="memory_tags_type"/>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="stackpointer">
|
||||
<attribute name="register"/>
|
||||
<attribute name="space"/>
|
||||
<optional>
|
||||
<attribute name="growth">
|
||||
<choice>
|
||||
<value>negative</value>
|
||||
<value>positive</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="reversejustify">
|
||||
<ref name="boolean_type"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="returnaddress">
|
||||
<ref name="varnode_tags_type"/>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="funcptr">
|
||||
<attribute name="align"/>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<zeroOrMore>
|
||||
<element name="spacebase">
|
||||
<attribute name="name"/>
|
||||
<attribute name="register"/>
|
||||
<attribute name="space"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<zeroOrMore>
|
||||
<element name="deadcodedelay">
|
||||
<attribute name="space"/>
|
||||
<attribute name="delay"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<zeroOrMore>
|
||||
<element name="segmentop">
|
||||
<attribute name="space"/>
|
||||
<optional> <attribute name="userop"/> </optional>
|
||||
<optional> <attribute name="baseinsize"/> </optional>
|
||||
<optional> <attribute name="innerinsize"/> </optional>
|
||||
<optional> <attribute name="farpointer"/> </optional>
|
||||
<optional>
|
||||
<attribute name="force">
|
||||
<ref name="boolean_type"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<interleave>
|
||||
<zeroOrMore>
|
||||
<element name="baseop">
|
||||
<ref name="segment_op_type"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
<zeroOrMore>
|
||||
<element name="innerop">
|
||||
<ref name="segment_op_type"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
<optional>
|
||||
<element name="constresolve">
|
||||
<ref name="varnode_tags_type"/>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<element name="default_proto">
|
||||
<element name="prototype">
|
||||
<ref name="prototype_type"/>
|
||||
</element>
|
||||
</element>
|
||||
|
||||
<zeroOrMore>
|
||||
<element name="prototype">
|
||||
<ref name="prototype_type"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<zeroOrMore>
|
||||
<element name="resolveprototype">
|
||||
<attribute name="name"/>
|
||||
<oneOrMore>
|
||||
<element name="model">
|
||||
<attribute name="name"/>
|
||||
</element>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<optional>
|
||||
<element name="eval_current_prototype">
|
||||
<attribute name="name"/>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="eval_called_prototype">
|
||||
<attribute name="name"/>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
</interleave>
|
||||
</element>
|
||||
</start>
|
||||
|
||||
<define name="segment_op_type">
|
||||
<attribute name="code">
|
||||
<choice>
|
||||
<value type="string">INT_ZEXT</value>
|
||||
<value type="string">INT_LEFT</value>
|
||||
<value type="string">INT_AND</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<optional>
|
||||
<attribute name="value"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="slot"/>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
<define name="pentry_type">
|
||||
<optional> <attribute name="maxsize"/> </optional>
|
||||
<optional> <attribute name="minsize"/> </optional>
|
||||
<optional> <attribute name="align"/> </optional>
|
||||
<optional> <attribute name="metatype"/> </optional>
|
||||
<optional>
|
||||
<attribute name="trial">
|
||||
<ref name="boolean_type"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional> <attribute name="extension"/> </optional>
|
||||
<!--
|
||||
THIS IS THE WEAK ADDR TYPE. Attribute size is not required.
|
||||
-->
|
||||
<ref name="addr_tags_type"/>
|
||||
</define>
|
||||
|
||||
<define name="rangelist_type">
|
||||
<oneOrMore>
|
||||
<ref name="range_type"/>
|
||||
</oneOrMore>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
Specifies generic calling convention for PrototypeModels
|
||||
|
||||
unknown: Unspecified convention (default)
|
||||
|
||||
stdcall: An MS Windows specific calling convention which
|
||||
uses the stack to pass all parameters and where
|
||||
the called-function is responsible for purging the stack.
|
||||
|
||||
cdecl: A standard/default calling convention which uses
|
||||
the stack to pass all parameters and where the
|
||||
caller is responsible for purging the stack.
|
||||
|
||||
fastcall: A standard/default calling convention
|
||||
in which only registers are used to pass parameters
|
||||
|
||||
thiscall: A C++ instance method calling convention
|
||||
|
||||
-->
|
||||
<define name="generic_calling_convention_type">
|
||||
<choice>
|
||||
<value type="string">unknown</value>
|
||||
<value type="string">stdcall</value>
|
||||
<value type="string">cdecl</value>
|
||||
<value type="string">fastcall</value>
|
||||
<value type="string">thiscall</value>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<define name="prototype_type">
|
||||
<attribute name="extrapop"/>
|
||||
<attribute name="stackshift"/>
|
||||
<attribute name="name"/>
|
||||
<optional>
|
||||
<attribute name="type">
|
||||
<ref name="generic_calling_convention_type"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<attribute name="strategy">
|
||||
<choice>
|
||||
<value>standard</value>
|
||||
<value>register</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
|
||||
<optional> <attribute name="hasthis"/> </optional>
|
||||
<optional> <attribute name="constructor"/> </optional>
|
||||
|
||||
<interleave>
|
||||
|
||||
<element name="input">
|
||||
<optional> <attribute name="pointermax"/> </optional>
|
||||
<optional> <attribute name="thisbeforeretpointer"/> </optional>
|
||||
<optional> <attribute name="killedbycall"/> </optional>
|
||||
<zeroOrMore>
|
||||
<element name="pentry">
|
||||
<ref name="pentry_type"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
|
||||
<element name="output">
|
||||
<optional> <attribute name="killedbycall"/> </optional>
|
||||
<zeroOrMore>
|
||||
<element name="pentry">
|
||||
<ref name="pentry_type"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
|
||||
<!--
|
||||
returnaddress describes where the return address is stored upon entry to
|
||||
a function with this prototype.
|
||||
-->
|
||||
<optional>
|
||||
<element name="returnaddress">
|
||||
<oneOrMore>
|
||||
<ref name="varnode_tags_type"/>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="unaffected">
|
||||
<interleave>
|
||||
<oneOrMore>
|
||||
<ref name="varnode_tags_type"/>
|
||||
</oneOrMore>
|
||||
</interleave>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<!--
|
||||
killedbycall places a "dividing line" in time so
|
||||
that you can cut off references to a varnode from a previous
|
||||
variable
|
||||
-->
|
||||
<optional>
|
||||
<element name="killedbycall">
|
||||
<oneOrMore>
|
||||
<ref name="varnode_tags_type"/>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<zeroOrMore>
|
||||
<element name="pcode">
|
||||
<attribute name="inject"/>
|
||||
<ref name="pcode_type"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<!--
|
||||
likelytrash indicates when calls will put random
|
||||
data in places that could be construed as global data
|
||||
-->
|
||||
<optional>
|
||||
<element name="likelytrash">
|
||||
<oneOrMore>
|
||||
<ref name="varnode_tags_type"/>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="localrange">
|
||||
<ref name="rangelist_type"/>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
</interleave>
|
||||
</define>
|
||||
|
||||
</grammar>
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
|
||||
|
||||
<define name="constraint_type">
|
||||
<element name="constraint">
|
||||
<optional> <attribute name="loader" /> </optional>
|
||||
<optional> <attribute name="primary" /> </optional>
|
||||
<optional> <attribute name="secondary" /> </optional>
|
||||
<optional> <attribute name="processor" /> </optional>
|
||||
<optional> <attribute name="endian" /> </optional>
|
||||
<optional> <attribute name="size" /> </optional>
|
||||
<optional> <attribute name="variant" /> </optional>
|
||||
<optional> <attribute name="compilerSpecID" /> </optional>
|
||||
<zeroOrMore>
|
||||
<ref name="constraint_type" />
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<start>
|
||||
<element name="opinions">
|
||||
<zeroOrMore>
|
||||
<ref name="constraint_type" />
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</start>
|
||||
</grammar>
|
|
@ -0,0 +1,247 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
|
||||
|
||||
<!--
|
||||
These are all the possible values for endianness.
|
||||
(Shouldn't ever change unless something complicated comes
|
||||
up)
|
||||
-->
|
||||
<define name="endian_type">
|
||||
<choice>
|
||||
<value>big</value>
|
||||
<value>little</value>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
duplicate definition of xs:boolean so we don't need to use
|
||||
that datatype library
|
||||
-->
|
||||
<define name="boolean_type">
|
||||
<choice>
|
||||
<value type="string">true</value>
|
||||
<value type="string">false</value>
|
||||
<value type="string">1</value>
|
||||
<value type="string">0</value>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
a key-value properties type for use by processor and compiler specs
|
||||
-->
|
||||
<define name="properties_type">
|
||||
<element name="properties">
|
||||
<zeroOrMore>
|
||||
<element name="property">
|
||||
<attribute name="key"/>
|
||||
<attribute name="value"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
memory_tags_type is a helper choice for memory-tagging elements
|
||||
such as global, nohighptr, etc.
|
||||
-->
|
||||
<define name="memory_tags_type">
|
||||
<choice>
|
||||
<ref name="register_type"/>
|
||||
<ref name="range_type"/>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
varnode_tags_type is a helper choice for varnode-tagging elements
|
||||
such as unaffected, constresolve, etc.
|
||||
-->
|
||||
<define name="varnode_tags_type">
|
||||
<choice>
|
||||
<ref name="register_type"/>
|
||||
<ref name="varnode_type"/>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
addr_tags_type is a helper choice for pentry
|
||||
-->
|
||||
<define name="addr_tags_type">
|
||||
<choice>
|
||||
<ref name="register_type"/>
|
||||
<ref name="addr_type"/>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
Specify a register to tag with a "memory" property
|
||||
such as global, nohighptr, volatile, etc.
|
||||
|
||||
Maybe this should be named differently from the register
|
||||
in processor_spec.rxg.
|
||||
-->
|
||||
<define name="register_type">
|
||||
<element name="register">
|
||||
<attribute name="name"/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
Unified strong range type where attributes space, first and last are
|
||||
required.
|
||||
|
||||
NOTE: all range types are now strong; i.e. there is no weak range
|
||||
type any more. Documentation here has been merged.
|
||||
|
||||
NOTE AGAIN: all range types are semi-weak,
|
||||
in that if first and last are omitted, the entire space is selected.
|
||||
If you provide first or last, the other is also required, and
|
||||
constrains the space to just that range of addresses. This type is
|
||||
actually a named element now.
|
||||
-->
|
||||
<define name="range_type">
|
||||
<element name="range">
|
||||
<attribute name="space"/>
|
||||
<optional>
|
||||
<group>
|
||||
<attribute name="first"/>
|
||||
<attribute name="last"/>
|
||||
</group>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
This replaces some uses of the old addr_type. Old
|
||||
documentation inserted here just for reference. (Not)
|
||||
Used in unaffected and probably constresolve too,
|
||||
maybe elsewhere.
|
||||
-->
|
||||
<define name="varnode_type">
|
||||
<element name="varnode">
|
||||
<attribute name="space"/>
|
||||
<attribute name="offset"/>
|
||||
<attribute name="size"/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
What pentry uses for calls where parameters don't go
|
||||
in registers.
|
||||
-->
|
||||
<define name="addr_type">
|
||||
<element name="addr">
|
||||
<attribute name="space"/>
|
||||
<optional>
|
||||
<attribute name="offset"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="piece1"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="piece2"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="piece3"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="piece4"/>
|
||||
</optional>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<!--
|
||||
NOTE: because RELAX NG does not support type inheritence, this type
|
||||
does NOT inherit from range_type (although that is indeed what it
|
||||
is).
|
||||
-->
|
||||
|
||||
<define name="context_tracked_set_type">
|
||||
<attribute name="space"/>
|
||||
<optional>
|
||||
<group>
|
||||
<attribute name="first"/>
|
||||
<attribute name="last"/>
|
||||
</group>
|
||||
</optional>
|
||||
<oneOrMore>
|
||||
<!--
|
||||
NOTE: leave currently unused description
|
||||
attribute in.
|
||||
-->
|
||||
<element name="set">
|
||||
<attribute name="name"/>
|
||||
<attribute name="val"/>
|
||||
<optional> <attribute name="description"/> </optional>
|
||||
</element>
|
||||
</oneOrMore>
|
||||
</define>
|
||||
|
||||
<define name="context_data_type">
|
||||
<interleave>
|
||||
<zeroOrMore>
|
||||
<element name="context_set">
|
||||
<ref name="context_tracked_set_type"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
<zeroOrMore>
|
||||
<element name="tracked_set">
|
||||
<ref name="context_tracked_set_type"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</interleave>
|
||||
</define>
|
||||
|
||||
<define name="symbol_type">
|
||||
<choice>
|
||||
<value type="string">code</value>
|
||||
<value type="string">code_ptr</value>
|
||||
</choice>
|
||||
</define>
|
||||
|
||||
<define name="inject_parameter_type">
|
||||
<attribute name="name"/>
|
||||
<optional>
|
||||
<attribute name="size"/>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
<define name="pcode_type">
|
||||
<optional>
|
||||
<attribute name="paramshift"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="dynamic"/>
|
||||
</optional>
|
||||
<interleave>
|
||||
<zeroOrMore>
|
||||
<element name="input"><ref name="inject_parameter_type"/></element>
|
||||
</zeroOrMore>
|
||||
<zeroOrMore>
|
||||
<element name="output"><ref name="inject_parameter_type"/></element>
|
||||
</zeroOrMore>
|
||||
</interleave>
|
||||
<optional>
|
||||
<element name="body">
|
||||
<text/>
|
||||
</element>
|
||||
</optional>
|
||||
</define>
|
||||
|
||||
<define name="jumpassist_type">
|
||||
<attribute name="name"/>
|
||||
<interleave>
|
||||
<optional>
|
||||
<element name="case_pcode"><ref name="pcode_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="addr_pcode"><ref name="pcode_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="default_pcode"><ref name="pcode_type"/></element>
|
||||
</optional>
|
||||
<optional>
|
||||
<element name="size_pcode"><ref name="pcode_type"/></element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</define>
|
||||
</grammar>
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
|
||||
|
||||
<include href="language_common.rxg" />
|
||||
|
||||
<!-- language_definitions files have extension .ldefs -->
|
||||
|
||||
<start>
|
||||
<element name="language_definitions">
|
||||
<zeroOrMore>
|
||||
<element name="language">
|
||||
<optional>
|
||||
<attribute name="hidden">
|
||||
<!-- a language marked as hidden will only be available within a development environment -->
|
||||
<ref name="boolean_type" />
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="deprecated">
|
||||
<ref name="boolean_type" />
|
||||
</attribute>
|
||||
</optional>
|
||||
<attribute name="processor"/>
|
||||
<attribute name="endian">
|
||||
<ref name="endian_type" />
|
||||
</attribute>
|
||||
<optional>
|
||||
<attribute name="instructionEndian">
|
||||
<ref name="endian_type" />
|
||||
</attribute>
|
||||
</optional>
|
||||
<attribute name="size" />
|
||||
<attribute name="variant" />
|
||||
<attribute name="version" />
|
||||
<attribute name="slafile" />
|
||||
<attribute name="processorspec" />
|
||||
<optional>
|
||||
<attribute name="manualindexfile" />
|
||||
</optional>
|
||||
<attribute name="id" />
|
||||
<element name="description"> <text/> </element>
|
||||
<optional>
|
||||
<element name="truncate_space">
|
||||
<attribute name="space" />
|
||||
<attribute name="size" />
|
||||
</element>
|
||||
</optional>
|
||||
<oneOrMore>
|
||||
<!-- first compiler spec is the default!!! -->
|
||||
<element name="compiler">
|
||||
<attribute name="name" />
|
||||
<attribute name="spec" />
|
||||
<attribute name="id" />
|
||||
</element>
|
||||
</oneOrMore>
|
||||
<zeroOrMore>
|
||||
<element name="external_name">
|
||||
<attribute name="tool" />
|
||||
<attribute name="name" />
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
</element>
|
||||
</start>
|
||||
</grammar>
|
|
@ -0,0 +1,151 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
|
||||
|
||||
<include href="language_common.rxg" />
|
||||
|
||||
<!-- processor_spec files have extension .pspec -->
|
||||
|
||||
<start>
|
||||
<element name="processor_spec">
|
||||
|
||||
<!-- IMPORTANT NOTE:
|
||||
If a register is renamed in the register_data section, any
|
||||
subsequent reference to that register must use the NEW name.
|
||||
Likewise, references before the rename must refer to the OLD
|
||||
name.
|
||||
|
||||
Also, references in compiler specs to the registers must use
|
||||
the new name, because the compiler specs for a given language
|
||||
are loaded after the language is completely loaded.
|
||||
-->
|
||||
|
||||
<interleave>
|
||||
|
||||
<optional>
|
||||
<ref name="properties_type"/>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="programcounter">
|
||||
<attribute name="register"/>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="data_space">
|
||||
<attribute name="space"/>
|
||||
<optional>
|
||||
<attribute name="ptr_wordsize"/>
|
||||
</optional>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="segmented_address">
|
||||
<attribute name="space"/>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<!-- see language_common.rxg -->
|
||||
<optional>
|
||||
<element name="context_data">
|
||||
<ref name="context_data_type"/>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="volatile">
|
||||
<attribute name="inputop"/>
|
||||
<attribute name="outputop"/>
|
||||
<oneOrMore>
|
||||
<ref name="memory_tags_type"/>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="incidentalcopy">
|
||||
<oneOrMore>
|
||||
<ref name="varnode_tags_type"/>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<zeroOrMore>
|
||||
<element name="jumpassist"><ref name="jumpassist_type"/>
|
||||
</element>
|
||||
</zeroOrMore>
|
||||
|
||||
<optional>
|
||||
<element name="register_data">
|
||||
<oneOrMore>
|
||||
<element name="register">
|
||||
<attribute name="name"/>
|
||||
<optional>
|
||||
<attribute name="rename"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="group"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="hidden">
|
||||
<ref name="boolean_type"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="unused">
|
||||
<ref name="boolean_type"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="vector_lane_sizes"/>
|
||||
</optional>
|
||||
</element>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="default_symbols">
|
||||
<oneOrMore>
|
||||
<element name="symbol">
|
||||
<attribute name="name"/>
|
||||
<attribute name="address"/>
|
||||
<optional>
|
||||
<attribute name="entry">
|
||||
<ref name="boolean_type"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="type">
|
||||
<ref name="symbol_type"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
|
||||
<optional>
|
||||
<element name="default_memory_blocks">
|
||||
<oneOrMore>
|
||||
<element name="memory_block">
|
||||
<attribute name="name"/>
|
||||
<attribute name="start_address"/>
|
||||
<optional> <attribute name="bit_mapped_address"/> </optional>
|
||||
<optional> <attribute name="mode"/> </optional>
|
||||
<optional> <attribute name="length"/> </optional>
|
||||
<optional>
|
||||
<attribute name="initialized">
|
||||
<ref name="boolean_type"/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</element>
|
||||
</oneOrMore>
|
||||
</element>
|
||||
</optional>
|
||||
</interleave>
|
||||
</element>
|
||||
</start>
|
||||
</grammar>
|
Loading…
Add table
Add a link
Reference in a new issue