-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path3230-Improve-documentation-for-context-variables.patch
64 lines (61 loc) · 3.1 KB
/
3230-Improve-documentation-for-context-variables.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Pokechu22 <[email protected]>
Date: Fri, 16 Jul 2021 18:03:06 -0700
Subject: [PATCH] 3230: Improve documentation for context variables
Add paragraph on registers associated with context variables
---
Ghidra/Features/Decompiler/src/main/doc/sleigh.xml | 14 ++++++++++++++
GhidraDocs/languages/html/sleigh_context.html | 14 ++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/Ghidra/Features/Decompiler/src/main/doc/sleigh.xml b/Ghidra/Features/Decompiler/src/main/doc/sleigh.xml
index d83b38ed33..536016f5f6 100644
--- a/Ghidra/Features/Decompiler/src/main/doc/sleigh.xml
+++ b/Ghidra/Features/Decompiler/src/main/doc/sleigh.xml
@@ -3685,6 +3685,20 @@ make the final decision about which form to generate. The setting of
this state is (at least partially) out of the control of SLEIGH,
although see the following sections.
</para>
+<para>
+Note that a context variable is tied to a specific register (in the
+example above, it is <emphasis>statusreg</emphasis>). Although this
+register can be one that is used by the actual processor for the same
+purpose, it is often convenient to use a separate register, as
+context variables can be used for purposes where the real processor
+does not have an (exposed) register. Context variables are not updated
+in the semantic actions section of a constructor, only in the disassembly
+actions section (see below), which also makes using the same register
+awkward. Lastly, note that due to implementation constraints, the
+register associated with a context variable must have a size that is
+a multiple of 4 bytes, though each context variable itself can be any
+size up to 32 bits.
+</para>
</sect2>
<sect2 id="sleigh_local_change">
<title>Local Context Change</title>
diff --git a/GhidraDocs/languages/html/sleigh_context.html b/GhidraDocs/languages/html/sleigh_context.html
index 0239994cde..6f1bd3b915 100644
--- a/GhidraDocs/languages/html/sleigh_context.html
+++ b/GhidraDocs/languages/html/sleigh_context.html
@@ -146,6 +146,20 @@ make the final decision about which form to generate. The setting of
this state is (at least partially) out of the control of SLEIGH,
although see the following sections.
</p>
+<p>
+Note that a context variable is tied to a specific register (in the
+example above, it is <span class="emphasis"><em>statusreg</em></span>). Although this
+register can be one that is used by the actual processor for the same
+purpose, it is often convenient to use a separate register, as
+context variables can be used for purposes where the real processor
+does not have an (exposed) register. Context variables are not updated
+in the semantic actions section of a constructor, only in the disassembly
+actions section (see below), which also makes using the same register
+awkward. Lastly, note that due to implementation constraints, the
+register associated with a context variable must have a size that is
+a multiple of 4 bytes, though each context variable itself can be any
+size up to 32 bits.
+</p>
</div>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
--
2.45.1