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/pj-dis.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* pj-dis.c -- Disassemble picoJava instructions.
    2    Copyright 1999, 2000 Free Software Foundation, Inc.
     2   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
    33   Contributed by Steve Chamberlain, of Transmeta (sac@pobox.com).
    44
     
    1717Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    1818
    19 
    2019#include <stdio.h>
    2120#include "sysdep.h"
     
    2524extern const pj_opc_info_t pj_opc_info[512];
    2625
    27 static int get_int (memaddr, iptr, info)
     26static int get_int PARAMS ((bfd_vma, int *, struct disassemble_info *));
     27
     28
     29static int
     30get_int (memaddr, iptr, info)
    2831     bfd_vma memaddr;
    2932     int *iptr;
     
    3437  int status = info->read_memory_func (memaddr, ival, 4, info);
    3538
    36   *iptr = (ival[0] << 24) 
    37     | (ival[1] << 16) 
    38     | (ival[2] << 8) 
    39     | (ival[3] << 0) ;
     39  *iptr = (ival[0] << 24)
     40    | (ival[1] << 16)
     41    | (ival[2] << 8)
     42    | (ival[3] << 0);
    4043
    4144  return status;
     
    6063      if ((status = info->read_memory_func (addr + 1, &byte_2, 1, info)))
    6164        goto fail;
    62       fprintf_fn (stream, "%s\t", pj_opc_info[opcode + byte_2].name);
     65      fprintf_fn (stream, "%s\t", pj_opc_info[opcode + byte_2].u.name);
    6366      return 2;
    6467    }
     
    7073      int a;
    7174      addr++;
    72       fprintf_fn (stream, "%s", op->name);
     75      fprintf_fn (stream, "%s", op->u.name);
    7376
    7477      /* The tableswitch instruction is followed by the default
    75          address, low value, high value and the destinations. */
     78         address, low value, high value and the destinations.  */
    7679
    77       if (strcmp (op->name, "tableswitch") == 0)
     80      if (strcmp (op->u.name, "tableswitch") == 0)
    7881        {
    7982          int lowval;
     
    8588            goto fail;
    8689
    87           fprintf_fn (stream," default: ");
     90          fprintf_fn (stream, " default: ");
    8891          (*info->print_address_func) (val + insn_start, info);
    8992          addr += 4;
     
    97100          addr += 4;
    98101
    99           while (lowval <= highval) {
    100             if ((status = get_int (addr, &val, info)))
    101               goto fail;
    102             fprintf_fn (stream," %d:[", lowval);
    103             (*info->print_address_func) (val + insn_start, info);
    104             fprintf_fn (stream," ]");
    105             addr += 4;
    106             lowval++;
    107           }
     102          while (lowval <= highval)
     103            {
     104              if ((status = get_int (addr, &val, info)))
     105                goto fail;
     106              fprintf_fn (stream, " %d:[", lowval);
     107              (*info->print_address_func) (val + insn_start, info);
     108              fprintf_fn (stream, " ]");
     109              addr += 4;
     110              lowval++;
     111            }
    108112          return addr - insn_start;
    109113        }
     
    111115      /* The lookupswitch instruction is followed by the default
    112116         address, element count and pairs of values and
    113          addresses. */
    114            
    115       if (strcmp (op->name, "lookupswitch") == 0)
     117         addresses.  */
     118
     119      if (strcmp (op->u.name, "lookupswitch") == 0)
    116120        {
    117121          int count;
     
    123127          addr += 4;
    124128
    125           fprintf_fn (stream," default: ");
     129          fprintf_fn (stream, " default: ");
    126130          (*info->print_address_func) (val + insn_start, info);
    127131
     
    130134          addr += 4;
    131135
    132           while (count--) {
    133             if ((status = get_int (addr, &val, info)))
    134               goto fail;
    135             addr += 4;
    136             fprintf_fn (stream," %d:[", val);
     136          while (count--)
     137            {
     138              if ((status = get_int (addr, &val, info)))
     139                goto fail;
     140              addr += 4;
     141              fprintf_fn (stream, " %d:[", val);
    137142
    138             if ((status = get_int (addr, &val, info)))
    139               goto fail;
    140             addr += 4;
     143              if ((status = get_int (addr, &val, info)))
     144                goto fail;
     145              addr += 4;
    141146
    142             (*info->print_address_func) (val + insn_start, info);
    143             fprintf_fn (stream," ]");
    144           }
     147              (*info->print_address_func) (val + insn_start, info);
     148              fprintf_fn (stream, " ]");
     149            }
    145150          return addr - insn_start;
    146151        }
Note: See TracChangeset for help on using the changeset viewer.