/* Table of opcodes for the OpenRISC 1000 ISA.
- Copyright 2002, 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2002, 2004, 2005, 2007, 2008, 2009, 2012
+ Free Software Foundation, Inc.
Contributed by Damjan Lampret (lampret@opencores.org).
This file is part of the GNU opcodes library.
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
-/* We treat all letters the same in encode/decode routines so
- we need to assign some characteristics to them like signess etc. */
+#include "sysdep.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "safe-ctype.h"
#include "ansidecl.h"
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
#include "opcode/or32.h"
+/* We treat all letters the same in encode/decode routines so
+ we need to assign some characteristics to them like signess etc. */
+
const struct or32_letter or32_letters[] =
{
{ 'A', NUM_UNSIGNED },
/* Calculates instruction length in bytes. Always 4 for OR32. */
int
-insn_len (int insn_index ATTRIBUTE_UNUSED)
+insn_len (int i_index ATTRIBUTE_UNUSED)
{
return 4;
}
}
const char *
-insn_name (int index)
+insn_name (int op_index)
{
- if (index >= 0 && index < (int) or32_num_opcodes)
- return or32_opcodes[index].name;
+ if (op_index >= 0 && op_index < (int) or32_num_opcodes)
+ return or32_opcodes[op_index].name;
else
return "???";
}
{
unsigned long tmp = strtol (enc, NULL, 16);
#if DEBUG
- printf (" enc=%s, tmp=%x ", enc, tmp);
+ printf (" enc=%s, tmp=%lx ", enc, tmp);
#endif
if (param_ch == '0')
tmp = 15 - tmp;
opc_pos--;
param_pos--;
#if DEBUG
- printf ("\n ret=%x opc_pos=%x, param_pos=%x\n", ret, opc_pos, param_pos);
+ printf ("\n ret=%lx opc_pos=%x, param_pos=%x\n", ret, opc_pos, param_pos);
#endif
if (ISLOWER (param_ch))
ret -= ((insn >> opc_pos) & 0x1) << param_pos;
enc++;
#if DEBUG
- printf ("ret=%x\n", ret);
+ printf ("ret=%lx\n", ret);
#endif
return ret;
}
int
disassemble_insn (unsigned long insn)
{
- int index;
- index = insn_decode (insn);
+ int op_index;
+ op_index = insn_decode (insn);
- if (index >= 0)
+ if (op_index >= 0)
{
- struct or32_opcode const *opcode = &or32_opcodes[index];
+ struct or32_opcode const *opcode = &or32_opcodes[op_index];
char *s;
sprintf (disassembled, "%s ", opcode->name);