2001-06-24 Ben Elliston <bje@redhat.com>

* m88k-dis.c: Format to conform to GNU coding standards.
This commit is contained in:
Ben Elliston 2001-06-24 01:04:16 +00:00
parent 62b7d3f1f1
commit 62d964d839
2 changed files with 57 additions and 90 deletions

View File

@ -1,3 +1,7 @@
2001-06-24 Ben Elliston <bje@redhat.com>
* m88k-dis.c: Format to conform to GNU coding standards.
2001-06-23 Andreas Jaeger <aj@suse.de> 2001-06-23 Andreas Jaeger <aj@suse.de>
* disassemble.c (disassembler_usage): Add unused attribute. * disassemble.c (disassembler_usage): Add unused attribute.

View File

@ -1,5 +1,5 @@
/* Print instructions for the Motorola 88000, for GDB and GNU Binutils. /* Print instructions for the Motorola 88000, for GDB and GNU Binutils.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1998, 2000 Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1998, 2000, 2001
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Data General Corporation, November 1989. Contributed by Data General Corporation, November 1989.
Partially derived from an earlier printcmd.c. Partially derived from an earlier printcmd.c.
@ -31,28 +31,16 @@ static int
m88kdis PARAMS ((bfd_vma, unsigned long, struct disassemble_info *)); m88kdis PARAMS ((bfd_vma, unsigned long, struct disassemble_info *));
static void static void
printop PARAMS ((struct disassemble_info *, OPSPEC *, printop PARAMS ((struct disassemble_info *, OPSPEC *, unsigned long, bfd_vma, int));
unsigned long, bfd_vma, int));
static void static void
init_disasm PARAMS ((void)); init_disasm PARAMS ((void));
static void static void
install PARAMS ((INSTAB *instptr)); install PARAMS ((INSTAB *instptr));
/* /* Disassemble an M88000 instruction at `memaddr'. */
* Disassemble an M88000 Instruction
*
*
* This module decodes the instruction at memaddr.
*
* Revision History
*
* Revision 1.0 11/08/85 Creation date by Motorola
* 05/11/89 R. Trawick adapted to GDB interface.
* 07/12/93 Ian Lance Taylor updated to
* binutils interface.
*/
int int
print_insn_m88k (memaddr, info) print_insn_m88k (memaddr, info)
@ -62,7 +50,7 @@ print_insn_m88k (memaddr, info)
bfd_byte buffer[4]; bfd_byte buffer[4];
int status; int status;
/* Instruction addresses may have low two bits set. Clear them. */ /* Instruction addresses may have low two bits set. Clear them. */
memaddr &=~ (bfd_vma) 3; memaddr &=~ (bfd_vma) 3;
status = (*info->read_memory_func) (memaddr, buffer, 4, info); status = (*info->read_memory_func) (memaddr, buffer, 4, info);
@ -76,10 +64,11 @@ print_insn_m88k (memaddr, info)
} }
/* /*
* disassemble the instruction in 'instruction'. * Disassemble the instruction in `instruction'.
* 'pc' should be the address of this instruction, it will * `pc' should be the address of this instruction, it will be used to
* be used to print the target address if this is a relative jump or call * print the target address if this is a relative jump or call the
* the disassembled instruction is written to 'info'. * disassembled instruction is written to `info'.
*
* The function returns the length of this instruction in bytes. * The function returns the length of this instruction in bytes.
*/ */
@ -98,7 +87,7 @@ m88kdis (pc, instruction, info)
if (! ihashtab_initialized) if (! ihashtab_initialized)
init_disasm (); init_disasm ();
/* create the appropriate mask to isolate the opcode */ /* Create the appropriate mask to isolate the opcode. */
opmask = DEFMASK; opmask = DEFMASK;
class = instruction & DEFMASK; class = instruction & DEFMASK;
if ((class >= SFU0) && (class <= SFU7)) if ((class >= SFU0) && (class <= SFU7))
@ -113,10 +102,10 @@ m88kdis (pc, instruction, info)
else if (class == RRI10) else if (class == RRI10)
opmask = RRI10MASK; opmask = RRI10MASK;
/* isolate the opcode */ /* Isolate the opcode. */
opcode = instruction & opmask; opcode = instruction & opmask;
/* search the hash table with the isolated opcode */ /* Search the hash table with the isolated opcode. */
for (entry_ptr = hashtable[opcode % HASHVAL]; for (entry_ptr = hashtable[opcode % HASHVAL];
(entry_ptr != NULL) && (entry_ptr->opcode != opcode); (entry_ptr != NULL) && (entry_ptr->opcode != opcode);
entry_ptr = entry_ptr->next) entry_ptr = entry_ptr->next)
@ -136,35 +125,27 @@ m88kdis (pc, instruction, info)
} }
/* /*
* Decode an Operand of an Instruction * Decode an Operand of an instruction.
* *
* Functional Description * This function formats and writes an operand of an instruction to
* * info based on the operand specification. When the `first' flag is
* This module formats and writes an operand of an instruction to info * set this is the first operand of an instruction. Undefined operand
* based on the operand specification. When the first flag is set this * types cause a <dis error> message.
* is the first operand of an instruction. Undefined operand types *
* cause a <dis error> message. * Parameters:
* * disassemble_info where the operand may be printed
* Parameters * OPSPEC *opptr pointer to an operand specification
* disassemble_info where the operand may be printed * UINT inst instruction from which operand is extracted
* OPSPEC *opptr Pointer to an operand specification * UINT pc pc of instruction; used for pc-relative disp.
* UINT inst Instruction from which operand is extracted * int first flag which if nonzero indicates the first
* UINT pc PC of instruction; used for pc-relative disp. * operand of an instruction
* int first Flag which if nonzero indicates the first *
* operand of an instruction * The operand specified is extracted from the instruction and is
* * written to buf in the format specified. The operand is preceded by
* Output * a comma if it is not the first operand of an instruction and it is
* * not a register indirect form. Registers are preceded by 'r' and
* The operand specified is extracted from the instruction and is * hex values by '0x'.
* written to buf in the format specified. The operand is preceded */
* by a comma if it is not the first operand of an instruction and it
* is not a register indirect form. Registers are preceded by 'r' and
* hex values by '0x'.
*
* Revision History
*
* Revision 1.0 11/08/85 Creation date
*/
static void static void
printop (info, opptr, inst, pc, first) printop (info, opptr, inst, pc, first)
@ -265,8 +246,8 @@ printop (info, opptr, inst, pc, first)
case BF: case BF:
(*info->fprintf_func) (info->stream, "%d<%d>", (*info->fprintf_func) (info->stream, "%d<%d>",
UEXT (inst, (opptr->offset) + 5, 5), UEXT (inst, (opptr->offset) + 5, 5),
UEXT (inst, opptr->offset, 5)); UEXT (inst, opptr->offset, 5));
break; break;
default: default:
@ -276,48 +257,30 @@ printop (info, opptr, inst, pc, first)
} }
/* /*
* Initialize the Disassembler Instruction Table * Initialize the disassembler instruction table.
* *
* Initialize the hash table and instruction table for the disassembler. * Initialize the hash table and instruction table for the
* This should be called once before the first call to disasm(). * disassembler. This should be called once before the first call to
* * disasm().
* Parameters */
*
* Output
*
* If the debug option is selected, certain statistics about the hashing
* distribution are written to stdout.
*
* Revision History
*
* Revision 1.0 11/08/85 Creation date
*/
static void static void
init_disasm () init_disasm ()
{ {
int i, size; int i, size;
for (i = 0; i < HASHVAL; i++) for (i = 0; i < HASHVAL; i++)
hashtable[i] = NULL; hashtable[i] = NULL;
size = sizeof (instructions) / sizeof (INSTAB); size = sizeof (instructions) / sizeof (INSTAB);
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
install (&instructions[i]); install (&instructions[i]);
} }
/* /*
* Insert an instruction into the disassembler table by hashing the * Insert an instruction into the disassembler table by hashing the
* opcode and inserting it into the linked list for that hash value. * opcode and inserting it into the linked list for that hash value.
* */
* Parameters
*
* INSTAB *instptr Pointer to the entry in the instruction table
* to be installed
*
* Revision 1.0 11/08/85 Creation date
* 05/11/89 R. TRAWICK ADAPTED FROM MOTOROLA
*/
static void static void
install (instptr) install (instptr)