OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [opcodes/] [s390-dis.c] - Diff between revs 157 and 225

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 157 Rev 225
Line 1... Line 1...
/* s390-dis.c -- Disassemble S390 instructions
/* s390-dis.c -- Disassemble S390 instructions
   Copyright 2000, 2001, 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
   Copyright 2000, 2001, 2002, 2003, 2005, 2007, 2008
 
   Free Software Foundation, Inc.
   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
   Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
 
 
   This file is part of the GNU opcodes library.
   This file is part of the GNU opcodes library.
 
 
   This library is free software; you can redistribute it and/or modify
   This library is free software; you can redistribute it and/or modify
Line 21... Line 22...
 
 
#include <stdio.h>
#include <stdio.h>
#include "ansidecl.h"
#include "ansidecl.h"
#include "sysdep.h"
#include "sysdep.h"
#include "dis-asm.h"
#include "dis-asm.h"
 
#include "opintl.h"
#include "opcode/s390.h"
#include "opcode/s390.h"
 
 
static int init_flag = 0;
static int init_flag = 0;
static int opc_index[256];
static int opc_index[256];
static int current_arch_mask = 0;
static int current_arch_mask = 0;
Line 34... Line 36...
static void
static void
init_disasm (struct disassemble_info *info)
init_disasm (struct disassemble_info *info)
{
{
  const struct s390_opcode *opcode;
  const struct s390_opcode *opcode;
  const struct s390_opcode *opcode_end;
  const struct s390_opcode *opcode_end;
 
  const char *p;
 
 
  memset (opc_index, 0, sizeof (opc_index));
  memset (opc_index, 0, sizeof (opc_index));
  opcode_end = s390_opcodes + s390_num_opcodes;
  opcode_end = s390_opcodes + s390_num_opcodes;
  for (opcode = s390_opcodes; opcode < opcode_end; opcode++)
  for (opcode = s390_opcodes; opcode < opcode_end; opcode++)
    {
    {
      opc_index[(int) opcode->opcode[0]] = opcode - s390_opcodes;
      opc_index[(int) opcode->opcode[0]] = opcode - s390_opcodes;
      while ((opcode < opcode_end) &&
      while ((opcode < opcode_end) &&
             (opcode[1].opcode[0] == opcode->opcode[0]))
             (opcode[1].opcode[0] == opcode->opcode[0]))
        opcode++;
        opcode++;
    }
    }
 
 
 
  for (p = info->disassembler_options; p != NULL; )
 
    {
 
      if (CONST_STRNEQ (p, "esa"))
 
        current_arch_mask = 1 << S390_OPCODE_ESA;
 
      else if (CONST_STRNEQ (p, "zarch"))
 
        current_arch_mask = 1 << S390_OPCODE_ZARCH;
 
      else
 
        fprintf (stderr, "Unknown S/390 disassembler option: %s\n", p);
 
 
 
      p = strchr (p, ',');
 
      if (p != NULL)
 
        p++;
 
    }
 
 
 
  if (!current_arch_mask)
  switch (info->mach)
  switch (info->mach)
    {
    {
    case bfd_mach_s390_31:
    case bfd_mach_s390_31:
      current_arch_mask = 1 << S390_OPCODE_ESA;
      current_arch_mask = 1 << S390_OPCODE_ESA;
      break;
      break;
Line 55... Line 74...
      current_arch_mask = 1 << S390_OPCODE_ZARCH;
      current_arch_mask = 1 << S390_OPCODE_ZARCH;
      break;
      break;
    default:
    default:
      abort ();
      abort ();
    }
    }
 
 
  init_flag = 1;
  init_flag = 1;
}
}
 
 
/* Extracts an operand value from an instruction.  */
/* Extracts an operand value from an instruction.  */
 
 
Line 249... Line 269...
      (*info->fprintf_func) (info->stream, ".byte\t0x%02x", value);
      (*info->fprintf_func) (info->stream, ".byte\t0x%02x", value);
      return 1;
      return 1;
    }
    }
}
}
 
 
 No newline at end of file
 No newline at end of file
 
void
 
print_s390_disassembler_options (FILE *stream)
 
{
 
  fprintf (stream, _("\n\
 
The following S/390 specific disassembler options are supported for use\n\
 
with the -M switch (multiple options should be separated by commas):\n"));
 
 
 
  fprintf (stream, _("  esa         Disassemble in ESA architecture mode\n"));
 
  fprintf (stream, _("  zarch       Disassemble in z/Architecture mode\n"));
 
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.