Ghidra is a software reverse engineering (SRE) framework
Updating documentation to include token endianess override
caheckman017b92ac2e25
diff --git a/Ghidra/Features/Decompiler/src/main/doc/sleigh.xml b/Ghidra/Features/Decompiler/src/main/doc/sleigh.xmlindex c6b1b624c2..c60683a52f 100644--- a/Ghidra/Features/Decompiler/src/main/doc/sleigh.xml+++ b/Ghidra/Features/Decompiler/src/main/doc/sleigh.xml@@ -4,7 +4,7 @@<title>SLEIGH</title><subtitle>A Language for Rapid Processor Specification</subtitle><pubdate>Originally published December 16, 2005</pubdate>- <releaseinfo>Last updated September 5, 2019</releaseinfo>+ <releaseinfo>Last updated October 28, 2020</releaseinfo></info><simplesect><info>@@ -573,13 +573,14 @@ define endian=little;</programlisting></informalexample>This defines how the processor interprets contiguous sequences of-bytes as integers. It effects how integer fields within an instruction-are interpreted (see <xref linkend="sleigh_defining_tokens"/>), and-it also effects the details of how the processor is supposed to-implement atomic operations like integer addition and integer-compare. The specification designer should only need to worry about-these details when labeling instruction fields, otherwise the-specification language will hide endianess issues.+bytes as integers or other values and globally affects values across+all address spaces. It also affects how integer fields+within an instruction are interpreted, (see <xref linkend="sleigh_defining_tokens"/>),+although it is possible to override this setting in the rare case that endianess is+different for data versus instruction encoding.+The specification designer generally only needs to worry about+endianess when labeling instruction fields and when defining overlapping registers,+otherwise the specification language hides endianess issues.</para></sect2><sect2>@@ -966,7 +967,7 @@ individual <emphasis>constructor</emphasis> (defined in <xref linkend="sleigh_codefines a local scope for operand names. As with most languages, alocal symbol with the same name as a globalsymbol <emphasis>hides</emphasis> the global symbol while that scope-is in affect.+is in effect.</para></sect2><sect2 id="sleigh_predefined_symbols">@@ -1057,8 +1058,22 @@ there are one or more field declarations specifying the name of thefield and the range of bits within the token making up the field. Thesize of a field does <emphasis>not</emphasis> need to be a multiple of8. The range is inclusive where the least significant bit in the token-is labeled 0. The endianess of the processor will effect this labeling-when defining tokens that are bigger than 1 byte. After each field+is labeled 0. When defining tokens that are bigger than 1 byte, the+global endianess setting (See <xref linkend="sleigh_endianess_definition"/>)+will affect this labeling. Although it is rarely required, it is possible to override+the global endianess setting for a specific token by appending either the qualifier+<emphasis role="bold">endian=little</emphasis> or <emphasis role="bold">endian=big</emphasis>+immediately after the token name and size. For instance:+<informalexample>+<programlisting>+ define token instr ( 32 ) endian=little op0=(0,15) <emphasis role="weak">...</emphasis>+</programlisting>+</informalexample>+The token <emphasis>instr</emphasis> is overridden to be little endian.+This override applies to all fields defined for the token but affects no other tokens.+</para>+<para>+After each fielddeclaration, there can be zero or more of the following attributekeywords:<informalexample>@@ -2023,7 +2038,7 @@ assignment to such a variable changes the context in which the currentinstruction is being disassembled and can potentially have a drasticeffect on how the rest of the instruction is disassembled. Anassignment of this form is considered local to the instruction and-will not effect how other instructions are parsed. The context+will not affect how other instructions are parsed. The contextvariable is reset to its original value before parsing otherinstructions. The disassembly action may also contain one ormore <emphasis role="bold">globalset</emphasis> directives, which@@ -2547,7 +2562,7 @@ the table symbol <emphasis>mode</emphasis>. When this constructor ismatched, as part of a more complicated instruction, thesymbol <emphasis>mode</emphasis> will represent the original semanticvalue of <emphasis>reg</emphasis> but with the standard post-increment-side effect.+side-effect.</para><para>The table symbol associated with the constructor becomes@@ -3724,7 +3739,7 @@ blr is opcode=35 & reg=15 & LRset=1 { return [lr]; }An alternative to the <emphasis role="bold">noflow</emphasis> attribute is to simply issuemultiple directives within a single constructor, so an explicit end to a context changecan be given. The value of the variable exported to the global state-is the one in affect at the point where the directive is issued. Thus,+is the one in effect at the point where the directive is issued. Thus,after one <emphasis role="bold">globalset</emphasis>, the same contextvariable can be assigned a different value, followed byanother <emphasis role="bold">globalset</emphasis> for a different@@ -3735,7 +3750,7 @@ Because context in SLEIGH is controlled by a disassembly process,there are some basic caveats to the use ofthe <emphasis role="bold">globalset</emphasis> directive. With<emphasis>flowing</emphasis> context changes,-there is no guarantee of what global state will be in affect at a+there is no guarantee of what global state will be in effect at aparticular address. During disassembly, at any givenpoint, the process may not have uncovered all the relevant directives,and the known directives may not necessarily be consistent. Indiff --git a/GhidraDocs/languages/html/sleigh.html b/GhidraDocs/languages/html/sleigh.htmlindex cc532db93e..a02b507fe4 100644--- a/GhidraDocs/languages/html/sleigh.html+++ b/GhidraDocs/languages/html/sleigh.html@@ -25,9 +25,9 @@<div class="titlepage"><div><div><h1 class="title">-<a name="idm140016193433872"></a>SLEIGH</h1></div>+<a name="idm140526921073488"></a>SLEIGH</h1></div><div><h3 class="subtitle"><i>A Language for Rapid Processor Specification</i></h3></div>-<div><p class="releaseinfo">Last updated September 5, 2019</p></div>+<div><p class="releaseinfo">Last updated October 28, 2020</p></div><div><p class="pubdate">Originally published December 16, 2005</p></div></div><hr>@@ -35,51 +35,51 @@<div class="toc"><p><b>Table of Contents</b></p><dl class="toc">-<dt><span class="sect1"><a href="sleigh.html#idm140016193411168">1. Introduction to P-Code</a></span></dt>+<dt><span class="sect1"><a href="sleigh.html#idm140526921048752">1. Introduction to P-Code</a></span></dt><dd><dl>-<dt><span class="sect2"><a href="sleigh.html#idm140016193402816">1.1. Address Spaces</a></span></dt>+<dt><span class="sect2"><a href="sleigh.html#idm140526921040400">1.1. Address Spaces</a></span></dt><dt><span class="sect2"><a href="sleigh.html#sleigh_varnodes">1.2. Varnodes</a></span></dt>-<dt><span class="sect2"><a href="sleigh.html#idm140016193387168">1.3. Operations</a></span></dt>+<dt><span class="sect2"><a href="sleigh.html#idm140526921024752">1.3. Operations</a></span></dt></dl></dd><dt><span class="sect1"><a href="sleigh_layout.html">2. Basic Specification Layout</a></span></dt><dd><dl>-<dt><span class="sect2"><a href="sleigh_layout.html#idm140016193347968">2.1. Comments</a></span></dt>-<dt><span class="sect2"><a href="sleigh_layout.html#idm140016193345328">2.2. Identifiers</a></span></dt>-<dt><span class="sect2"><a href="sleigh_layout.html#idm140016193343696">2.3. Strings</a></span></dt>-<dt><span class="sect2"><a href="sleigh_layout.html#idm140016193341936">2.4. Integers</a></span></dt>-<dt><span class="sect2"><a href="sleigh_layout.html#idm140016193337552">2.5. White Space</a></span></dt>+<dt><span class="sect2"><a href="sleigh_layout.html#idm140526920986416">2.1. Comments</a></span></dt>+<dt><span class="sect2"><a href="sleigh_layout.html#idm140526920983776">2.2. Identifiers</a></span></dt>+<dt><span class="sect2"><a href="sleigh_layout.html#idm140526920982144">2.3. Strings</a></span></dt>+<dt><span class="sect2"><a href="sleigh_layout.html#idm140526920980384">2.4. Integers</a></span></dt>+<dt><span class="sect2"><a href="sleigh_layout.html#idm140526920976000">2.5. White Space</a></span></dt></dl></dd><dt><span class="sect1"><a href="sleigh_preprocessing.html">3. Preprocessing</a></span></dt><dd><dl><dt><span class="sect2"><a href="sleigh_preprocessing.html#sleigh_including_files">3.1. Including Files</a></span></dt>-<dt><span class="sect2"><a href="sleigh_preprocessing.html#idm140016193329920">3.2. Preprocessor Macros</a></span></dt>-<dt><span class="sect2"><a href="sleigh_preprocessing.html#idm140016193323088">3.3. Conditional Compilation</a></span></dt>+<dt><span class="sect2"><a href="sleigh_preprocessing.html#idm140526920968368">3.2. Preprocessor Macros</a></span></dt>+<dt><span class="sect2"><a href="sleigh_preprocessing.html#idm140526920961536">3.3. Conditional Compilation</a></span></dt></dl></dd><dt><span class="sect1"><a href="sleigh_definitions.html">4. Basic Definitions</a></span></dt><dd><dl><dt><span class="sect2"><a href="sleigh_definitions.html#sleigh_endianess_definition">4.1. Endianess Definition</a></span></dt>-<dt><span class="sect2"><a href="sleigh_definitions.html#idm140016193284896">4.2. Alignment Definition</a></span></dt>-<dt><span class="sect2"><a href="sleigh_definitions.html#idm140016193281872">4.3. Space Definitions</a></span></dt>+<dt><span class="sect2"><a href="sleigh_definitions.html#idm140526921098128">4.2. Alignment Definition</a></span></dt>+<dt><span class="sect2"><a href="sleigh_definitions.html#idm140526921095104">4.3. Space Definitions</a></span></dt><dt><span class="sect2"><a href="sleigh_definitions.html#sleigh_naming_registers">4.4. Naming Registers</a></span></dt>-<dt><span class="sect2"><a href="sleigh_definitions.html#idm140016193245424">4.5. Bit Range Registers</a></span></dt>-<dt><span class="sect2"><a href="sleigh_definitions.html#idm140016193233216">4.6. User-Defined Operations</a></span></dt>+<dt><span class="sect2"><a href="sleigh_definitions.html#idm140526920875744">4.5. Bit Range Registers</a></span></dt>+<dt><span class="sect2"><a href="sleigh_definitions.html#idm140526920863712">4.6. User-Defined Operations</a></span></dt></dl></dd><dt><span class="sect1"><a href="sleigh_symbols.html">5. Introduction to Symbols</a></span></dt><dd><dl>-<dt><span class="sect2"><a href="sleigh_symbols.html#idm140016193206464">5.1. Notes on Namespaces</a></span></dt>+<dt><span class="sect2"><a href="sleigh_symbols.html#idm140526920845152">5.1. Notes on Namespaces</a></span></dt><dt><span class="sect2"><a href="sleigh_symbols.html#sleigh_predefined_symbols">5.2. Predefined Symbols</a></span></dt></dl></dd><dt><span class="sect1"><a href="sleigh_tokens.html">6. Tokens and Fields</a></span></dt><dd><dl><dt><span class="sect2"><a href="sleigh_tokens.html#sleigh_defining_tokens">6.1. Defining Tokens and Fields</a></span></dt>-<dt><span class="sect2"><a href="sleigh_tokens.html#idm140016193166064">6.2. Fields as Family Symbols</a></span></dt>-<dt><span class="sect2"><a href="sleigh_tokens.html#idm140016193160240">6.3. Attaching Alternate Meanings to Fields</a></span></dt>+<dt><span class="sect2"><a href="sleigh_tokens.html#idm140526920800080">6.2. Fields as Family Symbols</a></span></dt>+<dt><span class="sect2"><a href="sleigh_tokens.html#idm140526920794256">6.3. Attaching Alternate Meanings to Fields</a></span></dt><dt><span class="sect2"><a href="sleigh_tokens.html#sleigh_context_variables">6.4. Context Variables</a></span></dt></dl></dd><dt><span class="sect1"><a href="sleigh_constructors.html">7. Constructors</a></span></dt><dd><dl>-<dt><span class="sect2"><a href="sleigh_constructors.html#idm140016193117504">7.1. The Five Sections of a Constructor</a></span></dt>-<dt><span class="sect2"><a href="sleigh_constructors.html#idm140016193112928">7.2. The Table Header</a></span></dt>+<dt><span class="sect2"><a href="sleigh_constructors.html#idm140526920750848">7.1. The Five Sections of a Constructor</a></span></dt>+<dt><span class="sect2"><a href="sleigh_constructors.html#idm140526920746272">7.2. The Table Header</a></span></dt><dt><span class="sect2"><a href="sleigh_constructors.html#sleigh_display_section">7.3. The Display Section</a></span></dt><dt><span class="sect2"><a href="sleigh_constructors.html#sleigh_bit_pattern">7.4. The Bit Pattern Section</a></span></dt><dt><span class="sect2"><a href="sleigh_constructors.html#sleigh_disassembly_actions">7.5. Disassembly Actions Section</a></span></dt>@@ -87,12 +87,12 @@<dt><span class="sect2"><a href="sleigh_constructors.html#sleigh_semantic_section">7.7. The Semantic Section</a></span></dt><dt><span class="sect2"><a href="sleigh_constructors.html#sleigh_tables">7.8. Tables</a></span></dt><dt><span class="sect2"><a href="sleigh_constructors.html#sleigh_macros">7.9. P-code Macros</a></span></dt>-<dt><span class="sect2"><a href="sleigh_constructors.html#idm140016192659536">7.10. Build Directives</a></span></dt>-<dt><span class="sect2"><a href="sleigh_constructors.html#idm140016192651168">7.11. Delay Slot Directives</a></span></dt>+<dt><span class="sect2"><a href="sleigh_constructors.html#idm140526920290640">7.10. Build Directives</a></span></dt>+<dt><span class="sect2"><a href="sleigh_constructors.html#idm140526920281024">7.11. Delay Slot Directives</a></span></dt></dl></dd><dt><span class="sect1"><a href="sleigh_context.html">8. Using Context</a></span></dt><dd><dl>-<dt><span class="sect2"><a href="sleigh_context.html#idm140016192630992">8.1. Basic Use of Context Variables</a></span></dt>+<dt><span class="sect2"><a href="sleigh_context.html#idm140526920261472">8.1. Basic Use of Context Variables</a></span></dt><dt><span class="sect2"><a href="sleigh_context.html#sleigh_local_change">8.2. Local Context Change</a></span></dt><dt><span class="sect2"><a href="sleigh_context.html#sleigh_global_change">8.3. Global Context Change</a></span></dt></dl></dd>@@ -101,7 +101,7 @@</div><div class="simplesect"><div class="titlepage"><div><div><h2 class="title" style="clear: both">-<a name="idm140016193435456"></a>History</h2></div></div></div>+<a name="idm140526921055904"></a>History</h2></div></div></div><p>This document describes the syntax for the SLEIGH processorspecification language, which was developed for the GHIDRA@@ -129,7 +129,7 @@</div><div class="simplesect"><div class="titlepage"><div><div><h2 class="title" style="clear: both">-<a name="idm140016193415136"></a>Overview</h2></div></div></div>+<a name="idm140526921052720"></a>Overview</h2></div></div></div><p>SLEIGH is a language for describing the instruction sets of generalpurpose microprocessors, in order to facilitate the reverse@@ -162,7 +162,7 @@ Italics are used when defining terms and for named entities. Bold is used for SL</div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both">-<a name="idm140016193411168"></a>1.�Introduction to P-Code</h2></div></div></div>+<a name="idm140526921048752"></a>1.�Introduction to P-Code</h2></div></div></div><p>Although p-code is a distinct language from SLEIGH, because a majorpurpose of SLEIGH is to specify the translation from machine code to@@ -221,7 +221,7 @@ respectively.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193402816"></a>1.1.�Address Spaces</h3></div></div></div>+<a name="idm140526921040400"></a>1.1.�Address Spaces</h3></div></div></div><p>An <span class="emphasis"><em>address</em></span> space for p-code is a generalization ofthe indexed memory (RAM) that a typical processor has access to, and@@ -322,7 +322,7 @@ must be provided and enforced by the specification designer.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193387168"></a>1.3.�Operations</h3></div></div></div>+<a name="idm140526921024752"></a>1.3.�Operations</h3></div></div></div><p>P-code is intended to emulate a target processor by substituting asequence of p-code operations for each machine instruction. Thus everydiff --git a/GhidraDocs/languages/html/sleigh_constructors.html b/GhidraDocs/languages/html/sleigh_constructors.htmlindex 0a0b7f8e7d..21c175f0fd 100644--- a/GhidraDocs/languages/html/sleigh_constructors.html+++ b/GhidraDocs/languages/html/sleigh_constructors.html@@ -60,7 +60,7 @@ multiple constructors into a single table are addressed in <a class="xref" href=</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193117504"></a>7.1.�The Five Sections of a Constructor</h3></div></div></div>+<a name="idm140526920750848"></a>7.1.�The Five Sections of a Constructor</h3></div></div></div><p>A single complex statement in the specification file describes aconstructor. This statement is always made up of five distinct@@ -92,7 +92,7 @@ in turn.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193112928"></a>7.2.�The Table Header</h3></div></div></div>+<a name="idm140526920746272"></a>7.2.�The Table Header</h3></div></div></div><p>Every constructor must be part of a table, which is the element withan actual family symbol identifier associated with it. So each@@ -230,7 +230,7 @@ no such requirement.</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193083344"></a>7.3.2.�The '^' character</h4></div></div></div>+<a name="idm140526920716688"></a>7.3.2.�The '^' character</h4></div></div></div><p>The ‘^’ character in the display section is used to separateidentifiers from other characters where there shouldn’t be white space@@ -278,7 +278,7 @@ to <span class="emphasis"><em>match</em></span> the constructor being defined.</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193071904"></a>7.4.1.�Constraints</h4></div></div></div>+<a name="idm140526920705248"></a>7.4.1.�Constraints</h4></div></div></div><p>The patterns required for processor specifications can almost alwaysbe described as a mask and value pair. Given a specific instruction@@ -337,7 +337,7 @@ requires two or more mask/value style checks to correctly implement.</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193057968"></a>7.4.3.�Defining Operands and Invoking Subtables</h4></div></div></div>+<a name="idm140526920691312"></a>7.4.3.�Defining Operands and Invoking Subtables</h4></div></div></div><p>The principle way of defining a constructor operand, left undefinedfrom the display section, is done in the bit pattern section. If an@@ -396,7 +396,7 @@ statement of the grouping of old symbols into the new constructor.</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193046560"></a>7.4.4.�Variable Length Instructions</h4></div></div></div>+<a name="idm140526920679904"></a>7.4.4.�Variable Length Instructions</h4></div></div></div><p>There are some additional complexities to designing a specificationfor a processor with variable length instructions. Some initial@@ -419,7 +419,7 @@ designer control over how tokens fit together.</p><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016193043088"></a>7.4.4.1.�The ';' Operator</h5></div></div></div>+<a name="idm140526920676432"></a>7.4.4.1.�The ';' Operator</h5></div></div></div><p>The most important operator for patterns defining variable lengthinstructions is the concatenation operator ‘;’. When building a@@ -481,7 +481,7 @@ operator, so parentheses may be necessary to get the intended meaning.</div><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016193027776"></a>7.4.4.2.�The '...' Operator</h5></div></div></div>+<a name="idm140526920661120"></a>7.4.4.2.�The '...' Operator</h5></div></div></div><p>The ellipsis operator ‘...’ is used to satisfy the token matchingrequirements of the ‘&’ and ‘|’ operators (described in the previous@@ -557,7 +557,7 @@ don’t quite match the assembly.</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193007488"></a>7.4.6.�Empty Patterns</h4></div></div></div>+<a name="idm140526920640560"></a>7.4.6.�Empty Patterns</h4></div></div></div><p>Occasionally there is a need for an empty pattern when buildingtables. An empty pattern matches everything. There is a predefined@@ -567,7 +567,7 @@ to indicate an empty pattern.</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193005648"></a>7.4.7.�Advanced Constraints</h4></div></div></div>+<a name="idm140526920638720"></a>7.4.7.�Advanced Constraints</h4></div></div></div><p>A constraint does not have to be of the form “field = constant”,although this is almost always what is needed. In certain situations,@@ -821,7 +821,7 @@ assignment to such a variable changes the context in which the currentinstruction is being disassembled and can potentially have a drasticeffect on how the rest of the instruction is disassembled. Anassignment of this form is considered local to the instruction and-will not effect how other instructions are parsed. The context+will not affect how other instructions are parsed. The contextvariable is reset to its original value before parsing otherinstructions. The disassembly action may also contain one ormore <span class="bold"><strong>globalset</strong></span> directives, which@@ -939,7 +939,7 @@ varnode is <span class="emphasis"><em>r1</em></span>.</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016192898096"></a>7.7.1.�Expressions</h4></div></div></div>+<a name="idm140526920530304"></a>7.7.1.�Expressions</h4></div></div></div><p>Expressions are built out of symbols and the binary and unaryoperators listed in <a class="xref" href="sleigh_ref.html#syntaxref.htmltable" title="Table�5.�Semantic Expression Operators and Syntax">Table�5, “Semantic Expression Operators and Syntax”</a> in the@@ -954,7 +954,7 @@ within expressions to affect this order.</p><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016192895760"></a>7.7.1.1.�Arithmetic, Logical and Boolean Operators</h5></div></div></div>+<a name="idm140526920527872"></a>7.7.1.1.�Arithmetic, Logical and Boolean Operators</h5></div></div></div><p>For the most part these operators should be familiar to softwaredevelopers. The only real differences arise from the fact that@@ -1017,7 +1017,7 @@ set to something other than one.</div><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016192883312"></a>7.7.1.3.�Extension</h5></div></div></div>+<a name="idm140526920515552"></a>7.7.1.3.�Extension</h5></div></div></div><p>Most processors have instructions that extend small values into bigvalues, and many instructions do these minor data manipulations@@ -1039,7 +1039,7 @@ the <span class="bold"><strong>sext</strong></span> operator.</div><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016192876752"></a>7.7.1.4.�Truncation</h5></div></div></div>+<a name="idm140526920508832"></a>7.7.1.4.�Truncation</h5></div></div></div><p>There are two forms of syntax indicating a truncation of the inputvarnode. In one the varnode is followed by a colon ‘:’ and an integer@@ -1169,7 +1169,7 @@ the offset portion of the address, and to copy the desired value, the</div><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016192851952"></a>7.7.1.7.�Managed Code Operations</h5></div></div></div>+<a name="idm140526920484032"></a>7.7.1.7.�Managed Code Operations</h5></div></div></div><p>SLEIGH provides basic support for instructions where encoding and contextdon't provide a complete description of the semantics. This is the case@@ -1231,7 +1231,7 @@ define pcodeop arctan;</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016192839392"></a>7.7.2.�Statements</h4></div></div></div>+<a name="idm140526920471120"></a>7.7.2.�Statements</h4></div></div></div><p>We describe the types of semantic statements that are allowed in SLEIGH.</p>@@ -1305,7 +1305,7 @@ and may be enforced in future compiler versions.</div><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016192826448"></a>7.7.2.2.�Storage Statements</h5></div></div></div>+<a name="idm140526920458176"></a>7.7.2.2.�Storage Statements</h5></div></div></div><p>SLEIGH supports fairly standard <span class="emphasis"><em>storage statement</em></span>syntax to complement the load operator. The left-hand side of an@@ -1336,7 +1336,7 @@ attribute is set to something other than one.</div><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016192820512"></a>7.7.2.3.�Exports</h5></div></div></div>+<a name="idm140526920452240"></a>7.7.2.3.�Exports</h5></div></div></div><p>The semantic section doesn’t just specify how to generate p-code for aconstructor. Except for those constructors in the root table, this@@ -1366,7 +1366,7 @@ the table symbol <span class="emphasis"><em>mode</em></span>. When this construcmatched, as part of a more complicated instruction, thesymbol <span class="emphasis"><em>mode</em></span> will represent the original semanticvalue of <span class="emphasis"><em>reg</em></span> but with the standard post-increment-side effect.+side-effect.</p><p>The table symbol associated with the constructor becomes@@ -1388,7 +1388,7 @@ varnode being modified to be exported as an integer constant.</div><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016192809280"></a>7.7.2.4.�Dynamic References</h5></div></div></div>+<a name="idm140526920441008"></a>7.7.2.4.�Dynamic References</h5></div></div></div><p>The only other operator allowed as part ofan <span class="bold"><strong>export</strong></span> statement, is the ‘*’@@ -1447,7 +1447,7 @@ levels.</div><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016192795680"></a>7.7.2.5.�Branching Statements</h5></div></div></div>+<a name="idm140526920427360"></a>7.7.2.5.�Branching Statements</h5></div></div></div><p>This section discusses statements that generate p-code branchingoperations. These are listed in <a class="xref" href="sleigh_ref.html#branchref.htmltable" title="Table�7.�Branching Statements">Table�7, “Branching Statements”</a>, in the Appendix.@@ -1802,7 +1802,7 @@ each followed by a variation which corrects the error.</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016192728656"></a>7.7.4.�Unimplemented Semantics</h4></div></div></div>+<a name="idm140526920360336"></a>7.7.4.�Unimplemented Semantics</h4></div></div></div><p>The semantic section must be present for every constructor in thespecification. But the designer can leave the semantics explicitly@@ -1962,7 +1962,7 @@ should generally be avoided.</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016192701504"></a>7.8.2.�Specific Symbol Trees</h4></div></div></div>+<a name="idm140526920333184"></a>7.8.2.�Specific Symbol Trees</h4></div></div></div><p>When the SLEIGH parser analyzes an instruction, it starts with theroot symbol <span class="emphasis"><em>instruction</em></span>, and decides which of the@@ -2045,7 +2045,7 @@ and p-code for these encodings by walking the trees.</p><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016192682592"></a>7.8.2.1.�Disassembly Trees</h5></div></div></div>+<a name="idm140526920314640"></a>7.8.2.1.�Disassembly Trees</h5></div></div></div><p>If the nodes of each tree are replaced with the display information ofthe corresponding specific symbol, we see how the disassembly@@ -2068,7 +2068,7 @@ statements corresponding to the original instruction encodings.</div><div class="sect4"><div class="titlepage"><div><div><h5 class="title">-<a name="idm140016192676208"></a>7.8.2.2.�P-code Trees</h5></div></div></div>+<a name="idm140526920308256"></a>7.8.2.2.�P-code Trees</h5></div></div></div><p>A similar procedure produces the resulting p-code translation of theinstruction. If each node in the specific symbol tree is replaced with@@ -2147,7 +2147,7 @@ directive however should not be used in a macro.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016192659536"></a>7.10.�Build Directives</h3></div></div></div>+<a name="idm140526920290640"></a>7.10.�Build Directives</h3></div></div></div><p>Because the nodes of a specific symbol tree are traversed in adepth-first order, the p-code for a child node in general comes before@@ -2202,7 +2202,7 @@ normal action of the instruction.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016192651168"></a>7.11.�Delay Slot Directives</h3></div></div></div>+<a name="idm140526920281024"></a>7.11.�Delay Slot Directives</h3></div></div></div><p>For processors with a pipe-lined architecture, multiple instructionsare typically executing simultaneously. This can lead to processordiff --git a/GhidraDocs/languages/html/sleigh_context.html b/GhidraDocs/languages/html/sleigh_context.htmlindex fa762bb070..f8c72d7a6e 100644--- a/GhidraDocs/languages/html/sleigh_context.html+++ b/GhidraDocs/languages/html/sleigh_context.html@@ -85,7 +85,7 @@ whose encodings are otherwise the same.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016192630992"></a>8.1.�Basic Use of Context Variables</h3></div></div></div>+<a name="idm140526920261472"></a>8.1.�Basic Use of Context Variables</h3></div></div></div><p>Suppose a processor supports the use of two different sets ofregisters in its main addressing mode, based on the setting of a@@ -317,7 +317,7 @@ blr is opcode=35 & reg=15 & LRset=1 { return [lr]; }An alternative to the <span class="bold"><strong>noflow</strong></span> attribute is to simply issuemultiple directives within a single constructor, so an explicit end to a context changecan be given. The value of the variable exported to the global state-is the one in affect at the point where the directive is issued. Thus,+is the one in effect at the point where the directive is issued. Thus,after one <span class="bold"><strong>globalset</strong></span>, the same contextvariable can be assigned a different value, followed byanother <span class="bold"><strong>globalset</strong></span> for a different@@ -328,7 +328,7 @@ Because context in SLEIGH is controlled by a disassembly process,there are some basic caveats to the use ofthe <span class="bold"><strong>globalset</strong></span> directive. With<span class="emphasis"><em>flowing</em></span> context changes,-there is no guarantee of what global state will be in affect at a+there is no guarantee of what global state will be in effect at aparticular address. During disassembly, at any givenpoint, the process may not have uncovered all the relevant directives,and the known directives may not necessarily be consistent. Indiff --git a/GhidraDocs/languages/html/sleigh_definitions.html b/GhidraDocs/languages/html/sleigh_definitions.htmlindex 49f23dd0a8..96265a83e0 100644--- a/GhidraDocs/languages/html/sleigh_definitions.html+++ b/GhidraDocs/languages/html/sleigh_definitions.html@@ -44,18 +44,19 @@ define endian=little;</pre></div><p>This defines how the processor interprets contiguous sequences of-bytes as integers. It effects how integer fields within an instruction-are interpreted (see <a class="xref" href="sleigh_tokens.html#sleigh_defining_tokens" title="6.1.�Defining Tokens and Fields">Section�6.1, “Defining Tokens and Fields”</a>), and-it also effects the details of how the processor is supposed to-implement atomic operations like integer addition and integer-compare. The specification designer should only need to worry about-these details when labeling instruction fields, otherwise the-specification language will hide endianess issues.+bytes as integers or other values and globally affects values across+all address spaces. It also affects how integer fields+within an instruction are interpreted, (see <a class="xref" href="sleigh_tokens.html#sleigh_defining_tokens" title="6.1.�Defining Tokens and Fields">Section�6.1, “Defining Tokens and Fields”</a>),+although it is possible to override this setting in the rare case that endianess is+different for data versus instruction encoding.+The specification designer generally only needs to worry about+endianess when labeling instruction fields and when defining overlapping registers,+otherwise the specification language hides endianess issues.</p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193284896"></a>4.2.�Alignment Definition</h3></div></div></div>+<a name="idm140526921098128"></a>4.2.�Alignment Definition</h3></div></div></div><p>An alignment definition looks like</p>@@ -72,7 +73,7 @@ instruction as an error.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193281872"></a>4.3.�Space Definitions</h3></div></div></div>+<a name="idm140526921095104"></a>4.3.�Space Definitions</h3></div></div></div><p>The definition of an address space looks like</p>@@ -227,7 +228,7 @@ define register offset=0 size=1</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193245424"></a>4.5.�Bit Range Registers</h3></div></div></div>+<a name="idm140526920875744"></a>4.5.�Bit Range Registers</h3></div></div></div><p>Many processors define registers that either consist of a single bitor otherwise don't use an integral number of bytes. A recurring@@ -298,7 +299,7 @@ used as an alternate syntax for defining overlapping registers.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193233216"></a>4.6.�User-Defined Operations</h3></div></div></div>+<a name="idm140526920863712"></a>4.6.�User-Defined Operations</h3></div></div></div><p>The specification designer can define new p-code operations usinga <span class="bold"><strong>define pcodeop</strong></span> statement. Thisdiff --git a/GhidraDocs/languages/html/sleigh_layout.html b/GhidraDocs/languages/html/sleigh_layout.htmlindex 1f312277df..8b641bacdf 100644--- a/GhidraDocs/languages/html/sleigh_layout.html+++ b/GhidraDocs/languages/html/sleigh_layout.html@@ -36,7 +36,7 @@ by the compiler.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193347968"></a>2.1.�Comments</h3></div></div></div>+<a name="idm140526920986416"></a>2.1.�Comments</h3></div></div></div><p>Comments start with the ‘#’ character and continue to the end of theline. Comments can appear anywhere except the <span class="emphasis"><em>display section</em></span> of a@@ -46,7 +46,7 @@ interpreted as something that should be printed in disassembly.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193345328"></a>2.2.�Identifiers</h3></div></div></div>+<a name="idm140526920983776"></a>2.2.�Identifiers</h3></div></div></div><p>Identifiers are made up of letters a-z, capitals A-Z, digits 0-9 andthe characters ‘.’ and ‘_’. An identifier can use these characters in@@ -55,7 +55,7 @@ any order and for any length, but it must not start with a digit.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193343696"></a>2.3.�Strings</h3></div></div></div>+<a name="idm140526920982144"></a>2.3.�Strings</h3></div></div></div><p>String literals can be used, when specifying names and when specifyinghow disassembly should be printed, so that special characters are@@ -66,7 +66,7 @@ meaning.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193341936"></a>2.4.�Integers</h3></div></div></div>+<a name="idm140526920980384"></a>2.4.�Integers</h3></div></div></div><p>Integers are specified either in a decimal format or in a standard<span class="emphasis"><em>C-style</em></span> hexadecimal format by prepending the@@ -92,7 +92,7 @@ integers internally with 64 bits of precision.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193337552"></a>2.5.�White Space</h3></div></div></div>+<a name="idm140526920976000"></a>2.5.�White Space</h3></div></div></div><p>White space characters include space, tab, line-feed, verticalline-feed, and carriage-return (‘ ‘, ‘\t’, ‘\r’, ‘\v’,diff --git a/GhidraDocs/languages/html/sleigh_preprocessing.html b/GhidraDocs/languages/html/sleigh_preprocessing.htmlindex 1eb1e45f3a..5f47bc64bc 100644--- a/GhidraDocs/languages/html/sleigh_preprocessing.html+++ b/GhidraDocs/languages/html/sleigh_preprocessing.html@@ -54,7 +54,7 @@ own <span class="bold"><strong>@include</strong></span> directives.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193329920"></a>3.2.�Preprocessor Macros</h3></div></div></div>+<a name="idm140526920968368"></a>3.2.�Preprocessor Macros</h3></div></div></div><p>SLEIGH allows simple (unparameterized) macro definitions andexpansions. A macro definition occurs on one line and starts with@@ -85,7 +85,7 @@ definition of a macro from that point on in the file.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193323088"></a>3.3.�Conditional Compilation</h3></div></div></div>+<a name="idm140526920961536"></a>3.3.�Conditional Compilation</h3></div></div></div><p>SLEIGH supports several directives that allow conditional inclusion ofparts of a specification, based on the existence of a macro, or its@@ -103,7 +103,7 @@ and <span class="bold"><strong>@endif</strong></span>.</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193316944"></a>3.3.1.�@ifdef and @ifndef</h4></div></div></div>+<a name="idm140526920955392"></a>3.3.1.�@ifdef and @ifndef</h4></div></div></div><p>The <span class="bold"><strong>@ifdef</strong></span> directive is followed by amacro identifier and evaluates to true if the macro is defined.@@ -129,7 +129,7 @@ or <span class="bold"><strong>@elif</strong></span> directive (See below).</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193310672"></a>3.3.2.�@if</h4></div></div></div>+<a name="idm140526920949120"></a>3.3.2.�@if</h4></div></div></div><p>The <span class="bold"><strong>@if</strong></span> directive is followed by aboolean expression with macros as the variables and strings as the@@ -158,7 +158,7 @@ is defined.</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193303584"></a>3.3.3.�@else and @elif</h4></div></div></div>+<a name="idm140526920942032"></a>3.3.3.�@else and @elif</h4></div></div></div><p>An <span class="bold"><strong>@else</strong></span> directive splits the linesbounded by an <span class="bold"><strong>@if</strong></span> directive anddiff --git a/GhidraDocs/languages/html/sleigh_symbols.html b/GhidraDocs/languages/html/sleigh_symbols.htmlindex 6eb2b83374..a3ab15203c 100644--- a/GhidraDocs/languages/html/sleigh_symbols.html+++ b/GhidraDocs/languages/html/sleigh_symbols.html@@ -105,7 +105,7 @@ the predefined identifier <span class="emphasis"><em>instruction</em></span>.</p><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193206464"></a>5.1.�Notes on Namespaces</h3></div></div></div>+<a name="idm140526920845152"></a>5.1.�Notes on Namespaces</h3></div></div></div><p>Almost all identifiers live in the same global "scope". The global scope includes</p>@@ -138,7 +138,7 @@ individual <span class="emphasis"><em>constructor</em></span> (defined in <a cladefines a local scope for operand names. As with most languages, alocal symbol with the same name as a globalsymbol <span class="emphasis"><em>hides</em></span> the global symbol while that scope-is in affect.+is in effect.</p></div><div class="sect2">diff --git a/GhidraDocs/languages/html/sleigh_tokens.html b/GhidraDocs/languages/html/sleigh_tokens.htmlindex 79521cfd7b..dc572dfdb4 100644--- a/GhidraDocs/languages/html/sleigh_tokens.html+++ b/GhidraDocs/languages/html/sleigh_tokens.html@@ -56,8 +56,22 @@ there are one or more field declarations specifying the name of thefield and the range of bits within the token making up the field. Thesize of a field does <span class="emphasis"><em>not</em></span> need to be a multiple of8. The range is inclusive where the least significant bit in the token-is labeled 0. The endianess of the processor will effect this labeling-when defining tokens that are bigger than 1 byte. After each field+is labeled 0. When defining tokens that are bigger than 1 byte, the+global endianess setting (See <a class="xref" href="sleigh_definitions.html#sleigh_endianess_definition" title="4.1.�Endianess Definition">Section�4.1, “Endianess Definition”</a>)+will affect this labeling. Although it is rarely required, it is possible to override+the global endianess setting for a specific token by appending either the qualifier+<span class="bold"><strong>endian=little</strong></span> or <span class="bold"><strong>endian=big</strong></span>+immediately after the token name and size. For instance:+</p>+<div class="informalexample"><pre class="programlisting">+ define token instr ( 32 ) endian=little op0=(0,15) <span class="weak">...</span>+</pre></div>+<p>+The token <span class="emphasis"><em>instr</em></span> is overridden to be little endian.+This override applies to all fields defined for the token but affects no other tokens.+</p>+<p>+After each fielddeclaration, there can be zero or more of the following attributekeywords:</p>@@ -74,7 +88,7 @@ different names.</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193166064"></a>6.2.�Fields as Family Symbols</h3></div></div></div>+<a name="idm140526920800080"></a>6.2.�Fields as Family Symbols</h3></div></div></div><p>Fields are the most basic form of family symbol; they define a naturalmap from instruction bits to a specific symbol as follows. We take the@@ -99,7 +113,7 @@ the <span class="bold"><strong>dec</strong></span> attribute is not supported]</div><div class="sect2"><div class="titlepage"><div><div><h3 class="title">-<a name="idm140016193160240"></a>6.3.�Attaching Alternate Meanings to Fields</h3></div></div></div>+<a name="idm140526920794256"></a>6.3.�Attaching Alternate Meanings to Fields</h3></div></div></div><p>The default interpretation of a field is probably the most natural butof course processors interpret fields within an instruction in a wide@@ -110,7 +124,7 @@ interpretations must be built up out of tables.</p><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193158096"></a>6.3.1.�Attaching Registers</h4></div></div></div>+<a name="idm140526920792112"></a>6.3.1.�Attaching Registers</h4></div></div></div><p>Probably <span class="emphasis"><em>the</em></span> most common processor interpretationof a field is as an encoding of a particular register. In SLEIGH this@@ -149,7 +163,7 @@ of the instruction.</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193149824"></a>6.3.2.�Attaching Other Integers</h4></div></div></div>+<a name="idm140526920783840"></a>6.3.2.�Attaching Other Integers</h4></div></div></div><p>Sometimes a processor interprets a field as an integer but not theinteger given by the default interpretation. A different integer@@ -171,7 +185,7 @@ unspecified positions in the list using a ‘_’]</div><div class="sect3"><div class="titlepage"><div><div><h4 class="title">-<a name="idm140016193144192"></a>6.3.3.�Attaching Names</h4></div></div></div>+<a name="idm140526920778208"></a>6.3.3.�Attaching Names</h4></div></div></div><p>It is possible to just modify the display characteristics of a fieldwithout changing the semantic meaning. The need for this is rare, but