aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2023-05-12 08:57:58 +0200
committerJan Beulich <jbeulich@suse.com>2023-05-12 08:57:58 +0200
commit2aa11c298a366d15b9442f8c031e5132265954ac (patch)
tree8ea3fd3034561c2e49a04de4ba727ea8250cf140
parenta675ea09fb6e09cfebbdf8fc5795f4249f50d690 (diff)
downloadbinutils-2aa11c298a366d15b9442f8c031e5132265954ac.zip
binutils-2aa11c298a366d15b9442f8c031e5132265954ac.tar.gz
binutils-2aa11c298a366d15b9442f8c031e5132265954ac.tar.bz2
x86: move a few more disassembler helper functions
... such that they wouldn't need forward declarations anymore. Note that append_seg() already was suitably placed.
-rw-r--r--opcodes/i386-dis.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index ac69205..23e8b09 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -45,9 +45,6 @@ static bool dofloat (instr_info *, int);
static int putop (instr_info *, const char *, int);
static void oappend_with_style (instr_info *, const char *,
enum disassembler_style);
-static void oappend (instr_info *, const char *);
-static void append_seg (instr_info *);
-static void set_op (instr_info *, bfd_vma, bool);
static bool OP_E (instr_info *, int, int);
static bool OP_E_memory (instr_info *, int, int);
@@ -90,8 +87,6 @@ static bool OP_0f07 (instr_info *, int, int);
static bool OP_Monitor (instr_info *, int, int);
static bool OP_Mwait (instr_info *, int, int);
-static bool BadOp (instr_info *);
-
static bool PCLMUL_Fixup (instr_info *, int, int);
static bool VPCMP_Fixup (instr_info *, int, int);
static bool VPCOM_Fixup (instr_info *, int, int);
@@ -9504,7 +9499,15 @@ get_sib (instr_info *ins, int sizeflag)
return true;
}
-/* Like oappend (below), but S is a string starting with '%'. In
+/* Like oappend_with_style (below) but always with text style. */
+
+static void
+oappend (instr_info *ins, const char *s)
+{
+ oappend_with_style (ins, s, dis_style_text);
+}
+
+/* Like oappend (above), but S is a string starting with '%'. In
Intel syntax, the '%' is elided. */
static void
@@ -11201,14 +11204,6 @@ oappend_with_style (instr_info *ins, const char *s,
ins->obufp = stpcpy (ins->obufp, s);
}
-/* Like oappend_with_style but always with text style. */
-
-static void
-oappend (instr_info *ins, const char *s)
-{
- oappend_with_style (ins, s, dis_style_text);
-}
-
/* Add a single character C to the buffer pointer to by INS->obufp, marking
the style for the character as STYLE. */
@@ -11781,6 +11776,26 @@ get64 (instr_info *ins, uint64_t *res)
return true;
}
+static void
+set_op (instr_info *ins, bfd_vma op, bool riprel)
+{
+ ins->op_index[ins->op_ad] = ins->op_ad;
+ if (ins->address_mode == mode_64bit)
+ ins->op_address[ins->op_ad] = op;
+ else /* Mask to get a 32-bit address. */
+ ins->op_address[ins->op_ad] = op & 0xffffffff;
+ ins->op_riprel[ins->op_ad] = riprel;
+}
+
+static bool
+BadOp (instr_info *ins)
+{
+ /* Throw away prefixes and 1st. opcode byte. */
+ ins->codep = ins->insn_codep + 1;
+ ins->obufp = stpcpy (ins->obufp, "(bad)");
+ return true;
+}
+
static bool
OP_E_memory (instr_info *ins, int bytemode, int sizeflag)
{
@@ -12316,17 +12331,6 @@ OP_G (instr_info *ins, int bytemode, int sizeflag)
return true;
}
-static void
-set_op (instr_info *ins, bfd_vma op, bool riprel)
-{
- ins->op_index[ins->op_ad] = ins->op_ad;
- if (ins->address_mode == mode_64bit)
- ins->op_address[ins->op_ad] = op;
- else /* Mask to get a 32-bit address. */
- ins->op_address[ins->op_ad] = op & 0xffffffff;
- ins->op_riprel[ins->op_ad] = riprel;
-}
-
static bool
OP_REG (instr_info *ins, int code, int sizeflag)
{
@@ -13351,15 +13355,6 @@ OP_Monitor (instr_info *ins, int bytemode ATTRIBUTE_UNUSED,
}
static bool
-BadOp (instr_info *ins)
-{
- /* Throw away prefixes and 1st. opcode byte. */
- ins->codep = ins->insn_codep + 1;
- ins->obufp = stpcpy (ins->obufp, "(bad)");
- return true;
-}
-
-static bool
REP_Fixup (instr_info *ins, int bytemode, int sizeflag)
{
/* The 0xf3 prefix should be displayed as "rep" for ins, outs, movs,