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

Subversion Repositories openrisc_me

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

Show entire file | Details | Blame | View Log

Rev 157 Rev 225
Line 1... Line 1...
/* Disassembler code for CR16.
/* Disassembler code for CR16.
   Copyright 2007 Free Software Foundation, Inc.
   Copyright 2007, 2008, 2009  Free Software Foundation, Inc.
   Contributed by M R Swami Reddy (MR.Swami.Reddy@nsc.com).
   Contributed by M R Swami Reddy (MR.Swami.Reddy@nsc.com).
 
 
   This file is part of GAS, GDB and the GNU binutils.
   This file is part of GAS, GDB and the GNU binutils.
 
 
   This program is free software; you can redistribute it and/or modify it
   This program is free software; you can redistribute it and/or modify it
Line 305... Line 305...
 
 
static unsigned long
static unsigned long
build_mask (void)
build_mask (void)
{
{
  unsigned long mask = SBM (instruction->match_bits);
  unsigned long mask = SBM (instruction->match_bits);
 
 
 
  /* Adjust mask for bcond with 32-bit size instruction.  */
 
  if ((IS_INSN_MNEMONIC("b") && instruction->size == 2))
 
    mask = 0xff0f0000;
 
 
  return mask;
  return mask;
}
}
 
 
/* Search for a matching opcode. Return 1 for success, 0 for failure.  */
/* Search for a matching opcode. Return 1 for success, 0 for failure.  */
 
 
static int
static int
match_opcode (void)
match_opcode (void)
{
{
  unsigned long mask;
  unsigned long mask;
  /* The instruction 'constant' opcode doewsn't exceed 32 bits.  */
  /* The instruction 'constant' opcode doewsn't exceed 32 bits.  */
  unsigned long doubleWord = words[1] + (words[0] << 16);
  unsigned long doubleWord = (words[1] + (words[0] << 16)) & 0xffffffff;
 
 
  /* Start searching from end of instruction table.  */
  /* Start searching from end of instruction table.  */
  instruction = &cr16_instruction[NUMOPCODES - 2];
  instruction = &cr16_instruction[NUMOPCODES - 2];
 
 
  /* Loop over instruction table until a full match is found.  */
  /* Loop over instruction table until a full match is found.  */
  while (instruction >= cr16_instruction)
  while (instruction >= cr16_instruction)
    {
    {
      mask = build_mask ();
      mask = build_mask ();
 
      /* Adjust mask for bcond with 32-bit size instruction */
 
      if ((IS_INSN_MNEMONIC("b") && instruction->size == 2))
 
        mask = 0xff0f0000;
 
 
      if ((doubleWord & mask) == BIN (instruction->match,
      if ((doubleWord & mask) == BIN (instruction->match,
                                      instruction->match_bits))
                                      instruction->match_bits))
        return 1;
        return 1;
      else
      else
        instruction--;
        instruction--;
Line 667... Line 676...
        a->constant = 2 * a->constant + 2;
        a->constant = 2 * a->constant + 2;
 
 
      if ((!IS_INSN_TYPE (CSTBIT_INS)) && (!IS_INSN_TYPE (LD_STOR_INS)))
      if ((!IS_INSN_TYPE (CSTBIT_INS)) && (!IS_INSN_TYPE (LD_STOR_INS)))
        (sign_flag) ? func (stream, "%s", "*-"): func (stream, "%s","*+");
        (sign_flag) ? func (stream, "%s", "*-"): func (stream, "%s","*+");
 
 
 
      /* PR 10173: Avoid printing the 0x prefix twice.  */
 
      if (info->num_symbols > 0)
      func (stream, "%s", "0x");
      func (stream, "%s", "0x");
      number = ((relative ? memaddr : 0) +
      number = ((relative ? memaddr : 0) +
                (sign_flag ? ((- a->constant) & 0xffffffe) : a->constant));
                (sign_flag ? ((- a->constant) & 0xffffffe) : a->constant));
 
 
      (*info->print_address_func) ((number & ((1 << 24) - 1)), info);
      (*info->print_address_func) ((number & ((1 << 24) - 1)), info);

powered by: WebSVN 2.1.0

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