include/opcode/

* ppc.h (ppc_cpu_t): New typedef.
	(struct powerpc_opcode <flags>): Use it.
	(struct powerpc_operand <insert, extract>): Likewise.
	(struct powerpc_macro <flags>): Likewise.

gas/
	* config/tc-ppc.c (ppc_cpu): Use ppc_cpu_t typedef.
	(ppc_insert_operand): Likewise.
	(ppc_machine): Likewise.
	* config/tc-ppc.h: #include "opcode/ppc.h"
	(struct _ppc_fix_extra <ppc_cpu>): Use ppc_cpu_t typedef.
	(ppc_cpu): Update extern decl.

opcodes/
	* ppc-dis.c (print_insn_powerpc): Update prototye to use new
	ppc_cpu_t typedef.
	(struct dis_private): New.
	(POWERPC_DIALECT): New define.
	(powerpc_dialect): Renamed to...
	(powerpc_init_dialect): This.  Update to use ppc_cpu_t and
	struct dis_private.
	(print_insn_big_powerpc): Update for using structure in
	info->private_data.
	(print_insn_little_powerpc): Likewise.
	(operand_value_powerpc): Change type of dialect param to ppc_cpu_t.
	(skip_optional_operands): Likewise.
	(print_insn_powerpc): Likewise.  Remove initialization of dialect.
	* ppc-opc.c (extract_bat, extract_bba, extract_bdm, extract_bdp,
	extract_bo, extract_boe, extract_fxm, extract_mb6, extract_mbe,
	extract_nb, extract_nsi, extract_rbs, extract_sh6, extract_spr,
	extract_sprg, extract_tbr insert_bat, insert_bba, insert_bdm,
	insert_bdp, insert_bo, insert_boe, insert_fxm, insert_mb6, insert_mbe,
	insert_nsi, insert_ral, insert_ram, insert_raq, insert_ras, insert_rbs,
	insert_sh6, insert_spr, insert_sprg, insert_tbr): Change the dialect
	param to be of type ppc_cpu_t.  Update prototype.
This commit is contained in:
Peter Bergner
2008-06-13 20:16:00 +00:00
parent 6ae37fefeb
commit fa452fa683
8 changed files with 155 additions and 97 deletions

View File

@ -1,3 +1,12 @@
2008-06-13 Peter Bergner <bergner@vnet.ibm.com>
* config/tc-ppc.c (ppc_cpu): Use ppc_cpu_t typedef.
(ppc_insert_operand): Likewise.
(ppc_machine): Likewise.
* config/tc-ppc.h: #include "opcode/ppc.h"
(struct _ppc_fix_extra <ppc_cpu>): Use ppc_cpu_t typedef.
(ppc_cpu): Update extern decl.
2008-06-12 Adam Nemet <anemet@caviumnetworks.com> 2008-06-12 Adam Nemet <anemet@caviumnetworks.com>
* config/tc-mips.c (validate_mips_insn): Handle field descriptors * config/tc-mips.c (validate_mips_insn): Handle field descriptors

View File

@ -181,7 +181,7 @@ int ppc_cie_data_alignment;
/* The type of processor we are assembling for. This is one or more /* The type of processor we are assembling for. This is one or more
of the PPC_OPCODE flags defined in opcode/ppc.h. */ of the PPC_OPCODE flags defined in opcode/ppc.h. */
unsigned long ppc_cpu = 0; ppc_cpu_t ppc_cpu = 0;
/* The target specific pseudo-ops which we support. */ /* The target specific pseudo-ops which we support. */
@ -825,7 +825,7 @@ const size_t md_longopts_size = sizeof (md_longopts);
static int static int
parse_cpu (const char *arg) parse_cpu (const char *arg)
{ {
unsigned long altivec_or_spe = ppc_cpu & (PPC_OPCODE_ALTIVEC | PPC_OPCODE_SPE); ppc_cpu_t altivec_or_spe = ppc_cpu & (PPC_OPCODE_ALTIVEC | PPC_OPCODE_SPE);
/* -mpwrx and -mpwr2 mean to assemble for the IBM POWER/2 /* -mpwrx and -mpwr2 mean to assemble for the IBM POWER/2
(RIOS2). */ (RIOS2). */
@ -1573,7 +1573,7 @@ static unsigned long
ppc_insert_operand (unsigned long insn, ppc_insert_operand (unsigned long insn,
const struct powerpc_operand *operand, const struct powerpc_operand *operand,
offsetT val, offsetT val,
unsigned long ppc_cpu, ppc_cpu_t ppc_cpu,
char *file, char *file,
unsigned int line) unsigned int line)
{ {
@ -4138,7 +4138,7 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED)
{ {
char *cpu_string; char *cpu_string;
#define MAX_HISTORY 100 #define MAX_HISTORY 100
static unsigned long *cpu_history; static ppc_cpu_t *cpu_history;
static int curr_hist; static int curr_hist;
SKIP_WHITESPACE (); SKIP_WHITESPACE ();
@ -4159,7 +4159,7 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED)
if (cpu_string != NULL) if (cpu_string != NULL)
{ {
unsigned long old_cpu = ppc_cpu; ppc_cpu_t old_cpu = ppc_cpu;
char *p; char *p;
for (p = cpu_string; *p != 0; p++) for (p = cpu_string; *p != 0; p++)

View File

@ -22,6 +22,8 @@
#define TC_PPC #define TC_PPC
#include "opcode/ppc.h"
struct fix; struct fix;
/* Set the endianness we are using. Default to big endian. */ /* Set the endianness we are using. Default to big endian. */
@ -95,10 +97,10 @@ extern void ppc_handle_align (struct frag *);
for later use in md_apply_fix. */ for later use in md_apply_fix. */
struct _ppc_fix_extra struct _ppc_fix_extra
{ {
unsigned long ppc_cpu; ppc_cpu_t ppc_cpu;
}; };
extern unsigned long ppc_cpu; extern ppc_cpu_t ppc_cpu;
#define TC_FIX_TYPE struct _ppc_fix_extra #define TC_FIX_TYPE struct _ppc_fix_extra
#define TC_INIT_FIX_DATA(FIXP) \ #define TC_INIT_FIX_DATA(FIXP) \

View File

@ -1,3 +1,10 @@
2008-06-13 Peter Bergner <bergner@vnet.ibm.com>
* ppc.h (ppc_cpu_t): New typedef.
(struct powerpc_opcode <flags>): Use it.
(struct powerpc_operand <insert, extract>): Likewise.
(struct powerpc_macro <flags>): Likewise.
2008-06-12 Adam Nemet <anemet@caviumnetworks.com> 2008-06-12 Adam Nemet <anemet@caviumnetworks.com>
* mips.h: Document new field descriptors +x, +X, +p, +P, +s, +S. * mips.h: Document new field descriptors +x, +X, +p, +P, +s, +S.

View File

@ -22,6 +22,8 @@ Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, US
#ifndef PPC_H #ifndef PPC_H
#define PPC_H #define PPC_H
typedef unsigned long ppc_cpu_t;
/* The opcode table is an array of struct powerpc_opcode. */ /* The opcode table is an array of struct powerpc_opcode. */
struct powerpc_opcode struct powerpc_opcode
@ -42,7 +44,7 @@ struct powerpc_opcode
/* One bit flags for the opcode. These are used to indicate which /* One bit flags for the opcode. These are used to indicate which
specific processors support the instructions. The defined values specific processors support the instructions. The defined values
are listed below. */ are listed below. */
unsigned long flags; ppc_cpu_t flags;
/* An array of operand codes. Each code is an index into the /* An array of operand codes. Each code is an index into the
operand table. They appear in the order which the operands must operand table. They appear in the order which the operands must
@ -183,7 +185,7 @@ struct powerpc_operand
operand value is legal, *ERRMSG will be unchanged (most operands operand value is legal, *ERRMSG will be unchanged (most operands
can accept any value). */ can accept any value). */
unsigned long (*insert) unsigned long (*insert)
(unsigned long instruction, long op, int dialect, const char **errmsg); (unsigned long instruction, long op, ppc_cpu_t dialect, const char **errmsg);
/* Extraction function. This is used by the disassembler. To /* Extraction function. This is used by the disassembler. To
extract this operand type from an instruction, check this field. extract this operand type from an instruction, check this field.
@ -201,7 +203,7 @@ struct powerpc_operand
non-zero if this operand type can not actually be extracted from non-zero if this operand type can not actually be extracted from
this operand (i.e., the instruction does not match). If the this operand (i.e., the instruction does not match). If the
operand is valid, *INVALID will not be changed. */ operand is valid, *INVALID will not be changed. */
long (*extract) (unsigned long instruction, int dialect, int *invalid); long (*extract) (unsigned long instruction, ppc_cpu_t dialect, int *invalid);
/* One bit syntax flags. */ /* One bit syntax flags. */
unsigned long flags; unsigned long flags;
@ -318,7 +320,7 @@ struct powerpc_macro
/* One bit flags for the opcode. These are used to indicate which /* One bit flags for the opcode. These are used to indicate which
specific processors support the instructions. The values are the specific processors support the instructions. The values are the
same as those for the struct powerpc_opcode flags field. */ same as those for the struct powerpc_opcode flags field. */
unsigned long flags; ppc_cpu_t flags;
/* A format string to turn the macro into a normal instruction. /* A format string to turn the macro into a normal instruction.
Each %N in the string is replaced with operand number N (zero Each %N in the string is replaced with operand number N (zero

View File

@ -1,3 +1,27 @@
2008-06-13 Peter Bergner <bergner@vnet.ibm.com>
* ppc-dis.c (print_insn_powerpc): Update prototye to use new
ppc_cpu_t typedef.
(struct dis_private): New.
(POWERPC_DIALECT): New define.
(powerpc_dialect): Renamed to...
(powerpc_init_dialect): This. Update to use ppc_cpu_t and
struct dis_private.
(print_insn_big_powerpc): Update for using structure in
info->private_data.
(print_insn_little_powerpc): Likewise.
(operand_value_powerpc): Change type of dialect param to ppc_cpu_t.
(skip_optional_operands): Likewise.
(print_insn_powerpc): Likewise. Remove initialization of dialect.
* ppc-opc.c (extract_bat, extract_bba, extract_bdm, extract_bdp,
extract_bo, extract_boe, extract_fxm, extract_mb6, extract_mbe,
extract_nb, extract_nsi, extract_rbs, extract_sh6, extract_spr,
extract_sprg, extract_tbr insert_bat, insert_bba, insert_bdm,
insert_bdp, insert_bo, insert_boe, insert_fxm, insert_mb6, insert_mbe,
insert_nsi, insert_ral, insert_ram, insert_raq, insert_ras, insert_rbs,
insert_sh6, insert_spr, insert_sprg, insert_tbr): Change the dialect
param to be of type ppc_cpu_t. Update prototype.
2008-06-12 Adam Nemet <anemet@caviumnetworks.com> 2008-06-12 Adam Nemet <anemet@caviumnetworks.com>
* mips-dis.c (print_insn_args): Handle field descriptors +x, +p, * mips-dis.c (print_insn_args): Handle field descriptors +x, +p,

View File

@ -30,17 +30,30 @@
are provided because this file handles disassembly for the PowerPC are provided because this file handles disassembly for the PowerPC
in both big and little endian mode and also for the POWER (RS/6000) in both big and little endian mode and also for the POWER (RS/6000)
chip. */ chip. */
static int print_insn_powerpc (bfd_vma, struct disassemble_info *, int,
ppc_cpu_t);
static int print_insn_powerpc (bfd_vma, struct disassemble_info *, int, int); struct dis_private
{
/* Stash the result of parsing disassembler_options here. */
ppc_cpu_t dialect;
};
#define POWERPC_DIALECT(INFO) \
(((struct dis_private *) ((INFO)->private_data))->dialect)
/* Determine which set of machines to disassemble for. PPC403/601 or /* Determine which set of machines to disassemble for. PPC403/601 or
BookE. For convenience, also disassemble instructions supported BookE. For convenience, also disassemble instructions supported
by the AltiVec vector unit. */ by the AltiVec vector unit. */
static int static int
powerpc_dialect (struct disassemble_info *info) powerpc_init_dialect (struct disassemble_info *info)
{ {
int dialect = PPC_OPCODE_PPC; ppc_cpu_t dialect = PPC_OPCODE_PPC;
struct dis_private *priv = calloc (sizeof (*priv), 1);
if (priv == NULL)
return FALSE;
if (BFD_DEFAULT_TARGET_SIZE == 64) if (BFD_DEFAULT_TARGET_SIZE == 64)
dialect |= PPC_OPCODE_64; dialect |= PPC_OPCODE_64;
@ -107,8 +120,10 @@ powerpc_dialect (struct disassemble_info *info)
dialect |= PPC_OPCODE_64; dialect |= PPC_OPCODE_64;
} }
info->private_data = (char *) 0 + dialect; info->private_data = priv;
return dialect; POWERPC_DIALECT(info) = dialect;
return TRUE;
} }
/* Print a big endian PowerPC instruction. */ /* Print a big endian PowerPC instruction. */
@ -116,8 +131,9 @@ powerpc_dialect (struct disassemble_info *info)
int int
print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info) print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info)
{ {
int dialect = (char *) info->private_data - (char *) 0; if (info->private_data == NULL && !powerpc_init_dialect (info))
return print_insn_powerpc (memaddr, info, 1, dialect); return -1;
return print_insn_powerpc (memaddr, info, 1, POWERPC_DIALECT(info));
} }
/* Print a little endian PowerPC instruction. */ /* Print a little endian PowerPC instruction. */
@ -125,8 +141,9 @@ print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info)
int int
print_insn_little_powerpc (bfd_vma memaddr, struct disassemble_info *info) print_insn_little_powerpc (bfd_vma memaddr, struct disassemble_info *info)
{ {
int dialect = (char *) info->private_data - (char *) 0; if (info->private_data == NULL && !powerpc_init_dialect (info))
return print_insn_powerpc (memaddr, info, 0, dialect); return -1;
return print_insn_powerpc (memaddr, info, 0, POWERPC_DIALECT(info));
} }
/* Print a POWER (RS/6000) instruction. */ /* Print a POWER (RS/6000) instruction. */
@ -141,7 +158,7 @@ print_insn_rs6000 (bfd_vma memaddr, struct disassemble_info *info)
static long static long
operand_value_powerpc (const struct powerpc_operand *operand, operand_value_powerpc (const struct powerpc_operand *operand,
unsigned long insn, int dialect) unsigned long insn, ppc_cpu_t dialect)
{ {
long value; long value;
int invalid; int invalid;
@ -171,7 +188,7 @@ operand_value_powerpc (const struct powerpc_operand *operand,
static int static int
skip_optional_operands (const unsigned char *opindex, skip_optional_operands (const unsigned char *opindex,
unsigned long insn, int dialect) unsigned long insn, ppc_cpu_t dialect)
{ {
const struct powerpc_operand *operand; const struct powerpc_operand *operand;
@ -193,7 +210,7 @@ static int
print_insn_powerpc (bfd_vma memaddr, print_insn_powerpc (bfd_vma memaddr,
struct disassemble_info *info, struct disassemble_info *info,
int bigendian, int bigendian,
int dialect) ppc_cpu_t dialect)
{ {
bfd_byte buffer[4]; bfd_byte buffer[4];
int status; int status;
@ -202,9 +219,6 @@ print_insn_powerpc (bfd_vma memaddr,
const struct powerpc_opcode *opcode_end; const struct powerpc_opcode *opcode_end;
unsigned long op; unsigned long op;
if (dialect == 0)
dialect = powerpc_dialect (info);
status = (*info->read_memory_func) (memaddr, buffer, 4, info); status = (*info->read_memory_func) (memaddr, buffer, 4, info);
if (status != 0) if (status != 0)
{ {

View File

@ -38,41 +38,41 @@
/* Local insertion and extraction functions. */ /* Local insertion and extraction functions. */
static unsigned long insert_bat (unsigned long, long, int, const char **); static unsigned long insert_bat (unsigned long, long, ppc_cpu_t, const char **);
static long extract_bat (unsigned long, int, int *); static long extract_bat (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_bba (unsigned long, long, int, const char **); static unsigned long insert_bba (unsigned long, long, ppc_cpu_t, const char **);
static long extract_bba (unsigned long, int, int *); static long extract_bba (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_bdm (unsigned long, long, int, const char **); static unsigned long insert_bdm (unsigned long, long, ppc_cpu_t, const char **);
static long extract_bdm (unsigned long, int, int *); static long extract_bdm (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_bdp (unsigned long, long, int, const char **); static unsigned long insert_bdp (unsigned long, long, ppc_cpu_t, const char **);
static long extract_bdp (unsigned long, int, int *); static long extract_bdp (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_bo (unsigned long, long, int, const char **); static unsigned long insert_bo (unsigned long, long, ppc_cpu_t, const char **);
static long extract_bo (unsigned long, int, int *); static long extract_bo (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_boe (unsigned long, long, int, const char **); static unsigned long insert_boe (unsigned long, long, ppc_cpu_t, const char **);
static long extract_boe (unsigned long, int, int *); static long extract_boe (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_fxm (unsigned long, long, int, const char **); static unsigned long insert_fxm (unsigned long, long, ppc_cpu_t, const char **);
static long extract_fxm (unsigned long, int, int *); static long extract_fxm (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_mbe (unsigned long, long, int, const char **); static unsigned long insert_mbe (unsigned long, long, ppc_cpu_t, const char **);
static long extract_mbe (unsigned long, int, int *); static long extract_mbe (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_mb6 (unsigned long, long, int, const char **); static unsigned long insert_mb6 (unsigned long, long, ppc_cpu_t, const char **);
static long extract_mb6 (unsigned long, int, int *); static long extract_mb6 (unsigned long, ppc_cpu_t, int *);
static long extract_nb (unsigned long, int, int *); static long extract_nb (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_nsi (unsigned long, long, int, const char **); static unsigned long insert_nsi (unsigned long, long, ppc_cpu_t, const char **);
static long extract_nsi (unsigned long, int, int *); static long extract_nsi (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_ral (unsigned long, long, int, const char **); static unsigned long insert_ral (unsigned long, long, ppc_cpu_t, const char **);
static unsigned long insert_ram (unsigned long, long, int, const char **); static unsigned long insert_ram (unsigned long, long, ppc_cpu_t, const char **);
static unsigned long insert_raq (unsigned long, long, int, const char **); static unsigned long insert_raq (unsigned long, long, ppc_cpu_t, const char **);
static unsigned long insert_ras (unsigned long, long, int, const char **); static unsigned long insert_ras (unsigned long, long, ppc_cpu_t, const char **);
static unsigned long insert_rbs (unsigned long, long, int, const char **); static unsigned long insert_rbs (unsigned long, long, ppc_cpu_t, const char **);
static long extract_rbs (unsigned long, int, int *); static long extract_rbs (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_sh6 (unsigned long, long, int, const char **); static unsigned long insert_sh6 (unsigned long, long, ppc_cpu_t, const char **);
static long extract_sh6 (unsigned long, int, int *); static long extract_sh6 (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_spr (unsigned long, long, int, const char **); static unsigned long insert_spr (unsigned long, long, ppc_cpu_t, const char **);
static long extract_spr (unsigned long, int, int *); static long extract_spr (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_sprg (unsigned long, long, int, const char **); static unsigned long insert_sprg (unsigned long, long, ppc_cpu_t, const char **);
static long extract_sprg (unsigned long, int, int *); static long extract_sprg (unsigned long, ppc_cpu_t, int *);
static unsigned long insert_tbr (unsigned long, long, int, const char **); static unsigned long insert_tbr (unsigned long, long, ppc_cpu_t, const char **);
static long extract_tbr (unsigned long, int, int *); static long extract_tbr (unsigned long, ppc_cpu_t, int *);
/* The operands table. /* The operands table.
@ -592,7 +592,7 @@ const unsigned int num_powerpc_operands = (sizeof (powerpc_operands)
static unsigned long static unsigned long
insert_bat (unsigned long insn, insert_bat (unsigned long insn,
long value ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED) const char **errmsg ATTRIBUTE_UNUSED)
{ {
return insn | (((insn >> 21) & 0x1f) << 16); return insn | (((insn >> 21) & 0x1f) << 16);
@ -600,7 +600,7 @@ insert_bat (unsigned long insn,
static long static long
extract_bat (unsigned long insn, extract_bat (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid) int *invalid)
{ {
if (((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f)) if (((insn >> 21) & 0x1f) != ((insn >> 16) & 0x1f))
@ -617,7 +617,7 @@ extract_bat (unsigned long insn,
static unsigned long static unsigned long
insert_bba (unsigned long insn, insert_bba (unsigned long insn,
long value ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED) const char **errmsg ATTRIBUTE_UNUSED)
{ {
return insn | (((insn >> 16) & 0x1f) << 11); return insn | (((insn >> 16) & 0x1f) << 11);
@ -625,7 +625,7 @@ insert_bba (unsigned long insn,
static long static long
extract_bba (unsigned long insn, extract_bba (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid) int *invalid)
{ {
if (((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f)) if (((insn >> 16) & 0x1f) != ((insn >> 11) & 0x1f))
@ -653,7 +653,7 @@ extract_bba (unsigned long insn,
static unsigned long static unsigned long
insert_bdm (unsigned long insn, insert_bdm (unsigned long insn,
long value, long value,
int dialect, ppc_cpu_t dialect,
const char **errmsg ATTRIBUTE_UNUSED) const char **errmsg ATTRIBUTE_UNUSED)
{ {
if ((dialect & PPC_OPCODE_POWER4) == 0) if ((dialect & PPC_OPCODE_POWER4) == 0)
@ -673,7 +673,7 @@ insert_bdm (unsigned long insn,
static long static long
extract_bdm (unsigned long insn, extract_bdm (unsigned long insn,
int dialect, ppc_cpu_t dialect,
int *invalid) int *invalid)
{ {
if ((dialect & PPC_OPCODE_POWER4) == 0) if ((dialect & PPC_OPCODE_POWER4) == 0)
@ -698,7 +698,7 @@ extract_bdm (unsigned long insn,
static unsigned long static unsigned long
insert_bdp (unsigned long insn, insert_bdp (unsigned long insn,
long value, long value,
int dialect, ppc_cpu_t dialect,
const char **errmsg ATTRIBUTE_UNUSED) const char **errmsg ATTRIBUTE_UNUSED)
{ {
if ((dialect & PPC_OPCODE_POWER4) == 0) if ((dialect & PPC_OPCODE_POWER4) == 0)
@ -718,7 +718,7 @@ insert_bdp (unsigned long insn,
static long static long
extract_bdp (unsigned long insn, extract_bdp (unsigned long insn,
int dialect, ppc_cpu_t dialect,
int *invalid) int *invalid)
{ {
if ((dialect & PPC_OPCODE_POWER4) == 0) if ((dialect & PPC_OPCODE_POWER4) == 0)
@ -739,7 +739,7 @@ extract_bdp (unsigned long insn,
/* Check for legal values of a BO field. */ /* Check for legal values of a BO field. */
static int static int
valid_bo (long value, int dialect, int extract) valid_bo (long value, ppc_cpu_t dialect, int extract)
{ {
if ((dialect & PPC_OPCODE_POWER4) == 0) if ((dialect & PPC_OPCODE_POWER4) == 0)
{ {
@ -801,7 +801,7 @@ valid_bo (long value, int dialect, int extract)
static unsigned long static unsigned long
insert_bo (unsigned long insn, insert_bo (unsigned long insn,
long value, long value,
int dialect, ppc_cpu_t dialect,
const char **errmsg) const char **errmsg)
{ {
if (!valid_bo (value, dialect, 0)) if (!valid_bo (value, dialect, 0))
@ -811,7 +811,7 @@ insert_bo (unsigned long insn,
static long static long
extract_bo (unsigned long insn, extract_bo (unsigned long insn,
int dialect, ppc_cpu_t dialect,
int *invalid) int *invalid)
{ {
long value; long value;
@ -829,7 +829,7 @@ extract_bo (unsigned long insn,
static unsigned long static unsigned long
insert_boe (unsigned long insn, insert_boe (unsigned long insn,
long value, long value,
int dialect, ppc_cpu_t dialect,
const char **errmsg) const char **errmsg)
{ {
if (!valid_bo (value, dialect, 0)) if (!valid_bo (value, dialect, 0))
@ -842,7 +842,7 @@ insert_boe (unsigned long insn,
static long static long
extract_boe (unsigned long insn, extract_boe (unsigned long insn,
int dialect, ppc_cpu_t dialect,
int *invalid) int *invalid)
{ {
long value; long value;
@ -858,7 +858,7 @@ extract_boe (unsigned long insn,
static unsigned long static unsigned long
insert_fxm (unsigned long insn, insert_fxm (unsigned long insn,
long value, long value,
int dialect, ppc_cpu_t dialect,
const char **errmsg) const char **errmsg)
{ {
/* If we're handling the mfocrf and mtocrf insns ensure that exactly /* If we're handling the mfocrf and mtocrf insns ensure that exactly
@ -902,7 +902,7 @@ insert_fxm (unsigned long insn,
static long static long
extract_fxm (unsigned long insn, extract_fxm (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid) int *invalid)
{ {
long mask = (insn >> 12) & 0xff; long mask = (insn >> 12) & 0xff;
@ -933,7 +933,7 @@ extract_fxm (unsigned long insn,
static unsigned long static unsigned long
insert_mbe (unsigned long insn, insert_mbe (unsigned long insn,
long value, long value,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg) const char **errmsg)
{ {
unsigned long uval, mask; unsigned long uval, mask;
@ -985,7 +985,7 @@ insert_mbe (unsigned long insn,
static long static long
extract_mbe (unsigned long insn, extract_mbe (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid) int *invalid)
{ {
long ret; long ret;
@ -1019,7 +1019,7 @@ extract_mbe (unsigned long insn,
static unsigned long static unsigned long
insert_mb6 (unsigned long insn, insert_mb6 (unsigned long insn,
long value, long value,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED) const char **errmsg ATTRIBUTE_UNUSED)
{ {
return insn | ((value & 0x1f) << 6) | (value & 0x20); return insn | ((value & 0x1f) << 6) | (value & 0x20);
@ -1027,7 +1027,7 @@ insert_mb6 (unsigned long insn,
static long static long
extract_mb6 (unsigned long insn, extract_mb6 (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid ATTRIBUTE_UNUSED) int *invalid ATTRIBUTE_UNUSED)
{ {
return ((insn >> 6) & 0x1f) | (insn & 0x20); return ((insn >> 6) & 0x1f) | (insn & 0x20);
@ -1038,7 +1038,7 @@ extract_mb6 (unsigned long insn,
static long static long
extract_nb (unsigned long insn, extract_nb (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid ATTRIBUTE_UNUSED) int *invalid ATTRIBUTE_UNUSED)
{ {
long ret; long ret;
@ -1057,7 +1057,7 @@ extract_nb (unsigned long insn,
static unsigned long static unsigned long
insert_nsi (unsigned long insn, insert_nsi (unsigned long insn,
long value, long value,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED) const char **errmsg ATTRIBUTE_UNUSED)
{ {
return insn | (-value & 0xffff); return insn | (-value & 0xffff);
@ -1065,7 +1065,7 @@ insert_nsi (unsigned long insn,
static long static long
extract_nsi (unsigned long insn, extract_nsi (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid) int *invalid)
{ {
*invalid = 1; *invalid = 1;
@ -1079,7 +1079,7 @@ extract_nsi (unsigned long insn,
static unsigned long static unsigned long
insert_ral (unsigned long insn, insert_ral (unsigned long insn,
long value, long value,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg) const char **errmsg)
{ {
if (value == 0 if (value == 0
@ -1094,7 +1094,7 @@ insert_ral (unsigned long insn,
static unsigned long static unsigned long
insert_ram (unsigned long insn, insert_ram (unsigned long insn,
long value, long value,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg) const char **errmsg)
{ {
if ((unsigned long) value >= ((insn >> 21) & 0x1f)) if ((unsigned long) value >= ((insn >> 21) & 0x1f))
@ -1108,7 +1108,7 @@ insert_ram (unsigned long insn,
static unsigned long static unsigned long
insert_raq (unsigned long insn, insert_raq (unsigned long insn,
long value, long value,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg) const char **errmsg)
{ {
long rtvalue = (insn & RT_MASK) >> 21; long rtvalue = (insn & RT_MASK) >> 21;
@ -1125,7 +1125,7 @@ insert_raq (unsigned long insn,
static unsigned long static unsigned long
insert_ras (unsigned long insn, insert_ras (unsigned long insn,
long value, long value,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg) const char **errmsg)
{ {
if (value == 0) if (value == 0)
@ -1142,7 +1142,7 @@ insert_ras (unsigned long insn,
static unsigned long static unsigned long
insert_rbs (unsigned long insn, insert_rbs (unsigned long insn,
long value ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED) const char **errmsg ATTRIBUTE_UNUSED)
{ {
return insn | (((insn >> 21) & 0x1f) << 11); return insn | (((insn >> 21) & 0x1f) << 11);
@ -1150,7 +1150,7 @@ insert_rbs (unsigned long insn,
static long static long
extract_rbs (unsigned long insn, extract_rbs (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid) int *invalid)
{ {
if (((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f)) if (((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))
@ -1163,7 +1163,7 @@ extract_rbs (unsigned long insn,
static unsigned long static unsigned long
insert_sh6 (unsigned long insn, insert_sh6 (unsigned long insn,
long value, long value,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED) const char **errmsg ATTRIBUTE_UNUSED)
{ {
return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4); return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);
@ -1171,7 +1171,7 @@ insert_sh6 (unsigned long insn,
static long static long
extract_sh6 (unsigned long insn, extract_sh6 (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid ATTRIBUTE_UNUSED) int *invalid ATTRIBUTE_UNUSED)
{ {
return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20); return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);
@ -1183,7 +1183,7 @@ extract_sh6 (unsigned long insn,
static unsigned long static unsigned long
insert_spr (unsigned long insn, insert_spr (unsigned long insn,
long value, long value,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED) const char **errmsg ATTRIBUTE_UNUSED)
{ {
return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6); return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);
@ -1191,7 +1191,7 @@ insert_spr (unsigned long insn,
static long static long
extract_spr (unsigned long insn, extract_spr (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid ATTRIBUTE_UNUSED) int *invalid ATTRIBUTE_UNUSED)
{ {
return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0); return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);
@ -1202,7 +1202,7 @@ extract_spr (unsigned long insn,
static unsigned long static unsigned long
insert_sprg (unsigned long insn, insert_sprg (unsigned long insn,
long value, long value,
int dialect, ppc_cpu_t dialect,
const char **errmsg) const char **errmsg)
{ {
/* This check uses PPC_OPCODE_403 because PPC405 is later defined /* This check uses PPC_OPCODE_403 because PPC405 is later defined
@ -1223,7 +1223,7 @@ insert_sprg (unsigned long insn,
static long static long
extract_sprg (unsigned long insn, extract_sprg (unsigned long insn,
int dialect, ppc_cpu_t dialect,
int *invalid) int *invalid)
{ {
unsigned long val = (insn >> 16) & 0x1f; unsigned long val = (insn >> 16) & 0x1f;
@ -1251,7 +1251,7 @@ extract_sprg (unsigned long insn,
static unsigned long static unsigned long
insert_tbr (unsigned long insn, insert_tbr (unsigned long insn,
long value, long value,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED) const char **errmsg ATTRIBUTE_UNUSED)
{ {
if (value == 0) if (value == 0)
@ -1261,7 +1261,7 @@ insert_tbr (unsigned long insn,
static long static long
extract_tbr (unsigned long insn, extract_tbr (unsigned long insn,
int dialect ATTRIBUTE_UNUSED, ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid ATTRIBUTE_UNUSED) int *invalid ATTRIBUTE_UNUSED)
{ {
long ret; long ret;