summaryrefslogtreecommitdiff
path: root/src/arch/immediate.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-05-24 22:34:42 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-05-24 22:34:42 (GMT)
commit0b7d7f26c745ff0f52e9e483a0980351368ca824 (patch)
treea244c063bdfa69f2605be6b1a1e80d9a8551602c /src/arch/immediate.c
parentf7e5d077e0d62f8b8717c79616852c3e1009cfa6 (diff)
Supported nine extra x86 opcodes.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@66 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/immediate.c')
-rw-r--r--src/arch/immediate.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/arch/immediate.c b/src/arch/immediate.c
index dde5f02..7ef1220 100644
--- a/src/arch/immediate.c
+++ b/src/arch/immediate.c
@@ -30,6 +30,7 @@
#include "operand-int.h"
+#include "../common/extstr.h"
@@ -339,6 +340,12 @@ bool g_imm_operand_is_negative(const GImmOperand *operand)
static char *g_imm_operand_get_text(const GImmOperand *operand, const exe_format *format, AsmSyntax syntax)
{
char *result; /* Chaîne à retourner */
+ char *label; /* Etiquette de symbole */
+ SymbolType symtype; /* Type de symbole */
+ vmpa_t offset; /* Décallage final constaté */
+ char buffer[256]; /* Complément d'information */
+
+ /* Valeur brute */
result = (char *)calloc(19, sizeof(char));
@@ -412,6 +419,38 @@ static char *g_imm_operand_get_text(const GImmOperand *operand, const exe_format
}
+ /* Complément d'information */
+
+ if (operand->size == AOS_32_BITS_SIGNED || operand->size == AOS_32_BITS_UNSIGNED) /* FIXME */
+ {
+ offset = operand->unsigned_imm.val32; /* FIXME !!! */
+
+ if (resolve_exe_symbol(format, &label, &symtype, &offset))
+ {
+ switch (symtype)
+ {
+ case STP_SECTION:
+ if (offset == 0) snprintf(buffer, 256, " &lt;%s&gt;", label);
+ else snprintf(buffer, 256, " &lt;%s+0x%llx&gt;", label, offset);
+ result = stradd(result, buffer);
+ break;
+
+ case STP_STRING:
+ label = escape_crlf(label);
+ label = strrpl(label, "<", "&lt;");
+ label = strrpl(label, ">", "&gt;");
+ snprintf(buffer, 256, " \"%s\"", label);
+ result = stradd(result, buffer);
+ break;
+
+ }
+
+ free(label);
+
+ }
+
+ }
+
return result;
}