aboutsummaryrefslogtreecommitdiff
path: root/opcodes/ppc-dis.c
diff options
context:
space:
mode:
Diffstat (limited to 'opcodes/ppc-dis.c')
-rw-r--r--opcodes/ppc-dis.c90
1 files changed, 43 insertions, 47 deletions
diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c
index 0e2e185..d5293d3 100644
--- a/opcodes/ppc-dis.c
+++ b/opcodes/ppc-dis.c
@@ -381,39 +381,36 @@ disassemble_init_powerpc (struct disassemble_info *info)
if (powerpc_opcd_indices[PPC_OPCD_SEGS] == 0)
{
-
i = powerpc_num_opcodes;
while (--i >= 0)
- {
- unsigned op = PPC_OP (powerpc_opcodes[i].opcode);
-
- powerpc_opcd_indices[op] = i;
- }
+ {
+ unsigned op = PPC_OP (powerpc_opcodes[i].opcode);
+ powerpc_opcd_indices[op] = i;
+ }
last = powerpc_num_opcodes;
for (i = PPC_OPCD_SEGS; i > 0; --i)
- {
- if (powerpc_opcd_indices[i] == 0)
+ {
+ if (powerpc_opcd_indices[i] == 0)
powerpc_opcd_indices[i] = last;
- last = powerpc_opcd_indices[i];
- }
+ last = powerpc_opcd_indices[i];
+ }
i = vle_num_opcodes;
while (--i >= 0)
- {
- unsigned op = VLE_OP (vle_opcodes[i].opcode, vle_opcodes[i].mask);
- unsigned seg = VLE_OP_TO_SEG (op);
-
- vle_opcd_indices[seg] = i;
- }
+ {
+ unsigned op = VLE_OP (vle_opcodes[i].opcode, vle_opcodes[i].mask);
+ unsigned seg = VLE_OP_TO_SEG (op);
+ vle_opcd_indices[seg] = i;
+ }
last = vle_num_opcodes;
for (i = VLE_OPCD_SEGS; i > 0; --i)
- {
- if (vle_opcd_indices[i] == 0)
+ {
+ if (vle_opcd_indices[i] == 0)
vle_opcd_indices[i] = last;
- last = vle_opcd_indices[i];
- }
+ last = vle_opcd_indices[i];
+ }
}
/* SPE2 opcodes */
@@ -422,7 +419,6 @@ disassemble_init_powerpc (struct disassemble_info *info)
{
unsigned xop = SPE2_XOP (spe2_opcodes[i].opcode);
unsigned seg = SPE2_XOP_TO_SEG (xop);
-
spe2_opcd_indices[seg] = i;
}
@@ -464,11 +460,11 @@ print_insn_rs6000 (bfd_vma memaddr, struct disassemble_info *info)
/* Extract the operand value from the PowerPC or POWER instruction. */
-static long
+static int64_t
operand_value_powerpc (const struct powerpc_operand *operand,
- unsigned long insn, ppc_cpu_t dialect)
+ uint64_t insn, ppc_cpu_t dialect)
{
- long value;
+ int64_t value;
int invalid;
/* Extract the value from the instruction. */
if (operand->extract)
@@ -483,7 +479,7 @@ operand_value_powerpc (const struct powerpc_operand *operand,
{
/* BITM is always some number of zeros followed by some
number of ones, followed by some number of zeros. */
- unsigned long top = operand->bitm;
+ uint64_t top = operand->bitm;
/* top & -top gives the rightmost 1 bit, so this
fills in any trailing zeros. */
top |= (top & -top) - 1;
@@ -499,7 +495,7 @@ operand_value_powerpc (const struct powerpc_operand *operand,
static int
skip_optional_operands (const unsigned char *opindex,
- unsigned long insn, ppc_cpu_t dialect)
+ uint64_t insn, ppc_cpu_t dialect)
{
const struct powerpc_operand *operand;
@@ -519,7 +515,7 @@ skip_optional_operands (const unsigned char *opindex,
/* Find a match for INSN in the opcode table, given machine DIALECT. */
static const struct powerpc_opcode *
-lookup_powerpc (unsigned long insn, ppc_cpu_t dialect)
+lookup_powerpc (uint64_t insn, ppc_cpu_t dialect)
{
const struct powerpc_opcode *opcode, *opcode_end, *last;
unsigned long op;
@@ -570,7 +566,7 @@ lookup_powerpc (unsigned long insn, ppc_cpu_t dialect)
/* Find a match for INSN in the VLE opcode table. */
static const struct powerpc_opcode *
-lookup_vle (unsigned long insn)
+lookup_vle (uint64_t insn)
{
const struct powerpc_opcode *opcode;
const struct powerpc_opcode *opcode_end;
@@ -590,10 +586,10 @@ lookup_vle (unsigned long insn)
opcode < opcode_end;
++opcode)
{
- unsigned long table_opcd = opcode->opcode;
- unsigned long table_mask = opcode->mask;
+ uint64_t table_opcd = opcode->opcode;
+ uint64_t table_mask = opcode->mask;
bfd_boolean table_op_is_short = PPC_OP_SE_VLE(table_mask);
- unsigned long insn2;
+ uint64_t insn2;
const unsigned char *opindex;
const struct powerpc_operand *operand;
int invalid;
@@ -624,7 +620,7 @@ lookup_vle (unsigned long insn)
/* Find a match for INSN in the SPE2 opcode table. */
static const struct powerpc_opcode *
-lookup_spe2 (unsigned long insn)
+lookup_spe2 (uint64_t insn)
{
const struct powerpc_opcode *opcode, *opcode_end;
unsigned op, xop, seg;
@@ -645,9 +641,9 @@ lookup_spe2 (unsigned long insn)
opcode < opcode_end;
++opcode)
{
- unsigned long table_opcd = opcode->opcode;
- unsigned long table_mask = opcode->mask;
- unsigned long insn2;
+ uint64_t table_opcd = opcode->opcode;
+ uint64_t table_mask = opcode->mask;
+ uint64_t insn2;
const unsigned char *opindex;
const struct powerpc_operand *operand;
int invalid;
@@ -683,7 +679,7 @@ print_insn_powerpc (bfd_vma memaddr,
{
bfd_byte buffer[4];
int status;
- unsigned long insn;
+ uint64_t insn;
const struct powerpc_opcode *opcode;
bfd_boolean insn_is_short;
@@ -753,7 +749,7 @@ print_insn_powerpc (bfd_vma memaddr,
skip_optional = -1;
for (opindex = opcode->operands; *opindex != 0; opindex++)
{
- long value;
+ int64_t value;
operand = powerpc_operands + *opindex;
@@ -785,27 +781,27 @@ print_insn_powerpc (bfd_vma memaddr,
/* Print the operand as directed by the flags. */
if ((operand->flags & PPC_OPERAND_GPR) != 0
|| ((operand->flags & PPC_OPERAND_GPR_0) != 0 && value != 0))
- (*info->fprintf_func) (info->stream, "r%ld", value);
+ (*info->fprintf_func) (info->stream, "r%" PPC_INT_FMT "d", value);
else if ((operand->flags & PPC_OPERAND_FPR) != 0)
- (*info->fprintf_func) (info->stream, "f%ld", value);
+ (*info->fprintf_func) (info->stream, "f%" PPC_INT_FMT "d", value);
else if ((operand->flags & PPC_OPERAND_VR) != 0)
- (*info->fprintf_func) (info->stream, "v%ld", value);
+ (*info->fprintf_func) (info->stream, "v%" PPC_INT_FMT "d", value);
else if ((operand->flags & PPC_OPERAND_VSR) != 0)
- (*info->fprintf_func) (info->stream, "vs%ld", value);
+ (*info->fprintf_func) (info->stream, "vs%" PPC_INT_FMT "d", value);
else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0)
(*info->print_address_func) (memaddr + value, info);
else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0)
(*info->print_address_func) ((bfd_vma) value & 0xffffffff, info);
else if ((operand->flags & PPC_OPERAND_FSL) != 0)
- (*info->fprintf_func) (info->stream, "fsl%ld", value);
+ (*info->fprintf_func) (info->stream, "fsl%" PPC_INT_FMT "d", value);
else if ((operand->flags & PPC_OPERAND_FCR) != 0)
- (*info->fprintf_func) (info->stream, "fcr%ld", value);
+ (*info->fprintf_func) (info->stream, "fcr%" PPC_INT_FMT "d", value);
else if ((operand->flags & PPC_OPERAND_UDI) != 0)
- (*info->fprintf_func) (info->stream, "%ld", value);
+ (*info->fprintf_func) (info->stream, "%" PPC_INT_FMT "d", value);
else if ((operand->flags & PPC_OPERAND_CR_REG) != 0
&& (((dialect & PPC_OPCODE_PPC) != 0)
|| ((dialect & PPC_OPCODE_VLE) != 0)))
- (*info->fprintf_func) (info->stream, "cr%ld", value);
+ (*info->fprintf_func) (info->stream, "cr%" PPC_INT_FMT "d", value);
else if (((operand->flags & PPC_OPERAND_CR_BIT) != 0)
&& (((dialect & PPC_OPCODE_PPC) != 0)
|| ((dialect & PPC_OPCODE_VLE) != 0)))
@@ -821,7 +817,7 @@ print_insn_powerpc (bfd_vma memaddr,
(*info->fprintf_func) (info->stream, "%s", cbnames[cc]);
}
else
- (*info->fprintf_func) (info->stream, "%d", (int) value);
+ (*info->fprintf_func) (info->stream, "%" PPC_INT_FMT "d", value);
if (need_paren)
{
@@ -851,7 +847,7 @@ print_insn_powerpc (bfd_vma memaddr,
}
/* We could not find a match. */
- (*info->fprintf_func) (info->stream, ".long 0x%lx", insn);
+ (*info->fprintf_func) (info->stream, ".long 0x%" PPC_INT_FMT "x", insn);
return 4;
}