aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-02-05 16:37:39 -0500
committerMike Frysinger <vapier@gentoo.org>2014-08-13 07:06:15 -0400
commit703ec4e8d0c1daac6033e14170c0ddd28c455c0a (patch)
treec42edb3e967d2a4aef63b031b19f33391bbbf832 /opcodes
parented2c4879565a32432f6cbbf7569e0922835475b0 (diff)
downloadgdb-703ec4e8d0c1daac6033e14170c0ddd28c455c0a.zip
gdb-703ec4e8d0c1daac6033e14170c0ddd28c455c0a.tar.gz
gdb-703ec4e8d0c1daac6033e14170c0ddd28c455c0a.tar.bz2
opcodes: blackfin: push down global state
The variables used to track insn state should be pushed down into the private_data structure to avoid pollution across calls. This also happens to fix the output when hitting comments/invalid insns which needs to tweak a gas test. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog14
-rw-r--r--opcodes/bfin-dis.c112
2 files changed, 83 insertions, 43 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 48db533..4e7c93a 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,19 @@
2014-08-13 Mike Frysinger <vapier@gentoo.org>
+ * bfin-dis.c (comment, parallel): Move from global scope ...
+ (struct private): ... to this new struct.
+ (decode_ProgCtrl_0, decode_CaCTRL_0, decode_PushPopReg_0,
+ decode_PushPopMultiple_0, decode_ccMV_0, decode_CCflag_0,
+ decode_CC2dreg_0, decode_CC2stat_0, decode_BRCC_0, decode_UJUMP_0,
+ decode_LOGI2op_0, decode_COMPI2opD_0, decode_COMPI2opP_0,
+ decode_dagMODik_0, decode_LoopSetup_0, decode_LDIMMhalf_0,
+ decode_CALLa_0, decode_linkage_0, decode_pseudoDEBUG_0,
+ decode_pseudoOChar_0, decode_pseudodbg_assert_0, _print_insn_bfin,
+ print_insn_bfin): Declare private struct. Use priv's comment and
+ parallel members.
+
+2014-08-13 Mike Frysinger <vapier@gentoo.org>
+
* bfin-dis.c (ifetch): Do not align pc to 2 bytes.
(_print_insn_bfin): Add check for unaligned pc.
diff --git a/opcodes/bfin-dis.c b/opcodes/bfin-dis.c
index 8cc4604..b8bc087 100644
--- a/opcodes/bfin-dis.c
+++ b/opcodes/bfin-dis.c
@@ -42,8 +42,10 @@ typedef long TIword;
typedef unsigned int bu32;
-static char comment = 0;
-static char parallel = 0;
+struct private
+{
+ int comment, parallel;
+};
typedef enum
{
@@ -713,6 +715,7 @@ get_allreg (int grp, int reg)
static int
decode_ProgCtrl_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* ProgCtrl
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.prgfunc.......|.poprnd........|
@@ -722,7 +725,7 @@ decode_ProgCtrl_0 (TIword iw0, disassemble_info *outf)
if (prgfunc == 0 && poprnd == 0)
OUTS (outf, "NOP");
- else if (parallel)
+ else if (priv->parallel)
return 0;
else if (prgfunc == 1 && poprnd == 0)
OUTS (outf, "RTS");
@@ -800,6 +803,7 @@ decode_ProgCtrl_0 (TIword iw0, disassemble_info *outf)
static int
decode_CaCTRL_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* CaCTRL
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |.a.|.op....|.reg.......|
@@ -808,7 +812,7 @@ decode_CaCTRL_0 (TIword iw0, disassemble_info *outf)
int op = ((iw0 >> CaCTRL_op_bits) & CaCTRL_op_mask);
int reg = ((iw0 >> CaCTRL_reg_bits) & CaCTRL_reg_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (a == 0 && op == 0)
@@ -867,6 +871,7 @@ decode_CaCTRL_0 (TIword iw0, disassemble_info *outf)
static int
decode_PushPopReg_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* PushPopReg
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.W.|.grp.......|.reg.......|
@@ -875,7 +880,7 @@ decode_PushPopReg_0 (TIword iw0, disassemble_info *outf)
int grp = ((iw0 >> PushPopReg_grp_bits) & PushPopReg_grp_mask);
int reg = ((iw0 >> PushPopReg_reg_bits) & PushPopReg_reg_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (W == 0 && mostreg (reg, grp))
@@ -896,6 +901,7 @@ decode_PushPopReg_0 (TIword iw0, disassemble_info *outf)
static int
decode_PushPopMultiple_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* PushPopMultiple
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 0 | 0 | 0 | 0 | 1 | 0 |.d.|.p.|.W.|.dr........|.pr........|
@@ -906,7 +912,7 @@ decode_PushPopMultiple_0 (TIword iw0, disassemble_info *outf)
int dr = ((iw0 >> PushPopMultiple_dr_bits) & PushPopMultiple_dr_mask);
int pr = ((iw0 >> PushPopMultiple_pr_bits) & PushPopMultiple_pr_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (pr > 5)
@@ -960,6 +966,7 @@ decode_PushPopMultiple_0 (TIword iw0, disassemble_info *outf)
static int
decode_ccMV_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* ccMV
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 0 | 0 | 0 | 0 | 1 | 1 |.T.|.d.|.s.|.dst.......|.src.......|
@@ -970,7 +977,7 @@ decode_ccMV_0 (TIword iw0, disassemble_info *outf)
int src = ((iw0 >> CCmv_src_bits) & CCmv_src_mask);
int dst = ((iw0 >> CCmv_dst_bits) & CCmv_dst_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (T == 1)
@@ -995,6 +1002,7 @@ decode_ccMV_0 (TIword iw0, disassemble_info *outf)
static int
decode_CCflag_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* CCflag
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 0 | 0 | 0 | 1 |.I.|.opc.......|.G.|.y.........|.x.........|
@@ -1005,7 +1013,7 @@ decode_CCflag_0 (TIword iw0, disassemble_info *outf)
int G = ((iw0 >> CCflag_G_bits) & CCflag_G_mask);
int opc = ((iw0 >> CCflag_opc_bits) & CCflag_opc_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (opc == 0 && I == 0 && G == 0)
@@ -1173,6 +1181,7 @@ decode_CCflag_0 (TIword iw0, disassemble_info *outf)
static int
decode_CC2dreg_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* CC2dreg
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |.op....|.reg.......|
@@ -1180,7 +1189,7 @@ decode_CC2dreg_0 (TIword iw0, disassemble_info *outf)
int op = ((iw0 >> CC2dreg_op_bits) & CC2dreg_op_mask);
int reg = ((iw0 >> CC2dreg_reg_bits) & CC2dreg_reg_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (op == 0)
@@ -1204,6 +1213,7 @@ decode_CC2dreg_0 (TIword iw0, disassemble_info *outf)
static int
decode_CC2stat_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* CC2stat
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.D.|.op....|.cbit..............|
@@ -1214,7 +1224,7 @@ decode_CC2stat_0 (TIword iw0, disassemble_info *outf)
const char *bitname = statbits (cbit);
- if (parallel)
+ if (priv->parallel)
return 0;
if (decode_statbits[cbit] == REG_LASTREG)
@@ -1279,6 +1289,7 @@ decode_CC2stat_0 (TIword iw0, disassemble_info *outf)
static int
decode_BRCC_0 (TIword iw0, bfd_vma pc, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* BRCC
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 0 | 0 | 1 |.T.|.B.|.offset................................|
@@ -1287,7 +1298,7 @@ decode_BRCC_0 (TIword iw0, bfd_vma pc, disassemble_info *outf)
int T = ((iw0 >> BRCC_T_bits) & BRCC_T_mask);
int offset = ((iw0 >> BRCC_offset_bits) & BRCC_offset_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (T == 1 && B == 1)
@@ -1321,13 +1332,14 @@ decode_BRCC_0 (TIword iw0, bfd_vma pc, disassemble_info *outf)
static int
decode_UJUMP_0 (TIword iw0, bfd_vma pc, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* UJUMP
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 0 | 1 | 0 |.offset........................................|
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
int offset = ((iw0 >> UJump_offset_bits) & UJump_offset_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
OUTS (outf, "JUMP.S 0x");
@@ -1571,6 +1583,7 @@ decode_PTR2op_0 (TIword iw0, disassemble_info *outf)
static int
decode_LOGI2op_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* LOGI2op
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 1 | 0 | 0 | 1 |.opc.......|.src...............|.dst.......|
@@ -1579,7 +1592,7 @@ decode_LOGI2op_0 (TIword iw0, disassemble_info *outf)
int opc = ((iw0 >> LOGI2op_opc_bits) & LOGI2op_opc_mask);
int dst = ((iw0 >> LOGI2op_dst_bits) & LOGI2op_dst_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (opc == 0)
@@ -1591,7 +1604,7 @@ decode_LOGI2op_0 (TIword iw0, disassemble_info *outf)
OUTS (outf, ");\t\t/* bit");
OUTS (outf, imm7d (src));
OUTS (outf, " */");
- comment = 1;
+ priv->comment = 1;
}
else if (opc == 1)
{
@@ -1602,7 +1615,7 @@ decode_LOGI2op_0 (TIword iw0, disassemble_info *outf)
OUTS (outf, ");\t\t/* bit");
OUTS (outf, imm7d (src));
OUTS (outf, " */");
- comment = 1;
+ priv->comment = 1;
}
else if (opc == 2)
{
@@ -1613,7 +1626,7 @@ decode_LOGI2op_0 (TIword iw0, disassemble_info *outf)
OUTS (outf, ");\t\t/* bit");
OUTS (outf, imm7d (src));
OUTS (outf, " */");
- comment = 1;
+ priv->comment = 1;
}
else if (opc == 3)
{
@@ -1624,7 +1637,7 @@ decode_LOGI2op_0 (TIword iw0, disassemble_info *outf)
OUTS (outf, ");\t\t/* bit");
OUTS (outf, imm7d (src));
OUTS (outf, " */");
- comment = 1;
+ priv->comment = 1;
}
else if (opc == 4)
{
@@ -1635,7 +1648,7 @@ decode_LOGI2op_0 (TIword iw0, disassemble_info *outf)
OUTS (outf, ");\t\t/* bit");
OUTS (outf, imm7d (src));
OUTS (outf, " */");
- comment = 1;
+ priv->comment = 1;
}
else if (opc == 5)
{
@@ -1755,6 +1768,7 @@ decode_COMP3op_0 (TIword iw0, disassemble_info *outf)
static int
decode_COMPI2opD_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* COMPI2opD
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 1 | 1 | 0 | 0 |.op|..src......................|.dst.......|
@@ -1765,7 +1779,7 @@ decode_COMPI2opD_0 (TIword iw0, disassemble_info *outf)
bu32 *pval = get_allreg (0, dst);
- if (parallel)
+ if (priv->parallel)
return 0;
/* Since we don't have 32-bit immediate loads, we allow the disassembler
@@ -1792,7 +1806,7 @@ decode_COMPI2opD_0 (TIword iw0, disassemble_info *outf)
OUTS (outf, "(");
OUTS (outf, imm32 (*pval));
OUTS (outf, ") */");
- comment = 1;
+ priv->comment = 1;
}
else if (op == 1)
{
@@ -1802,7 +1816,7 @@ decode_COMPI2opD_0 (TIword iw0, disassemble_info *outf)
OUTS (outf, ";\t\t/* (");
OUTS (outf, imm7d (src));
OUTS (outf, ") */");
- comment = 1;
+ priv->comment = 1;
}
else
return 0;
@@ -1813,6 +1827,7 @@ decode_COMPI2opD_0 (TIword iw0, disassemble_info *outf)
static int
decode_COMPI2opP_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* COMPI2opP
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 0 | 1 | 1 | 0 | 1 |.op|.src.......................|.dst.......|
@@ -1823,7 +1838,7 @@ decode_COMPI2opP_0 (TIword iw0, disassemble_info *outf)
bu32 *pval = get_allreg (1, dst);
- if (parallel)
+ if (priv->parallel)
return 0;
if (op == 0)
@@ -1847,7 +1862,7 @@ decode_COMPI2opP_0 (TIword iw0, disassemble_info *outf)
OUTS (outf, "(");
OUTS (outf, imm32 (*pval));
OUTS (outf, ") */");
- comment = 1;
+ priv->comment = 1;
}
else if (op == 1)
{
@@ -1857,7 +1872,7 @@ decode_COMPI2opP_0 (TIword iw0, disassemble_info *outf)
OUTS (outf, ";\t\t/* (");
OUTS (outf, imm7d (src));
OUTS (outf, ") */");
- comment = 1;
+ priv->comment = 1;
}
else
return 0;
@@ -2024,6 +2039,7 @@ decode_dagMODim_0 (TIword iw0, disassemble_info *outf)
static int
decode_dagMODik_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* dagMODik
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |.op....|.i.....|
@@ -2054,7 +2070,7 @@ decode_dagMODik_0 (TIword iw0, disassemble_info *outf)
else
return 0;
- if (! parallel)
+ if (!priv->parallel)
{
OUTS (outf, ";\t\t/* ( ");
if (op == 0 || op == 1)
@@ -2062,7 +2078,7 @@ decode_dagMODik_0 (TIword iw0, disassemble_info *outf)
else if (op == 2 || op == 3)
OUTS (outf, "4");
OUTS (outf, ") */");
- comment = 1;
+ priv->comment = 1;
}
return 2;
@@ -2577,6 +2593,7 @@ decode_LDSTii_0 (TIword iw0, disassemble_info *outf)
static int
decode_LoopSetup_0 (TIword iw0, TIword iw1, bfd_vma pc, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* LoopSetup
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |.rop...|.c.|.soffset.......|
@@ -2588,7 +2605,7 @@ decode_LoopSetup_0 (TIword iw0, TIword iw1, bfd_vma pc, disassemble_info *outf)
int soffset = ((iw0 >> (LoopSetup_soffset_bits - 16)) & LoopSetup_soffset_mask);
int eoffset = ((iw1 >> LoopSetup_eoffset_bits) & LoopSetup_eoffset_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (reg > 7)
@@ -2638,6 +2655,7 @@ decode_LoopSetup_0 (TIword iw0, TIword iw1, bfd_vma pc, disassemble_info *outf)
static int
decode_LDIMMhalf_0 (TIword iw0, TIword iw1, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* LDIMMhalf
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |.Z.|.H.|.S.|.grp...|.reg.......|
@@ -2652,7 +2670,7 @@ decode_LDIMMhalf_0 (TIword iw0, TIword iw1, disassemble_info *outf)
bu32 *pval = get_allreg (grp, reg);
- if (parallel)
+ if (priv->parallel)
return 0;
/* Since we don't have 32-bit immediate loads, we allow the disassembler
@@ -2760,7 +2778,7 @@ decode_LDIMMhalf_0 (TIword iw0, TIword iw1, disassemble_info *outf)
}
OUTS (outf, " */");
- comment = 1;
+ priv->comment = 1;
}
if (S == 1 || Z == 1)
{
@@ -2771,7 +2789,7 @@ decode_LDIMMhalf_0 (TIword iw0, TIword iw1, disassemble_info *outf)
OUTS (outf, "(");
OUTS (outf, imm32 (*pval));
OUTS (outf, ") */");
- comment = 1;
+ priv->comment = 1;
}
return 4;
}
@@ -2779,6 +2797,7 @@ decode_LDIMMhalf_0 (TIword iw0, TIword iw1, disassemble_info *outf)
static int
decode_CALLa_0 (TIword iw0, TIword iw1, bfd_vma pc, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* CALLa
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 1 | 1 | 1 | 0 | 0 | 0 | 1 |.S.|.msw...........................|
@@ -2788,7 +2807,7 @@ decode_CALLa_0 (TIword iw0, TIword iw1, bfd_vma pc, disassemble_info *outf)
int lsw = ((iw1 >> 0) & 0xffff);
int msw = ((iw0 >> 0) & 0xff);
- if (parallel)
+ if (priv->parallel)
return 0;
if (S == 1)
@@ -2916,6 +2935,7 @@ decode_LDSTidxI_0 (TIword iw0, TIword iw1, disassemble_info *outf)
static int
decode_linkage_0 (TIword iw0, TIword iw1, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* linkage
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.R.|
@@ -2924,7 +2944,7 @@ decode_linkage_0 (TIword iw0, TIword iw1, disassemble_info *outf)
int R = ((iw0 >> (Linkage_R_bits - 16)) & Linkage_R_mask);
int framesize = ((iw1 >> Linkage_framesize_bits) & Linkage_framesize_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (R == 0)
@@ -2934,7 +2954,7 @@ decode_linkage_0 (TIword iw0, TIword iw1, disassemble_info *outf)
OUTS (outf, ";\t\t/* (");
OUTS (outf, uimm16s4d (framesize));
OUTS (outf, ") */");
- comment = 1;
+ priv->comment = 1;
}
else if (R == 1)
OUTS (outf, "UNLINK");
@@ -4512,6 +4532,7 @@ decode_dsp32shiftimm_0 (TIword iw0, TIword iw1, disassemble_info *outf)
static int
decode_pseudoDEBUG_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* pseudoDEBUG
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |.fn....|.grp.......|.reg.......|
@@ -4520,7 +4541,7 @@ decode_pseudoDEBUG_0 (TIword iw0, disassemble_info *outf)
int grp = ((iw0 >> PseudoDbg_grp_bits) & PseudoDbg_grp_mask);
int reg = ((iw0 >> PseudoDbg_reg_bits) & PseudoDbg_reg_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (reg == 0 && fn == 3)
@@ -4571,13 +4592,14 @@ decode_pseudoDEBUG_0 (TIword iw0, disassemble_info *outf)
static int
decode_pseudoOChar_0 (TIword iw0, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* psedoOChar
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 |.ch............................|
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
int ch = ((iw0 >> PseudoChr_ch_bits) & PseudoChr_ch_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
OUTS (outf, "OUTC ");
@@ -4589,6 +4611,7 @@ decode_pseudoOChar_0 (TIword iw0, disassemble_info *outf)
static int
decode_pseudodbg_assert_0 (TIword iw0, TIword iw1, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
/* pseudodbg_assert
+---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
| 1 | 1 | 1 | 1 | 0 | - | - | - | dbgop |.grp.......|.regtest...|
@@ -4599,7 +4622,7 @@ decode_pseudodbg_assert_0 (TIword iw0, TIword iw1, disassemble_info *outf)
int grp = ((iw0 >> (PseudoDbg_Assert_grp_bits - 16)) & PseudoDbg_Assert_grp_mask);
int regtest = ((iw0 >> (PseudoDbg_Assert_regtest_bits - 16)) & PseudoDbg_Assert_regtest_mask);
- if (parallel)
+ if (priv->parallel)
return 0;
if (dbgop == 0)
@@ -4659,6 +4682,7 @@ ifetch (bfd_vma pc, disassemble_info *outf, TIword *iw)
static int
_print_insn_bfin (bfd_vma pc, disassemble_info *outf)
{
+ struct private *priv = outf->private_data;
TIword iw0;
TIword iw1;
int rv = 0;
@@ -4686,7 +4710,7 @@ _print_insn_bfin (bfd_vma pc, disassemble_info *outf)
if ((iw0 & 0xf7ff) == 0xc003 && iw1 == 0x1800)
{
- if (parallel)
+ if (priv->parallel)
{
OUTS (outf, "ILLEGAL");
return 0;
@@ -4778,12 +4802,17 @@ _print_insn_bfin (bfd_vma pc, disassemble_info *outf)
int
print_insn_bfin (bfd_vma pc, disassemble_info *outf)
{
+ struct private priv;
TIword iw0;
int count;
if (ifetch (pc, outf, &iw0) == -1)
return -1;
+ priv.parallel = 0;
+ priv.comment = 0;
+ outf->private_data = &priv;
+
count = _print_insn_bfin (pc, outf);
if (count == -1)
return -1;
@@ -4796,7 +4825,7 @@ print_insn_bfin (bfd_vma pc, disassemble_info *outf)
int legal = 1;
int len;
- parallel = 1;
+ priv.parallel = 1;
OUTS (outf, " || ");
len = _print_insn_bfin (pc + 4, outf);
if (len == -1)
@@ -4815,19 +4844,16 @@ print_insn_bfin (bfd_vma pc, disassemble_info *outf)
else
{
OUTS (outf, ";\t\t/* ILLEGAL PARALLEL INSTRUCTION */");
- comment = 1;
+ priv.comment = 1;
count = 0;
}
- parallel = 0;
}
- if (!comment)
+ if (!priv.comment)
OUTS (outf, ";");
if (count == 0)
return 2;
- comment = 0;
-
return count;
}