projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Set the architecture (GDB multiarch needs it).
[deliverable/binutils-gdb.git]
/
opcodes
/
z8k-dis.c
diff --git
a/opcodes/z8k-dis.c
b/opcodes/z8k-dis.c
index d296f64c3dc6145b48ebb45ef8ecdc74bbe07aeb..9621b3ee095f086ff3e327f7d7c0e0eff28894a7 100644
(file)
--- a/
opcodes/z8k-dis.c
+++ b/
opcodes/z8k-dis.c
@@
-1,4
+1,7
@@
-/*
+/* Disassemble z8000 code.
+ Copyright 1992, 1993, 1995, 1998, 2000
+ Free Software Foundation, Inc.
+
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
@@
-13,18
+16,15
@@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
-Foundation, Inc.,
675 Mass Ave, Cambridge, MA 02139
, USA. */
+Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307
, USA. */
-#include <ansidecl.h>
#include "sysdep.h"
#include "dis-asm.h"
#define DEFINE_TABLE
#include "z8k-opc.h"
#include "sysdep.h"
#include "dis-asm.h"
#define DEFINE_TABLE
#include "z8k-opc.h"
-
\f
#include <setjmp.h>
\f
#include <setjmp.h>
-
\f
typedef struct
{
\f
typedef struct
{
@@
-56,7
+56,7
@@
instr_data_s;
to ADDR (exclusive) are valid. Returns 1 for success, longjmps
on error. */
#define FETCH_DATA(info, nibble) \
to ADDR (exclusive) are valid. Returns 1 for success, longjmps
on error. */
#define FETCH_DATA(info, nibble) \
- ((nibble) <
=
((instr_data_s *)(info->private_data))->max_fetched \
+ ((nibble) < ((instr_data_s *)(info->private_data))->max_fetched \
? 1 : fetch_data ((info), (nibble)))
static int
? 1 : fetch_data ((info), (nibble)))
static int
@@
-64,34
+64,34
@@
fetch_data (info, nibble)
struct disassemble_info *info;
int nibble;
{
struct disassemble_info *info;
int nibble;
{
- char mybuf[20];
+
unsigned
char mybuf[20];
int status;
int status;
- instr_data_s *priv = (instr_data_s *)info->private_data;
- bfd_vma start = priv->insn_start + priv->max_fetched / 2;
+ instr_data_s *priv = (instr_data_s *) info->private_data;
if ((nibble % 4) != 0)
abort ();
if ((nibble % 4) != 0)
abort ();
- status = (*info->read_memory_func) (start,
- mybuf,
- (nibble - priv->max_fetched) / 2,
+
+ status = (*info->read_memory_func) (priv->insn_start,
+ (bfd_byte *) mybuf,
+ nibble / 2,
info);
if (status != 0)
{
info);
if (status != 0)
{
- (*info->memory_error_func) (status, start, info);
- longjmp (priv->bailout);
+ (*info->memory_error_func) (status,
priv->insn_
start, info);
+ longjmp (priv->bailout
, 1
);
}
{
int i;
}
{
int i;
-
char *p = mybuf + priv->max_fetched / 2
;
-
- for (i =
priv->max_fetched
; i < nibble;)
+
unsigned char *p = mybuf
;
+
+ for (i =
0
; i < nibble;)
{
priv->words[i] = (p[0] << 8) | p[1];
{
priv->words[i] = (p[0] << 8) | p[1];
-
+
priv->bytes[i] = *p;
priv->nibbles[i++] = *p >> 4;
priv->bytes[i] = *p;
priv->nibbles[i++] = *p >> 4;
- priv->nibbles[i++] = *p &0xf;
+ priv->nibbles[i++] = *p &
0xf;
++p;
priv->bytes[i] = *p;
++p;
priv->bytes[i] = *p;
@@
-125,7
+125,7
@@
static char *codes[16] =
"nc/uge"
};
"nc/uge"
};
-int z8k_lookup_instr PARAMS ((unsigned char*, disassemble_info *));
+int z8k_lookup_instr PARAMS ((unsigned char
*, disassemble_info *));
static void output_instr
PARAMS ((instr_data_s *, unsigned long, disassemble_info *));
static void unpack_instr PARAMS ((instr_data_s *, int, disassemble_info *));
static void output_instr
PARAMS ((instr_data_s *, unsigned long, disassemble_info *));
static void unpack_instr PARAMS ((instr_data_s *, int, disassemble_info *));
@@
-133,7
+133,7
@@
static void unparse_instr PARAMS ((instr_data_s *));
static int
print_insn_z8k (addr, info, is_segmented)
static int
print_insn_z8k (addr, info, is_segmented)
-
unsigned long
addr;
+
bfd_vma
addr;
disassemble_info *info;
int is_segmented;
{
disassemble_info *info;
int is_segmented;
{
@@
-163,15
+163,17
@@
print_insn_z8k (addr, info, is_segmented)
}
}
}
}
+int
print_insn_z8001 (addr, info)
print_insn_z8001 (addr, info)
-
unsigned long
addr;
+
bfd_vma
addr;
disassemble_info *info;
{
return print_insn_z8k (addr, info, 1);
}
disassemble_info *info;
{
return print_insn_z8k (addr, info, 1);
}
+int
print_insn_z8002 (addr, info)
print_insn_z8002 (addr, info)
-
unsigned long
addr;
+
bfd_vma
addr;
disassemble_info *info;
{
return print_insn_z8k (addr, info, 0);
disassemble_info *info;
{
return print_insn_z8k (addr, info, 0);
@@
-193,7
+195,9
@@
z8k_lookup_instr (nibbles, info)
while (!nibl_matched && z8k_table[tabl_index].name)
{
nibl_matched = 1;
while (!nibl_matched && z8k_table[tabl_index].name)
{
nibl_matched = 1;
- for (nibl_index = 0; nibl_index < z8k_table[tabl_index].length * 2 && nibl_matched; nibl_index++)
+ for (nibl_index = 0;
+ nibl_index < z8k_table[tabl_index].length * 2 && nibl_matched;
+ nibl_index++)
{
if ((nibl_index % 4) == 0)
/* Fetch one word at a time. */
{
if ((nibl_index % 4) == 0)
/* Fetch one word at a time. */
@@
-367,8
+371,9
@@
unpack_instr (instr_data, is_segmented, info)
case ARG_IMMN:
instr_data->immediate = instr_nibl - 1;
break;
case ARG_IMMN:
instr_data->immediate = instr_nibl - 1;
break;
- /* ????? */
- /* missing ARG_IMMNMINUS1 */
+ case ARG_IMM4M1:
+ instr_data->immediate = instr_nibl + 1;
+ break;
case ARG_IMM_1:
instr_data->immediate = 1;
break;
case ARG_IMM_1:
instr_data->immediate = 1;
break;
@@
-435,7
+440,7
@@
unpack_instr (instr_data, is_segmented, info)
instr_data->interrupts = instr_nibl & 0x3;
break;
case CLASS_BIT:
instr_data->interrupts = instr_nibl & 0x3;
break;
case CLASS_BIT:
- /*
do nothing
*/
+ /*
Do nothing.
*/
break;
case CLASS_IR:
instr_data->arg_reg[datum_value] = instr_nibl;
break;
case CLASS_IR:
instr_data->arg_reg[datum_value] = instr_nibl;
@@
-493,26
+498,26
@@
unparse_instr (instr_data)
switch (datum_class)
{
case CLASS_X:
switch (datum_class)
{
case CLASS_X:
- sprintf (tmp_str, "0x%0
x(R%
d)", instr_data->address,
+ sprintf (tmp_str, "0x%0
lx(R%l
d)", instr_data->address,
instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_BA:
instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_BA:
- sprintf (tmp_str, "r%
d(#%
x)", instr_data->arg_reg[datum_value],
+ sprintf (tmp_str, "r%
ld(#%l
x)", instr_data->arg_reg[datum_value],
instr_data->immediate);
strcat (out_str, tmp_str);
break;
case CLASS_BX:
instr_data->immediate);
strcat (out_str, tmp_str);
break;
case CLASS_BX:
- sprintf (tmp_str, "r%
d(R%
d)", instr_data->arg_reg[datum_value],
+ sprintf (tmp_str, "r%
ld(R%l
d)", instr_data->arg_reg[datum_value],
instr_data->arg_reg[ARG_RX]);
strcat (out_str, tmp_str);
break;
case CLASS_DISP:
instr_data->arg_reg[ARG_RX]);
strcat (out_str, tmp_str);
break;
case CLASS_DISP:
- sprintf (tmp_str, "#0x%0x", instr_data->displacement);
+ sprintf (tmp_str, "#0x%0
l
x", instr_data->displacement);
strcat (out_str, tmp_str);
break;
case CLASS_IMM:
strcat (out_str, tmp_str);
break;
case CLASS_IMM:
- sprintf (tmp_str, "#0x%0x", instr_data->immediate);
+ sprintf (tmp_str, "#0x%0
l
x", instr_data->immediate);
strcat (out_str, tmp_str);
break;
case CLASS_CC:
strcat (out_str, tmp_str);
break;
case CLASS_CC:
@@
-520,44
+525,44
@@
unparse_instr (instr_data)
strcat (out_str, tmp_str);
break;
case CLASS_CTRL:
strcat (out_str, tmp_str);
break;
case CLASS_CTRL:
- sprintf (tmp_str, "0x%0x", instr_data->ctrl_code);
+ sprintf (tmp_str, "0x%0
l
x", instr_data->ctrl_code);
strcat (out_str, tmp_str);
break;
case CLASS_DA:
case CLASS_ADDRESS:
strcat (out_str, tmp_str);
break;
case CLASS_DA:
case CLASS_ADDRESS:
- sprintf (tmp_str, "#0x%0x", instr_data->address);
+ sprintf (tmp_str, "#0x%0
l
x", instr_data->address);
strcat (out_str, tmp_str);
break;
case CLASS_IR:
strcat (out_str, tmp_str);
break;
case CLASS_IR:
- sprintf (tmp_str, "@R%d", instr_data->arg_reg[datum_value]);
+ sprintf (tmp_str, "@R%
l
d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_FLAGS:
strcat (out_str, tmp_str);
break;
case CLASS_FLAGS:
- sprintf (tmp_str, "0x%0x", instr_data->flags);
+ sprintf (tmp_str, "0x%0
l
x", instr_data->flags);
strcat (out_str, tmp_str);
break;
case CLASS_REG_BYTE:
if (instr_data->arg_reg[datum_value] >= 0x8)
{
strcat (out_str, tmp_str);
break;
case CLASS_REG_BYTE:
if (instr_data->arg_reg[datum_value] >= 0x8)
{
- sprintf (tmp_str, "rl%d",
+ sprintf (tmp_str, "rl%
l
d",
instr_data->arg_reg[datum_value] - 0x8);
}
else
{
instr_data->arg_reg[datum_value] - 0x8);
}
else
{
- sprintf (tmp_str, "rh%d", instr_data->arg_reg[datum_value]);
+ sprintf (tmp_str, "rh%
l
d", instr_data->arg_reg[datum_value]);
}
strcat (out_str, tmp_str);
break;
case CLASS_REG_WORD:
}
strcat (out_str, tmp_str);
break;
case CLASS_REG_WORD:
- sprintf (tmp_str, "r%d", instr_data->arg_reg[datum_value]);
+ sprintf (tmp_str, "r%
l
d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_REG_QUAD:
strcat (out_str, tmp_str);
break;
case CLASS_REG_QUAD:
- sprintf (tmp_str, "rq%d", instr_data->arg_reg[datum_value]);
+ sprintf (tmp_str, "rq%
l
d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_REG_LONG:
strcat (out_str, tmp_str);
break;
case CLASS_REG_LONG:
- sprintf (tmp_str, "rr%d", instr_data->arg_reg[datum_value]);
+ sprintf (tmp_str, "rr%
l
d", instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
default:
strcat (out_str, tmp_str);
break;
default:
This page took
0.02739 seconds
and
4
git commands to generate.