1999-05-03 15:29:11 +08:00
|
|
|
/* Disassembler for the PA-RISC. Somewhat derived from sparc-pinsn.c.
|
2022-01-02 06:30:17 +08:00
|
|
|
Copyright (C) 1989-2022 Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
Contributed by the Center for Software Science at the
|
|
|
|
University of Utah (pa-gdb-bugs@cs.utah.edu).
|
|
|
|
|
2007-07-05 17:49:03 +08:00
|
|
|
This file is part of the GNU opcodes library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
2005-07-01 19:16:33 +08:00
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-07-05 17:49:03 +08:00
|
|
|
the Free Software Foundation; either version 3, or (at your option)
|
|
|
|
any later version.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2007-07-05 17:49:03 +08: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.
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2005-07-01 19:16:33 +08: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. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#include "sysdep.h"
|
Move print_insn_XXX to an opcodes internal header
With the changes done in previous patches, print_insn_XXX functions
don't have to be external visible out of opcodes, because both gdb
and objdump select disassemblers through a single interface.
This patch moves these print_insn_XXX declarations from
include/dis-asm.h to opcodes/disassemble.h, which is a new header
added by this patch.
include:
2017-05-24 Yao Qi <yao.qi@linaro.org>
* dis-asm.h: Move some function declarations to
opcodes/disassemble.h.
opcodes:
2017-05-24 Yao Qi <yao.qi@linaro.org>
* alpha-dis.c: Include disassemble.h, don't include
dis-asm.h.
* avr-dis.c, bfin-dis.c, cr16-dis.c: Likewise.
* crx-dis.c, d10v-dis.c, d30v-dis.c: Likewise.
* disassemble.c, dlx-dis.c, epiphany-dis.c: Likewise.
* fr30-dis.c, ft32-dis.c, h8300-dis.c, h8500-dis.c: Likewise.
* hppa-dis.c, i370-dis.c, i386-dis.c: Likewise.
* i860-dis.c, i960-dis.c, ip2k-dis.c: Likewise.
* iq2000-dis.c, lm32-dis.c, m10200-dis.c: Likewise.
* m10300-dis.c, m32r-dis.c, m68hc11-dis.c: Likewise.
* m68k-dis.c, m88k-dis.c, mcore-dis.c: Likewise.
* metag-dis.c, microblaze-dis.c, mmix-dis.c: Likewise.
* moxie-dis.c, msp430-dis.c, mt-dis.c:
* nds32-dis.c, nios2-dis.c, ns32k-dis.c: Likewise.
* or1k-dis.c, pdp11-dis.c, pj-dis.c: Likewise.
* ppc-dis.c, pru-dis.c, riscv-dis.c: Likewise.
* rl78-dis.c, s390-dis.c, score-dis.c: Likewise.
* sh-dis.c, sh64-dis.c, tic30-dis.c: Likewise.
* tic4x-dis.c, tic54x-dis.c, tic6x-dis.c: Likewise.
* tic80-dis.c, tilegx-dis.c, tilepro-dis.c: Likewise.
* v850-dis.c, vax-dis.c, visium-dis.c: Likewise.
* w65-dis.c, wasm32-dis.c, xc16x-dis.c: Likewise.
* xgate-dis.c, xstormy16-dis.c, xtensa-dis.c: Likewise.
* z80-dis.c, z8k-dis.c: Likewise.
* disassemble.h: New file.
2017-05-25 00:23:52 +08:00
|
|
|
#include "disassemble.h"
|
1999-05-03 15:29:11 +08:00
|
|
|
#include "libhppa.h"
|
|
|
|
#include "opcode/hppa.h"
|
|
|
|
|
|
|
|
/* Integer register names, indexed by the numbers which appear in the
|
|
|
|
opcodes. */
|
2003-02-25 11:22:06 +08:00
|
|
|
static const char *const reg_names[] =
|
2005-07-01 19:16:33 +08:00
|
|
|
{
|
|
|
|
"flags", "r1", "rp", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
|
1999-05-03 15:29:11 +08:00
|
|
|
"r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19",
|
|
|
|
"r20", "r21", "r22", "r23", "r24", "r25", "r26", "dp", "ret0", "ret1",
|
2005-07-01 19:16:33 +08:00
|
|
|
"sp", "r31"
|
|
|
|
};
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
/* Floating point register names, indexed by the numbers which appear in the
|
|
|
|
opcodes. */
|
2003-02-25 11:22:06 +08:00
|
|
|
static const char *const fp_reg_names[] =
|
2005-07-01 19:16:33 +08:00
|
|
|
{
|
|
|
|
"fpsr", "fpe2", "fpe4", "fpe6",
|
2003-02-25 11:22:06 +08:00
|
|
|
"fr4", "fr5", "fr6", "fr7", "fr8",
|
|
|
|
"fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
|
1999-05-03 15:29:11 +08:00
|
|
|
"fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23",
|
2005-07-01 19:16:33 +08:00
|
|
|
"fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31"
|
|
|
|
};
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
typedef unsigned int CORE_ADDR;
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Get at various relevent fields of an instruction word. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2005-07-01 19:16:33 +08:00
|
|
|
#define MASK_5 0x1f
|
1999-08-28 18:17:07 +08:00
|
|
|
#define MASK_10 0x3ff
|
1999-05-03 15:29:11 +08:00
|
|
|
#define MASK_11 0x7ff
|
|
|
|
#define MASK_14 0x3fff
|
2000-04-22 06:04:29 +08:00
|
|
|
#define MASK_16 0xffff
|
1999-05-03 15:29:11 +08:00
|
|
|
#define MASK_21 0x1fffff
|
|
|
|
|
2005-07-01 19:16:33 +08:00
|
|
|
/* These macros get bit fields using HP's numbering (MSB = 0). */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
#define GET_FIELD(X, FROM, TO) \
|
|
|
|
((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
|
|
|
|
|
2000-07-09 15:29:39 +08:00
|
|
|
#define GET_BIT(X, WHICH) \
|
|
|
|
GET_FIELD (X, WHICH, WHICH)
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* Some of these have been converted to 2-d arrays because they
|
|
|
|
consume less storage this way. If the maintenance becomes a
|
|
|
|
problem, convert them back to const 1-d pointer arrays. */
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const control_reg[] =
|
|
|
|
{
|
1999-05-03 15:29:11 +08:00
|
|
|
"rctr", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",
|
|
|
|
"pidr1", "pidr2", "ccr", "sar", "pidr3", "pidr4",
|
|
|
|
"iva", "eiem", "itmr", "pcsq", "pcoq", "iir", "isr",
|
|
|
|
"ior", "ipsw", "eirr", "tr0", "tr1", "tr2", "tr3",
|
|
|
|
"tr4", "tr5", "tr6", "tr7"
|
|
|
|
};
|
|
|
|
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const compare_cond_names[] =
|
|
|
|
{
|
1999-08-06 23:50:21 +08:00
|
|
|
"", ",=", ",<", ",<=", ",<<", ",<<=", ",sv", ",od",
|
|
|
|
",tr", ",<>", ",>=", ",>", ",>>=", ",>>", ",nsv", ",ev"
|
|
|
|
};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const compare_cond_64_names[] =
|
|
|
|
{
|
2011-01-01 00:43:46 +08:00
|
|
|
",*", ",*=", ",*<", ",*<=", ",*<<", ",*<<=", ",*sv", ",*od",
|
1999-08-06 23:50:21 +08:00
|
|
|
",*tr", ",*<>", ",*>=", ",*>", ",*>>=", ",*>>", ",*nsv", ",*ev"
|
|
|
|
};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const cmpib_cond_64_names[] =
|
|
|
|
{
|
1999-08-06 23:50:21 +08:00
|
|
|
",*<<", ",*=", ",*<", ",*<=", ",*>>=", ",*<>", ",*>=", ",*>"
|
1999-05-03 15:29:11 +08:00
|
|
|
};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const add_cond_names[] =
|
|
|
|
{
|
1999-08-06 23:50:21 +08:00
|
|
|
"", ",=", ",<", ",<=", ",nuv", ",znv", ",sv", ",od",
|
|
|
|
",tr", ",<>", ",>=", ",>", ",uv", ",vnz", ",nsv", ",ev"
|
|
|
|
};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const add_cond_64_names[] =
|
|
|
|
{
|
2011-01-01 00:43:46 +08:00
|
|
|
",*", ",*=", ",*<", ",*<=", ",*nuv", ",*znv", ",*sv", ",*od",
|
1999-08-06 23:50:21 +08:00
|
|
|
",*tr", ",*<>", ",*>=", ",*>", ",*uv", ",*vnz", ",*nsv", ",*ev"
|
|
|
|
};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const wide_add_cond_names[] =
|
|
|
|
{
|
1999-08-06 23:50:21 +08:00
|
|
|
"", ",=", ",<", ",<=", ",nuv", ",*=", ",*<", ",*<=",
|
|
|
|
",tr", ",<>", ",>=", ",>", ",uv", ",*<>", ",*>=", ",*>"
|
1999-05-03 15:29:11 +08:00
|
|
|
};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const logical_cond_names[] =
|
|
|
|
{
|
1999-05-03 15:29:11 +08:00
|
|
|
"", ",=", ",<", ",<=", 0, 0, 0, ",od",
|
|
|
|
",tr", ",<>", ",>=", ",>", 0, 0, 0, ",ev"};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const logical_cond_64_names[] =
|
|
|
|
{
|
2011-01-01 00:43:46 +08:00
|
|
|
",*", ",*=", ",*<", ",*<=", 0, 0, 0, ",*od",
|
1999-08-06 23:50:21 +08:00
|
|
|
",*tr", ",*<>", ",*>=", ",*>", 0, 0, 0, ",*ev"};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const unit_cond_names[] =
|
|
|
|
{
|
1999-11-25 11:29:14 +08:00
|
|
|
"", ",swz", ",sbz", ",shz", ",sdc", ",swc", ",sbc", ",shc",
|
|
|
|
",tr", ",nwz", ",nbz", ",nhz", ",ndc", ",nwc", ",nbc", ",nhc"
|
1999-05-03 15:29:11 +08:00
|
|
|
};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const unit_cond_64_names[] =
|
|
|
|
{
|
2011-01-01 00:43:46 +08:00
|
|
|
",*", ",*swz", ",*sbz", ",*shz", ",*sdc", ",*swc", ",*sbc", ",*shc",
|
1999-08-06 23:50:21 +08:00
|
|
|
",*tr", ",*nwz", ",*nbz", ",*nhz", ",*ndc", ",*nwc", ",*nbc", ",*nhc"
|
|
|
|
};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const shift_cond_names[] =
|
|
|
|
{
|
1999-05-03 15:29:11 +08:00
|
|
|
"", ",=", ",<", ",od", ",tr", ",<>", ",>=", ",ev"
|
|
|
|
};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const shift_cond_64_names[] =
|
|
|
|
{
|
2011-01-01 00:43:46 +08:00
|
|
|
",*", ",*=", ",*<", ",*od", ",*tr", ",*<>", ",*>=", ",*ev"
|
1999-08-06 23:50:21 +08:00
|
|
|
};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const bb_cond_64_names[] =
|
|
|
|
{
|
1999-08-06 23:50:21 +08:00
|
|
|
",*<", ",*>="
|
|
|
|
};
|
1999-09-19 01:38:51 +08:00
|
|
|
static const char *const index_compl_names[] = {"", ",m", ",s", ",sm"};
|
|
|
|
static const char *const short_ldst_compl_names[] = {"", ",ma", "", ",mb"};
|
2005-07-01 19:16:33 +08:00
|
|
|
static const char *const short_bytes_compl_names[] =
|
|
|
|
{
|
1999-05-03 15:29:11 +08:00
|
|
|
"", ",b,m", ",e", ",e,m"
|
|
|
|
};
|
|
|
|
static const char *const float_format_names[] = {",sgl", ",dbl", "", ",quad"};
|
2003-02-25 11:22:06 +08:00
|
|
|
static const char *const fcnv_fixed_names[] = {",w", ",dw", "", ",qw"};
|
|
|
|
static const char *const fcnv_ufixed_names[] = {",uw", ",udw", "", ",uqw"};
|
1999-09-19 01:38:51 +08:00
|
|
|
static const char *const float_comp_names[] =
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
",false?", ",false", ",?", ",!<=>", ",=", ",=t", ",?=", ",!<>",
|
|
|
|
",!?>=", ",<", ",?<", ",!>=", ",!?>", ",<=", ",?<=", ",!>",
|
|
|
|
",!?<=", ",>", ",?>", ",!<=", ",!?<", ",>=", ",?>=", ",!<",
|
|
|
|
",!?=", ",<>", ",!=", ",!=t", ",!?", ",<=>", ",true?", ",true"
|
|
|
|
};
|
1999-09-19 01:38:51 +08:00
|
|
|
static const char *const signed_unsigned_names[] = {",u", ",s"};
|
|
|
|
static const char *const mix_half_names[] = {",l", ",r"};
|
|
|
|
static const char *const saturation_names[] = {",us", ",ss", 0, ""};
|
|
|
|
static const char *const read_write_names[] = {",r", ",w"};
|
|
|
|
static const char *const add_compl_names[] = { 0, "", ",l", ",tsv" };
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2003-02-25 11:22:06 +08:00
|
|
|
/* For a bunch of different instructions form an index into a
|
2000-04-22 06:04:29 +08:00
|
|
|
completer name table. */
|
1999-05-03 15:29:11 +08:00
|
|
|
#define GET_COMPL(insn) (GET_FIELD (insn, 26, 26) | \
|
|
|
|
GET_FIELD (insn, 18, 18) << 1)
|
|
|
|
|
|
|
|
#define GET_COND(insn) (GET_FIELD ((insn), 16, 18) + \
|
|
|
|
(GET_FIELD ((insn), 19, 19) ? 8 : 0))
|
|
|
|
|
|
|
|
/* Utility function to print registers. Put these first, so gcc's function
|
|
|
|
inlining can do its stuff. */
|
|
|
|
|
|
|
|
#define fputs_filtered(STR,F) (*info->fprintf_func) (info->stream, "%s", STR)
|
|
|
|
|
|
|
|
static void
|
2005-07-01 19:16:33 +08:00
|
|
|
fput_reg (unsigned reg, disassemble_info *info)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2012-07-24 20:56:47 +08:00
|
|
|
(*info->fprintf_func) (info->stream, "%s", reg ? reg_names[reg] : "r0");
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-07-01 19:16:33 +08:00
|
|
|
fput_fp_reg (unsigned reg, disassemble_info *info)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2012-07-24 20:56:47 +08:00
|
|
|
(*info->fprintf_func) (info->stream, "%s", reg ? fp_reg_names[reg] : "fr0");
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-07-01 19:16:33 +08:00
|
|
|
fput_fp_reg_r (unsigned reg, disassemble_info *info)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
/* Special case floating point exception registers. */
|
|
|
|
if (reg < 4)
|
|
|
|
(*info->fprintf_func) (info->stream, "fpe%d", reg * 2 + 1);
|
|
|
|
else
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func) (info->stream, "%sR",
|
|
|
|
reg ? fp_reg_names[reg] : "fr0");
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-07-01 19:16:33 +08:00
|
|
|
fput_creg (unsigned reg, disassemble_info *info)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2012-07-24 20:56:47 +08:00
|
|
|
(*info->fprintf_func) (info->stream, "%s", control_reg[reg]);
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Print constants with sign. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
static void
|
2005-07-01 19:16:33 +08:00
|
|
|
fput_const (unsigned num, disassemble_info *info)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
if ((int) num < 0)
|
2020-01-20 10:02:37 +08:00
|
|
|
(*info->fprintf_func) (info->stream, "-%x", -num);
|
1999-05-03 15:29:11 +08:00
|
|
|
else
|
|
|
|
(*info->fprintf_func) (info->stream, "%x", num);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Routines to extract various sized constants out of hppa
|
2000-04-22 06:04:29 +08:00
|
|
|
instructions. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract a 3-bit space register number from a be, ble, mtsp or mfsp. */
|
1999-05-03 15:29:11 +08:00
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_3 (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return GET_FIELD (word, 18, 18) << 2 | GET_FIELD (word, 16, 17);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_5_load (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return low_sign_extend (word >> 16 & MASK_5, 5);
|
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract the immediate field from a st{bhw}s instruction. */
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_5_store (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return low_sign_extend (word & MASK_5, 5);
|
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract the immediate field from a break instruction. */
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
static unsigned
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_5r_store (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return (word & MASK_5);
|
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract the immediate field from a {sr}sm instruction. */
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
static unsigned
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_5R_store (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return (word >> 16 & MASK_5);
|
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract the 10 bit immediate field from a {sr}sm instruction. */
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-08-28 18:17:07 +08:00
|
|
|
static unsigned
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_10U_store (unsigned word)
|
1999-08-28 18:17:07 +08:00
|
|
|
{
|
|
|
|
return (word >> 16 & MASK_10);
|
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract the immediate field from a bb instruction. */
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
static unsigned
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_5Q_store (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return (word >> 21 & MASK_5);
|
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract an 11 bit immediate field. */
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_11 (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return low_sign_extend (word & MASK_11, 11);
|
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract a 14 bit immediate field. */
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_14 (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
return low_sign_extend (word & MASK_14, 14);
|
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract a 16 bit immediate field (PA2.0 wide only). */
|
2005-07-01 19:16:33 +08:00
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_16 (unsigned word)
|
2000-04-22 06:04:29 +08:00
|
|
|
{
|
ubsan: hppa: left shift of negative value
bfd/
* libhppa.h (hppa_field_adjust, bfd_hppa_insn2fmt): Delete forward
declaration. Move ATTRIBUTE_UNUSED to definition.
(sign_extend, low_sign_extend, sign_unext, low_sign_unext),
(re_assemble_3, re_assemble_12, re_assemble_14, re_assemble_16),
(re_assemble_17, re_assemble_21, re_assemble_22): Likewise. Make
args and return value unsigned. Use unsigned variables.
(hppa_rebuild_insn): Similarly.
opcodes/
* hppa-dis.c (extract_16, extract_21, print_insn_hppa): Use
unsigned variables.
2019-12-20 09:44:19 +08:00
|
|
|
unsigned m15, m0, m1;
|
2005-07-01 19:16:33 +08:00
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
m0 = GET_BIT (word, 16);
|
|
|
|
m1 = GET_BIT (word, 17);
|
|
|
|
m15 = GET_BIT (word, 31);
|
|
|
|
word = (word >> 1) & 0x1fff;
|
|
|
|
word = word | (m15 << 15) | ((m15 ^ m0) << 14) | ((m15 ^ m1) << 13);
|
|
|
|
return sign_extend (word, 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Extract a 21 bit constant. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_21 (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
ubsan: hppa: left shift of negative value
bfd/
* libhppa.h (hppa_field_adjust, bfd_hppa_insn2fmt): Delete forward
declaration. Move ATTRIBUTE_UNUSED to definition.
(sign_extend, low_sign_extend, sign_unext, low_sign_unext),
(re_assemble_3, re_assemble_12, re_assemble_14, re_assemble_16),
(re_assemble_17, re_assemble_21, re_assemble_22): Likewise. Make
args and return value unsigned. Use unsigned variables.
(hppa_rebuild_insn): Similarly.
opcodes/
* hppa-dis.c (extract_16, extract_21, print_insn_hppa): Use
unsigned variables.
2019-12-20 09:44:19 +08:00
|
|
|
unsigned val;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
word &= MASK_21;
|
|
|
|
word <<= 11;
|
|
|
|
val = GET_FIELD (word, 20, 20);
|
|
|
|
val <<= 11;
|
|
|
|
val |= GET_FIELD (word, 9, 19);
|
|
|
|
val <<= 2;
|
|
|
|
val |= GET_FIELD (word, 5, 6);
|
|
|
|
val <<= 5;
|
|
|
|
val |= GET_FIELD (word, 0, 4);
|
|
|
|
val <<= 2;
|
|
|
|
val |= GET_FIELD (word, 7, 8);
|
|
|
|
return sign_extend (val, 21) << 11;
|
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract a 12 bit constant from branch instructions. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_12 (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
return sign_extend (GET_FIELD (word, 19, 28)
|
|
|
|
| GET_FIELD (word, 29, 29) << 10
|
|
|
|
| (word & 0x1) << 11, 12) << 2;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
2000-04-22 06:04:29 +08:00
|
|
|
/* Extract a 17 bit constant from branch instructions, returning the
|
|
|
|
19 bit signed value. */
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_17 (unsigned word)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
return sign_extend (GET_FIELD (word, 19, 28)
|
|
|
|
| GET_FIELD (word, 29, 29) << 10
|
|
|
|
| GET_FIELD (word, 11, 15) << 11
|
|
|
|
| (word & 0x1) << 16, 17) << 2;
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
1999-09-20 04:14:30 +08:00
|
|
|
static int
|
2005-07-01 19:16:33 +08:00
|
|
|
extract_22 (unsigned word)
|
1999-09-20 04:14:30 +08:00
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
return sign_extend (GET_FIELD (word, 19, 28)
|
|
|
|
| GET_FIELD (word, 29, 29) << 10
|
|
|
|
| GET_FIELD (word, 11, 15) << 11
|
|
|
|
| GET_FIELD (word, 6, 10) << 16
|
|
|
|
| (word & 0x1) << 21, 22) << 2;
|
1999-09-20 04:14:30 +08:00
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
/* Print one instruction. */
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
int
|
2005-07-01 19:16:33 +08:00
|
|
|
print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
|
1999-05-03 15:29:11 +08:00
|
|
|
{
|
|
|
|
bfd_byte buffer[4];
|
|
|
|
unsigned int insn, i;
|
|
|
|
|
|
|
|
{
|
|
|
|
int status =
|
|
|
|
(*info->read_memory_func) (memaddr, buffer, sizeof (buffer), info);
|
|
|
|
if (status != 0)
|
|
|
|
{
|
|
|
|
(*info->memory_error_func) (status, memaddr, info);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
insn = bfd_getb32 (buffer);
|
|
|
|
|
|
|
|
for (i = 0; i < NUMOPCODES; ++i)
|
|
|
|
{
|
|
|
|
const struct pa_opcode *opcode = &pa_opcodes[i];
|
2005-07-01 19:16:33 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
if ((insn & opcode->mask) == opcode->match)
|
|
|
|
{
|
2005-07-01 19:16:33 +08:00
|
|
|
const char *s;
|
2000-04-22 06:04:29 +08:00
|
|
|
#ifndef BFD64
|
|
|
|
if (opcode->arch == pa20w)
|
|
|
|
continue;
|
|
|
|
#endif
|
1999-05-03 15:29:11 +08:00
|
|
|
(*info->fprintf_func) (info->stream, "%s", opcode->name);
|
|
|
|
|
2003-02-25 11:22:06 +08:00
|
|
|
if (!strchr ("cfCY?-+nHNZFIuv{", opcode->args[0]))
|
1999-05-03 15:29:11 +08:00
|
|
|
(*info->fprintf_func) (info->stream, " ");
|
|
|
|
for (s = opcode->args; *s != '\0'; ++s)
|
|
|
|
{
|
|
|
|
switch (*s)
|
|
|
|
{
|
|
|
|
case 'x':
|
|
|
|
fput_reg (GET_FIELD (insn, 11, 15), info);
|
|
|
|
break;
|
1999-08-28 16:47:50 +08:00
|
|
|
case 'a':
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'b':
|
|
|
|
fput_reg (GET_FIELD (insn, 6, 10), info);
|
|
|
|
break;
|
|
|
|
case '^':
|
|
|
|
fput_creg (GET_FIELD (insn, 6, 10), info);
|
|
|
|
break;
|
|
|
|
case 't':
|
|
|
|
fput_reg (GET_FIELD (insn, 27, 31), info);
|
|
|
|
break;
|
1999-08-29 15:53:24 +08:00
|
|
|
|
2003-02-25 11:22:06 +08:00
|
|
|
/* Handle floating point registers. */
|
1999-08-29 15:53:24 +08:00
|
|
|
case 'f':
|
|
|
|
switch (*++s)
|
|
|
|
{
|
|
|
|
case 't':
|
1999-05-03 15:29:11 +08:00
|
|
|
fput_fp_reg (GET_FIELD (insn, 27, 31), info);
|
1999-08-29 15:53:24 +08:00
|
|
|
break;
|
|
|
|
case 'T':
|
|
|
|
if (GET_FIELD (insn, 25, 25))
|
|
|
|
fput_fp_reg_r (GET_FIELD (insn, 27, 31), info);
|
|
|
|
else
|
|
|
|
fput_fp_reg (GET_FIELD (insn, 27, 31), info);
|
|
|
|
break;
|
|
|
|
case 'a':
|
|
|
|
if (GET_FIELD (insn, 25, 25))
|
|
|
|
fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
|
|
|
|
else
|
|
|
|
fput_fp_reg (GET_FIELD (insn, 6, 10), info);
|
|
|
|
break;
|
1999-09-19 02:09:38 +08:00
|
|
|
|
2018-05-09 14:20:29 +08:00
|
|
|
/* 'fA' will not generate a space before the register
|
2003-02-25 11:22:06 +08:00
|
|
|
name. Normally that is fine. Except that it
|
|
|
|
causes problems with xmpyu which has no FP format
|
|
|
|
completer. */
|
1999-09-19 02:09:38 +08:00
|
|
|
case 'X':
|
|
|
|
fputs_filtered (" ", info);
|
2003-02-25 11:22:06 +08:00
|
|
|
/* FALLTHRU */
|
1999-09-19 02:09:38 +08:00
|
|
|
|
1999-08-29 15:53:24 +08:00
|
|
|
case 'A':
|
|
|
|
if (GET_FIELD (insn, 24, 24))
|
|
|
|
fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
|
|
|
|
else
|
|
|
|
fput_fp_reg (GET_FIELD (insn, 6, 10), info);
|
|
|
|
break;
|
|
|
|
case 'b':
|
|
|
|
if (GET_FIELD (insn, 25, 25))
|
|
|
|
fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
|
|
|
|
else
|
|
|
|
fput_fp_reg (GET_FIELD (insn, 11, 15), info);
|
|
|
|
break;
|
|
|
|
case 'B':
|
|
|
|
if (GET_FIELD (insn, 19, 19))
|
|
|
|
fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
|
|
|
|
else
|
|
|
|
fput_fp_reg (GET_FIELD (insn, 11, 15), info);
|
|
|
|
break;
|
|
|
|
case 'C':
|
|
|
|
{
|
|
|
|
int reg = GET_FIELD (insn, 21, 22);
|
|
|
|
reg |= GET_FIELD (insn, 16, 18) << 2;
|
|
|
|
if (GET_FIELD (insn, 23, 23) != 0)
|
|
|
|
fput_fp_reg_r (reg, info);
|
|
|
|
else
|
|
|
|
fput_fp_reg (reg, info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'i':
|
|
|
|
{
|
|
|
|
int reg = GET_FIELD (insn, 6, 10);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
1999-08-29 15:53:24 +08:00
|
|
|
reg |= (GET_FIELD (insn, 26, 26) << 4);
|
|
|
|
fput_fp_reg (reg, info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'j':
|
|
|
|
{
|
|
|
|
int reg = GET_FIELD (insn, 11, 15);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
1999-08-29 15:53:24 +08:00
|
|
|
reg |= (GET_FIELD (insn, 26, 26) << 4);
|
|
|
|
fput_fp_reg (reg, info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'k':
|
|
|
|
{
|
|
|
|
int reg = GET_FIELD (insn, 27, 31);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
1999-08-29 15:53:24 +08:00
|
|
|
reg |= (GET_FIELD (insn, 26, 26) << 4);
|
|
|
|
fput_fp_reg (reg, info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'l':
|
|
|
|
{
|
|
|
|
int reg = GET_FIELD (insn, 21, 25);
|
1999-05-03 15:29:11 +08:00
|
|
|
|
1999-08-29 15:53:24 +08:00
|
|
|
reg |= (GET_FIELD (insn, 26, 26) << 4);
|
|
|
|
fput_fp_reg (reg, info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 'm':
|
|
|
|
{
|
|
|
|
int reg = GET_FIELD (insn, 16, 20);
|
|
|
|
|
|
|
|
reg |= (GET_FIELD (insn, 26, 26) << 4);
|
|
|
|
fput_fp_reg (reg, info);
|
|
|
|
break;
|
|
|
|
}
|
2000-04-22 06:04:29 +08:00
|
|
|
|
2003-02-25 11:22:06 +08:00
|
|
|
/* 'fe' will not generate a space before the register
|
|
|
|
name. Normally that is fine. Except that it
|
|
|
|
causes problems with fstw fe,y(b) which has no FP
|
|
|
|
format completer. */
|
2000-04-22 06:04:29 +08:00
|
|
|
case 'E':
|
|
|
|
fputs_filtered (" ", info);
|
2003-02-25 11:22:06 +08:00
|
|
|
/* FALLTHRU */
|
2000-04-22 06:04:29 +08:00
|
|
|
|
1999-09-20 03:52:39 +08:00
|
|
|
case 'e':
|
2000-04-22 06:04:29 +08:00
|
|
|
if (GET_FIELD (insn, 30, 30))
|
1999-09-20 03:52:39 +08:00
|
|
|
fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
|
|
|
|
else
|
|
|
|
fput_fp_reg (GET_FIELD (insn, 11, 15), info);
|
|
|
|
break;
|
2000-04-22 06:04:29 +08:00
|
|
|
case 'x':
|
|
|
|
fput_fp_reg (GET_FIELD (insn, 11, 15), info);
|
|
|
|
break;
|
1999-08-29 15:53:24 +08:00
|
|
|
}
|
1999-09-19 01:57:08 +08:00
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
case '5':
|
|
|
|
fput_const (extract_5_load (insn), info);
|
|
|
|
break;
|
|
|
|
case 's':
|
2003-02-25 08:20:29 +08:00
|
|
|
{
|
|
|
|
int space = GET_FIELD (insn, 16, 17);
|
|
|
|
/* Zero means implicit addressing, not use of sr0. */
|
|
|
|
if (space != 0)
|
|
|
|
(*info->fprintf_func) (info->stream, "sr%d", space);
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
1999-08-06 23:50:21 +08:00
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'S':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func) (info->stream, "sr%d",
|
|
|
|
extract_3 (insn));
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
1999-08-28 16:17:36 +08:00
|
|
|
|
2003-02-25 11:22:06 +08:00
|
|
|
/* Handle completers. */
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'c':
|
1999-08-28 16:17:36 +08:00
|
|
|
switch (*++s)
|
|
|
|
{
|
|
|
|
case 'x':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s",
|
|
|
|
index_compl_names[GET_COMPL (insn)]);
|
2002-01-01 07:44:08 +08:00
|
|
|
break;
|
|
|
|
case 'X':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
index_compl_names[GET_COMPL (insn)]);
|
1999-08-28 16:17:36 +08:00
|
|
|
break;
|
|
|
|
case 'm':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s",
|
|
|
|
short_ldst_compl_names[GET_COMPL (insn)]);
|
2002-01-01 07:44:08 +08:00
|
|
|
break;
|
|
|
|
case 'M':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
short_ldst_compl_names[GET_COMPL (insn)]);
|
1999-08-28 16:17:36 +08:00
|
|
|
break;
|
2002-01-01 07:44:08 +08:00
|
|
|
case 'A':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
short_bytes_compl_names[GET_COMPL (insn)]);
|
1999-08-28 16:17:36 +08:00
|
|
|
break;
|
2002-01-01 07:44:08 +08:00
|
|
|
case 's':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s",
|
|
|
|
short_bytes_compl_names[GET_COMPL (insn)]);
|
2002-01-01 07:44:08 +08:00
|
|
|
break;
|
1999-10-10 15:58:37 +08:00
|
|
|
case 'c':
|
|
|
|
case 'C':
|
|
|
|
switch (GET_FIELD (insn, 20, 21))
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
(*info->fprintf_func) (info->stream, ",bc ");
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
(*info->fprintf_func) (info->stream, ",sl ");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
(*info->fprintf_func) (info->stream, " ");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
switch (GET_FIELD (insn, 20, 21))
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
(*info->fprintf_func) (info->stream, ",co ");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
(*info->fprintf_func) (info->stream, " ");
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'o':
|
|
|
|
(*info->fprintf_func) (info->stream, ",o");
|
|
|
|
break;
|
1999-09-23 22:28:25 +08:00
|
|
|
case 'g':
|
|
|
|
(*info->fprintf_func) (info->stream, ",gate");
|
1999-10-10 15:58:37 +08:00
|
|
|
break;
|
1999-09-23 22:28:25 +08:00
|
|
|
case 'p':
|
|
|
|
(*info->fprintf_func) (info->stream, ",l,push");
|
|
|
|
break;
|
|
|
|
case 'P':
|
|
|
|
(*info->fprintf_func) (info->stream, ",pop");
|
|
|
|
break;
|
|
|
|
case 'l':
|
1999-08-28 18:17:07 +08:00
|
|
|
case 'L':
|
|
|
|
(*info->fprintf_func) (info->stream, ",l");
|
|
|
|
break;
|
|
|
|
case 'w':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
read_write_names[GET_FIELD (insn, 25, 25)]);
|
1999-08-28 18:17:07 +08:00
|
|
|
break;
|
|
|
|
case 'W':
|
2005-07-17 10:26:26 +08:00
|
|
|
(*info->fprintf_func) (info->stream, ",w ");
|
1999-08-28 18:17:07 +08:00
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
if (GET_FIELD (insn, 23, 26) == 5)
|
|
|
|
(*info->fprintf_func) (info->stream, ",r");
|
|
|
|
break;
|
1999-08-28 16:17:36 +08:00
|
|
|
case 'Z':
|
|
|
|
if (GET_FIELD (insn, 26, 26))
|
|
|
|
(*info->fprintf_func) (info->stream, ",m ");
|
|
|
|
else
|
|
|
|
(*info->fprintf_func) (info->stream, " ");
|
|
|
|
break;
|
1999-08-28 18:17:07 +08:00
|
|
|
case 'i':
|
|
|
|
if (GET_FIELD (insn, 25, 25))
|
|
|
|
(*info->fprintf_func) (info->stream, ",i");
|
|
|
|
break;
|
1999-08-28 18:59:07 +08:00
|
|
|
case 'z':
|
|
|
|
if (!GET_FIELD (insn, 21, 21))
|
|
|
|
(*info->fprintf_func) (info->stream, ",z");
|
|
|
|
break;
|
1999-08-28 18:17:07 +08:00
|
|
|
case 'a':
|
|
|
|
(*info->fprintf_func)
|
2003-02-25 11:22:06 +08:00
|
|
|
(info->stream, "%s",
|
|
|
|
add_compl_names[GET_FIELD (insn, 20, 21)]);
|
1999-08-28 18:17:07 +08:00
|
|
|
break;
|
|
|
|
case 'Y':
|
|
|
|
(*info->fprintf_func)
|
2003-02-25 11:22:06 +08:00
|
|
|
(info->stream, ",dc%s",
|
|
|
|
add_compl_names[GET_FIELD (insn, 20, 21)]);
|
1999-08-28 18:17:07 +08:00
|
|
|
break;
|
|
|
|
case 'y':
|
|
|
|
(*info->fprintf_func)
|
2003-02-25 11:22:06 +08:00
|
|
|
(info->stream, ",c%s",
|
|
|
|
add_compl_names[GET_FIELD (insn, 20, 21)]);
|
1999-08-28 18:17:07 +08:00
|
|
|
break;
|
|
|
|
case 'v':
|
|
|
|
if (GET_FIELD (insn, 20, 20))
|
|
|
|
(*info->fprintf_func) (info->stream, ",tsv");
|
|
|
|
break;
|
|
|
|
case 't':
|
|
|
|
(*info->fprintf_func) (info->stream, ",tc");
|
|
|
|
if (GET_FIELD (insn, 20, 20))
|
|
|
|
(*info->fprintf_func) (info->stream, ",tsv");
|
|
|
|
break;
|
|
|
|
case 'B':
|
|
|
|
(*info->fprintf_func) (info->stream, ",db");
|
|
|
|
if (GET_FIELD (insn, 20, 20))
|
|
|
|
(*info->fprintf_func) (info->stream, ",tsv");
|
|
|
|
break;
|
|
|
|
case 'b':
|
|
|
|
(*info->fprintf_func) (info->stream, ",b");
|
|
|
|
if (GET_FIELD (insn, 20, 20))
|
|
|
|
(*info->fprintf_func) (info->stream, ",tsv");
|
|
|
|
break;
|
|
|
|
case 'T':
|
|
|
|
if (GET_FIELD (insn, 25, 25))
|
|
|
|
(*info->fprintf_func) (info->stream, ",tc");
|
|
|
|
break;
|
1999-08-28 16:47:50 +08:00
|
|
|
case 'S':
|
|
|
|
/* EXTRD/W has a following condition. */
|
|
|
|
if (*(s + 1) == '?')
|
|
|
|
(*info->fprintf_func)
|
2003-02-25 11:22:06 +08:00
|
|
|
(info->stream, "%s",
|
|
|
|
signed_unsigned_names[GET_FIELD (insn, 21, 21)]);
|
1999-08-28 16:47:50 +08:00
|
|
|
else
|
|
|
|
(*info->fprintf_func)
|
2003-02-25 11:22:06 +08:00
|
|
|
(info->stream, "%s ",
|
|
|
|
signed_unsigned_names[GET_FIELD (insn, 21, 21)]);
|
1999-08-28 16:47:50 +08:00
|
|
|
break;
|
|
|
|
case 'h':
|
|
|
|
(*info->fprintf_func)
|
2003-02-25 11:22:06 +08:00
|
|
|
(info->stream, "%s",
|
|
|
|
mix_half_names[GET_FIELD (insn, 17, 17)]);
|
1999-08-28 16:47:50 +08:00
|
|
|
break;
|
|
|
|
case 'H':
|
|
|
|
(*info->fprintf_func)
|
2003-02-25 11:22:06 +08:00
|
|
|
(info->stream, "%s ",
|
|
|
|
saturation_names[GET_FIELD (insn, 24, 25)]);
|
1999-08-28 16:47:50 +08:00
|
|
|
break;
|
|
|
|
case '*':
|
|
|
|
(*info->fprintf_func)
|
2003-02-25 11:22:06 +08:00
|
|
|
(info->stream, ",%d%d%d%d ",
|
|
|
|
GET_FIELD (insn, 17, 18), GET_FIELD (insn, 20, 21),
|
|
|
|
GET_FIELD (insn, 22, 23), GET_FIELD (insn, 24, 25));
|
1999-08-28 16:47:50 +08:00
|
|
|
break;
|
1999-09-20 04:17:48 +08:00
|
|
|
|
|
|
|
case 'q':
|
|
|
|
{
|
|
|
|
int m, a;
|
|
|
|
|
|
|
|
m = GET_FIELD (insn, 28, 28);
|
|
|
|
a = GET_FIELD (insn, 29, 29);
|
|
|
|
|
|
|
|
if (m && !a)
|
|
|
|
fputs_filtered (",ma ", info);
|
|
|
|
else if (m && a)
|
|
|
|
fputs_filtered (",mb ", info);
|
|
|
|
else
|
|
|
|
fputs_filtered (" ", info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 'J':
|
|
|
|
{
|
2000-07-09 15:29:39 +08:00
|
|
|
int opc = GET_FIELD (insn, 0, 5);
|
1999-09-20 04:17:48 +08:00
|
|
|
|
2000-07-09 15:29:39 +08:00
|
|
|
if (opc == 0x16 || opc == 0x1e)
|
1999-09-20 04:17:48 +08:00
|
|
|
{
|
|
|
|
if (GET_FIELD (insn, 29, 29) == 0)
|
|
|
|
fputs_filtered (",ma ", info);
|
|
|
|
else
|
|
|
|
fputs_filtered (",mb ", info);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fputs_filtered (" ", info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-10-10 15:58:37 +08:00
|
|
|
case 'e':
|
1999-09-20 04:17:48 +08:00
|
|
|
{
|
2000-07-09 15:29:39 +08:00
|
|
|
int opc = GET_FIELD (insn, 0, 5);
|
1999-09-20 04:17:48 +08:00
|
|
|
|
2000-07-09 15:29:39 +08:00
|
|
|
if (opc == 0x13 || opc == 0x1b)
|
1999-09-20 04:17:48 +08:00
|
|
|
{
|
|
|
|
if (GET_FIELD (insn, 18, 18) == 1)
|
|
|
|
fputs_filtered (",mb ", info);
|
|
|
|
else
|
|
|
|
fputs_filtered (",ma ", info);
|
|
|
|
}
|
2000-07-09 15:29:39 +08:00
|
|
|
else if (opc == 0x17 || opc == 0x1f)
|
1999-09-20 04:17:48 +08:00
|
|
|
{
|
|
|
|
if (GET_FIELD (insn, 31, 31) == 1)
|
|
|
|
fputs_filtered (",ma ", info);
|
|
|
|
else
|
|
|
|
fputs_filtered (",mb ", info);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fputs_filtered (" ", info);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
1999-08-28 16:17:36 +08:00
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
1999-08-06 07:02:01 +08:00
|
|
|
|
2003-02-25 11:22:06 +08:00
|
|
|
/* Handle conditions. */
|
1999-05-03 15:29:11 +08:00
|
|
|
case '?':
|
1999-08-06 07:02:01 +08:00
|
|
|
{
|
|
|
|
s++;
|
|
|
|
switch (*s)
|
|
|
|
{
|
|
|
|
case 'f':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
float_comp_names[GET_FIELD (insn, 27, 31)]);
|
1999-08-06 07:02:01 +08:00
|
|
|
break;
|
|
|
|
|
2005-07-01 19:16:33 +08:00
|
|
|
/* These four conditions are for the set of instructions
|
1999-08-06 07:02:01 +08:00
|
|
|
which distinguish true/false conditions by opcode
|
|
|
|
rather than by the 'f' bit (sigh): comb, comib,
|
2005-07-01 19:16:33 +08:00
|
|
|
addb, addib. */
|
1999-08-06 07:02:01 +08:00
|
|
|
case 't':
|
2003-02-25 11:22:06 +08:00
|
|
|
fputs_filtered
|
|
|
|
(compare_cond_names[GET_FIELD (insn, 16, 18)], info);
|
1999-08-06 07:02:01 +08:00
|
|
|
break;
|
1999-10-10 15:58:37 +08:00
|
|
|
case 'n':
|
2003-02-25 11:22:06 +08:00
|
|
|
fputs_filtered
|
|
|
|
(compare_cond_names[GET_FIELD (insn, 16, 18)
|
|
|
|
+ GET_FIELD (insn, 4, 4) * 8],
|
|
|
|
info);
|
1999-08-06 23:50:21 +08:00
|
|
|
break;
|
1999-10-10 15:58:37 +08:00
|
|
|
case 'N':
|
2003-02-25 11:22:06 +08:00
|
|
|
fputs_filtered
|
|
|
|
(compare_cond_64_names[GET_FIELD (insn, 16, 18)
|
|
|
|
+ GET_FIELD (insn, 2, 2) * 8],
|
|
|
|
info);
|
1999-08-06 23:50:21 +08:00
|
|
|
break;
|
|
|
|
case 'Q':
|
2003-02-25 11:22:06 +08:00
|
|
|
fputs_filtered
|
|
|
|
(cmpib_cond_64_names[GET_FIELD (insn, 16, 18)],
|
|
|
|
info);
|
1999-08-06 23:50:21 +08:00
|
|
|
break;
|
1999-08-06 07:02:01 +08:00
|
|
|
case '@':
|
2003-02-25 11:22:06 +08:00
|
|
|
fputs_filtered
|
|
|
|
(add_cond_names[GET_FIELD (insn, 16, 18)
|
|
|
|
+ GET_FIELD (insn, 4, 4) * 8],
|
|
|
|
info);
|
1999-08-06 07:02:01 +08:00
|
|
|
break;
|
|
|
|
case 's':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
compare_cond_names[GET_COND (insn)]);
|
1999-08-06 07:02:01 +08:00
|
|
|
break;
|
1999-08-06 23:50:21 +08:00
|
|
|
case 'S':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
compare_cond_64_names[GET_COND (insn)]);
|
1999-08-06 23:50:21 +08:00
|
|
|
break;
|
1999-08-06 07:02:01 +08:00
|
|
|
case 'a':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
add_cond_names[GET_COND (insn)]);
|
1999-08-06 07:02:01 +08:00
|
|
|
break;
|
1999-08-06 23:50:21 +08:00
|
|
|
case 'A':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
add_cond_64_names[GET_COND (insn)]);
|
1999-08-06 23:50:21 +08:00
|
|
|
break;
|
1999-08-06 07:02:01 +08:00
|
|
|
case 'd':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s",
|
|
|
|
add_cond_names[GET_FIELD (insn, 16, 18)]);
|
1999-08-06 07:02:01 +08:00
|
|
|
break;
|
1999-08-29 15:53:24 +08:00
|
|
|
|
1999-08-06 23:50:21 +08:00
|
|
|
case 'W':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
1999-08-06 23:50:21 +08:00
|
|
|
(info->stream, "%s",
|
2003-02-25 11:22:06 +08:00
|
|
|
wide_add_cond_names[GET_FIELD (insn, 16, 18) +
|
|
|
|
GET_FIELD (insn, 4, 4) * 8]);
|
1999-08-06 23:50:21 +08:00
|
|
|
break;
|
1999-08-06 07:02:01 +08:00
|
|
|
|
|
|
|
case 'l':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
logical_cond_names[GET_COND (insn)]);
|
1999-08-06 07:02:01 +08:00
|
|
|
break;
|
1999-08-06 23:50:21 +08:00
|
|
|
case 'L':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
logical_cond_64_names[GET_COND (insn)]);
|
1999-08-06 23:50:21 +08:00
|
|
|
break;
|
1999-08-06 07:02:01 +08:00
|
|
|
case 'u':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
unit_cond_names[GET_COND (insn)]);
|
1999-08-06 07:02:01 +08:00
|
|
|
break;
|
1999-08-06 23:50:21 +08:00
|
|
|
case 'U':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
unit_cond_64_names[GET_COND (insn)]);
|
1999-08-06 23:50:21 +08:00
|
|
|
break;
|
1999-08-06 07:02:01 +08:00
|
|
|
case 'y':
|
|
|
|
case 'x':
|
|
|
|
case 'b':
|
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s",
|
|
|
|
shift_cond_names[GET_FIELD (insn, 16, 18)]);
|
|
|
|
|
|
|
|
/* If the next character in args is 'n', it will handle
|
|
|
|
putting out the space. */
|
|
|
|
if (s[1] != 'n')
|
|
|
|
(*info->fprintf_func) (info->stream, " ");
|
|
|
|
break;
|
1999-08-06 23:50:21 +08:00
|
|
|
case 'X':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
shift_cond_64_names[GET_FIELD (insn, 16, 18)]);
|
1999-08-06 23:50:21 +08:00
|
|
|
break;
|
|
|
|
case 'B':
|
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s",
|
|
|
|
bb_cond_64_names[GET_FIELD (insn, 16, 16)]);
|
1999-08-06 07:02:01 +08:00
|
|
|
|
1999-08-06 23:50:21 +08:00
|
|
|
/* If the next character in args is 'n', it will handle
|
|
|
|
putting out the space. */
|
|
|
|
if (s[1] != 'n')
|
|
|
|
(*info->fprintf_func) (info->stream, " ");
|
|
|
|
break;
|
1999-08-06 07:02:01 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
|
|
|
|
case 'V':
|
|
|
|
fput_const (extract_5_store (insn), info);
|
|
|
|
break;
|
|
|
|
case 'r':
|
|
|
|
fput_const (extract_5r_store (insn), info);
|
|
|
|
break;
|
|
|
|
case 'R':
|
|
|
|
fput_const (extract_5R_store (insn), info);
|
|
|
|
break;
|
1999-08-28 18:17:07 +08:00
|
|
|
case 'U':
|
|
|
|
fput_const (extract_10U_store (insn), info);
|
|
|
|
break;
|
1999-11-25 11:29:14 +08:00
|
|
|
case 'B':
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'Q':
|
|
|
|
fput_const (extract_5Q_store (insn), info);
|
|
|
|
break;
|
|
|
|
case 'i':
|
|
|
|
fput_const (extract_11 (insn), info);
|
|
|
|
break;
|
|
|
|
case 'j':
|
|
|
|
fput_const (extract_14 (insn), info);
|
|
|
|
break;
|
|
|
|
case 'k':
|
2005-08-06 01:52:06 +08:00
|
|
|
fputs_filtered ("L%", info);
|
1999-05-03 15:29:11 +08:00
|
|
|
fput_const (extract_21 (insn), info);
|
|
|
|
break;
|
2001-01-14 13:14:45 +08:00
|
|
|
case '<':
|
2000-04-22 06:04:29 +08:00
|
|
|
case 'l':
|
|
|
|
/* 16-bit long disp., PA2.0 wide only. */
|
|
|
|
fput_const (extract_16 (insn), info);
|
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'n':
|
|
|
|
if (insn & 0x2)
|
|
|
|
(*info->fprintf_func) (info->stream, ",n ");
|
|
|
|
else
|
|
|
|
(*info->fprintf_func) (info->stream, " ");
|
|
|
|
break;
|
|
|
|
case 'N':
|
|
|
|
if ((insn & 0x20) && s[1])
|
|
|
|
(*info->fprintf_func) (info->stream, ",n ");
|
|
|
|
else if (insn & 0x20)
|
|
|
|
(*info->fprintf_func) (info->stream, ",n");
|
|
|
|
else if (s[1])
|
|
|
|
(*info->fprintf_func) (info->stream, " ");
|
|
|
|
break;
|
|
|
|
case 'w':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->print_address_func)
|
|
|
|
(memaddr + 8 + extract_12 (insn), info);
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
|
|
|
case 'W':
|
|
|
|
/* 17 bit PC-relative branch. */
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->print_address_func)
|
|
|
|
((memaddr + 8 + extract_17 (insn)), info);
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
|
|
|
case 'z':
|
|
|
|
/* 17 bit displacement. This is an offset from a register
|
|
|
|
so it gets disasssembled as just a number, not any sort
|
|
|
|
of address. */
|
|
|
|
fput_const (extract_17 (insn), info);
|
|
|
|
break;
|
1999-09-08 03:52:51 +08:00
|
|
|
|
|
|
|
case 'Z':
|
|
|
|
/* addil %r1 implicit output. */
|
2005-08-14 09:15:34 +08:00
|
|
|
fputs_filtered ("r1", info);
|
1999-09-08 03:52:51 +08:00
|
|
|
break;
|
1999-09-23 22:28:25 +08:00
|
|
|
|
|
|
|
case 'Y':
|
|
|
|
/* be,l %sr0,%r31 implicit output. */
|
2005-08-14 09:15:34 +08:00
|
|
|
fputs_filtered ("sr0,r31", info);
|
1999-09-23 22:28:25 +08:00
|
|
|
break;
|
2003-02-25 11:22:06 +08:00
|
|
|
|
1999-10-10 15:58:37 +08:00
|
|
|
case '@':
|
|
|
|
(*info->fprintf_func) (info->stream, "0");
|
|
|
|
break;
|
|
|
|
|
1999-08-28 14:45:18 +08:00
|
|
|
case '.':
|
|
|
|
(*info->fprintf_func) (info->stream, "%d",
|
2003-02-25 11:22:06 +08:00
|
|
|
GET_FIELD (insn, 24, 25));
|
1999-08-28 14:45:18 +08:00
|
|
|
break;
|
1999-08-28 18:17:07 +08:00
|
|
|
case '*':
|
|
|
|
(*info->fprintf_func) (info->stream, "%d",
|
2003-02-25 11:22:06 +08:00
|
|
|
GET_FIELD (insn, 22, 25));
|
1999-08-28 18:17:07 +08:00
|
|
|
break;
|
1999-08-28 16:00:27 +08:00
|
|
|
case '!':
|
2005-08-14 09:15:34 +08:00
|
|
|
fputs_filtered ("sar", info);
|
1999-08-28 16:00:27 +08:00
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'p':
|
|
|
|
(*info->fprintf_func) (info->stream, "%d",
|
2003-02-25 11:22:06 +08:00
|
|
|
31 - GET_FIELD (insn, 22, 26));
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
1999-08-28 14:45:18 +08:00
|
|
|
case '~':
|
|
|
|
{
|
|
|
|
int num;
|
|
|
|
num = GET_FIELD (insn, 20, 20) << 5;
|
|
|
|
num |= GET_FIELD (insn, 22, 26);
|
|
|
|
(*info->fprintf_func) (info->stream, "%d", 63 - num);
|
|
|
|
break;
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'P':
|
|
|
|
(*info->fprintf_func) (info->stream, "%d",
|
2003-02-25 11:22:06 +08:00
|
|
|
GET_FIELD (insn, 22, 26));
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
1999-08-28 18:59:07 +08:00
|
|
|
case 'q':
|
|
|
|
{
|
|
|
|
int num;
|
|
|
|
num = GET_FIELD (insn, 20, 20) << 5;
|
|
|
|
num |= GET_FIELD (insn, 22, 26);
|
|
|
|
(*info->fprintf_func) (info->stream, "%d", num);
|
|
|
|
break;
|
|
|
|
}
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'T':
|
|
|
|
(*info->fprintf_func) (info->stream, "%d",
|
2003-02-25 11:22:06 +08:00
|
|
|
32 - GET_FIELD (insn, 27, 31));
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
1999-08-28 18:59:07 +08:00
|
|
|
case '%':
|
|
|
|
{
|
|
|
|
int num;
|
|
|
|
num = (GET_FIELD (insn, 23, 23) + 1) * 32;
|
|
|
|
num -= GET_FIELD (insn, 27, 31);
|
|
|
|
(*info->fprintf_func) (info->stream, "%d", num);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case '|':
|
|
|
|
{
|
|
|
|
int num;
|
|
|
|
num = (GET_FIELD (insn, 19, 19) + 1) * 32;
|
|
|
|
num -= GET_FIELD (insn, 27, 31);
|
|
|
|
(*info->fprintf_func) (info->stream, "%d", num);
|
|
|
|
break;
|
|
|
|
}
|
1999-08-28 14:45:18 +08:00
|
|
|
case '$':
|
|
|
|
fput_const (GET_FIELD (insn, 20, 28), info);
|
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
case 'A':
|
|
|
|
fput_const (GET_FIELD (insn, 6, 18), info);
|
|
|
|
break;
|
|
|
|
case 'D':
|
|
|
|
fput_const (GET_FIELD (insn, 6, 31), info);
|
|
|
|
break;
|
1999-08-29 15:53:24 +08:00
|
|
|
case 'v':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func) (info->stream, ",%d",
|
|
|
|
GET_FIELD (insn, 23, 25));
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
|
|
|
case 'O':
|
|
|
|
fput_const ((GET_FIELD (insn, 6,20) << 5 |
|
|
|
|
GET_FIELD (insn, 27, 31)), info);
|
|
|
|
break;
|
|
|
|
case 'o':
|
|
|
|
fput_const (GET_FIELD (insn, 6, 20), info);
|
|
|
|
break;
|
|
|
|
case '2':
|
|
|
|
fput_const ((GET_FIELD (insn, 6, 22) << 5 |
|
|
|
|
GET_FIELD (insn, 27, 31)), info);
|
|
|
|
break;
|
|
|
|
case '1':
|
|
|
|
fput_const ((GET_FIELD (insn, 11, 20) << 5 |
|
|
|
|
GET_FIELD (insn, 27, 31)), info);
|
|
|
|
break;
|
|
|
|
case '0':
|
|
|
|
fput_const ((GET_FIELD (insn, 16, 20) << 5 |
|
|
|
|
GET_FIELD (insn, 27, 31)), info);
|
|
|
|
break;
|
|
|
|
case 'u':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func) (info->stream, ",%d",
|
|
|
|
GET_FIELD (insn, 23, 25));
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
|
|
|
case 'F':
|
2005-07-01 19:16:33 +08:00
|
|
|
/* If no destination completer and not before a completer
|
|
|
|
for fcmp, need a space here. */
|
1999-08-28 14:29:15 +08:00
|
|
|
if (s[1] == 'G' || s[1] == '?')
|
2003-02-25 11:22:06 +08:00
|
|
|
fputs_filtered
|
|
|
|
(float_format_names[GET_FIELD (insn, 19, 20)], info);
|
1999-05-03 15:29:11 +08:00
|
|
|
else
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
float_format_names[GET_FIELD (insn, 19, 20)]);
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
|
|
|
case 'G':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
float_format_names[GET_FIELD (insn, 17, 18)]);
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
|
|
|
case 'H':
|
|
|
|
if (GET_FIELD (insn, 26, 26) == 1)
|
|
|
|
(*info->fprintf_func) (info->stream, "%s ",
|
2003-02-25 11:22:06 +08:00
|
|
|
float_format_names[0]);
|
1999-05-03 15:29:11 +08:00
|
|
|
else
|
|
|
|
(*info->fprintf_func) (info->stream, "%s ",
|
2003-02-25 11:22:06 +08:00
|
|
|
float_format_names[1]);
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
|
|
|
case 'I':
|
2005-07-01 19:16:33 +08:00
|
|
|
/* If no destination completer and not before a completer
|
|
|
|
for fcmp, need a space here. */
|
1999-08-28 14:29:15 +08:00
|
|
|
if (s[1] == '?')
|
2003-02-25 11:22:06 +08:00
|
|
|
fputs_filtered
|
|
|
|
(float_format_names[GET_FIELD (insn, 20, 20)], info);
|
1999-05-03 15:29:11 +08:00
|
|
|
else
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->fprintf_func)
|
|
|
|
(info->stream, "%s ",
|
|
|
|
float_format_names[GET_FIELD (insn, 20, 20)]);
|
1999-05-03 15:29:11 +08:00
|
|
|
break;
|
1999-09-20 04:10:45 +08:00
|
|
|
|
2003-02-25 11:22:06 +08:00
|
|
|
case 'J':
|
|
|
|
fput_const (extract_14 (insn), info);
|
|
|
|
break;
|
1999-09-20 04:10:45 +08:00
|
|
|
|
1999-09-20 03:29:37 +08:00
|
|
|
case '#':
|
|
|
|
{
|
ubsan: hppa: left shift of negative value
bfd/
* libhppa.h (hppa_field_adjust, bfd_hppa_insn2fmt): Delete forward
declaration. Move ATTRIBUTE_UNUSED to definition.
(sign_extend, low_sign_extend, sign_unext, low_sign_unext),
(re_assemble_3, re_assemble_12, re_assemble_14, re_assemble_16),
(re_assemble_17, re_assemble_21, re_assemble_22): Likewise. Make
args and return value unsigned. Use unsigned variables.
(hppa_rebuild_insn): Similarly.
opcodes/
* hppa-dis.c (extract_16, extract_21, print_insn_hppa): Use
unsigned variables.
2019-12-20 09:44:19 +08:00
|
|
|
unsigned sign = GET_FIELD (insn, 31, 31);
|
|
|
|
unsigned imm10 = GET_FIELD (insn, 18, 27);
|
|
|
|
unsigned disp;
|
1999-09-20 03:29:37 +08:00
|
|
|
|
|
|
|
if (sign)
|
2015-09-24 01:05:16 +08:00
|
|
|
disp = (-1U << 10) | imm10;
|
1999-09-20 03:29:37 +08:00
|
|
|
else
|
|
|
|
disp = imm10;
|
|
|
|
|
|
|
|
disp <<= 3;
|
|
|
|
fput_const (disp, info);
|
|
|
|
break;
|
|
|
|
}
|
2003-02-25 11:22:06 +08:00
|
|
|
case 'K':
|
1999-09-20 03:29:37 +08:00
|
|
|
case 'd':
|
|
|
|
{
|
ubsan: hppa: left shift of negative value
bfd/
* libhppa.h (hppa_field_adjust, bfd_hppa_insn2fmt): Delete forward
declaration. Move ATTRIBUTE_UNUSED to definition.
(sign_extend, low_sign_extend, sign_unext, low_sign_unext),
(re_assemble_3, re_assemble_12, re_assemble_14, re_assemble_16),
(re_assemble_17, re_assemble_21, re_assemble_22): Likewise. Make
args and return value unsigned. Use unsigned variables.
(hppa_rebuild_insn): Similarly.
opcodes/
* hppa-dis.c (extract_16, extract_21, print_insn_hppa): Use
unsigned variables.
2019-12-20 09:44:19 +08:00
|
|
|
unsigned sign = GET_FIELD (insn, 31, 31);
|
|
|
|
unsigned imm11 = GET_FIELD (insn, 18, 28);
|
|
|
|
unsigned disp;
|
1999-09-20 03:29:37 +08:00
|
|
|
|
|
|
|
if (sign)
|
2015-09-24 01:05:16 +08:00
|
|
|
disp = (-1U << 11) | imm11;
|
1999-09-20 03:29:37 +08:00
|
|
|
else
|
|
|
|
disp = imm11;
|
|
|
|
|
|
|
|
disp <<= 2;
|
|
|
|
fput_const (disp, info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-01-14 13:14:45 +08:00
|
|
|
case '>':
|
2000-04-22 06:04:29 +08:00
|
|
|
case 'y':
|
|
|
|
{
|
|
|
|
/* 16-bit long disp., PA2.0 wide only. */
|
|
|
|
int disp = extract_16 (insn);
|
|
|
|
disp &= ~3;
|
|
|
|
fput_const (disp, info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case '&':
|
|
|
|
{
|
|
|
|
/* 16-bit long disp., PA2.0 wide only. */
|
|
|
|
int disp = extract_16 (insn);
|
|
|
|
disp &= ~7;
|
|
|
|
fput_const (disp, info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-09-20 02:50:17 +08:00
|
|
|
case '_':
|
2003-02-25 11:22:06 +08:00
|
|
|
break; /* Dealt with by '{' */
|
|
|
|
|
1999-09-20 02:50:17 +08:00
|
|
|
case '{':
|
2003-02-25 11:22:06 +08:00
|
|
|
{
|
|
|
|
int sub = GET_FIELD (insn, 14, 16);
|
|
|
|
int df = GET_FIELD (insn, 17, 18);
|
|
|
|
int sf = GET_FIELD (insn, 19, 20);
|
|
|
|
const char * const * source = float_format_names;
|
|
|
|
const char * const * dest = float_format_names;
|
|
|
|
char *t = "";
|
2005-07-01 19:16:33 +08:00
|
|
|
|
2003-02-25 11:22:06 +08:00
|
|
|
if (sub == 4)
|
|
|
|
{
|
|
|
|
fputs_filtered (",UND ", info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if ((sub & 3) == 3)
|
|
|
|
t = ",t";
|
|
|
|
if ((sub & 3) == 1)
|
|
|
|
source = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names;
|
|
|
|
if (sub & 2)
|
|
|
|
dest = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names;
|
|
|
|
|
|
|
|
(*info->fprintf_func) (info->stream, "%s%s%s ",
|
|
|
|
t, source[sf], dest[df]);
|
|
|
|
break;
|
|
|
|
}
|
1999-09-20 02:50:17 +08:00
|
|
|
|
|
|
|
case 'm':
|
|
|
|
{
|
|
|
|
int y = GET_FIELD (insn, 16, 18);
|
|
|
|
|
|
|
|
if (y != 1)
|
|
|
|
fput_const ((y ^ 1) - 1, info);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'h':
|
|
|
|
{
|
|
|
|
int cbit;
|
|
|
|
|
|
|
|
cbit = GET_FIELD (insn, 16, 18);
|
|
|
|
|
|
|
|
if (cbit > 0)
|
|
|
|
(*info->fprintf_func) (info->stream, ",%d", cbit - 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case '=':
|
|
|
|
{
|
|
|
|
int cond = GET_FIELD (insn, 27, 31);
|
|
|
|
|
2005-07-01 19:16:33 +08:00
|
|
|
switch (cond)
|
|
|
|
{
|
|
|
|
case 0: fputs_filtered (" ", info); break;
|
|
|
|
case 1: fputs_filtered ("acc ", info); break;
|
|
|
|
case 2: fputs_filtered ("rej ", info); break;
|
|
|
|
case 5: fputs_filtered ("acc8 ", info); break;
|
|
|
|
case 6: fputs_filtered ("rej8 ", info); break;
|
|
|
|
case 9: fputs_filtered ("acc6 ", info); break;
|
|
|
|
case 13: fputs_filtered ("acc4 ", info); break;
|
|
|
|
case 17: fputs_filtered ("acc2 ", info); break;
|
|
|
|
default: break;
|
|
|
|
}
|
1999-09-20 02:50:17 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
1999-09-20 02:11:48 +08:00
|
|
|
case 'X':
|
2003-02-25 11:22:06 +08:00
|
|
|
(*info->print_address_func)
|
|
|
|
(memaddr + 8 + extract_22 (insn), info);
|
1999-09-20 02:11:48 +08:00
|
|
|
break;
|
1999-09-20 01:06:11 +08:00
|
|
|
case 'L':
|
2005-08-14 09:15:34 +08:00
|
|
|
fputs_filtered (",rp", info);
|
1999-09-20 01:06:11 +08:00
|
|
|
break;
|
1999-05-03 15:29:11 +08:00
|
|
|
default:
|
|
|
|
(*info->fprintf_func) (info->stream, "%c", *s);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-07-01 19:16:33 +08:00
|
|
|
return sizeof (insn);
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
(*info->fprintf_func) (info->stream, "#%8x", insn);
|
2005-07-01 19:16:33 +08:00
|
|
|
return sizeof (insn);
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|