Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/opcodes/h8300-dis.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* Disassemble h8300 instructions.
    2    Copyright 1993, 1994, 1996, 1998, 2000 Free Software Foundation, Inc.
     2   Copyright 1993, 1994, 1996, 1998, 2000, 2001, 2002
     3   Free Software Foundation, Inc.
    34
    45This program is free software; you can redistribute it and/or modify
     
    2324#include "dis-asm.h"
    2425#include "opintl.h"
     26#include "libiberty.h"
     27
     28struct h8_instruction
     29{
     30  int length;
     31  const struct h8_opcode *opcode;
     32};
     33
     34struct h8_instruction *h8_instructions;
     35
     36static void bfd_h8_disassemble_init PARAMS ((void));
     37static unsigned int bfd_h8_disassemble
     38  PARAMS ((bfd_vma, disassemble_info *, int));
    2539
    2640/* Run through the opcodes and sort them into order to make them easy
     
    3044{
    3145  unsigned int i;
    32   struct h8_opcode *p;
    33 
    34   for (p = h8_opcodes; p->name; p++)
     46  unsigned int nopcodes;
     47  const struct h8_opcode *p;
     48  struct h8_instruction *pi;
     49
     50  nopcodes = sizeof (h8_opcodes) / sizeof (struct h8_opcode);
     51
     52  h8_instructions = (struct h8_instruction *)
     53    xmalloc (nopcodes * sizeof (struct h8_instruction));
     54
     55  for (p = h8_opcodes, pi = h8_instructions; p->name; p++, pi++)
    3556    {
    3657      int n1 = 0;
     
    5576        abort ();
    5677
    57       p->length = i / 2;
     78      pi->length = i / 2;
     79      pi->opcode = p;
    5880    }
     81
     82  /* Add entry for the NULL vector terminator.  */
     83  pi->length = 0;
     84  pi->opcode = p;
    5985}
    6086
    61 unsigned int
     87static unsigned int
    6288bfd_h8_disassemble (addr, info, mode)
    6389     bfd_vma addr;
     
    6692{
    6793  /* Find the first entry in the table for this opcode.  */
    68   static CONST char *regnames[] =
     94  static const char *regnames[] =
    6995    {
    7096      "r0h", "r1h", "r2h", "r3h", "r4h", "r5h", "r6h", "r7h",
    7197      "r0l", "r1l", "r2l", "r3l", "r4l", "r5l", "r6l", "r7l"
    7298    };
    73   static CONST char *wregnames[] =
     99  static const char *wregnames[] =
    74100    {
    75101      "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
    76102      "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7"
    77103    };
    78   static CONST char *lregnames[] =
     104  static const char *lregnames[] =
    79105    {
    80106      "er0", "er1", "er2", "er3", "er4", "er5", "er6", "er7",
     
    87113  int bit = 0;
    88114  int plen = 0;
    89   static boolean init = 0;
    90   struct h8_opcode *q;
    91   char CONST **pregnames = mode != 0 ? lregnames : wregnames;
     115  static bfd_boolean init = 0;
     116  const struct h8_instruction *qi;
     117  char const **pregnames = mode != 0 ? lregnames : wregnames;
    92118  int status;
    93119  int l;
     
    113139
    114140  /* Find the exact opcode/arg combo.  */
    115   for (q = h8_opcodes; q->name; q++)
    116     {
     141  for (qi = h8_instructions; qi->opcode->name; qi++)
     142    {
     143      const struct h8_opcode *q = qi->opcode;
    117144      op_type *nib = q->data.nib;
    118145      unsigned int len = 0;
     
    243270                  int i;
    244271
    245                   for (i = 0; i < q->length; i++)
     272                  for (i = 0; i < qi->length; i++)
    246273                    fprintf (stream, "%02x ", data[i]);
    247274
     
    260287
    261288                      fprintf (stream, "@sp+,er%d-er%d", high - count, high);
    262                       return q->length;
     289                      return qi->length;
    263290                    }
    264291
     
    271298
    272299                      fprintf (stream, "er%d-er%d,@-sp", low, low + count);
    273                       return q->length;
     300                      return qi->length;
    274301                    }
    275302
     
    385412                  }
    386413
    387                   return q->length;
     414                  return qi->length;
    388415                }
    389416              else
Note: See TracChangeset for help on using the changeset viewer.