* mips-dis.c (print_insn_arg): Print condition code registers as
$fccN.
This commit is contained in:
parent
293c76a376
commit
30b1724cc8
2 changed files with 86 additions and 32 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Mon Sep 9 14:26:26 1996 Ian Lance Taylor <ian@cygnus.com>
|
||||||
|
|
||||||
|
* mips-dis.c (print_insn_arg): Print condition code registers as
|
||||||
|
$fccN.
|
||||||
|
|
||||||
|
Tue Sep 3 12:09:46 1996 Doug Evans <dje@canuck.cygnus.com>
|
||||||
|
|
||||||
|
* sparc-opc.c (sparc_opcodes): Add setuw, setsw, setx.
|
||||||
|
|
||||||
start-sanitize-v850
|
start-sanitize-v850
|
||||||
Tue Sep 3 12:05:25 1996 Jeffrey A Law (law@cygnus.com)
|
Tue Sep 3 12:05:25 1996 Jeffrey A Law (law@cygnus.com)
|
||||||
|
|
||||||
|
|
|
@ -16,16 +16,13 @@ GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
#include "dis-asm.h"
|
#include "dis-asm.h"
|
||||||
#include "opcode/mips.h"
|
#include "opcode/mips.h"
|
||||||
|
|
||||||
/* FIXME: we need direct access to the swapping functions. */
|
|
||||||
#include "libbfd.h"
|
|
||||||
|
|
||||||
/* Mips instructions are never longer than this many bytes. */
|
/* Mips instructions are never longer than this many bytes. */
|
||||||
#define MAXLEN 4
|
#define MAXLEN 4
|
||||||
|
|
||||||
|
@ -80,7 +77,7 @@ print_insn_arg (d, l, pc, info)
|
||||||
|
|
||||||
case 'i':
|
case 'i':
|
||||||
case 'u':
|
case 'u':
|
||||||
(*info->fprintf_func) (info->stream, "%d",
|
(*info->fprintf_func) (info->stream, "0x%x",
|
||||||
(l >> OP_SH_IMMEDIATE) & OP_MASK_IMMEDIATE);
|
(l >> OP_SH_IMMEDIATE) & OP_MASK_IMMEDIATE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -93,6 +90,18 @@ print_insn_arg (d, l, pc, info)
|
||||||
delta);
|
delta);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'h':
|
||||||
|
(*info->fprintf_func) (info->stream, "0x%x",
|
||||||
|
(unsigned int) ((l >> OP_SH_PREFX)
|
||||||
|
& OP_MASK_PREFX));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'k':
|
||||||
|
(*info->fprintf_func) (info->stream, "0x%x",
|
||||||
|
(unsigned int) ((l >> OP_SH_CACHE)
|
||||||
|
& OP_MASK_CACHE));
|
||||||
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
(*info->print_address_func)
|
(*info->print_address_func)
|
||||||
(((pc & 0xF0000000) | (((l >> OP_SH_TARGET) & OP_MASK_TARGET) << 2)),
|
(((pc & 0xF0000000) | (((l >> OP_SH_TARGET) & OP_MASK_TARGET) << 2)),
|
||||||
|
@ -155,6 +164,11 @@ print_insn_arg (d, l, pc, info)
|
||||||
(l >> OP_SH_FD) & OP_MASK_FD);
|
(l >> OP_SH_FD) & OP_MASK_FD);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'R':
|
||||||
|
(*info->fprintf_func) (info->stream, "$f%d",
|
||||||
|
(l >> OP_SH_FR) & OP_MASK_FR);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'E':
|
case 'E':
|
||||||
(*info->fprintf_func) (info->stream, "$%d",
|
(*info->fprintf_func) (info->stream, "$%d",
|
||||||
(l >> OP_SH_RT) & OP_MASK_RT);
|
(l >> OP_SH_RT) & OP_MASK_RT);
|
||||||
|
@ -165,6 +179,16 @@ print_insn_arg (d, l, pc, info)
|
||||||
(l >> OP_SH_RD) & OP_MASK_RD);
|
(l >> OP_SH_RD) & OP_MASK_RD);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'N':
|
||||||
|
(*info->fprintf_func) (info->stream, "$fcc%d",
|
||||||
|
(l >> OP_SH_BCC) & OP_MASK_BCC);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'M':
|
||||||
|
(*info->fprintf_func) (info->stream, "$fcc%d",
|
||||||
|
(l >> OP_SH_CCC) & OP_MASK_CCC);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
(*info->fprintf_func) (info->stream,
|
(*info->fprintf_func) (info->stream,
|
||||||
"# internal error, undefined modifier(%c)", *d);
|
"# internal error, undefined modifier(%c)", *d);
|
||||||
|
@ -177,44 +201,65 @@ print_insn_arg (d, l, pc, info)
|
||||||
always 4. BIGENDIAN must be 1 if this is big-endian code, 0 if
|
always 4. BIGENDIAN must be 1 if this is big-endian code, 0 if
|
||||||
this is little-endian code. */
|
this is little-endian code. */
|
||||||
|
|
||||||
int
|
static int
|
||||||
_print_insn_mips (memaddr, word, info)
|
_print_insn_mips (memaddr, word, info)
|
||||||
bfd_vma memaddr;
|
bfd_vma memaddr;
|
||||||
struct disassemble_info *info;
|
struct disassemble_info *info;
|
||||||
unsigned long int word;
|
unsigned long int word;
|
||||||
{
|
{
|
||||||
register int i;
|
register const struct mips_opcode *op;
|
||||||
|
static boolean init = 0;
|
||||||
|
static const struct mips_opcode *mips_hash[OP_MASK_OP + 1];
|
||||||
|
|
||||||
|
/* Build a hash table to shorten the search time. */
|
||||||
|
if (! init)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i <= OP_MASK_OP; i++)
|
||||||
|
{
|
||||||
|
for (op = mips_opcodes; op < &mips_opcodes[NUMOPCODES]; op++)
|
||||||
|
{
|
||||||
|
if (op->pinfo == INSN_MACRO)
|
||||||
|
continue;
|
||||||
|
if (i == ((op->match >> OP_SH_OP) & OP_MASK_OP))
|
||||||
|
{
|
||||||
|
mips_hash[i] = op;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
op = mips_hash[(word >> OP_SH_OP) & OP_MASK_OP];
|
||||||
|
if (op != NULL)
|
||||||
|
{
|
||||||
|
for (; op < &mips_opcodes[NUMOPCODES]; op++)
|
||||||
|
{
|
||||||
|
if (op->pinfo != INSN_MACRO && (word & op->mask) == op->match)
|
||||||
|
{
|
||||||
register const char *d;
|
register const char *d;
|
||||||
|
|
||||||
for (i = 0; i < NUMOPCODES; i++)
|
(*info->fprintf_func) (info->stream, "%s", op->name);
|
||||||
|
|
||||||
|
d = op->args;
|
||||||
|
if (d != NULL)
|
||||||
{
|
{
|
||||||
if (mips_opcodes[i].pinfo != INSN_MACRO)
|
(*info->fprintf_func) (info->stream, " ");
|
||||||
{
|
for (; *d != '\0'; d++)
|
||||||
register unsigned int match = mips_opcodes[i].match;
|
print_insn_arg (d, word, memaddr, info);
|
||||||
register unsigned int mask = mips_opcodes[i].mask;
|
}
|
||||||
if ((word & mask) == match)
|
|
||||||
break;
|
return 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle undefined instructions. */
|
/* Handle undefined instructions. */
|
||||||
if (i == NUMOPCODES)
|
|
||||||
{
|
|
||||||
(*info->fprintf_func) (info->stream, "0x%x", word);
|
(*info->fprintf_func) (info->stream, "0x%x", word);
|
||||||
return 4;
|
return 4;
|
||||||
}
|
|
||||||
|
|
||||||
(*info->fprintf_func) (info->stream, "%s", mips_opcodes[i].name);
|
|
||||||
|
|
||||||
if (!(d = mips_opcodes[i].args))
|
|
||||||
return 4;
|
|
||||||
|
|
||||||
(*info->fprintf_func) (info->stream, " ");
|
|
||||||
|
|
||||||
while (*d)
|
|
||||||
print_insn_arg (d++, word, memaddr, info);
|
|
||||||
|
|
||||||
return 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -225,7 +270,7 @@ print_insn_big_mips (memaddr, info)
|
||||||
bfd_byte buffer[4];
|
bfd_byte buffer[4];
|
||||||
int status = (*info->read_memory_func) (memaddr, buffer, 4, info);
|
int status = (*info->read_memory_func) (memaddr, buffer, 4, info);
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
return _print_insn_mips (memaddr, _do_getb32 (buffer), info);
|
return _print_insn_mips (memaddr, (unsigned long) bfd_getb32 (buffer), info);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(*info->memory_error_func) (status, memaddr, info);
|
(*info->memory_error_func) (status, memaddr, info);
|
||||||
|
@ -241,7 +286,7 @@ print_insn_little_mips (memaddr, info)
|
||||||
bfd_byte buffer[4];
|
bfd_byte buffer[4];
|
||||||
int status = (*info->read_memory_func) (memaddr, buffer, 4, info);
|
int status = (*info->read_memory_func) (memaddr, buffer, 4, info);
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
return _print_insn_mips (memaddr, _do_getl32 (buffer), info);
|
return _print_insn_mips (memaddr, (unsigned long) bfd_getl32 (buffer), info);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(*info->memory_error_func) (status, memaddr, info);
|
(*info->memory_error_func) (status, memaddr, info);
|
||||||
|
|
Loading…
Reference in a new issue