mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 02:50:08 +08:00
* config/tc-m68k.c (m68k_ip): If instruction is invalid for the
selected architecture, print a message saying so and listing what processors support it, rather than saying "operands mismatch".
This commit is contained in:
@ -992,6 +992,7 @@ void m68k_ip (instring)
|
|||||||
char *crack_operand();
|
char *crack_operand();
|
||||||
LITTLENUM_TYPE words[6];
|
LITTLENUM_TYPE words[6];
|
||||||
LITTLENUM_TYPE *wordp;
|
LITTLENUM_TYPE *wordp;
|
||||||
|
unsigned long ok_arch = 0;
|
||||||
|
|
||||||
if (*instring == ' ')
|
if (*instring == ' ')
|
||||||
instring++; /* skip leading whitespace */
|
instring++; /* skip leading whitespace */
|
||||||
@ -1048,7 +1049,6 @@ void m68k_ip (instring)
|
|||||||
for(n=opsfound;n>0;--n)
|
for(n=opsfound;n>0;--n)
|
||||||
the_ins.operands[n]=the_ins.operands[n-1];
|
the_ins.operands[n]=the_ins.operands[n-1];
|
||||||
|
|
||||||
/* memcpy((char *)(&the_ins.operands[1]), (char *)(&the_ins.operands[0]), opsfound*sizeof(the_ins.operands[0])); */
|
|
||||||
memset((char *)(&the_ins.operands[0]), '\0', sizeof(the_ins.operands[0]));
|
memset((char *)(&the_ins.operands[0]), '\0', sizeof(the_ins.operands[0]));
|
||||||
the_ins.operands[0].mode=MSCR;
|
the_ins.operands[0].mode=MSCR;
|
||||||
the_ins.operands[0].reg=COPNUM; /* COP #1 */
|
the_ins.operands[0].reg=COPNUM; /* COP #1 */
|
||||||
@ -1062,11 +1062,12 @@ void m68k_ip (instring)
|
|||||||
then reject this pattern. */
|
then reject this pattern. */
|
||||||
|
|
||||||
if (opsfound != opcode->m_opnum
|
if (opsfound != opcode->m_opnum
|
||||||
|| ((opcode->m_arch & current_architecture) == 0)) {
|
|| ((opcode->m_arch & current_architecture) == 0))
|
||||||
|
{
|
||||||
++losing;
|
++losing;
|
||||||
|
ok_arch |= opcode->m_arch;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
for (s=opcode->m_operands, opP = &the_ins.operands[0]; *s && !losing; s += 2, opP++) {
|
for (s=opcode->m_operands, opP = &the_ins.operands[0]; *s && !losing; s += 2, opP++) {
|
||||||
/* Warning: this switch is huge! */
|
/* Warning: this switch is huge! */
|
||||||
/* I've tried to organize the cases into this order:
|
/* I've tried to organize the cases into this order:
|
||||||
@ -1378,7 +1379,8 @@ void m68k_ip (instring)
|
|||||||
*s, __LINE__, __FILE__);
|
*s, __LINE__, __FILE__);
|
||||||
} /* switch on type of operand */
|
} /* switch on type of operand */
|
||||||
|
|
||||||
if (losing) break;
|
if (losing)
|
||||||
|
break;
|
||||||
} /* for each operand */
|
} /* for each operand */
|
||||||
} /* if immediately wrong */
|
} /* if immediately wrong */
|
||||||
|
|
||||||
@ -1389,7 +1391,67 @@ void m68k_ip (instring)
|
|||||||
opcode = opcode->m_next;
|
opcode = opcode->m_next;
|
||||||
|
|
||||||
if (!opcode) {
|
if (!opcode) {
|
||||||
the_ins.error = "instruction/operands mismatch or invalid\n instruction for this architecture";
|
if (ok_arch)
|
||||||
|
{
|
||||||
|
char buf[200], *cp;
|
||||||
|
int len;
|
||||||
|
strcpy (buf, "invalid instruction for this architecture; needs ");
|
||||||
|
cp = buf + strlen (buf);
|
||||||
|
switch (ok_arch)
|
||||||
|
{
|
||||||
|
case mfloat:
|
||||||
|
strcpy (cp, "fpu");
|
||||||
|
break;
|
||||||
|
case mmmu:
|
||||||
|
strcpy (cp, "mmu");
|
||||||
|
break;
|
||||||
|
case m68020up:
|
||||||
|
strcpy (cp, "68020 or higher");
|
||||||
|
break;
|
||||||
|
case m68000up:
|
||||||
|
strcpy (cp, "68000 or higher");
|
||||||
|
break;
|
||||||
|
case m68010up:
|
||||||
|
strcpy (cp, "68010 or higher");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
int got_one = 0, idx;
|
||||||
|
const static struct {
|
||||||
|
enum m68k_architecture arch;
|
||||||
|
const char *name;
|
||||||
|
} archs[] = {
|
||||||
|
m68000, "68000",
|
||||||
|
m68010, "68010",
|
||||||
|
m68020, "68020",
|
||||||
|
m68030, "68030",
|
||||||
|
m68040, "68040",
|
||||||
|
m68881, "68881",
|
||||||
|
m68851, "68851",
|
||||||
|
};
|
||||||
|
for (idx = 0; idx < sizeof (archs)/sizeof (archs[0]); idx++)
|
||||||
|
{
|
||||||
|
if (archs[idx].arch & ok_arch)
|
||||||
|
{
|
||||||
|
if (got_one)
|
||||||
|
{
|
||||||
|
strcpy (cp, " or ");
|
||||||
|
cp += strlen (cp);
|
||||||
|
}
|
||||||
|
got_one = 1;
|
||||||
|
strcpy (cp, archs[idx].name);
|
||||||
|
cp += strlen (cp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
len = cp - buf + 1;
|
||||||
|
cp = malloc (len);
|
||||||
|
strcpy (cp, buf);
|
||||||
|
the_ins.error = cp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
the_ins.error = "operands mismatch";
|
||||||
return;
|
return;
|
||||||
} /* Fell off the end */
|
} /* Fell off the end */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user