blob: 4f7e2b1f278b7793b5c170ac31b789e5042d8509 [file]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Target Communication Framework Services - Disassembly</title>
</head>
<body lang='EN-US'>
<h1>Target Communication Framework Services - Disassembly</h1>
<ul>
<li><a href='#VersionHistory'>Version History</a>
<li><a href='#Overview'>Overview</a>
<li><a href='#Cmds'>Commands</a>
<ul>
<li><a href='#CmdGetCapabilities'>Get Capabilities</a>
<li><a href='#CmdDisassemble'>Disassemble</a>
</ul>
<li><a href='#API'>API</a>
</ul>
<h1>Disassembly Service</h1>
<h2><a name='VersionHistory'>Version History</a></h2>
<table border=1 cellpadding=8>
<tr>
<th>Version
<th>Date
<th>Change
<tr>
<td>0.1
<td>2011-02-18
<td>Initial contribution
</table>
<h2><a name='Overview'>Overview</a></h2>
<p>Disassembly is the translation of machine language (or memory bytes), into human readable assembly language. The readable assembly language is produced from a specified Instruction Set Architecture (or ISA).</p>
<p>While disassembly is dependent upon a specific processor architecture, the memory from which it is derived is not. So for a given memory context, or buffer, the specified ISA used to disassemble the memory bytes is subjective to the Tool or user.</p>
<p>The service uses standard format for error reports,
see <a href='TCF Error Report Format.html'>Error Report Format</a>.</p>
<h2><a name='Cmds'>Commands</a></h2>
<h3><a name='CmdDisassemble'>Disassemble</a></h3>
<pre><b><font face="Courier New" size=2 color=#333399>
C &bull; <i>&lt;token&gt;</i> &bull; Disassembly &bull; disassemble &bull; <i>&lt;string: context-id&gt;</i> &bull; <i>&lt;int: start location&gt;</i> &bull; <i>&lt;int: size&gt;</i> &bull; <i>&lt;object: disassembly parameters&gt;</i> &bull;</font></b></pre>
<p> The command disassembles instruction code from a specified range of memory, in a specified context.<p>
<p>Where context-id is the memory context in which to process the command.</p>
<p>Predefined properties are:</p>
<ul>
<li><code><b><font face="Courier New" size=2 color=#333399><a name='propISA'>"ISA"</a> : <i>&lt;string&gt;</i></font></b></code>
- The name of the instruction set architecture.
<li><code><b><font face="Courier New" size=2 color=#333399><a name='propSimplified'>"Simplified"</a> : <i>&lt;boolean&gt;</i></font></b></code>
- If true, simplified mnemonics are specified.
<li><code><b><font face="Courier New" size=2 color=#333399><a name='propPseudoInst'>"PseudoInstructions"</a> : <i>&lt;boolean&gt;</i></font></b></code>
- If true, pseudo-instructions are requested.
<li><code><b><font face="Courier New" size=2 color=#333399><a name='propOpcodeValue'>"OpcodeValue"</a> : <i>&lt;boolean&gt;</i></font></b></code>
- If true, the instruction code byte values are returned.
</ul>
<p>Reply:</p>
<pre><b><font face="Courier New" size=2 color=#333399>
R &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;error report&gt;</i> &bull; <i>&lt;array: disassembly output&gt;</i> &bull;
<i>&lt;array: disassembly output&gt;</i>
&rArr; <i>&lt;null&gt;</i>
&rArr; [ ]
&rArr; [ <i>&lt;disassembly line list&gt;</i> ]
<i>&lt;disassembly line list&gt;</i>
&rArr; <i>&lt;object: disassembly line&gt;</i>
&rArr; <i>&lt;disassembly line list&gt;</i>, <i>&lt;object: disassembly line&gt;</i>
</font></b></pre>
<pre><b><font face="Courier New" size=2 color=#333399>
<i>&lt;object: disassembly line&gt;</i>
</font></b></pre>
<p>Disassembly line is an object containing properties. Predefined properties are:</p>
<ul>
<li><code><b><font face="Courier New" size=2 color=#333399>"ISA" : <i>&lt;string&gt;</i></font></b></code>
- Instruction Set Architecture of the disassembly line
<li><code><b><font face="Courier New" size=2 color=#333399>"Address" : <i>&lt;int&gt;</i></font></b></code>
- Address of the instruction
<li><code><b><font face="Courier New" size=2 color=#333399>"Size" : <i>&lt;int&gt;</i></font></b></code>
- Size of the instruction in bytes
<li><code><b><font face="Courier New" size=2 color=#333399>"Instruction" : <i>&lt;array&gt;</i></font></b></code>
- Array of the intruction fields
<li><code><b><font face="Courier New" size=2 color=#333399>"OpcodeValue" : <i>&lt;string&gt;</i></font></b></code>
- Encoded byte array of the instruction binary representation
</ul>
<pre><b><font face="Courier New" size=2 color=#333399>
<i>&lt;object: Instruction field&gt;</i>
</font></b></pre>
<p>Instruction field is an object containing properties. Predefined properties are:</p>
<ul>
<li><code><b><font face="Courier New" size=2 color=#333399>"Type" : <i>&lt;string&gt;</i></font></b></code>
- The predefined type of the instruction field. Predefined types are:
<ul>
<li>"String"
<li>"Register"
<li>"Address"
<li>"Displacement"
<li>"Immediate"
</ul>
<li><code><b><font face="Courier New" size=2 color=#333399>"Text" : <i>&lt;string&gt;</i></font></b></code>
- Value of the field for "String" and "Register" types.
<li><code><b><font face="Courier New" size=2 color=#333399>"Value" : <i>&lt;number&gt;</i></font></b></code>
- Value of the field for "Address," "Displacement," or "Immediate" types.
<li><code><b><font face="Courier New" size=2 color=#333399>"AddressSpace" : <i>&lt;context-id&gt;</i></font></b></code>
- Context-ID of the address space used with the "Address" type.
</ul>
<p><b>Examples:</b></p>
<p>The following command requests disassembly at address <code>0x1000</code>, for 8 bytes, in memory context "mc1", using a generic PowerPC ISA, and requesting instruction code bytes:</p>
<pre><b><font face="Courier New" size=2 color=#333399>
C <i>&lt;token&gt;</i> Disassembly <i>disassemble "mc1" 0x1000 8 {ISA:PPC,OpcodeValue:true}</i>
</font></b></pre>
<h3><a name='CmdGetCapabilities'>Get Capabilities</a></h3>
<pre><b><font face="Courier New" size=2 color=#333399>
C &bull; <i>&lt;token&gt;</i> &bull; Disassembly &bull; getCapabilities &bull; <i>&lt;string: context ID&gt;</i> &bull;
</font></b></pre>
<p>The command reports disassembly service capabilities to clients so they
can adjust to different implementations of the service.
The exact definition of context depends on the target agent and provided topology.</p>
<p>Reply:</p>
<pre><b><font face="Courier New" size=2 color=#333399>
R &bull; <i>&lt;token&gt;</i> &bull; <i>&lt;error report&gt;</i> &bull; <i>&lt;service capabilities&gt;</i> &bull;
<i>&lt;service capabilities&gt;</i>
&rArr; <i>&lt;null&gt;</i>
&rArr; <i>&lt;array: capabilities list&gt;</i>
</font></b></pre>
<p>Service capabilities consist of an array of lists of properties. All properties are optional.
Tools and targets can define additional properties. Predefined properties are:</p>
<ul>
<li><code><b><font face="Courier New" size=2 color=#333399>"ISA" : <i>&lt;string&gt;</i></font></b></code>
- The name of the supported instruction set architecture
<li><code><b><font face="Courier New" size=2 color=#333399>"Simplified" : <i>&lt;boolean&gt;</i></font></b></code>
- If true, simplified mnemonics are supported. These are typical 1:1 correlation of architecture instruction to simplified mnemonic.
<li><code><b><font face="Courier New" size=2 color=#333399>"PseudoInstruction" : <i>&lt;boolean&gt;</i></font></b></code>
- If true, pseudo-instructions are supported. These are typically macros, which correlate multiple architecture instructions to one pseudo-instruction.
<li><code><b><font face="Courier New" size=2 color=#333399>"OpcodeValue" : <i>&lt;boolean&gt;</i></font></b></code>
- If true, the decoded instruction code bytes are retrievable with the OpcodeValue parameter.
</ul>
<h2><a name='API'>API</a></h2>
<pre>
<font color=#3F5FBF>/**
* TCF Disassembly service interface.
*
* <font color=#7F9FBF>@noimplement</font> This interface is not intended to be implemented by clients.
*/</font>
<font color=#7F0055>public interface</font> IDisassembly <font color=#7F0055>extends</font> IService {
<font color=#3F5FBF>/**
* This service name, as it appears on the wire - a TCF name of the service.
*/</font>
<font color=#7F0055>static final</font> String NAME = "Disassembly";
<font color=#7F0055>static final</font> String
<font color=#3F5FBF>/** The name of the instruction set architecture, String */</font>
CAPABILITY_ISA = "ISA",
<font color=#3F5FBF>/** If true, simplified mnemonics are supported or requested, Boolean */</font>
CAPABILITY_SIMPLIFIED = "Simplified",
<font color=#3F5FBF>/** If true, pseudo-instructions are supported or requested, Boolean */</font>
CAPABILITY_PSEUDO = "Pseudo",
<font color=#3F5FBF>/** If true, instruction code bytes are supported or requested, Boolean */</font>
CAPABILITY_OPCODE = "OpcodeValue";
<font color=#3F5FBF>/**
* Retrieve disassembly service capabilities a given context-id.
* <font color=#7F9FBF>@param</font> context_id - a context ID, usually one returned by Run Control or Memory services.
* <font color=#7F9FBF>@param</font> done - command result call back object.
* <font color=#7F9FBF>@return</font> - pending command handle.
*/</font>
IToken getCapabilities(String context_id, DoneGetCapabilities done);
<font color=#3F5FBF>/**
* Call back interface for 'getCapabilities' command.
*/</font>
<font color=#7F0055>interface</font> DoneGetCapabilities {
<font color=#3F5FBF>/**
* Called when capabilities retrieval is done.
* <font color=#7F9FBF>@param</font> token - command handle.
* <font color=#7F9FBF>@param</font> error - error object or null.
* <font color=#7F9FBF>@param</font> capabilities - array of capabilities, see CAPABILITY_* for contents of each array element.
*/</font>
<font color=#7F0055>void</font> doneGetCapabilities(IToken token, Throwable error, Map&lt;String,Object&gt;[] capabilities);
}
<font color=#3F5FBF>/**
* Disassemble instruction code from a specified range of memory addresses, in a specified context.
* <font color=#7F9FBF>@param</font> context_id - a context ID, usually one returned by Run Control or Memory services.
* <font color=#7F9FBF>@param</font> addr - address of first instruction to disassemble.
* <font color=#7F9FBF>@param</font> size - size in bytes of the address range.
* <font color=#7F9FBF>@param</font> params - properties to control the disassembly output, an element of capabilities array, see getCapabilities.
* <font color=#7F9FBF>@param</font> done - command result call back object.
* <font color=#7F9FBF>@return</font> - pending command handle.
*/</font>
IToken disassemble(String context_id, Number addr, <font color=#7F0055>int</font> size, Map&lt;String,Object&gt; params, DoneDisassemble done);
<font color=#3F5FBF>/**
* Call back interface for 'disassemble' command.
*/</font>
<font color=#7F0055>interface</font> DoneDisassemble {
<font color=#3F5FBF>/**
* Called when disassembling is done.
* <font color=#7F9FBF>@param</font> token - command handle.
* <font color=#7F9FBF>@param</font> error - error object or null.
* <font color=#7F9FBF>@param</font> disassembly - array of disassembly lines.
*/</font>
<font color=#7F0055>void</font> doneDisassemble(IToken token, Throwable error, IDisassemblyLine[] disassembly);
}
<font color=#3F5FBF>/**
* Interface to represent a single disassembly line.
*/</font>
<font color=#7F0055>interface</font> IDisassemblyLine {
<font color=#3F5FBF>/**
* <font color=#7F9FBF>@return</font> instruction address.
*/</font>
Number getAddress();
<font color=#3F5FBF>/**
* <font color=#7F9FBF>@return</font> instruction size in bytes.
*/</font>
<font color=#7F0055>int</font> getSize();
<font color=#3F5FBF>/**
* <font color=#7F9FBF>@return</font> instruction binary representation.
*/</font>
<font color=#7F0055>byte</font>[] getOpcodeValue();
<font color=#3F5FBF>/**
* <font color=#7F9FBF>@return</font> array of instruction fields, each field is a collection of field properties, see FIELD_*.
*/</font>
Map&lt;String,Object&gt;[] getInstruction();
}
<font color=#3F5FBF>/** Instruction field properties */</font>
<font color=#7F0055>static final</font> String
<font color=#3F5FBF>/** The type of the instruction field. See FTYPE_*, String. */</font>
FIELD_TYPE = "Type",
<font color=#3F5FBF>/** Value of the field for "String" and "Register" types, String. */</font>
FIELD_TEXT = "Text",
<font color=#3F5FBF>/** Value of the field for "Address", "Displacement", or "Immediate" types, Number. */</font>
FIELD_VALUE = "Value",
<font color=#3F5FBF>/** Context ID of the address space used with "Address" types, String. */</font>
FIELD_ADDRESS_SPACE = "AddressSpace";
<font color=#3F5FBF>/** Instruction field types */</font>
<font color=#7F0055>static final</font> String
FTYPE_STRING = "String",
FTYPE_ADDRESS = "Address",
FTYPE_DISPLACEMENT = "Displacement",
FTYPE_IMMEDIATE = "Immediate";
<font color=#3F5FBF>/** <font color=#7F9FBF>@since</font> 1.7 */</font>
<font color=#7F0055>static final</font> String
FTYPE_REGISTER = "Register";
<font color=#3F5FBF>/**
* @deprecated
*/</font>
<font color=#7F0055>static final</font> String
FTYPE_Register = "Register";
}
</pre>
</body>
</html>