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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [opcodes/] [or32-dis.c] - Diff between revs 330 and 673

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

Rev 330 Rev 673
Line 26... Line 26...
#include "opcode/or32.h"
#include "opcode/or32.h"
#include "safe-ctype.h"
#include "safe-ctype.h"
#include <string.h>
#include <string.h>
#include <stdlib.h>
#include <stdlib.h>
 
 
#define EXTEND29(x) ((x) & (unsigned long) 0x10000000 ? ((x) | (unsigned long) 0xf0000000) : ((x)))
#define EXTEND29(x) ((x) & 0x10000000UL ? ((x) | ~0x0fffffffUL) : ((x)))
 
 
/* Now find the four bytes of INSN_CH and put them in *INSN.  */
/* Now find the four bytes of INSN_CH and put them in *INSN.  */
 
 
static void
static void
find_bytes_big (unsigned char *insn_ch, unsigned long *insn)
find_bytes_big (unsigned char *insn_ch, unsigned long *insn)
Line 55... Line 55...
    ((unsigned long) insn_ch[0]);
    ((unsigned long) insn_ch[0]);
}
}
 
 
typedef void (*find_byte_func_type) (unsigned char *, unsigned long *);
typedef void (*find_byte_func_type) (unsigned char *, unsigned long *);
 
 
 
/* Extract a field according to an opcode format string (see or32-opc.c)
 
 * Sign extends those that are letter_signed() despite unsigned return type */
static unsigned long
static unsigned long
or32_extract (char param_ch, char *enc_initial, unsigned long insn)
or32_extract (char param_ch, char *enc_initial, unsigned long insn)
{
{
  char *enc;
  char *enc;
  unsigned long ret = 0;
  unsigned long ret = 0;
Line 98... Line 100...
      }
      }
    else if ((*enc == '0') || (*enc == '1'))
    else if ((*enc == '0') || (*enc == '1'))
      {
      {
        opc_pos--;
        opc_pos--;
        if (param_ch == *enc)
        if (param_ch == *enc)
          ret |= 1 << opc_pos;
          ret |= 1UL << opc_pos;
        enc++;
        enc++;
      }
      }
    else if (*enc == param_ch)
    else if (*enc == param_ch)
      {
      {
        opc_pos--;
        opc_pos--;
Line 118... Line 120...
          {
          {
#if DEBUG
#if DEBUG
            printf ("\n  ret=%x opc_pos=%x, param_pos=%x\n",
            printf ("\n  ret=%x opc_pos=%x, param_pos=%x\n",
                    ret, opc_pos, param_pos);
                    ret, opc_pos, param_pos);
#endif
#endif
            ret |= 0xffffffff << letter_range(param_ch);
            ret |= -1L << letter_range(param_ch);
#if DEBUG
#if DEBUG
            printf ("\n  after conversion to signed: ret=%x\n", ret);
            printf ("\n  after conversion to signed: ret=%x\n", ret);
#endif
#endif
          }
          }
        enc++;
        enc++;

powered by: WebSVN 2.1.0

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