2000-07-20 18:46:28 +02:00
|
|
|
|
/* Disassembler code for CRIS.
|
2016-01-01 12:25:12 +01:00
|
|
|
|
Copyright (C) 2000-2016 Free Software Foundation, Inc.
|
2000-07-20 18:46:28 +02:00
|
|
|
|
Contributed by Axis Communications AB, Lund, Sweden.
|
|
|
|
|
Written by Hans-Peter Nilsson.
|
|
|
|
|
|
2007-07-05 11:49:03 +02:00
|
|
|
|
This file is part of the GNU opcodes library.
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
2007-07-05 11:49:03 +02:00
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
|
|
|
|
any later version.
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
2007-07-05 11:49:03 +02:00
|
|
|
|
It is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
|
|
|
License for more details.
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
2005-07-01 13:16:33 +02:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
|
MA 02110-1301, USA. */
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
#include "sysdep.h"
|
2012-05-17 17:13:28 +02:00
|
|
|
|
#include "dis-asm.h"
|
2000-07-20 18:46:28 +02:00
|
|
|
|
#include "opcode/cris.h"
|
|
|
|
|
#include "libiberty.h"
|
|
|
|
|
|
|
|
|
|
/* No instruction will be disassembled longer than this. In theory, and
|
|
|
|
|
in silicon, address prefixes can be cascaded. In practice, cascading
|
|
|
|
|
is not used by GCC, and not supported by the assembler. */
|
|
|
|
|
#ifndef MAX_BYTES_PER_CRIS_INSN
|
|
|
|
|
#define MAX_BYTES_PER_CRIS_INSN 8
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Whether or not to decode prefixes, folding it into the following
|
|
|
|
|
instruction. FIXME: Make this optional later. */
|
|
|
|
|
#ifndef PARSE_PREFIX
|
|
|
|
|
#define PARSE_PREFIX 1
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-09-29 20:17:25 +02:00
|
|
|
|
/* Sometimes we prefix all registers with this character. */
|
|
|
|
|
#define REGISTER_PREFIX_CHAR '$'
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
/* Whether or not to trace the following sequence:
|
|
|
|
|
sub* X,r%d
|
|
|
|
|
bound* Y,r%d
|
|
|
|
|
adds.w [pc+r%d.w],pc
|
|
|
|
|
|
|
|
|
|
This is the assembly form of a switch-statement in C.
|
|
|
|
|
The "sub is optional. If there is none, then X will be zero.
|
|
|
|
|
X is the value of the first case,
|
|
|
|
|
Y is the number of cases (including default).
|
|
|
|
|
|
|
|
|
|
This results in case offsets printed on the form:
|
|
|
|
|
case N: -> case_address
|
|
|
|
|
where N is an estimation on the corresponding 'case' operand in C,
|
|
|
|
|
and case_address is where execution of that case continues after the
|
|
|
|
|
sequence presented above.
|
|
|
|
|
|
|
|
|
|
The old style of output was to print the offsets as instructions,
|
|
|
|
|
which made it hard to follow "case"-constructs in the disassembly,
|
|
|
|
|
and caused a lot of annoying warnings about undefined instructions.
|
|
|
|
|
|
|
|
|
|
FIXME: Make this optional later. */
|
|
|
|
|
#ifndef TRACE_CASE
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
#define TRACE_CASE (disdata->trace_case)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
enum cris_disass_family
|
|
|
|
|
{ cris_dis_v0_v10, cris_dis_common_v10_v32, cris_dis_v32 };
|
|
|
|
|
|
|
|
|
|
/* Stored in the disasm_info->private_data member. */
|
|
|
|
|
struct cris_disasm_data
|
|
|
|
|
{
|
|
|
|
|
/* Whether to print something less confusing if we find something
|
|
|
|
|
matching a switch-construct. */
|
|
|
|
|
bfd_boolean trace_case;
|
|
|
|
|
|
|
|
|
|
/* Whether this code is flagged as crisv32. FIXME: Should be an enum
|
|
|
|
|
that includes "compatible". */
|
|
|
|
|
enum cris_disass_family distype;
|
|
|
|
|
};
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
/* Value of first element in switch. */
|
|
|
|
|
static long case_offset = 0;
|
|
|
|
|
|
|
|
|
|
/* How many more case-offsets to print. */
|
|
|
|
|
static long case_offset_counter = 0;
|
|
|
|
|
|
|
|
|
|
/* Number of case offsets. */
|
|
|
|
|
static long no_of_case_offsets = 0;
|
|
|
|
|
|
|
|
|
|
/* Candidate for next case_offset. */
|
|
|
|
|
static long last_immediate = 0;
|
|
|
|
|
|
2002-11-30 09:39:46 +01:00
|
|
|
|
static int cris_constraint
|
2005-07-01 13:16:33 +02:00
|
|
|
|
(const char *, unsigned, unsigned, struct cris_disasm_data *);
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
|
|
|
|
|
/* Parse disassembler options and store state in info. FIXME: For the
|
|
|
|
|
time being, we abuse static variables. */
|
|
|
|
|
|
|
|
|
|
static bfd_boolean
|
2005-07-01 13:16:33 +02:00
|
|
|
|
cris_parse_disassembler_options (disassemble_info *info,
|
|
|
|
|
enum cris_disass_family distype)
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
{
|
|
|
|
|
struct cris_disasm_data *disdata;
|
|
|
|
|
|
|
|
|
|
info->private_data = calloc (1, sizeof (struct cris_disasm_data));
|
|
|
|
|
disdata = (struct cris_disasm_data *) info->private_data;
|
|
|
|
|
if (disdata == NULL)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Default true. */
|
|
|
|
|
disdata->trace_case
|
|
|
|
|
= (info->disassembler_options == NULL
|
|
|
|
|
|| (strcmp (info->disassembler_options, "nocase") != 0));
|
|
|
|
|
|
|
|
|
|
disdata->distype = distype;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
static const struct cris_spec_reg *
|
2005-07-01 13:16:33 +02:00
|
|
|
|
spec_reg_info (unsigned int sreg, enum cris_disass_family distype)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
{
|
|
|
|
|
int i;
|
2005-07-01 13:16:33 +02:00
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
for (i = 0; cris_spec_regs[i].name != NULL; i++)
|
|
|
|
|
{
|
|
|
|
|
if (cris_spec_regs[i].number == sreg)
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
{
|
|
|
|
|
if (distype == cris_dis_v32)
|
|
|
|
|
switch (cris_spec_regs[i].applicable_version)
|
|
|
|
|
{
|
|
|
|
|
case cris_ver_warning:
|
|
|
|
|
case cris_ver_version_all:
|
|
|
|
|
case cris_ver_v3p:
|
|
|
|
|
case cris_ver_v8p:
|
|
|
|
|
case cris_ver_v10p:
|
|
|
|
|
case cris_ver_v32p:
|
|
|
|
|
/* No ambiguous sizes or register names with CRISv32. */
|
|
|
|
|
if (cris_spec_regs[i].warning == NULL)
|
|
|
|
|
return &cris_spec_regs[i];
|
|
|
|
|
default:
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
else if (cris_spec_regs[i].applicable_version != cris_ver_v32p)
|
|
|
|
|
return &cris_spec_regs[i];
|
|
|
|
|
}
|
2000-07-20 18:46:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the number of bits in the argument. */
|
2000-09-29 20:17:25 +02:00
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
static int
|
2005-07-01 13:16:33 +02:00
|
|
|
|
number_of_bits (unsigned int val)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
{
|
|
|
|
|
int bits;
|
|
|
|
|
|
2001-07-24 06:10:19 +02:00
|
|
|
|
for (bits = 0; val != 0; val &= val - 1)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
bits++;
|
|
|
|
|
|
|
|
|
|
return bits;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get an entry in the opcode-table. */
|
2000-09-29 20:17:25 +02:00
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
static const struct cris_opcode *
|
2005-07-01 13:16:33 +02:00
|
|
|
|
get_opcode_entry (unsigned int insn,
|
|
|
|
|
unsigned int prefix_insn,
|
|
|
|
|
struct cris_disasm_data *disdata)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
{
|
|
|
|
|
/* For non-prefixed insns, we keep a table of pointers, indexed by the
|
|
|
|
|
insn code. Each entry is initialized when found to be NULL. */
|
|
|
|
|
static const struct cris_opcode **opc_table = NULL;
|
|
|
|
|
|
|
|
|
|
const struct cris_opcode *max_matchedp = NULL;
|
|
|
|
|
const struct cris_opcode **prefix_opc_table = NULL;
|
|
|
|
|
|
|
|
|
|
/* We hold a table for each prefix that need to be handled differently. */
|
|
|
|
|
static const struct cris_opcode **dip_prefixes = NULL;
|
|
|
|
|
static const struct cris_opcode **bdapq_m1_prefixes = NULL;
|
|
|
|
|
static const struct cris_opcode **bdapq_m2_prefixes = NULL;
|
|
|
|
|
static const struct cris_opcode **bdapq_m4_prefixes = NULL;
|
|
|
|
|
static const struct cris_opcode **rest_prefixes = NULL;
|
|
|
|
|
|
|
|
|
|
/* Allocate and clear the opcode-table. */
|
|
|
|
|
if (opc_table == NULL)
|
|
|
|
|
{
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
opc_table = malloc (65536 * sizeof (opc_table[0]));
|
|
|
|
|
if (opc_table == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
memset (opc_table, 0, 65536 * sizeof (const struct cris_opcode *));
|
|
|
|
|
|
|
|
|
|
dip_prefixes
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= malloc (65536 * sizeof (const struct cris_opcode **));
|
|
|
|
|
if (dip_prefixes == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
memset (dip_prefixes, 0, 65536 * sizeof (dip_prefixes[0]));
|
|
|
|
|
|
|
|
|
|
bdapq_m1_prefixes
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= malloc (65536 * sizeof (const struct cris_opcode **));
|
|
|
|
|
if (bdapq_m1_prefixes == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
memset (bdapq_m1_prefixes, 0, 65536 * sizeof (bdapq_m1_prefixes[0]));
|
|
|
|
|
|
|
|
|
|
bdapq_m2_prefixes
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= malloc (65536 * sizeof (const struct cris_opcode **));
|
|
|
|
|
if (bdapq_m2_prefixes == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
memset (bdapq_m2_prefixes, 0, 65536 * sizeof (bdapq_m2_prefixes[0]));
|
|
|
|
|
|
|
|
|
|
bdapq_m4_prefixes
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= malloc (65536 * sizeof (const struct cris_opcode **));
|
|
|
|
|
if (bdapq_m4_prefixes == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
memset (bdapq_m4_prefixes, 0, 65536 * sizeof (bdapq_m4_prefixes[0]));
|
|
|
|
|
|
|
|
|
|
rest_prefixes
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= malloc (65536 * sizeof (const struct cris_opcode **));
|
|
|
|
|
if (rest_prefixes == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
memset (rest_prefixes, 0, 65536 * sizeof (rest_prefixes[0]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Get the right table if this is a prefix.
|
|
|
|
|
This code is connected to cris_constraints in that it knows what
|
|
|
|
|
prefixes play a role in recognition of patterns; the necessary
|
|
|
|
|
state is reflected by which table is used. If constraints
|
|
|
|
|
involving match or non-match of prefix insns are changed, then this
|
|
|
|
|
probably needs changing too. */
|
|
|
|
|
if (prefix_insn != NO_CRIS_PREFIX)
|
|
|
|
|
{
|
|
|
|
|
const struct cris_opcode *popcodep
|
|
|
|
|
= (opc_table[prefix_insn] != NULL
|
|
|
|
|
? opc_table[prefix_insn]
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
: get_opcode_entry (prefix_insn, NO_CRIS_PREFIX, disdata));
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
if (popcodep == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
if (popcodep->match == BDAP_QUICK_OPCODE)
|
|
|
|
|
{
|
|
|
|
|
/* Since some offsets are recognized with "push" macros, we
|
|
|
|
|
have to have different tables for them. */
|
|
|
|
|
int offset = (prefix_insn & 255);
|
|
|
|
|
|
|
|
|
|
if (offset > 127)
|
|
|
|
|
offset -= 256;
|
|
|
|
|
|
|
|
|
|
switch (offset)
|
|
|
|
|
{
|
|
|
|
|
case -4:
|
|
|
|
|
prefix_opc_table = bdapq_m4_prefixes;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case -2:
|
|
|
|
|
prefix_opc_table = bdapq_m2_prefixes;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case -1:
|
|
|
|
|
prefix_opc_table = bdapq_m1_prefixes;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
prefix_opc_table = rest_prefixes;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (popcodep->match == DIP_OPCODE)
|
|
|
|
|
/* We don't allow postincrement when the prefix is DIP, so use a
|
|
|
|
|
different table for DIP. */
|
|
|
|
|
prefix_opc_table = dip_prefixes;
|
|
|
|
|
else
|
|
|
|
|
prefix_opc_table = rest_prefixes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (prefix_insn != NO_CRIS_PREFIX
|
|
|
|
|
&& prefix_opc_table[insn] != NULL)
|
|
|
|
|
max_matchedp = prefix_opc_table[insn];
|
|
|
|
|
else if (prefix_insn == NO_CRIS_PREFIX && opc_table[insn] != NULL)
|
|
|
|
|
max_matchedp = opc_table[insn];
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const struct cris_opcode *opcodep;
|
|
|
|
|
int max_level_of_match = -1;
|
|
|
|
|
|
|
|
|
|
for (opcodep = cris_opcodes;
|
|
|
|
|
opcodep->name != NULL;
|
|
|
|
|
opcodep++)
|
|
|
|
|
{
|
|
|
|
|
int level_of_match;
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
if (disdata->distype == cris_dis_v32)
|
|
|
|
|
{
|
|
|
|
|
switch (opcodep->applicable_version)
|
|
|
|
|
{
|
|
|
|
|
case cris_ver_version_all:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cris_ver_v0_3:
|
|
|
|
|
case cris_ver_v0_10:
|
|
|
|
|
case cris_ver_v3_10:
|
|
|
|
|
case cris_ver_sim_v0_10:
|
|
|
|
|
case cris_ver_v8_10:
|
|
|
|
|
case cris_ver_v10:
|
|
|
|
|
case cris_ver_warning:
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
case cris_ver_v3p:
|
|
|
|
|
case cris_ver_v8p:
|
|
|
|
|
case cris_ver_v10p:
|
|
|
|
|
case cris_ver_v32p:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cris_ver_v8:
|
|
|
|
|
abort ();
|
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switch (opcodep->applicable_version)
|
|
|
|
|
{
|
|
|
|
|
case cris_ver_version_all:
|
|
|
|
|
case cris_ver_v0_3:
|
|
|
|
|
case cris_ver_v3p:
|
|
|
|
|
case cris_ver_v0_10:
|
|
|
|
|
case cris_ver_v8p:
|
|
|
|
|
case cris_ver_v8_10:
|
|
|
|
|
case cris_ver_v10:
|
|
|
|
|
case cris_ver_sim_v0_10:
|
|
|
|
|
case cris_ver_v10p:
|
|
|
|
|
case cris_ver_warning:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case cris_ver_v32p:
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
case cris_ver_v8:
|
|
|
|
|
abort ();
|
|
|
|
|
default:
|
|
|
|
|
abort ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
/* We give a double lead for bits matching the template in
|
|
|
|
|
cris_opcodes. Not even, because then "move p8,r10" would
|
|
|
|
|
be given 2 bits lead over "clear.d r10". When there's a
|
|
|
|
|
tie, the first entry in the table wins. This is
|
|
|
|
|
deliberate, to avoid a more complicated recognition
|
|
|
|
|
formula. */
|
|
|
|
|
if ((opcodep->match & insn) == opcodep->match
|
|
|
|
|
&& (opcodep->lose & insn) == 0
|
|
|
|
|
&& ((level_of_match
|
|
|
|
|
= cris_constraint (opcodep->args,
|
|
|
|
|
insn,
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
prefix_insn,
|
|
|
|
|
disdata))
|
2000-07-20 18:46:28 +02:00
|
|
|
|
>= 0)
|
|
|
|
|
&& ((level_of_match
|
|
|
|
|
+= 2 * number_of_bits (opcodep->match
|
|
|
|
|
| opcodep->lose))
|
|
|
|
|
> max_level_of_match))
|
|
|
|
|
{
|
|
|
|
|
max_matchedp = opcodep;
|
|
|
|
|
max_level_of_match = level_of_match;
|
|
|
|
|
|
|
|
|
|
/* If there was a full match, never mind looking
|
|
|
|
|
further. */
|
|
|
|
|
if (level_of_match >= 2 * 16)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* Fill in the new entry.
|
|
|
|
|
|
|
|
|
|
If there are changes to the opcode-table involving prefixes, and
|
|
|
|
|
disassembly then does not work correctly, try removing the
|
|
|
|
|
else-clause below that fills in the prefix-table. If that
|
|
|
|
|
helps, you need to change the prefix_opc_table setting above, or
|
|
|
|
|
something related. */
|
|
|
|
|
if (prefix_insn == NO_CRIS_PREFIX)
|
|
|
|
|
opc_table[insn] = max_matchedp;
|
|
|
|
|
else
|
|
|
|
|
prefix_opc_table[insn] = max_matchedp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return max_matchedp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return -1 if the constraints of a bitwise-matched instruction say
|
|
|
|
|
that there is no match. Otherwise return a nonnegative number
|
|
|
|
|
indicating the confidence in the match (higher is better). */
|
2000-09-29 20:17:25 +02:00
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
static int
|
2005-07-01 13:16:33 +02:00
|
|
|
|
cris_constraint (const char *cs,
|
|
|
|
|
unsigned int insn,
|
|
|
|
|
unsigned int prefix_insn,
|
|
|
|
|
struct cris_disasm_data *disdata)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
{
|
|
|
|
|
int retval = 0;
|
|
|
|
|
int tmp;
|
|
|
|
|
int prefix_ok = 0;
|
|
|
|
|
const char *s;
|
2005-07-01 13:16:33 +02:00
|
|
|
|
|
2001-07-24 06:10:19 +02:00
|
|
|
|
for (s = cs; *s; s++)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
switch (*s)
|
|
|
|
|
{
|
|
|
|
|
case '!':
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
/* Do not recognize "pop" if there's a prefix and then only for
|
|
|
|
|
v0..v10. */
|
|
|
|
|
if (prefix_insn != NO_CRIS_PREFIX
|
|
|
|
|
|| disdata->distype != cris_dis_v0_v10)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
return -1;
|
|
|
|
|
break;
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
case 'U':
|
|
|
|
|
/* Not recognized at disassembly. */
|
|
|
|
|
return -1;
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
case 'M':
|
|
|
|
|
/* Size modifier for "clear", i.e. special register 0, 4 or 8.
|
|
|
|
|
Check that it is one of them. Only special register 12 could
|
|
|
|
|
be mismatched, but checking for matches is more logical than
|
|
|
|
|
checking for mismatches when there are only a few cases. */
|
|
|
|
|
tmp = ((insn >> 12) & 0xf);
|
|
|
|
|
if (tmp != 0 && tmp != 4 && tmp != 8)
|
|
|
|
|
return -1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'm':
|
|
|
|
|
if ((insn & 0x30) == 0x30)
|
|
|
|
|
return -1;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'S':
|
|
|
|
|
/* A prefix operand without side-effect. */
|
|
|
|
|
if (prefix_insn != NO_CRIS_PREFIX && (insn & 0x400) == 0)
|
|
|
|
|
{
|
|
|
|
|
prefix_ok = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
case 's':
|
|
|
|
|
case 'y':
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
case 'Y':
|
2000-07-20 18:46:28 +02:00
|
|
|
|
/* If this is a prefixed insn with postincrement (side-effect),
|
|
|
|
|
the prefix must not be DIP. */
|
|
|
|
|
if (prefix_insn != NO_CRIS_PREFIX)
|
|
|
|
|
{
|
|
|
|
|
if (insn & 0x400)
|
|
|
|
|
{
|
|
|
|
|
const struct cris_opcode *prefix_opcodep
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= get_opcode_entry (prefix_insn, NO_CRIS_PREFIX, disdata);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
if (prefix_opcodep->match == DIP_OPCODE)
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prefix_ok = 1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'B':
|
|
|
|
|
/* If we don't fall through, then the prefix is ok. */
|
|
|
|
|
prefix_ok = 1;
|
|
|
|
|
|
|
|
|
|
/* A "push" prefix. Check for valid "push" size.
|
|
|
|
|
In case of special register, it may be != 4. */
|
|
|
|
|
if (prefix_insn != NO_CRIS_PREFIX)
|
|
|
|
|
{
|
|
|
|
|
/* Match the prefix insn to BDAPQ. */
|
|
|
|
|
const struct cris_opcode *prefix_opcodep
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= get_opcode_entry (prefix_insn, NO_CRIS_PREFIX, disdata);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
if (prefix_opcodep->match == BDAP_QUICK_OPCODE)
|
|
|
|
|
{
|
|
|
|
|
int pushsize = (prefix_insn & 255);
|
|
|
|
|
|
|
|
|
|
if (pushsize > 127)
|
|
|
|
|
pushsize -= 256;
|
|
|
|
|
|
|
|
|
|
if (s[1] == 'P')
|
|
|
|
|
{
|
|
|
|
|
unsigned int spec_reg = (insn >> 12) & 15;
|
|
|
|
|
const struct cris_spec_reg *sregp
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= spec_reg_info (spec_reg, disdata->distype);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
/* For a special-register, the "prefix size" must
|
|
|
|
|
match the size of the register. */
|
|
|
|
|
if (sregp && sregp->reg_size == (unsigned int) -pushsize)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else if (s[1] == 'R')
|
|
|
|
|
{
|
|
|
|
|
if ((insn & 0x30) == 0x20 && pushsize == -4)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* FIXME: Should abort here; next constraint letter
|
|
|
|
|
*must* be 'P' or 'R'. */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
case 'D':
|
|
|
|
|
retval = (((insn >> 12) & 15) == (insn & 15));
|
|
|
|
|
if (!retval)
|
|
|
|
|
return -1;
|
|
|
|
|
else
|
|
|
|
|
retval += 4;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'P':
|
|
|
|
|
{
|
|
|
|
|
const struct cris_spec_reg *sregp
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= spec_reg_info ((insn >> 12) & 15, disdata->distype);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
/* Since we match four bits, we will give a value of 4-1 = 3
|
|
|
|
|
in a match. If there is a corresponding exact match of a
|
|
|
|
|
special register in another pattern, it will get a value of
|
|
|
|
|
4, which will be higher. This should be correct in that an
|
|
|
|
|
exact pattern would match better than a general pattern.
|
|
|
|
|
|
|
|
|
|
Note that there is a reason for not returning zero; the
|
|
|
|
|
pattern for "clear" is partly matched in the bit-pattern
|
|
|
|
|
(the two lower bits must be zero), while the bit-pattern
|
|
|
|
|
for a move from a special register is matched in the
|
|
|
|
|
register constraint. */
|
|
|
|
|
|
|
|
|
|
if (sregp != NULL)
|
|
|
|
|
{
|
|
|
|
|
retval += 3;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (prefix_insn != NO_CRIS_PREFIX && ! prefix_ok)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 13:16:33 +02:00
|
|
|
|
/* Format number as hex with a leading "0x" into outbuffer. */
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
format_hex (unsigned long number,
|
|
|
|
|
char *outbuffer,
|
|
|
|
|
struct cris_disasm_data *disdata)
|
|
|
|
|
{
|
|
|
|
|
/* Truncate negative numbers on >32-bit hosts. */
|
|
|
|
|
number &= 0xffffffff;
|
|
|
|
|
|
|
|
|
|
sprintf (outbuffer, "0x%lx", number);
|
|
|
|
|
|
|
|
|
|
/* Save this value for the "case" support. */
|
|
|
|
|
if (TRACE_CASE)
|
|
|
|
|
last_immediate = number;
|
|
|
|
|
|
|
|
|
|
return outbuffer + strlen (outbuffer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Format number as decimal into outbuffer. Parameter signedp says
|
|
|
|
|
whether the number should be formatted as signed (!= 0) or
|
|
|
|
|
unsigned (== 0). */
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
format_dec (long number, char *outbuffer, int signedp)
|
|
|
|
|
{
|
|
|
|
|
last_immediate = number;
|
2008-07-30 06:34:58 +02:00
|
|
|
|
if (signedp)
|
|
|
|
|
sprintf (outbuffer, "%ld", number);
|
|
|
|
|
else
|
|
|
|
|
sprintf (outbuffer, "%lu", (unsigned long) number);
|
2005-07-01 13:16:33 +02:00
|
|
|
|
|
|
|
|
|
return outbuffer + strlen (outbuffer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Format the name of the general register regno into outbuffer. */
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
format_reg (struct cris_disasm_data *disdata,
|
|
|
|
|
int regno,
|
|
|
|
|
char *outbuffer_start,
|
|
|
|
|
bfd_boolean with_reg_prefix)
|
|
|
|
|
{
|
|
|
|
|
char *outbuffer = outbuffer_start;
|
|
|
|
|
|
|
|
|
|
if (with_reg_prefix)
|
|
|
|
|
*outbuffer++ = REGISTER_PREFIX_CHAR;
|
|
|
|
|
|
|
|
|
|
switch (regno)
|
|
|
|
|
{
|
|
|
|
|
case 15:
|
|
|
|
|
/* For v32, there is no context in which we output PC. */
|
|
|
|
|
if (disdata->distype == cris_dis_v32)
|
|
|
|
|
strcpy (outbuffer, "acr");
|
|
|
|
|
else
|
|
|
|
|
strcpy (outbuffer, "pc");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 14:
|
|
|
|
|
strcpy (outbuffer, "sp");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
sprintf (outbuffer, "r%d", regno);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return outbuffer_start + strlen (outbuffer_start);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Format the name of a support register into outbuffer. */
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
format_sup_reg (unsigned int regno,
|
|
|
|
|
char *outbuffer_start,
|
|
|
|
|
bfd_boolean with_reg_prefix)
|
|
|
|
|
{
|
|
|
|
|
char *outbuffer = outbuffer_start;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (with_reg_prefix)
|
|
|
|
|
*outbuffer++ = REGISTER_PREFIX_CHAR;
|
|
|
|
|
|
|
|
|
|
for (i = 0; cris_support_regs[i].name != NULL; i++)
|
|
|
|
|
if (cris_support_regs[i].number == regno)
|
|
|
|
|
{
|
|
|
|
|
sprintf (outbuffer, "%s", cris_support_regs[i].name);
|
|
|
|
|
return outbuffer_start + strlen (outbuffer_start);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* There's supposed to be register names covering all numbers, though
|
|
|
|
|
some may be generic names. */
|
|
|
|
|
sprintf (outbuffer, "format_sup_reg-BUG");
|
|
|
|
|
return outbuffer_start + strlen (outbuffer_start);
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
/* Return the length of an instruction. */
|
2000-09-29 20:17:25 +02:00
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
static unsigned
|
2005-07-01 13:16:33 +02:00
|
|
|
|
bytes_to_skip (unsigned int insn,
|
|
|
|
|
const struct cris_opcode *matchedp,
|
2005-12-06 00:27:01 +01:00
|
|
|
|
enum cris_disass_family distype,
|
|
|
|
|
const struct cris_opcode *prefix_matchedp)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
{
|
|
|
|
|
/* Each insn is a word plus "immediate" operands. */
|
|
|
|
|
unsigned to_skip = 2;
|
Updated sources to avoid using the identifier name "new", which is a
keyword in c++.
* bfd/aoutx.h (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol.
* bfd/coffgen.c (coff_make_empty_symbol)
(coff_bfd_make_debug_symbol): Rename variable new to new_symbol.
* bfd/cpu-ia64-opc.c (ext_reg, ins_imms_scaled): Rename variable
new to new_insn.
* bfd/doc/chew.c (newentry, add_intrinsic): Rename variable new to
new_d.
* bfd/ecoff.c (_bfd_ecoff_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/elf32-m68k.c (elf_m68k_get_got_entry_type): Rename argument
new to new_reloc.
* bfd/hash.c (bfd_hash_lookup): Rename variable new to new_string.
* bfd/ieee.c (ieee_make_empty_symbol): Rename variable new to
new_symbol.
* bfd/linker.c (bfd_new_link_order): Rename variable new to
new_lo.
* bfd/mach-o.c (bfd_mach_o_sizeof_headers): Rename variable new to
symbol.
* bfd/oasys.c (oasys_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/pdp11.c (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol_type.
* bfd/plugin.c (bfd_plugin_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/rs6000-core.c (CoreHdr, VmInfo): Rename union member new to
new_dump.
(read_hdr, rs6000coff_core_p)
(rs6000coff_core_file_matches_executable_p)
(rs6000coff_core_file_failing_command)
(rs6000coff_core_file_failing_signal): Updated function to use new
union member name.
* bfd/som.c (som_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/syms.c (_bfd_generic_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/tekhex.c (first_phase, tekhex_make_empty_symbol): Rename
variable new to new_symbol.
* binutils/nlmconv.c (main): Rename variable new to new_name.
* gas/config/tc-arm.c (insert_reg_alias): Rename variable new to
new_reg.
* gas/config/tc-dlx.c (parse_operand): Rename variable new to
new_pos.
* gas/config/tc-ia64.c (ia64_gen_real_reloc_type): Rename variable
new to newr.
* gas/config/tc-mcore.c (parse_exp, parse_imm): Rename variable
new to new_pointer.
* gas/config/tc-microblaze.c (parse_exp, parse_imm, check_got):
Change name from new to new_pointer.
* gas/config/tc-or32.c (parse_operand): Rename variable new to
new_pointer.
* gas/config/tc-pdp11.c (md_assemble): Rename variable new to
new_pointer.
* gas/config/tc-pj.c (alias): Change argument new to new_name.
* gas/config/tc-score.c (s3_build_score_ops_hsh): Rename variable
new to new_opcode. (s3_build_dependency_insn_hsh) Rename variable
new to new_i2n. (s3_convert): Rename variables old and new to
r_old and r_new.
* gas/config/tc-score7.c (s7_build_score_ops_hsh): Rename variable
new to new_opcode. (s7_build_dependency_insn_hsh): Rename variable
new to new_i2d. (s7_b32_relax_to_b16, s7_convert_frag): Rename
variables old and new to r_old and r_new.
* gas/config/tc-sh.c (parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-sh64.c (shmedia_parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-tic4x.c (tic4x_operand_parse): Rename variable new
to new_pointer.
* gas/config/tc-z8k.c (parse_exp): Rename variable new to
new_pointer.
* gas/listing.c (listing_newline): Rename variable new to new_i.
* ld/ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop)
(exp_trinop, exp_unop, exp_nameop, exp_assop): Rename variable new
to new_e.
* ld/ldfile.c (ldfile_add_library_path): Rename variable new to
new_dirs. (ldfile_add_arch): Rename variable new to new_arch.
* ld/ldlang.c (new_statement, lang_final, lang_add_wild)
(lang_target, lang_add_fill, lang_add_data, lang_add_assignment)
(lang_add_insert): Rename variable new to new_stmt. (new_afile):
Added missing cast. (lang_memory_region_lookup): Rename variable
new to new_region. (init_os): Rename variable new to
new_userdata. (lang_add_section): Rename variable new to
new_section. (ldlang_add_undef): Rename variable new to
new_undef. (realsymbol): Rename variable new to new_name.
* opcodes/z8kgen.c (internal, gas): Rename variable new to new_op.
Updated sources to avoid using the identifier name "template",
which is a keyword in c++.
* bfd/elf32-arm.c (struct stub_def): Rename member template to
template_sequence. (arm_build_one_stub,
find_stub_size_and_template, arm_size_one_stub, arm_map_one_stub):
Rename variable template to template_sequence.
* bfd/elfxx-ia64.c (elfNN_ia64_relax_br, elfNN_ia64_relax_brl):
Rename variable template to template_val.
* gas/config/tc-arm.c (struct asm_cond, struct asm_psr, struct
asm_barrier_opt): Change member template to
template_name. (md_begin): Update code to reflect new member
names.
* gas/config/tc-i386.c (struct templates, struct _i386_insn)
(match_template, cpu_flags_match, match_reg_size, match_mem_size)
(operand_size_match, md_begin, i386_print_statistics, pi)
(build_vex_prefix, md_assemble, parse_insn, optimize_imm)
(optimize_disp): Updated code to use new names. (parse_insn):
Added casts.
* gas/config/tc-ia64.c (dot_template, emit_one_bundle): Updated
code to use new names.
* gas/config/tc-score.c (struct s3_asm_opcode): Renamed member
template to template_name. (s3_parse_16_32_inst, s3_parse_48_inst,
s3_do_macro_ldst_label, s3_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-score7.c (struct s7_asm_opcode): Renamed member
template to template_name. (s7_parse_16_32_inst,
s7_do_macro_ldst_label, s7_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-tic30.c (md_begin, struct tic30_insn)
(md_assemble): Update code to use new names.
* gas/config/tc-tic54x.c (struct _tic54x_insn, md_begin)
(optimize_insn, tic54x_parse_insn, next_line_shows_parallel):
Update code to use new names.
* include/opcode/tic30.h (template): Rename type template to
insn_template. Updated code to use new name.
* include/opcode/tic54x.h (template): Rename type template to
insn_template.
* opcodes/cris-dis.c (bytes_to_skip): Update code to use new name.
* opcodes/i386-dis.c (putop): Update code to use new name.
* opcodes/i386-gen.c (process_i386_opcodes): Update code to use
new name.
* opcodes/i386-opc.h (struct template): Rename struct template to
insn_template. Update code accordingly.
* opcodes/i386-tbl.h (i386_optab): Update type to use new name.
* opcodes/ia64-dis.c (print_insn_ia64): Rename variable template
to template_val.
* opcodes/tic30-dis.c (struct instruction, get_tic30_instruction):
Update code to use new name.
* opcodes/tic54x-dis.c (has_lkaddr, get_insn_size)
(print_parallel_instruction, print_insn_tic54x, tic54x_get_insn):
Update code to use new name.
* opcodes/tic54x-opc.c (tic54x_unknown_opcode, tic54x_optab):
Update type to new name.
2009-08-30 00:11:02 +02:00
|
|
|
|
const char *template_name = (const char *) matchedp->args;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
const char *s;
|
|
|
|
|
|
Updated sources to avoid using the identifier name "new", which is a
keyword in c++.
* bfd/aoutx.h (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol.
* bfd/coffgen.c (coff_make_empty_symbol)
(coff_bfd_make_debug_symbol): Rename variable new to new_symbol.
* bfd/cpu-ia64-opc.c (ext_reg, ins_imms_scaled): Rename variable
new to new_insn.
* bfd/doc/chew.c (newentry, add_intrinsic): Rename variable new to
new_d.
* bfd/ecoff.c (_bfd_ecoff_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/elf32-m68k.c (elf_m68k_get_got_entry_type): Rename argument
new to new_reloc.
* bfd/hash.c (bfd_hash_lookup): Rename variable new to new_string.
* bfd/ieee.c (ieee_make_empty_symbol): Rename variable new to
new_symbol.
* bfd/linker.c (bfd_new_link_order): Rename variable new to
new_lo.
* bfd/mach-o.c (bfd_mach_o_sizeof_headers): Rename variable new to
symbol.
* bfd/oasys.c (oasys_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/pdp11.c (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol_type.
* bfd/plugin.c (bfd_plugin_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/rs6000-core.c (CoreHdr, VmInfo): Rename union member new to
new_dump.
(read_hdr, rs6000coff_core_p)
(rs6000coff_core_file_matches_executable_p)
(rs6000coff_core_file_failing_command)
(rs6000coff_core_file_failing_signal): Updated function to use new
union member name.
* bfd/som.c (som_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/syms.c (_bfd_generic_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/tekhex.c (first_phase, tekhex_make_empty_symbol): Rename
variable new to new_symbol.
* binutils/nlmconv.c (main): Rename variable new to new_name.
* gas/config/tc-arm.c (insert_reg_alias): Rename variable new to
new_reg.
* gas/config/tc-dlx.c (parse_operand): Rename variable new to
new_pos.
* gas/config/tc-ia64.c (ia64_gen_real_reloc_type): Rename variable
new to newr.
* gas/config/tc-mcore.c (parse_exp, parse_imm): Rename variable
new to new_pointer.
* gas/config/tc-microblaze.c (parse_exp, parse_imm, check_got):
Change name from new to new_pointer.
* gas/config/tc-or32.c (parse_operand): Rename variable new to
new_pointer.
* gas/config/tc-pdp11.c (md_assemble): Rename variable new to
new_pointer.
* gas/config/tc-pj.c (alias): Change argument new to new_name.
* gas/config/tc-score.c (s3_build_score_ops_hsh): Rename variable
new to new_opcode. (s3_build_dependency_insn_hsh) Rename variable
new to new_i2n. (s3_convert): Rename variables old and new to
r_old and r_new.
* gas/config/tc-score7.c (s7_build_score_ops_hsh): Rename variable
new to new_opcode. (s7_build_dependency_insn_hsh): Rename variable
new to new_i2d. (s7_b32_relax_to_b16, s7_convert_frag): Rename
variables old and new to r_old and r_new.
* gas/config/tc-sh.c (parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-sh64.c (shmedia_parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-tic4x.c (tic4x_operand_parse): Rename variable new
to new_pointer.
* gas/config/tc-z8k.c (parse_exp): Rename variable new to
new_pointer.
* gas/listing.c (listing_newline): Rename variable new to new_i.
* ld/ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop)
(exp_trinop, exp_unop, exp_nameop, exp_assop): Rename variable new
to new_e.
* ld/ldfile.c (ldfile_add_library_path): Rename variable new to
new_dirs. (ldfile_add_arch): Rename variable new to new_arch.
* ld/ldlang.c (new_statement, lang_final, lang_add_wild)
(lang_target, lang_add_fill, lang_add_data, lang_add_assignment)
(lang_add_insert): Rename variable new to new_stmt. (new_afile):
Added missing cast. (lang_memory_region_lookup): Rename variable
new to new_region. (init_os): Rename variable new to
new_userdata. (lang_add_section): Rename variable new to
new_section. (ldlang_add_undef): Rename variable new to
new_undef. (realsymbol): Rename variable new to new_name.
* opcodes/z8kgen.c (internal, gas): Rename variable new to new_op.
Updated sources to avoid using the identifier name "template",
which is a keyword in c++.
* bfd/elf32-arm.c (struct stub_def): Rename member template to
template_sequence. (arm_build_one_stub,
find_stub_size_and_template, arm_size_one_stub, arm_map_one_stub):
Rename variable template to template_sequence.
* bfd/elfxx-ia64.c (elfNN_ia64_relax_br, elfNN_ia64_relax_brl):
Rename variable template to template_val.
* gas/config/tc-arm.c (struct asm_cond, struct asm_psr, struct
asm_barrier_opt): Change member template to
template_name. (md_begin): Update code to reflect new member
names.
* gas/config/tc-i386.c (struct templates, struct _i386_insn)
(match_template, cpu_flags_match, match_reg_size, match_mem_size)
(operand_size_match, md_begin, i386_print_statistics, pi)
(build_vex_prefix, md_assemble, parse_insn, optimize_imm)
(optimize_disp): Updated code to use new names. (parse_insn):
Added casts.
* gas/config/tc-ia64.c (dot_template, emit_one_bundle): Updated
code to use new names.
* gas/config/tc-score.c (struct s3_asm_opcode): Renamed member
template to template_name. (s3_parse_16_32_inst, s3_parse_48_inst,
s3_do_macro_ldst_label, s3_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-score7.c (struct s7_asm_opcode): Renamed member
template to template_name. (s7_parse_16_32_inst,
s7_do_macro_ldst_label, s7_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-tic30.c (md_begin, struct tic30_insn)
(md_assemble): Update code to use new names.
* gas/config/tc-tic54x.c (struct _tic54x_insn, md_begin)
(optimize_insn, tic54x_parse_insn, next_line_shows_parallel):
Update code to use new names.
* include/opcode/tic30.h (template): Rename type template to
insn_template. Updated code to use new name.
* include/opcode/tic54x.h (template): Rename type template to
insn_template.
* opcodes/cris-dis.c (bytes_to_skip): Update code to use new name.
* opcodes/i386-dis.c (putop): Update code to use new name.
* opcodes/i386-gen.c (process_i386_opcodes): Update code to use
new name.
* opcodes/i386-opc.h (struct template): Rename struct template to
insn_template. Update code accordingly.
* opcodes/i386-tbl.h (i386_optab): Update type to use new name.
* opcodes/ia64-dis.c (print_insn_ia64): Rename variable template
to template_val.
* opcodes/tic30-dis.c (struct instruction, get_tic30_instruction):
Update code to use new name.
* opcodes/tic54x-dis.c (has_lkaddr, get_insn_size)
(print_parallel_instruction, print_insn_tic54x, tic54x_get_insn):
Update code to use new name.
* opcodes/tic54x-opc.c (tic54x_unknown_opcode, tic54x_optab):
Update type to new name.
2009-08-30 00:11:02 +02:00
|
|
|
|
for (s = template_name; *s; s++)
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
if ((*s == 's' || *s == 'N' || *s == 'Y')
|
2005-12-06 00:27:01 +01:00
|
|
|
|
&& (insn & 0x400) && (insn & 15) == 15
|
|
|
|
|
&& prefix_matchedp == NULL)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
{
|
|
|
|
|
/* Immediate via [pc+], so we have to check the size of the
|
|
|
|
|
operand. */
|
Updated sources to avoid using the identifier name "new", which is a
keyword in c++.
* bfd/aoutx.h (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol.
* bfd/coffgen.c (coff_make_empty_symbol)
(coff_bfd_make_debug_symbol): Rename variable new to new_symbol.
* bfd/cpu-ia64-opc.c (ext_reg, ins_imms_scaled): Rename variable
new to new_insn.
* bfd/doc/chew.c (newentry, add_intrinsic): Rename variable new to
new_d.
* bfd/ecoff.c (_bfd_ecoff_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/elf32-m68k.c (elf_m68k_get_got_entry_type): Rename argument
new to new_reloc.
* bfd/hash.c (bfd_hash_lookup): Rename variable new to new_string.
* bfd/ieee.c (ieee_make_empty_symbol): Rename variable new to
new_symbol.
* bfd/linker.c (bfd_new_link_order): Rename variable new to
new_lo.
* bfd/mach-o.c (bfd_mach_o_sizeof_headers): Rename variable new to
symbol.
* bfd/oasys.c (oasys_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/pdp11.c (NAME (aout, make_empty_symbol)): Rename variable
new to new_symbol_type.
* bfd/plugin.c (bfd_plugin_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/rs6000-core.c (CoreHdr, VmInfo): Rename union member new to
new_dump.
(read_hdr, rs6000coff_core_p)
(rs6000coff_core_file_matches_executable_p)
(rs6000coff_core_file_failing_command)
(rs6000coff_core_file_failing_signal): Updated function to use new
union member name.
* bfd/som.c (som_make_empty_symbol): Rename variable new to
new_symbol_type.
* bfd/syms.c (_bfd_generic_make_empty_symbol): Rename variable new
to new_symbol.
* bfd/tekhex.c (first_phase, tekhex_make_empty_symbol): Rename
variable new to new_symbol.
* binutils/nlmconv.c (main): Rename variable new to new_name.
* gas/config/tc-arm.c (insert_reg_alias): Rename variable new to
new_reg.
* gas/config/tc-dlx.c (parse_operand): Rename variable new to
new_pos.
* gas/config/tc-ia64.c (ia64_gen_real_reloc_type): Rename variable
new to newr.
* gas/config/tc-mcore.c (parse_exp, parse_imm): Rename variable
new to new_pointer.
* gas/config/tc-microblaze.c (parse_exp, parse_imm, check_got):
Change name from new to new_pointer.
* gas/config/tc-or32.c (parse_operand): Rename variable new to
new_pointer.
* gas/config/tc-pdp11.c (md_assemble): Rename variable new to
new_pointer.
* gas/config/tc-pj.c (alias): Change argument new to new_name.
* gas/config/tc-score.c (s3_build_score_ops_hsh): Rename variable
new to new_opcode. (s3_build_dependency_insn_hsh) Rename variable
new to new_i2n. (s3_convert): Rename variables old and new to
r_old and r_new.
* gas/config/tc-score7.c (s7_build_score_ops_hsh): Rename variable
new to new_opcode. (s7_build_dependency_insn_hsh): Rename variable
new to new_i2d. (s7_b32_relax_to_b16, s7_convert_frag): Rename
variables old and new to r_old and r_new.
* gas/config/tc-sh.c (parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-sh64.c (shmedia_parse_exp): Rename variable new to
new_pointer.
* gas/config/tc-tic4x.c (tic4x_operand_parse): Rename variable new
to new_pointer.
* gas/config/tc-z8k.c (parse_exp): Rename variable new to
new_pointer.
* gas/listing.c (listing_newline): Rename variable new to new_i.
* ld/ldexp.c (exp_intop, exp_bigintop, exp_relop, exp_binop)
(exp_trinop, exp_unop, exp_nameop, exp_assop): Rename variable new
to new_e.
* ld/ldfile.c (ldfile_add_library_path): Rename variable new to
new_dirs. (ldfile_add_arch): Rename variable new to new_arch.
* ld/ldlang.c (new_statement, lang_final, lang_add_wild)
(lang_target, lang_add_fill, lang_add_data, lang_add_assignment)
(lang_add_insert): Rename variable new to new_stmt. (new_afile):
Added missing cast. (lang_memory_region_lookup): Rename variable
new to new_region. (init_os): Rename variable new to
new_userdata. (lang_add_section): Rename variable new to
new_section. (ldlang_add_undef): Rename variable new to
new_undef. (realsymbol): Rename variable new to new_name.
* opcodes/z8kgen.c (internal, gas): Rename variable new to new_op.
Updated sources to avoid using the identifier name "template",
which is a keyword in c++.
* bfd/elf32-arm.c (struct stub_def): Rename member template to
template_sequence. (arm_build_one_stub,
find_stub_size_and_template, arm_size_one_stub, arm_map_one_stub):
Rename variable template to template_sequence.
* bfd/elfxx-ia64.c (elfNN_ia64_relax_br, elfNN_ia64_relax_brl):
Rename variable template to template_val.
* gas/config/tc-arm.c (struct asm_cond, struct asm_psr, struct
asm_barrier_opt): Change member template to
template_name. (md_begin): Update code to reflect new member
names.
* gas/config/tc-i386.c (struct templates, struct _i386_insn)
(match_template, cpu_flags_match, match_reg_size, match_mem_size)
(operand_size_match, md_begin, i386_print_statistics, pi)
(build_vex_prefix, md_assemble, parse_insn, optimize_imm)
(optimize_disp): Updated code to use new names. (parse_insn):
Added casts.
* gas/config/tc-ia64.c (dot_template, emit_one_bundle): Updated
code to use new names.
* gas/config/tc-score.c (struct s3_asm_opcode): Renamed member
template to template_name. (s3_parse_16_32_inst, s3_parse_48_inst,
s3_do_macro_ldst_label, s3_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-score7.c (struct s7_asm_opcode): Renamed member
template to template_name. (s7_parse_16_32_inst,
s7_do_macro_ldst_label, s7_build_score_ops_hsh): Update code to
use new names.
* gas/config/tc-tic30.c (md_begin, struct tic30_insn)
(md_assemble): Update code to use new names.
* gas/config/tc-tic54x.c (struct _tic54x_insn, md_begin)
(optimize_insn, tic54x_parse_insn, next_line_shows_parallel):
Update code to use new names.
* include/opcode/tic30.h (template): Rename type template to
insn_template. Updated code to use new name.
* include/opcode/tic54x.h (template): Rename type template to
insn_template.
* opcodes/cris-dis.c (bytes_to_skip): Update code to use new name.
* opcodes/i386-dis.c (putop): Update code to use new name.
* opcodes/i386-gen.c (process_i386_opcodes): Update code to use
new name.
* opcodes/i386-opc.h (struct template): Rename struct template to
insn_template. Update code accordingly.
* opcodes/i386-tbl.h (i386_optab): Update type to use new name.
* opcodes/ia64-dis.c (print_insn_ia64): Rename variable template
to template_val.
* opcodes/tic30-dis.c (struct instruction, get_tic30_instruction):
Update code to use new name.
* opcodes/tic54x-dis.c (has_lkaddr, get_insn_size)
(print_parallel_instruction, print_insn_tic54x, tic54x_get_insn):
Update code to use new name.
* opcodes/tic54x-opc.c (tic54x_unknown_opcode, tic54x_optab):
Update type to new name.
2009-08-30 00:11:02 +02:00
|
|
|
|
int mode_size = 1 << ((insn >> 4) & (*template_name == 'z' ? 1 : 3));
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
if (matchedp->imm_oprnd_size == SIZE_FIX_32)
|
|
|
|
|
to_skip += 4;
|
|
|
|
|
else if (matchedp->imm_oprnd_size == SIZE_SPEC_REG)
|
|
|
|
|
{
|
|
|
|
|
const struct cris_spec_reg *sregp
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= spec_reg_info ((insn >> 12) & 15, distype);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
/* FIXME: Improve error handling; should have been caught
|
|
|
|
|
earlier. */
|
|
|
|
|
if (sregp == NULL)
|
|
|
|
|
return 2;
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
/* PC is incremented by two, not one, for a byte. Except on
|
|
|
|
|
CRISv32, where constants are always DWORD-size for
|
|
|
|
|
special registers. */
|
|
|
|
|
to_skip +=
|
|
|
|
|
distype == cris_dis_v32 ? 4 : (sregp->reg_size + 1) & ~1;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
to_skip += (mode_size + 1) & ~1;
|
|
|
|
|
}
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
else if (*s == 'n')
|
|
|
|
|
to_skip += 4;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
else if (*s == 'b')
|
|
|
|
|
to_skip += 2;
|
|
|
|
|
|
|
|
|
|
return to_skip;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print condition code flags. */
|
2000-09-29 20:17:25 +02:00
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
static char *
|
2005-07-01 13:16:33 +02:00
|
|
|
|
print_flags (struct cris_disasm_data *disdata, unsigned int insn, char *cp)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
{
|
|
|
|
|
/* Use the v8 (Etrax 100) flag definitions for disassembly.
|
|
|
|
|
The differences with v0 (Etrax 1..4) vs. Svinto are:
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
v0 'd' <=> v8 'm'
|
|
|
|
|
v0 'e' <=> v8 'b'.
|
|
|
|
|
FIXME: Emit v0..v3 flag names somehow. */
|
|
|
|
|
static const char v8_fnames[] = "cvznxibm";
|
|
|
|
|
static const char v32_fnames[] = "cvznxiup";
|
|
|
|
|
const char *fnames
|
|
|
|
|
= disdata->distype == cris_dis_v32 ? v32_fnames : v8_fnames;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
unsigned char flagbits = (((insn >> 8) & 0xf0) | (insn & 15));
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++)
|
|
|
|
|
if (flagbits & (1 << i))
|
|
|
|
|
*cp++ = fnames[i];
|
|
|
|
|
|
|
|
|
|
return cp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print out an insn with its operands, and update the info->insn_type
|
|
|
|
|
fields. The prefix_opcodep and the rest hold a prefix insn that is
|
|
|
|
|
supposed to be output as an address mode. */
|
2000-09-29 20:17:25 +02:00
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
static void
|
2005-07-01 13:16:33 +02:00
|
|
|
|
print_with_operands (const struct cris_opcode *opcodep,
|
|
|
|
|
unsigned int insn,
|
|
|
|
|
unsigned char *buffer,
|
|
|
|
|
bfd_vma addr,
|
|
|
|
|
disassemble_info *info,
|
|
|
|
|
/* If a prefix insn was before this insn (and is supposed
|
|
|
|
|
to be output as an address), here is a description of
|
|
|
|
|
it. */
|
|
|
|
|
const struct cris_opcode *prefix_opcodep,
|
|
|
|
|
unsigned int prefix_insn,
|
|
|
|
|
unsigned char *prefix_buffer,
|
|
|
|
|
bfd_boolean with_reg_prefix)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
{
|
|
|
|
|
/* Get a buffer of somewhat reasonable size where we store
|
|
|
|
|
intermediate parts of the insn. */
|
2000-09-29 20:17:25 +02:00
|
|
|
|
char temp[sizeof (".d [$r13=$r12-2147483648],$r10") * 2];
|
2000-07-20 18:46:28 +02:00
|
|
|
|
char *tp = temp;
|
|
|
|
|
static const char mode_char[] = "bwd?";
|
|
|
|
|
const char *s;
|
|
|
|
|
const char *cs;
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
struct cris_disasm_data *disdata
|
|
|
|
|
= (struct cris_disasm_data *) info->private_data;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
/* Print out the name first thing we do. */
|
|
|
|
|
(*info->fprintf_func) (info->stream, "%s", opcodep->name);
|
|
|
|
|
|
|
|
|
|
cs = opcodep->args;
|
|
|
|
|
s = cs;
|
|
|
|
|
|
|
|
|
|
/* Ignore any prefix indicator. */
|
|
|
|
|
if (*s == 'p')
|
|
|
|
|
s++;
|
|
|
|
|
|
|
|
|
|
if (*s == 'm' || *s == 'M' || *s == 'z')
|
|
|
|
|
{
|
|
|
|
|
*tp++ = '.';
|
|
|
|
|
|
|
|
|
|
/* Get the size-letter. */
|
|
|
|
|
*tp++ = *s == 'M'
|
|
|
|
|
? (insn & 0x8000 ? 'd'
|
|
|
|
|
: insn & 0x4000 ? 'w' : 'b')
|
|
|
|
|
: mode_char[(insn >> 4) & (*s == 'z' ? 1 : 3)];
|
|
|
|
|
|
|
|
|
|
/* Ignore the size and the space character that follows. */
|
|
|
|
|
s += 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Add a space if this isn't a long-branch, because for those will add
|
|
|
|
|
the condition part of the name later. */
|
|
|
|
|
if (opcodep->match != (BRANCH_PC_LOW + BRANCH_INCR_HIGH * 256))
|
|
|
|
|
*tp++ = ' ';
|
|
|
|
|
|
|
|
|
|
/* Fill in the insn-type if deducible from the name (and there's no
|
|
|
|
|
better way). */
|
|
|
|
|
if (opcodep->name[0] == 'j')
|
|
|
|
|
{
|
2006-09-16 20:12:17 +02:00
|
|
|
|
if (CONST_STRNEQ (opcodep->name, "jsr"))
|
2000-07-20 18:46:28 +02:00
|
|
|
|
/* It's "jsr" or "jsrc". */
|
|
|
|
|
info->insn_type = dis_jsr;
|
|
|
|
|
else
|
|
|
|
|
/* Any other jump-type insn is considered a branch. */
|
|
|
|
|
info->insn_type = dis_branch;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We might know some more fields right now. */
|
|
|
|
|
info->branch_delay_insns = opcodep->delayed;
|
|
|
|
|
|
|
|
|
|
/* Handle operands. */
|
|
|
|
|
for (; *s; s++)
|
|
|
|
|
{
|
|
|
|
|
switch (*s)
|
|
|
|
|
{
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
case 'T':
|
|
|
|
|
tp = format_sup_reg ((insn >> 12) & 15, tp, with_reg_prefix);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'A':
|
|
|
|
|
if (with_reg_prefix)
|
|
|
|
|
*tp++ = REGISTER_PREFIX_CHAR;
|
|
|
|
|
*tp++ = 'a';
|
|
|
|
|
*tp++ = 'c';
|
|
|
|
|
*tp++ = 'r';
|
|
|
|
|
break;
|
2015-08-12 13:45:07 +02:00
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
case '[':
|
|
|
|
|
case ']':
|
2000-07-20 18:46:28 +02:00
|
|
|
|
case ',':
|
|
|
|
|
*tp++ = *s;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case '!':
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
/* Ignore at this point; used at earlier stages to avoid
|
|
|
|
|
recognition if there's a prefix at something that in other
|
|
|
|
|
ways looks like a "pop". */
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
|
/* Ignore. This is an optional ".d " on the large one of
|
|
|
|
|
relaxable insns. */
|
2000-07-20 18:46:28 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'B':
|
|
|
|
|
/* This was the prefix that made this a "push". We've already
|
|
|
|
|
handled it by recognizing it, so signal that the prefix is
|
|
|
|
|
handled by setting it to NULL. */
|
|
|
|
|
prefix_opcodep = NULL;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'D':
|
|
|
|
|
case 'r':
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, insn & 15, tp, with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'R':
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'n':
|
|
|
|
|
{
|
|
|
|
|
/* Like N but pc-relative to the start of the insn. */
|
|
|
|
|
unsigned long number
|
|
|
|
|
= (buffer[2] + buffer[3] * 256 + buffer[4] * 65536
|
|
|
|
|
+ buffer[5] * 0x1000000 + addr);
|
|
|
|
|
|
|
|
|
|
/* Finish off and output previous formatted bytes. */
|
|
|
|
|
*tp = 0;
|
|
|
|
|
if (temp[0])
|
|
|
|
|
(*info->fprintf_func) (info->stream, "%s", temp);
|
|
|
|
|
tp = temp;
|
|
|
|
|
|
|
|
|
|
(*info->print_address_func) ((bfd_vma) number, info);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'u':
|
|
|
|
|
{
|
|
|
|
|
/* Like n but the offset is bits <3:0> in the instruction. */
|
|
|
|
|
unsigned long number = (buffer[0] & 0xf) * 2 + addr;
|
|
|
|
|
|
|
|
|
|
/* Finish off and output previous formatted bytes. */
|
|
|
|
|
*tp = 0;
|
|
|
|
|
if (temp[0])
|
|
|
|
|
(*info->fprintf_func) (info->stream, "%s", temp);
|
|
|
|
|
tp = temp;
|
|
|
|
|
|
|
|
|
|
(*info->print_address_func) ((bfd_vma) number, info);
|
|
|
|
|
}
|
2000-07-20 18:46:28 +02:00
|
|
|
|
break;
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
case 'N':
|
2000-07-20 18:46:28 +02:00
|
|
|
|
case 'y':
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
case 'Y':
|
2000-07-20 18:46:28 +02:00
|
|
|
|
case 'S':
|
|
|
|
|
case 's':
|
|
|
|
|
/* Any "normal" memory operand. */
|
2005-12-06 00:27:01 +01:00
|
|
|
|
if ((insn & 0x400) && (insn & 15) == 15 && prefix_opcodep == NULL)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
{
|
|
|
|
|
/* We're looking at [pc+], i.e. we need to output an immediate
|
|
|
|
|
number, where the size can depend on different things. */
|
|
|
|
|
long number;
|
|
|
|
|
int signedp
|
|
|
|
|
= ((*cs == 'z' && (insn & 0x20))
|
|
|
|
|
|| opcodep->match == BDAP_QUICK_OPCODE);
|
|
|
|
|
int nbytes;
|
|
|
|
|
|
|
|
|
|
if (opcodep->imm_oprnd_size == SIZE_FIX_32)
|
|
|
|
|
nbytes = 4;
|
|
|
|
|
else if (opcodep->imm_oprnd_size == SIZE_SPEC_REG)
|
|
|
|
|
{
|
|
|
|
|
const struct cris_spec_reg *sregp
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= spec_reg_info ((insn >> 12) & 15, disdata->distype);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
/* A NULL return should have been as a non-match earlier,
|
|
|
|
|
so catch it as an internal error in the error-case
|
|
|
|
|
below. */
|
|
|
|
|
if (sregp == NULL)
|
|
|
|
|
/* Whatever non-valid size. */
|
|
|
|
|
nbytes = 42;
|
|
|
|
|
else
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
/* PC is always incremented by a multiple of two.
|
|
|
|
|
For CRISv32, immediates are always 4 bytes for
|
|
|
|
|
special registers. */
|
|
|
|
|
nbytes = disdata->distype == cris_dis_v32
|
|
|
|
|
? 4 : (sregp->reg_size + 1) & ~1;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
int mode_size = 1 << ((insn >> 4) & (*cs == 'z' ? 1 : 3));
|
|
|
|
|
|
|
|
|
|
if (mode_size == 1)
|
|
|
|
|
nbytes = 2;
|
|
|
|
|
else
|
|
|
|
|
nbytes = mode_size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (nbytes)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
number = buffer[2];
|
|
|
|
|
if (signedp && number > 127)
|
|
|
|
|
number -= 256;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
number = buffer[2] + buffer[3] * 256;
|
|
|
|
|
if (signedp && number > 32767)
|
|
|
|
|
number -= 65536;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
number
|
|
|
|
|
= buffer[2] + buffer[3] * 256 + buffer[4] * 65536
|
|
|
|
|
+ buffer[5] * 0x1000000;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
strcpy (tp, "bug");
|
|
|
|
|
tp += 3;
|
|
|
|
|
number = 42;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((*cs == 'z' && (insn & 0x20))
|
|
|
|
|
|| (opcodep->match == BDAP_QUICK_OPCODE
|
|
|
|
|
&& (nbytes <= 2 || buffer[1 + nbytes] == 0)))
|
|
|
|
|
tp = format_dec (number, tp, signedp);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
unsigned int highbyte = (number >> 24) & 0xff;
|
|
|
|
|
|
|
|
|
|
/* Either output this as an address or as a number. If it's
|
|
|
|
|
a dword with the same high-byte as the address of the
|
|
|
|
|
insn, assume it's an address, and also if it's a non-zero
|
|
|
|
|
non-0xff high-byte. If this is a jsr or a jump, then
|
|
|
|
|
it's definitely an address. */
|
|
|
|
|
if (nbytes == 4
|
|
|
|
|
&& (highbyte == ((addr >> 24) & 0xff)
|
|
|
|
|
|| (highbyte != 0 && highbyte != 0xff)
|
|
|
|
|
|| info->insn_type == dis_branch
|
|
|
|
|
|| info->insn_type == dis_jsr))
|
|
|
|
|
{
|
|
|
|
|
/* Finish off and output previous formatted bytes. */
|
|
|
|
|
*tp = 0;
|
|
|
|
|
tp = temp;
|
|
|
|
|
if (temp[0])
|
|
|
|
|
(*info->fprintf_func) (info->stream, "%s", temp);
|
|
|
|
|
|
|
|
|
|
(*info->print_address_func) ((bfd_vma) number, info);
|
|
|
|
|
|
|
|
|
|
info->target = number;
|
|
|
|
|
}
|
|
|
|
|
else
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_hex (number, tp, disdata);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Not an immediate number. Then this is a (possibly
|
|
|
|
|
prefixed) memory operand. */
|
|
|
|
|
if (info->insn_type != dis_nonbranch)
|
|
|
|
|
{
|
|
|
|
|
int mode_size
|
|
|
|
|
= 1 << ((insn >> 4)
|
|
|
|
|
& (opcodep->args[0] == 'z' ? 1 : 3));
|
|
|
|
|
int size;
|
|
|
|
|
info->insn_type = dis_dref;
|
|
|
|
|
info->flags |= CRIS_DIS_FLAG_MEMREF;
|
|
|
|
|
|
|
|
|
|
if (opcodep->imm_oprnd_size == SIZE_FIX_32)
|
|
|
|
|
size = 4;
|
|
|
|
|
else if (opcodep->imm_oprnd_size == SIZE_SPEC_REG)
|
|
|
|
|
{
|
|
|
|
|
const struct cris_spec_reg *sregp
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= spec_reg_info ((insn >> 12) & 15, disdata->distype);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
/* FIXME: Improve error handling; should have been caught
|
|
|
|
|
earlier. */
|
|
|
|
|
if (sregp == NULL)
|
|
|
|
|
size = 4;
|
|
|
|
|
else
|
|
|
|
|
size = sregp->reg_size;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
size = mode_size;
|
|
|
|
|
|
|
|
|
|
info->data_size = size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*tp++ = '[';
|
|
|
|
|
|
|
|
|
|
if (prefix_opcodep
|
|
|
|
|
/* We don't match dip with a postincremented field
|
|
|
|
|
as a side-effect address mode. */
|
|
|
|
|
&& ((insn & 0x400) == 0
|
|
|
|
|
|| prefix_opcodep->match != DIP_OPCODE))
|
|
|
|
|
{
|
|
|
|
|
if (insn & 0x400)
|
|
|
|
|
{
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, insn & 15, tp, with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
*tp++ = '=';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* We mainly ignore the prefix format string when the
|
|
|
|
|
address-mode syntax is output. */
|
|
|
|
|
switch (prefix_opcodep->match)
|
|
|
|
|
{
|
|
|
|
|
case DIP_OPCODE:
|
|
|
|
|
/* It's [r], [r+] or [pc+]. */
|
|
|
|
|
if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15)
|
|
|
|
|
{
|
|
|
|
|
/* It's [pc+]. This cannot possibly be anything
|
|
|
|
|
but an address. */
|
|
|
|
|
unsigned long number
|
|
|
|
|
= prefix_buffer[2] + prefix_buffer[3] * 256
|
|
|
|
|
+ prefix_buffer[4] * 65536
|
|
|
|
|
+ prefix_buffer[5] * 0x1000000;
|
|
|
|
|
|
|
|
|
|
info->target = (bfd_vma) number;
|
|
|
|
|
|
|
|
|
|
/* Finish off and output previous formatted
|
|
|
|
|
data. */
|
|
|
|
|
*tp = 0;
|
|
|
|
|
tp = temp;
|
|
|
|
|
if (temp[0])
|
|
|
|
|
(*info->fprintf_func) (info->stream, "%s", temp);
|
|
|
|
|
|
|
|
|
|
(*info->print_address_func) ((bfd_vma) number, info);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* For a memref in an address, we use target2.
|
|
|
|
|
In this case, target is zero. */
|
|
|
|
|
info->flags
|
|
|
|
|
|= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG
|
|
|
|
|
| CRIS_DIS_FLAG_MEM_TARGET2_MEM);
|
|
|
|
|
|
|
|
|
|
info->target2 = prefix_insn & 15;
|
|
|
|
|
|
|
|
|
|
*tp++ = '[';
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, prefix_insn & 15, tp,
|
2000-09-29 20:17:25 +02:00
|
|
|
|
with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
if (prefix_insn & 0x400)
|
|
|
|
|
*tp++ = '+';
|
|
|
|
|
*tp++ = ']';
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BDAP_QUICK_OPCODE:
|
|
|
|
|
{
|
|
|
|
|
int number;
|
|
|
|
|
|
|
|
|
|
number = prefix_buffer[0];
|
|
|
|
|
if (number > 127)
|
|
|
|
|
number -= 256;
|
|
|
|
|
|
|
|
|
|
/* Output "reg+num" or, if num < 0, "reg-num". */
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp,
|
2000-09-29 20:17:25 +02:00
|
|
|
|
with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
if (number >= 0)
|
|
|
|
|
*tp++ = '+';
|
|
|
|
|
tp = format_dec (number, tp, 1);
|
|
|
|
|
|
|
|
|
|
info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG;
|
|
|
|
|
info->target = (prefix_insn >> 12) & 15;
|
|
|
|
|
info->target2 = (bfd_vma) number;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BIAP_OPCODE:
|
|
|
|
|
/* Output "r+R.m". */
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, prefix_insn & 15, tp,
|
|
|
|
|
with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
*tp++ = '+';
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp,
|
2000-09-29 20:17:25 +02:00
|
|
|
|
with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
*tp++ = '.';
|
|
|
|
|
*tp++ = mode_char[(prefix_insn >> 4) & 3];
|
|
|
|
|
|
|
|
|
|
info->flags
|
|
|
|
|
|= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG
|
|
|
|
|
| CRIS_DIS_FLAG_MEM_TARGET_IS_REG
|
|
|
|
|
|
|
|
|
|
| ((prefix_insn & 0x8000)
|
|
|
|
|
? CRIS_DIS_FLAG_MEM_TARGET2_MULT4
|
|
|
|
|
: ((prefix_insn & 0x8000)
|
|
|
|
|
? CRIS_DIS_FLAG_MEM_TARGET2_MULT2 : 0)));
|
|
|
|
|
|
|
|
|
|
/* Is it the casejump? It's a "adds.w [pc+r%d.w],pc". */
|
|
|
|
|
if (insn == 0xf83f && (prefix_insn & ~0xf000) == 0x55f)
|
|
|
|
|
/* Then start interpreting data as offsets. */
|
|
|
|
|
case_offset_counter = no_of_case_offsets;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BDAP_INDIR_OPCODE:
|
|
|
|
|
/* Output "r+s.m", or, if "s" is [pc+], "r+s" or
|
|
|
|
|
"r-s". */
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, (prefix_insn >> 12) & 15, tp,
|
2000-09-29 20:17:25 +02:00
|
|
|
|
with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
if ((prefix_insn & 0x400) && (prefix_insn & 15) == 15)
|
|
|
|
|
{
|
|
|
|
|
long number;
|
|
|
|
|
unsigned int nbytes;
|
|
|
|
|
|
|
|
|
|
/* It's a value. Get its size. */
|
|
|
|
|
int mode_size = 1 << ((prefix_insn >> 4) & 3);
|
|
|
|
|
|
|
|
|
|
if (mode_size == 1)
|
|
|
|
|
nbytes = 2;
|
|
|
|
|
else
|
|
|
|
|
nbytes = mode_size;
|
|
|
|
|
|
|
|
|
|
switch (nbytes)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
number = prefix_buffer[2];
|
|
|
|
|
if (number > 127)
|
|
|
|
|
number -= 256;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
number = prefix_buffer[2] + prefix_buffer[3] * 256;
|
|
|
|
|
if (number > 32767)
|
|
|
|
|
number -= 65536;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
number
|
|
|
|
|
= prefix_buffer[2] + prefix_buffer[3] * 256
|
|
|
|
|
+ prefix_buffer[4] * 65536
|
|
|
|
|
+ prefix_buffer[5] * 0x1000000;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
strcpy (tp, "bug");
|
|
|
|
|
tp += 3;
|
|
|
|
|
number = 42;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG;
|
|
|
|
|
info->target2 = (bfd_vma) number;
|
|
|
|
|
|
|
|
|
|
/* If the size is dword, then assume it's an
|
|
|
|
|
address. */
|
|
|
|
|
if (nbytes == 4)
|
|
|
|
|
{
|
|
|
|
|
/* Finish off and output previous formatted
|
|
|
|
|
bytes. */
|
|
|
|
|
*tp++ = '+';
|
|
|
|
|
*tp = 0;
|
|
|
|
|
tp = temp;
|
|
|
|
|
(*info->fprintf_func) (info->stream, "%s", temp);
|
|
|
|
|
|
|
|
|
|
(*info->print_address_func) ((bfd_vma) number, info);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (number >= 0)
|
|
|
|
|
*tp++ = '+';
|
|
|
|
|
tp = format_dec (number, tp, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Output "r+[R].m" or "r+[R+].m". */
|
|
|
|
|
*tp++ = '+';
|
|
|
|
|
*tp++ = '[';
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, prefix_insn & 15, tp,
|
2000-09-29 20:17:25 +02:00
|
|
|
|
with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
if (prefix_insn & 0x400)
|
|
|
|
|
*tp++ = '+';
|
|
|
|
|
*tp++ = ']';
|
|
|
|
|
*tp++ = '.';
|
|
|
|
|
*tp++ = mode_char[(prefix_insn >> 4) & 3];
|
|
|
|
|
|
|
|
|
|
info->flags
|
|
|
|
|
|= (CRIS_DIS_FLAG_MEM_TARGET2_IS_REG
|
|
|
|
|
| CRIS_DIS_FLAG_MEM_TARGET2_MEM
|
|
|
|
|
| CRIS_DIS_FLAG_MEM_TARGET_IS_REG
|
|
|
|
|
|
|
|
|
|
| (((prefix_insn >> 4) == 2)
|
|
|
|
|
? 0
|
|
|
|
|
: (((prefix_insn >> 4) & 3) == 1
|
|
|
|
|
? CRIS_DIS_FLAG_MEM_TARGET2_MEM_WORD
|
|
|
|
|
: CRIS_DIS_FLAG_MEM_TARGET2_MEM_BYTE)));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
(*info->fprintf_func) (info->stream, "?prefix-bug");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* To mark that the prefix is used, reset it. */
|
|
|
|
|
prefix_opcodep = NULL;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, insn & 15, tp, with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
info->flags |= CRIS_DIS_FLAG_MEM_TARGET_IS_REG;
|
|
|
|
|
info->target = insn & 15;
|
|
|
|
|
|
|
|
|
|
if (insn & 0x400)
|
|
|
|
|
*tp++ = '+';
|
|
|
|
|
}
|
|
|
|
|
*tp++ = ']';
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'x':
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
*tp++ = '.';
|
|
|
|
|
*tp++ = mode_char[(insn >> 4) & 3];
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'I':
|
|
|
|
|
tp = format_dec (insn & 63, tp, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'b':
|
|
|
|
|
{
|
|
|
|
|
int where = buffer[2] + buffer[3] * 256;
|
|
|
|
|
|
|
|
|
|
if (where > 32767)
|
|
|
|
|
where -= 65536;
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
where += addr + ((disdata->distype == cris_dis_v32) ? 0 : 4);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
if (insn == BA_PC_INCR_OPCODE)
|
|
|
|
|
info->insn_type = dis_branch;
|
|
|
|
|
else
|
|
|
|
|
info->insn_type = dis_condbranch;
|
|
|
|
|
|
|
|
|
|
info->target = (bfd_vma) where;
|
|
|
|
|
|
|
|
|
|
*tp = 0;
|
|
|
|
|
tp = temp;
|
|
|
|
|
(*info->fprintf_func) (info->stream, "%s%s ",
|
|
|
|
|
temp, cris_cc_strings[insn >> 12]);
|
|
|
|
|
|
|
|
|
|
(*info->print_address_func) ((bfd_vma) where, info);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'c':
|
|
|
|
|
tp = format_dec (insn & 31, tp, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'C':
|
|
|
|
|
tp = format_dec (insn & 15, tp, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'o':
|
|
|
|
|
{
|
|
|
|
|
long offset = insn & 0xfe;
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
bfd_vma target;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
if (insn & 1)
|
|
|
|
|
offset |= ~0xff;
|
|
|
|
|
|
|
|
|
|
if (opcodep->match == BA_QUICK_OPCODE)
|
|
|
|
|
info->insn_type = dis_branch;
|
|
|
|
|
else
|
|
|
|
|
info->insn_type = dis_condbranch;
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
target = addr + ((disdata->distype == cris_dis_v32) ? 0 : 2) + offset;
|
|
|
|
|
info->target = target;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
*tp = 0;
|
|
|
|
|
tp = temp;
|
|
|
|
|
(*info->fprintf_func) (info->stream, "%s", temp);
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
(*info->print_address_func) (target, info);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
case 'Q':
|
2000-07-20 18:46:28 +02:00
|
|
|
|
case 'O':
|
|
|
|
|
{
|
|
|
|
|
long number = buffer[0];
|
|
|
|
|
|
|
|
|
|
if (number > 127)
|
|
|
|
|
number = number - 256;
|
|
|
|
|
|
|
|
|
|
tp = format_dec (number, tp, 1);
|
|
|
|
|
*tp++ = ',';
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = format_reg (disdata, (insn >> 12) & 15, tp, with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'f':
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
tp = print_flags (disdata, insn, tp);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'i':
|
2005-03-23 20:21:16 +01:00
|
|
|
|
tp = format_dec ((insn & 32) ? (insn & 31) | ~31L : insn & 31, tp, 1);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'P':
|
|
|
|
|
{
|
|
|
|
|
const struct cris_spec_reg *sregp
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
= spec_reg_info ((insn >> 12) & 15, disdata->distype);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
if (sregp->name == NULL)
|
|
|
|
|
/* Should have been caught as a non-match eariler. */
|
|
|
|
|
*tp++ = '?';
|
|
|
|
|
else
|
|
|
|
|
{
|
2000-09-29 20:17:25 +02:00
|
|
|
|
if (with_reg_prefix)
|
|
|
|
|
*tp++ = REGISTER_PREFIX_CHAR;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
strcpy (tp, sregp->name);
|
|
|
|
|
tp += strlen (tp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
strcpy (tp, "???");
|
|
|
|
|
tp += 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*tp = 0;
|
|
|
|
|
|
|
|
|
|
if (prefix_opcodep)
|
|
|
|
|
(*info->fprintf_func) (info->stream, " (OOPS unused prefix \"%s: %s\")",
|
|
|
|
|
prefix_opcodep->name, prefix_opcodep->args);
|
|
|
|
|
|
|
|
|
|
(*info->fprintf_func) (info->stream, "%s", temp);
|
|
|
|
|
|
|
|
|
|
/* Get info for matching case-tables, if we don't have any active.
|
|
|
|
|
We assume that the last constant seen is used; either in the insn
|
|
|
|
|
itself or in a "move.d const,rN, sub.d rN,rM"-like sequence. */
|
|
|
|
|
if (TRACE_CASE && case_offset_counter == 0)
|
|
|
|
|
{
|
2006-09-16 20:12:17 +02:00
|
|
|
|
if (CONST_STRNEQ (opcodep->name, "sub"))
|
2000-07-20 18:46:28 +02:00
|
|
|
|
case_offset = last_immediate;
|
|
|
|
|
|
|
|
|
|
/* It could also be an "add", if there are negative case-values. */
|
2006-09-16 20:12:17 +02:00
|
|
|
|
else if (CONST_STRNEQ (opcodep->name, "add"))
|
2005-07-01 13:16:33 +02:00
|
|
|
|
/* The first case is the negated operand to the add. */
|
|
|
|
|
case_offset = -last_immediate;
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
/* A bound insn will tell us the number of cases. */
|
2006-09-16 20:12:17 +02:00
|
|
|
|
else if (CONST_STRNEQ (opcodep->name, "bound"))
|
2005-07-01 13:16:33 +02:00
|
|
|
|
no_of_case_offsets = last_immediate + 1;
|
|
|
|
|
|
2000-07-20 18:46:28 +02:00
|
|
|
|
/* A jump or jsr or branch breaks the chain of insns for a
|
|
|
|
|
case-table, so assume default first-case again. */
|
|
|
|
|
else if (info->insn_type == dis_jsr
|
|
|
|
|
|| info->insn_type == dis_branch
|
|
|
|
|
|| info->insn_type == dis_condbranch)
|
|
|
|
|
case_offset = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Print the CRIS instruction at address memaddr on stream. Returns
|
2000-09-29 20:17:25 +02:00
|
|
|
|
length of the instruction, in bytes. Prefix register names with `$' if
|
|
|
|
|
WITH_REG_PREFIX. */
|
|
|
|
|
|
|
|
|
|
static int
|
2005-07-01 13:16:33 +02:00
|
|
|
|
print_insn_cris_generic (bfd_vma memaddr,
|
|
|
|
|
disassemble_info *info,
|
|
|
|
|
bfd_boolean with_reg_prefix)
|
2000-07-20 18:46:28 +02:00
|
|
|
|
{
|
|
|
|
|
int nbytes;
|
|
|
|
|
unsigned int insn;
|
|
|
|
|
const struct cris_opcode *matchedp;
|
|
|
|
|
int advance = 0;
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
struct cris_disasm_data *disdata
|
|
|
|
|
= (struct cris_disasm_data *) info->private_data;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
/* No instruction will be disassembled as longer than this number of
|
|
|
|
|
bytes; stacked prefixes will not be expanded. */
|
|
|
|
|
unsigned char buffer[MAX_BYTES_PER_CRIS_INSN];
|
|
|
|
|
unsigned char *bufp;
|
2001-09-19 19:40:28 +02:00
|
|
|
|
int status = 0;
|
2000-07-20 18:46:28 +02:00
|
|
|
|
bfd_vma addr;
|
|
|
|
|
|
|
|
|
|
/* There will be an "out of range" error after the last instruction.
|
|
|
|
|
Reading pairs of bytes in decreasing number, we hope that we will get
|
|
|
|
|
at least the amount that we will consume.
|
|
|
|
|
|
|
|
|
|
If we can't get any data, or we do not get enough data, we print
|
|
|
|
|
the error message. */
|
|
|
|
|
|
|
|
|
|
for (nbytes = MAX_BYTES_PER_CRIS_INSN; nbytes > 0; nbytes -= 2)
|
|
|
|
|
{
|
|
|
|
|
status = (*info->read_memory_func) (memaddr, buffer, nbytes, info);
|
|
|
|
|
if (status == 0)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If we did not get all we asked for, then clear the rest.
|
|
|
|
|
Hopefully this makes a reproducible result in case of errors. */
|
|
|
|
|
if (nbytes != MAX_BYTES_PER_CRIS_INSN)
|
|
|
|
|
memset (buffer + nbytes, 0, MAX_BYTES_PER_CRIS_INSN - nbytes);
|
|
|
|
|
|
|
|
|
|
addr = memaddr;
|
|
|
|
|
bufp = buffer;
|
|
|
|
|
|
|
|
|
|
/* Set some defaults for the insn info. */
|
|
|
|
|
info->insn_info_valid = 1;
|
|
|
|
|
info->branch_delay_insns = 0;
|
|
|
|
|
info->data_size = 0;
|
|
|
|
|
info->insn_type = dis_nonbranch;
|
|
|
|
|
info->flags = 0;
|
|
|
|
|
info->target = 0;
|
|
|
|
|
info->target2 = 0;
|
|
|
|
|
|
|
|
|
|
/* If we got any data, disassemble it. */
|
|
|
|
|
if (nbytes != 0)
|
|
|
|
|
{
|
|
|
|
|
matchedp = NULL;
|
|
|
|
|
|
|
|
|
|
insn = bufp[0] + bufp[1] * 256;
|
|
|
|
|
|
|
|
|
|
/* If we're in a case-table, don't disassemble the offsets. */
|
|
|
|
|
if (TRACE_CASE && case_offset_counter != 0)
|
|
|
|
|
{
|
|
|
|
|
info->insn_type = dis_noninsn;
|
|
|
|
|
advance += 2;
|
|
|
|
|
|
|
|
|
|
/* If to print data as offsets, then shortcut here. */
|
Kaveh Ghazi's printf format attribute checking patch.
bfd:
* elf32-xtensa.c (vsprint_msg): Add format attribute. Fix
format bugs.
* vms.h (_bfd_vms_debug): Add format attribute.
(_bfd_vms_debug, _bfd_hexdump): Fix typos.
binutils:
* bucomm.h (report): Add format attribute.
* dlltool.c (inform): Likewise.
* dllwrap.c (display, inform, warn): Likewise.
* objdump.c (objdump_sprintf): Likewise.
* readelf.c (error, warn): Likewise. Fix format bugs.
gas:
* config/tc-tic30.c (debug): Add format attribute. Fix format
bugs.
include:
* dis-asm.h (fprintf_ftype): Add format attribute.
opcodes:
* arc-dis.c, arm-dis.c, cris-dis.c, crx-dis.c, d10v-dis.c,
d30v-dis.c, fr30-dis.c, h8300-dis.c, h8500-dis.c, i860-dis.c,
ia64-dis.c, ip2k-dis.c, m10200-dis.c, m10300-dis.c,
m88k-dis.c, mcore-dis.c, mips-dis.c, ms1-dis.c, or32-dis.c,
ppc-dis.c, sh64-dis.c, sparc-dis.c, tic4x-dis.c, tic80-dis.c,
v850-dis.c: Fix format bugs.
* ia64-gen.c (fail, warn): Add format attribute.
* or32-opc.c (debug): Likewise.
2005-07-07 21:27:52 +02:00
|
|
|
|
(*info->fprintf_func) (info->stream, "case %ld%s: -> ",
|
2000-07-20 18:46:28 +02:00
|
|
|
|
case_offset + no_of_case_offsets
|
|
|
|
|
- case_offset_counter,
|
|
|
|
|
case_offset_counter == 1 ? "/default" :
|
|
|
|
|
"");
|
|
|
|
|
|
|
|
|
|
(*info->print_address_func) ((bfd_vma)
|
|
|
|
|
((short) (insn)
|
|
|
|
|
+ (long) (addr
|
|
|
|
|
- (no_of_case_offsets
|
|
|
|
|
- case_offset_counter)
|
|
|
|
|
* 2)), info);
|
|
|
|
|
case_offset_counter--;
|
|
|
|
|
|
|
|
|
|
/* The default case start (without a "sub" or "add") must be
|
|
|
|
|
zero. */
|
|
|
|
|
if (case_offset_counter == 0)
|
|
|
|
|
case_offset = 0;
|
|
|
|
|
}
|
|
|
|
|
else if (insn == 0)
|
|
|
|
|
{
|
|
|
|
|
/* We're often called to disassemble zeroes. While this is a
|
|
|
|
|
valid "bcc .+2" insn, it is also useless enough and enough
|
|
|
|
|
of a nuiscance that we will just output "bcc .+2" for it
|
|
|
|
|
and signal it as a noninsn. */
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
(*info->fprintf_func) (info->stream,
|
|
|
|
|
disdata->distype == cris_dis_v32
|
|
|
|
|
? "bcc ." : "bcc .+2");
|
2000-07-20 18:46:28 +02:00
|
|
|
|
info->insn_type = dis_noninsn;
|
|
|
|
|
advance += 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
const struct cris_opcode *prefix_opcodep = NULL;
|
|
|
|
|
unsigned char *prefix_buffer = bufp;
|
|
|
|
|
unsigned int prefix_insn = insn;
|
|
|
|
|
int prefix_size = 0;
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
matchedp = get_opcode_entry (insn, NO_CRIS_PREFIX, disdata);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
/* Check if we're supposed to write out prefixes as address
|
|
|
|
|
modes and if this was a prefix. */
|
|
|
|
|
if (matchedp != NULL && PARSE_PREFIX && matchedp->args[0] == 'p')
|
|
|
|
|
{
|
|
|
|
|
/* If it's a prefix, put it into the prefix vars and get the
|
|
|
|
|
main insn. */
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
prefix_size = bytes_to_skip (prefix_insn, matchedp,
|
2005-12-06 00:27:01 +01:00
|
|
|
|
disdata->distype, NULL);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
prefix_opcodep = matchedp;
|
|
|
|
|
|
|
|
|
|
insn = bufp[prefix_size] + bufp[prefix_size + 1] * 256;
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
matchedp = get_opcode_entry (insn, prefix_insn, disdata);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
if (matchedp != NULL)
|
|
|
|
|
{
|
|
|
|
|
addr += prefix_size;
|
|
|
|
|
bufp += prefix_size;
|
|
|
|
|
advance += prefix_size;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* The "main" insn wasn't valid, at least not when
|
|
|
|
|
prefixed. Put back things enough to output the
|
|
|
|
|
prefix insn only, as a normal insn. */
|
|
|
|
|
matchedp = prefix_opcodep;
|
|
|
|
|
insn = prefix_insn;
|
|
|
|
|
prefix_opcodep = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (matchedp == NULL)
|
|
|
|
|
{
|
Kaveh Ghazi's printf format attribute checking patch.
bfd:
* elf32-xtensa.c (vsprint_msg): Add format attribute. Fix
format bugs.
* vms.h (_bfd_vms_debug): Add format attribute.
(_bfd_vms_debug, _bfd_hexdump): Fix typos.
binutils:
* bucomm.h (report): Add format attribute.
* dlltool.c (inform): Likewise.
* dllwrap.c (display, inform, warn): Likewise.
* objdump.c (objdump_sprintf): Likewise.
* readelf.c (error, warn): Likewise. Fix format bugs.
gas:
* config/tc-tic30.c (debug): Add format attribute. Fix format
bugs.
include:
* dis-asm.h (fprintf_ftype): Add format attribute.
opcodes:
* arc-dis.c, arm-dis.c, cris-dis.c, crx-dis.c, d10v-dis.c,
d30v-dis.c, fr30-dis.c, h8300-dis.c, h8500-dis.c, i860-dis.c,
ia64-dis.c, ip2k-dis.c, m10200-dis.c, m10300-dis.c,
m88k-dis.c, mcore-dis.c, mips-dis.c, ms1-dis.c, or32-dis.c,
ppc-dis.c, sh64-dis.c, sparc-dis.c, tic4x-dis.c, tic80-dis.c,
v850-dis.c: Fix format bugs.
* ia64-gen.c (fail, warn): Add format attribute.
* or32-opc.c (debug): Likewise.
2005-07-07 21:27:52 +02:00
|
|
|
|
(*info->fprintf_func) (info->stream, "??0x%x", insn);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
advance += 2;
|
|
|
|
|
|
|
|
|
|
info->insn_type = dis_noninsn;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2005-12-06 00:27:01 +01:00
|
|
|
|
advance
|
|
|
|
|
+= bytes_to_skip (insn, matchedp, disdata->distype,
|
|
|
|
|
prefix_opcodep);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
|
|
|
|
|
/* The info_type and assorted fields will be set according
|
|
|
|
|
to the operands. */
|
|
|
|
|
print_with_operands (matchedp, insn, bufp, addr, info,
|
|
|
|
|
prefix_opcodep, prefix_insn,
|
2000-09-29 20:17:25 +02:00
|
|
|
|
prefix_buffer, with_reg_prefix);
|
2000-07-20 18:46:28 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
info->insn_type = dis_noninsn;
|
|
|
|
|
|
|
|
|
|
/* If we read less than MAX_BYTES_PER_CRIS_INSN, i.e. we got an error
|
|
|
|
|
status when reading that much, and the insn decoding indicated a
|
|
|
|
|
length exceeding what we read, there is an error. */
|
|
|
|
|
if (status != 0 && (nbytes == 0 || advance > nbytes))
|
|
|
|
|
{
|
|
|
|
|
(*info->memory_error_func) (status, memaddr, info);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Max supported insn size with one folded prefix insn. */
|
|
|
|
|
info->bytes_per_line = MAX_BYTES_PER_CRIS_INSN;
|
|
|
|
|
|
|
|
|
|
/* I would like to set this to a fixed value larger than the actual
|
|
|
|
|
number of bytes to print in order to avoid spaces between bytes,
|
|
|
|
|
but objdump.c (2.9.1) does not like that, so we print 16-bit
|
|
|
|
|
chunks, which is the next choice. */
|
|
|
|
|
info->bytes_per_chunk = 2;
|
|
|
|
|
|
|
|
|
|
/* Printing bytes in order of increasing addresses makes sense,
|
|
|
|
|
especially on a little-endian target.
|
|
|
|
|
This is completely the opposite of what you think; setting this to
|
|
|
|
|
BFD_ENDIAN_LITTLE will print bytes in order N..0 rather than the 0..N
|
|
|
|
|
we want. */
|
|
|
|
|
info->display_endian = BFD_ENDIAN_BIG;
|
|
|
|
|
|
|
|
|
|
return advance;
|
|
|
|
|
}
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
/* Disassemble, prefixing register names with `$'. CRIS v0..v10. */
|
2000-09-29 20:17:25 +02:00
|
|
|
|
|
|
|
|
|
static int
|
2005-07-01 13:16:33 +02:00
|
|
|
|
print_insn_cris_with_register_prefix (bfd_vma vma,
|
|
|
|
|
disassemble_info *info)
|
2000-09-29 20:17:25 +02:00
|
|
|
|
{
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
if (info->private_data == NULL
|
|
|
|
|
&& !cris_parse_disassembler_options (info, cris_dis_v0_v10))
|
|
|
|
|
return -1;
|
|
|
|
|
return print_insn_cris_generic (vma, info, TRUE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Disassemble, prefixing register names with `$'. CRIS v32. */
|
|
|
|
|
|
|
|
|
|
static int
|
2005-07-01 13:16:33 +02:00
|
|
|
|
print_insn_crisv32_with_register_prefix (bfd_vma vma,
|
|
|
|
|
disassemble_info *info)
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
{
|
|
|
|
|
if (info->private_data == NULL
|
|
|
|
|
&& !cris_parse_disassembler_options (info, cris_dis_v32))
|
|
|
|
|
return -1;
|
|
|
|
|
return print_insn_cris_generic (vma, info, TRUE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Disassemble, prefixing register names with `$'.
|
|
|
|
|
Common v10 and v32 subset. */
|
|
|
|
|
|
|
|
|
|
static int
|
2005-07-01 13:16:33 +02:00
|
|
|
|
print_insn_crisv10_v32_with_register_prefix (bfd_vma vma,
|
|
|
|
|
disassemble_info *info)
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
{
|
|
|
|
|
if (info->private_data == NULL
|
|
|
|
|
&& !cris_parse_disassembler_options (info, cris_dis_common_v10_v32))
|
|
|
|
|
return -1;
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return print_insn_cris_generic (vma, info, TRUE);
|
2000-09-29 20:17:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
/* Disassemble, no prefixes on register names. CRIS v0..v10. */
|
2000-09-29 20:17:25 +02:00
|
|
|
|
|
|
|
|
|
static int
|
2005-07-01 13:16:33 +02:00
|
|
|
|
print_insn_cris_without_register_prefix (bfd_vma vma,
|
|
|
|
|
disassemble_info *info)
|
2000-09-29 20:17:25 +02:00
|
|
|
|
{
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
if (info->private_data == NULL
|
|
|
|
|
&& !cris_parse_disassembler_options (info, cris_dis_v0_v10))
|
|
|
|
|
return -1;
|
|
|
|
|
return print_insn_cris_generic (vma, info, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Disassemble, no prefixes on register names. CRIS v32. */
|
|
|
|
|
|
|
|
|
|
static int
|
2005-07-01 13:16:33 +02:00
|
|
|
|
print_insn_crisv32_without_register_prefix (bfd_vma vma,
|
|
|
|
|
disassemble_info *info)
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
{
|
|
|
|
|
if (info->private_data == NULL
|
|
|
|
|
&& !cris_parse_disassembler_options (info, cris_dis_v32))
|
|
|
|
|
return -1;
|
|
|
|
|
return print_insn_cris_generic (vma, info, FALSE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Disassemble, no prefixes on register names.
|
|
|
|
|
Common v10 and v32 subset. */
|
|
|
|
|
|
|
|
|
|
static int
|
2005-07-01 13:16:33 +02:00
|
|
|
|
print_insn_crisv10_v32_without_register_prefix (bfd_vma vma,
|
|
|
|
|
disassemble_info *info)
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
{
|
|
|
|
|
if (info->private_data == NULL
|
|
|
|
|
&& !cris_parse_disassembler_options (info, cris_dis_common_v10_v32))
|
|
|
|
|
return -1;
|
2002-11-30 09:39:46 +01:00
|
|
|
|
return print_insn_cris_generic (vma, info, FALSE);
|
2000-09-29 20:17:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a disassembler-function that prints registers with a `$' prefix,
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
or one that prints registers without a prefix.
|
|
|
|
|
FIXME: We should improve the solution to avoid the multitude of
|
|
|
|
|
functions seen above. */
|
2000-09-29 20:17:25 +02:00
|
|
|
|
|
|
|
|
|
disassembler_ftype
|
2005-07-01 13:16:33 +02:00
|
|
|
|
cris_get_disassembler (bfd *abfd)
|
2000-09-29 20:17:25 +02:00
|
|
|
|
{
|
2000-11-14 21:08:55 +01:00
|
|
|
|
/* If there's no bfd in sight, we return what is valid as input in all
|
|
|
|
|
contexts if fed back to the assembler: disassembly *with* register
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
prefix. Unfortunately this will be totally wrong for v32. */
|
|
|
|
|
if (abfd == NULL)
|
2000-09-29 20:17:25 +02:00
|
|
|
|
return print_insn_cris_with_register_prefix;
|
|
|
|
|
|
Generally, handle CRISv32.
* cris-dis.c (TRACE_CASE): Define as (disdata->trace_case).
(struct cris_disasm_data): New type.
(format_reg, format_hex, cris_constraint, print_flags)
(get_opcode_entry): Add struct cris_disasm_data * parameter. All
callers changed.
(format_sup_reg, print_insn_crisv32_with_register_prefix)
(print_insn_crisv32_without_register_prefix)
(print_insn_crisv10_v32_with_register_prefix)
(print_insn_crisv10_v32_without_register_prefix)
(cris_parse_disassembler_options): New functions.
(bytes_to_skip, cris_spec_reg): Add enum cris_disass_family
parameter. All callers changed.
(get_opcode_entry): Call malloc, not xmalloc. Return NULL on
failure.
(cris_constraint) <case 'Y', 'U'>: New cases.
(bytes_to_skip): Handle 'Y' and 'N' as 's'. Skip size is 4 bytes
for constraint 'n'.
(print_with_operands) <case 'Y'>: New case.
(print_with_operands) <case 'T', 'A', '[', ']', 'd', 'n', 'u'>
<case 'N', 'Y', 'Q'>: New cases.
(print_insn_cris_generic): Emit "bcc ." for zero and CRISv32.
(print_insn_cris_with_register_prefix)
(print_insn_cris_without_register_prefix): Call
cris_parse_disassembler_options.
* cris-opc.c (cris_spec_regs): Mention that this table isn't used
for CRISv32 and the size of immediate operands. New v32-only
entries for bz, pid, srs, wz, exs, eda, dz, ebp, erp, nrp, ccs and
spc. Add v32-only 4-byte entries for p2, p3, p5 and p6. Change
ccr, ibr, irp to be v0..v10. Change bar, dccr to be v8..v10.
Change brp to be v3..v10.
(cris_support_regs): New vector.
(cris_opcodes): Update head comment. New format characters '[',
']', space, 'A', 'd', 'N', 'n', 'Q', 'T', 'u', 'U', 'Y'.
Add new opcodes for v32 and adjust existing opcodes to accommodate
differences to earlier variants.
(cris_cond15s): New vector.
2004-11-04 15:54:38 +01:00
|
|
|
|
if (bfd_get_symbol_leading_char (abfd) == 0)
|
|
|
|
|
{
|
|
|
|
|
if (bfd_get_mach (abfd) == bfd_mach_cris_v32)
|
|
|
|
|
return print_insn_crisv32_with_register_prefix;
|
|
|
|
|
if (bfd_get_mach (abfd) == bfd_mach_cris_v10_v32)
|
|
|
|
|
return print_insn_crisv10_v32_with_register_prefix;
|
|
|
|
|
|
|
|
|
|
/* We default to v10. This may be specifically specified in the
|
|
|
|
|
bfd mach, but is also the default setting. */
|
|
|
|
|
return print_insn_cris_with_register_prefix;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (bfd_get_mach (abfd) == bfd_mach_cris_v32)
|
|
|
|
|
return print_insn_crisv32_without_register_prefix;
|
|
|
|
|
if (bfd_get_mach (abfd) == bfd_mach_cris_v10_v32)
|
|
|
|
|
return print_insn_crisv10_v32_without_register_prefix;
|
2000-09-29 20:17:25 +02:00
|
|
|
|
return print_insn_cris_without_register_prefix;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 13:16:33 +02:00
|
|
|
|
/* Local variables:
|
|
|
|
|
eval: (c-set-style "gnu")
|
|
|
|
|
indent-tabs-mode: t
|
|
|
|
|
End: */
|