summaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2002-04-25 10:59:24 +0000
committerNick Clifton <nickc@redhat.com>2002-04-25 10:59:24 +0000
commit3c25c5f6e8cec6d81e1576e2680767e30a17518f (patch)
treed9cee69823d148950242641f909f06c2bf6b10f5 /opcodes
parent95b80706953a70706f105907c5bb8b8ffb4f844f (diff)
downloadbinutils-gdb-3c25c5f6e8cec6d81e1576e2680767e30a17518f.tar.gz
The patch contains mostly fixes for the disassembler. It also fixes
a crash of the assembler with some malformed source input. Long segmented addresses are now correctly relocated. Finally it updates my email address in the MAINTAINERS file.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog21
-rw-r--r--opcodes/z8k-dis.c171
-rw-r--r--opcodes/z8k-opc.h70
-rw-r--r--opcodes/z8kgen.c57
4 files changed, 180 insertions, 139 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 5757ed0b66b..777f1bc7ac6 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,24 @@
+2002-04-24 Christian Groessler <chris@groessler.org>
+
+ * z8k-dis.c (print_insn_z8k): Set disassemble_info to 2
+ bytes_per_chunk, 6 bytes_per_line for nicer display of the hex
+ codes.
+ (z8k_lookup_instr): CLASS_IGNORE case added.
+ (output_instr): Don't print hex codes, they are already
+ printed.
+ (unpack_instr): ARG_NIM4 case added. ARG_NIM8 case
+ fixed. Support CLASS_BIT_1OR2 and CLASS_IGNORE cases.
+ (unparse_instr): Fix base and indexed addressing disassembly:
+ The index is inside the brackets.
+ * z8kgen.c (gas): Add ARG_NIM4 and CLASS_IGNORE defines.
+ (opt): Fix shift left/right arithmetic/logical byte defines:
+ The high byte of the immediate word is ignored by the
+ processor.
+ Fix n parameter of ldm opcodes: The opcode contains (n-1).
+ (args): Fix "n" entry.
+ (toks): Add "nim4" and "iiii" entries.
+ * z8k-opc.h: Regenerated with new z8kgen.c.
+
2002-04-24 Nick Clifton <nickc@cambridge.redhat.com>
* po/id.po: New Indonesian translation.
diff --git a/opcodes/z8k-dis.c b/opcodes/z8k-dis.c
index 091d9379ddd..d375e6908d2 100644
--- a/opcodes/z8k-dis.c
+++ b/opcodes/z8k-dis.c
@@ -1,22 +1,23 @@
/* Disassemble z8000 code.
- Copyright 1992, 1993, 1998, 2000, 2001
+ Copyright 1992, 1993, 1998, 2000, 2001, 2002
Free Software Foundation, Inc.
-This file is part of GNU Binutils.
+ This file is part of GNU Binutils.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 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
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
#include "sysdep.h"
#include "dis-asm.h"
@@ -26,7 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <setjmp.h>
-typedef struct {
+typedef struct
+{
/* These are all indexed by nibble number (i.e only every other entry
of bytes is used, and every 4th entry of words). */
unsigned char nibbles[24];
@@ -48,7 +50,8 @@ typedef struct {
unsigned long ctrl_code;
unsigned long flags;
unsigned long interrupts;
-} instr_data_s;
+}
+instr_data_s;
static int fetch_data PARAMS ((struct disassemble_info *, int));
@@ -106,35 +109,37 @@ fetch_data (info, nibble)
return 1;
}
-static char *codes[16] = {
- "f",
- "lt",
- "le",
- "ule",
- "ov/pe",
- "mi",
- "eq",
- "c/ult",
- "t",
- "ge",
- "gt",
- "ugt",
- "nov/po",
- "pl",
- "ne",
- "nc/uge"
-};
-
-static char *ctrl_names[8] = {
- "<invld>",
- "flags",
- "fcw",
- "refresh",
- "psapseg",
- "psapoff",
- "nspseg",
- "nspoff"
-};
+static char *codes[16] =
+ {
+ "f",
+ "lt",
+ "le",
+ "ule",
+ "ov/pe",
+ "mi",
+ "eq",
+ "c/ult",
+ "t",
+ "ge",
+ "gt",
+ "ugt",
+ "nov/po",
+ "pl",
+ "ne",
+ "nc/uge"
+ };
+
+static char *ctrl_names[8] =
+ {
+ "<invld>",
+ "flags",
+ "fcw",
+ "refresh",
+ "psapseg",
+ "psapoff",
+ "nspseg",
+ "nspoff"
+ };
static int seg_length;
static int print_insn_z8k PARAMS ((bfd_vma, disassemble_info *, int));
@@ -159,6 +164,10 @@ print_insn_z8k (addr, info, is_segmented)
/* Error return. */
return -1;
+ info->bytes_per_chunk = 2;
+ info->bytes_per_line = 6;
+ info->display_endian = BFD_ENDIAN_BIG;
+
instr_data.tabl_index = z8k_lookup_instr (instr_data.nibbles, info);
if (instr_data.tabl_index > 0)
{
@@ -227,6 +236,8 @@ z8k_lookup_instr (nibbles, info)
if (datum_value != instr_nibl)
nibl_matched = 0;
break;
+ case CLASS_IGNORE:
+ break;
case CLASS_00II:
if (!((~instr_nibl) & 0x4))
nibl_matched = 0;
@@ -265,10 +276,9 @@ z8k_lookup_instr (nibbles, info)
break;
}
}
+
if (nibl_matched)
- {
- return tabl_index;
- }
+ return tabl_index;
tabl_index++;
}
@@ -281,24 +291,13 @@ output_instr (instr_data, addr, info)
unsigned long addr ATTRIBUTE_UNUSED;
disassemble_info *info;
{
- int loop, loop_limit;
- char tmp_str[20];
+ int num_bytes;
char out_str[100];
- strcpy (out_str, "\t");
-
- loop_limit = (z8k_table[instr_data->tabl_index].length + seg_length) * 2;
- FETCH_DATA (info, loop_limit);
- for (loop = 0; loop < loop_limit; loop++)
- {
- sprintf (tmp_str, "%x", instr_data->nibbles[loop]);
- strcat (out_str, tmp_str);
- }
+ out_str[0] = 0;
- while (loop++ < 8)
- {
- strcat (out_str, " ");
- }
+ num_bytes = (z8k_table[instr_data->tabl_index].length + seg_length) * 2;
+ FETCH_DATA (info, num_bytes);
strcat (out_str, instr_data->instr_asmsrc);
@@ -320,6 +319,7 @@ unpack_instr (instr_data, is_segmented, info)
nibl_count = 0;
loop = 0;
seg_length = 0;
+
while (z8k_table[instr_data->tabl_index].byte_info[loop] != 0)
{
FETCH_DATA (info, nibl_count + 4 - (nibl_count % 4));
@@ -343,16 +343,13 @@ unpack_instr (instr_data, is_segmented, info)
break;
case ARG_DISP12:
if (instr_word & 0x800)
- {
- /* neg. 12 bit displacement */
- instr_data->displacement = instr_data->insn_start + 2
- - (signed short) ((instr_word & 0xfff) | 0xf000) * 2;
- }
+ /* Negative 12 bit displacement. */
+ instr_data->displacement = instr_data->insn_start + 2
+ - (signed short) ((instr_word & 0xfff) | 0xf000) * 2;
else
- {
- instr_data->displacement = instr_data->insn_start + 2
- - (instr_word & 0x0fff) * 2;
- }
+ instr_data->displacement = instr_data->insn_start + 2
+ - (instr_word & 0x0fff) * 2;
+
nibl_count += 2;
break;
default:
@@ -365,8 +362,11 @@ unpack_instr (instr_data, is_segmented, info)
case ARG_IMM4:
instr_data->immediate = instr_nibl;
break;
+ case ARG_NIM4:
+ instr_data->immediate = (- instr_nibl) & 0xf;
+ break;
case ARG_NIM8:
- instr_data->immediate = (-instr_byte);
+ instr_data->immediate = (- instr_byte) & 0xff;
nibl_count += 1;
break;
case ARG_IMM8:
@@ -452,6 +452,7 @@ unpack_instr (instr_data, is_segmented, info)
case CLASS_00II:
instr_data->interrupts = instr_nibl & 0x3;
break;
+ case CLASS_IGNORE:
case CLASS_BIT:
instr_data->ctrl_code = instr_nibl & 0x7;
break;
@@ -469,6 +470,10 @@ unpack_instr (instr_data, is_segmented, info)
instr_data->insn_start + 2 + (signed char) instr_byte * 2;
nibl_count += 1;
break;
+ case CLASS_BIT_1OR2:
+ instr_data->immediate = ((instr_nibl >> 1) & 0x1) + 1;
+ nibl_count += 1;
+ break;
default:
abort ();
break;
@@ -489,7 +494,7 @@ unparse_instr (instr_data, is_segmented)
int loop, loop_limit;
char out_str[80], tmp_str[25];
- sprintf (out_str, "\t%s\t", z8k_table[instr_data->tabl_index].name);
+ sprintf (out_str, "%s\t", z8k_table[instr_data->tabl_index].name);
loop_limit = z8k_table[instr_data->tabl_index].noperands;
for (loop = 0; loop < loop_limit; loop++)
@@ -504,18 +509,26 @@ unparse_instr (instr_data, is_segmented)
switch (datum_class)
{
case CLASS_X:
- sprintf (tmp_str, "0x%0lx(R%ld)", instr_data->address,
- instr_data->arg_reg[datum_value]);
+ sprintf (tmp_str, "0x%0lx(r%ld)", instr_data->address,
+ instr_data->arg_reg[datum_value]);
strcat (out_str, tmp_str);
break;
case CLASS_BA:
- sprintf (tmp_str, "r%ld(#%lx)", instr_data->arg_reg[datum_value],
- instr_data->immediate);
+ if (is_segmented)
+ sprintf (tmp_str, "rr%ld(#%lx)", instr_data->arg_reg[datum_value],
+ instr_data->immediate);
+ else
+ sprintf (tmp_str, "r%ld(#%lx)", instr_data->arg_reg[datum_value],
+ instr_data->immediate);
strcat (out_str, tmp_str);
break;
case CLASS_BX:
- sprintf (tmp_str, "r%ld(R%ld)", instr_data->arg_reg[datum_value],
- instr_data->arg_reg[ARG_RX]);
+ if (is_segmented)
+ sprintf (tmp_str, "rr%ld(r%ld)", instr_data->arg_reg[datum_value],
+ instr_data->arg_reg[ARG_RX]);
+ else
+ sprintf (tmp_str, "r%ld(r%ld)", instr_data->arg_reg[datum_value],
+ instr_data->arg_reg[ARG_RX]);
strcat (out_str, tmp_str);
break;
case CLASS_DISP:
diff --git a/opcodes/z8k-opc.h b/opcodes/z8k-opc.h
index c62867c4bbf..025cfabdd65 100644
--- a/opcodes/z8k-opc.h
+++ b/opcodes/z8k-opc.h
@@ -21,6 +21,7 @@
#define ARG_IMM2 0x0a
#define ARG_IMM1OR2 0x0b
#define ARG_DISP12 0x0b
+#define ARG_NIM4 0x0c
#define ARG_DISP8 0x0c
#define ARG_IMM4M1 0x0d
#define CLASS_MASK 0x1fff0
@@ -32,6 +33,7 @@
#define CLASS_IMM 0x60
#define CLASS_CC 0x70
#define CLASS_CTRL 0x80
+#define CLASS_IGNORE 0x90
#define CLASS_ADDRESS 0xd0
#define CLASS_0CCC 0xe0
#define CLASS_1CCC 0xf0
@@ -2419,64 +2421,64 @@ opcode_entry_type z8k_table[] = {
{CLASS_BIT+7,CLASS_BIT+5,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_REG+(ARG_RX),CLASS_BIT+0,CLASS_BIT+0,0,},2,4,215},
-/* 0001 1100 ddN0 1001 0000 ssss 0000 nminus1 *** ldm @rd,rs,n */
+/* 0001 1100 ddN0 1001 0000 ssss 0000 imm4m1 *** ldm @rd,rs,n */
{
#ifdef NICENAMES
"ldm @rd,rs,n",16,11,
0x00,
#endif
-"ldm",OPC_ldm,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),0,},3,4,216},
+"ldm",OPC_ldm,0,{CLASS_IR+(ARG_RD),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMM4M1),},
+ {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),0,},3,4,216},
-/* 0101 1100 ddN0 1001 0000 ssss 0000 nminus1 address_dst *** ldm address_dst(rd),rs,n */
+/* 0101 1100 ddN0 1001 0000 ssss 0000 imm4m1 address_dst *** ldm address_dst(rd),rs,n */
{
#ifdef NICENAMES
"ldm address_dst(rd),rs,n",16,15,
0x00,
#endif
-"ldm",OPC_ldm,0,{CLASS_X+(ARG_RD),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_DST),},3,6,217},
+"ldm",OPC_ldm,0,{CLASS_X+(ARG_RD),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMM4M1),},
+ {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),},3,6,217},
-/* 0101 1100 0000 1001 0000 ssss 0000 nminus1 address_dst *** ldm address_dst,rs,n */
+/* 0101 1100 0000 1001 0000 ssss 0000 imm4m1 address_dst *** ldm address_dst,rs,n */
{
#ifdef NICENAMES
"ldm address_dst,rs,n",16,14,
0x00,
#endif
-"ldm",OPC_ldm,0,{CLASS_DA+(ARG_DST),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_DST),},3,6,218},
+"ldm",OPC_ldm,0,{CLASS_DA+(ARG_DST),CLASS_REG_WORD+(ARG_RS),CLASS_IMM + (ARG_IMM4M1),},
+ {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+9,CLASS_BIT+0,CLASS_REG+(ARG_RS),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_DST),},3,6,218},
-/* 0001 1100 ssN0 0001 0000 dddd 0000 nminus1 *** ldm rd,@rs,n */
+/* 0001 1100 ssN0 0001 0000 dddd 0000 imm4m1 *** ldm rd,@rs,n */
{
#ifdef NICENAMES
"ldm rd,@rs,n",16,11,
0x00,
#endif
-"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),0,},3,4,219},
+"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_IR+(ARG_RS),CLASS_IMM + (ARG_IMM4M1),},
+ {CLASS_BIT+1,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),0,},3,4,219},
-/* 0101 1100 ssN0 0001 0000 dddd 0000 nminus1 address_src *** ldm rd,address_src(rs),n */
+/* 0101 1100 ssN0 0001 0000 dddd 0000 imm4m1 address_src *** ldm rd,address_src(rs),n */
{
#ifdef NICENAMES
"ldm rd,address_src(rs),n",16,15,
0x00,
#endif
-"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_SRC),},3,6,220},
+"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_X+(ARG_RS),CLASS_IMM + (ARG_IMM4M1),},
+ {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_REGN0+(ARG_RS),CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_SRC),},3,6,220},
-/* 0101 1100 0000 0001 0000 dddd 0000 nminus1 address_src *** ldm rd,address_src,n */
+/* 0101 1100 0000 0001 0000 dddd 0000 imm4m1 address_src *** ldm rd,address_src,n */
{
#ifdef NICENAMES
"ldm rd,address_src,n",16,14,
0x00,
#endif
-"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),CLASS_IMM + (ARG_IMMN),},
- {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMMNMINUS1),CLASS_ADDRESS+(ARG_SRC),},3,6,221},
+"ldm",OPC_ldm,0,{CLASS_REG_WORD+(ARG_RD),CLASS_DA+(ARG_SRC),CLASS_IMM + (ARG_IMM4M1),},
+ {CLASS_BIT+5,CLASS_BIT+0xc,CLASS_BIT+0,CLASS_BIT+1,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_BIT+0,CLASS_IMM+(ARG_IMM4M1),CLASS_ADDRESS+(ARG_SRC),},3,6,221},
/* 0011 1001 ssN0 0000 *** ldps @rs */
@@ -3729,14 +3731,14 @@ opcode_entry_type z8k_table[] = {
{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,346},
-/* 1011 0010 dddd 1001 0000 0000 imm8 *** slab rbd,imm8 */
+/* 1011 0010 dddd 1001 iiii iiii 0000 imm4 *** slab rbd,imm4 */
{
#ifdef NICENAMES
-"slab rbd,imm8",8,13,
+"slab rbd,imm4",8,13,
0x3c,
#endif
-"slab",OPC_slab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,347},
+"slab",OPC_slab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),0,},2,4,347},
/* 1011 0011 dddd 1101 0000 0000 imm8 *** slal rrd,imm8 */
@@ -3759,14 +3761,14 @@ opcode_entry_type z8k_table[] = {
{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,349},
-/* 1011 0010 dddd 0001 0000 0000 imm8 *** sllb rbd,imm8 */
+/* 1011 0010 dddd 0001 iiii iiii 0000 imm4 *** sllb rbd,imm4 */
{
#ifdef NICENAMES
-"sllb rbd,imm8",8,13,
+"sllb rbd,imm4",8,13,
0x38,
#endif
-"sllb",OPC_sllb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_IMM8),0,0,},2,4,350},
+"sllb",OPC_sllb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0,CLASS_IMM+(ARG_IMM4),0,},2,4,350},
/* 1011 0011 dddd 0101 0000 0000 imm8 *** slll rrd,imm8 */
@@ -3849,14 +3851,14 @@ opcode_entry_type z8k_table[] = {
{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,358},
-/* 1011 0010 dddd 1001 0000 0000 nim8 *** srab rbd,imm8 */
+/* 1011 0010 dddd 1001 iiii iiii 1111 nim4 *** srab rbd,imm4 */
{
#ifdef NICENAMES
-"srab rbd,imm8",8,13,
+"srab rbd,imm4",8,13,
0x3c,
#endif
-"srab",OPC_srab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_NIM8),0,0,},2,4,359},
+"srab",OPC_srab,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+9,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM4),0,},2,4,359},
/* 1011 0011 dddd 1101 1111 1111 nim8 *** sral rrd,imm8 */
@@ -3879,14 +3881,14 @@ opcode_entry_type z8k_table[] = {
{CLASS_BIT+0xb,CLASS_BIT+3,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0xf,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM8),0,0,},2,4,361},
-/* 1011 0010 dddd 0001 0000 0000 nim8 *** srlb rbd,imm8 */
+/* 1011 0010 dddd 0001 iiii iiii 1111 nim4 *** srlb rbd,imm4 */
{
#ifdef NICENAMES
-"srlb rbd,imm8",8,13,
+"srlb rbd,imm4",8,13,
0x3c,
#endif
-"srlb",OPC_srlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),},
- {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_BIT+0,CLASS_BIT+0,CLASS_IMM+(ARG_NIM8),0,0,},2,4,362},
+"srlb",OPC_srlb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM +(ARG_IMM4),},
+ {CLASS_BIT+0xb,CLASS_BIT+2,CLASS_REG+(ARG_RD),CLASS_BIT+1,CLASS_IGNORE,CLASS_IGNORE,CLASS_BIT+0xf,CLASS_IMM+(ARG_NIM4),0,},2,4,362},
/* 1011 0011 dddd 0101 1111 1111 nim8 *** srll rrd,imm8 */
diff --git a/opcodes/z8kgen.c b/opcodes/z8kgen.c
index f171724b762..fa8505939a9 100644
--- a/opcodes/z8kgen.c
+++ b/opcodes/z8kgen.c
@@ -1,23 +1,23 @@
-/*
- Copyright 2001 Free Software Foundation, Inc.
+/* Copyright 2001, 2002 Free Software Foundation, Inc.
- This file is part of GNU Binutils.
+ This file is part of GNU Binutils.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 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
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA. */
-/* This program generates z8k-opc.h */
+/* This program generates z8k-opc.h. */
#include <stdio.h>
#include "sysdep.h"
@@ -285,12 +285,12 @@ struct op opt[] =
"------", 5, 16, "1011 1101 dddd imm4", "ldk rd,imm4", 0,
- "------", 11, 16, "0001 1100 ddN0 1001 0000 ssss 0000 nminus1", "ldm @rd,rs,n", 0,
- "------", 15, 16, "0101 1100 ddN0 1001 0000 ssss 0000 nminus1 address_dst", "ldm address_dst(rd),rs,n", 0,
- "------", 14, 16, "0101 1100 0000 1001 0000 ssss 0000 nminus1 address_dst", "ldm address_dst,rs,n", 0,
- "------", 11, 16, "0001 1100 ssN0 0001 0000 dddd 0000 nminus1", "ldm rd,@rs,n", 0,
- "------", 15, 16, "0101 1100 ssN0 0001 0000 dddd 0000 nminus1 address_src", "ldm rd,address_src(rs),n", 0,
- "------", 14, 16, "0101 1100 0000 0001 0000 dddd 0000 nminus1 address_src", "ldm rd,address_src,n", 0,
+ "------", 11, 16, "0001 1100 ddN0 1001 0000 ssss 0000 imm4m1", "ldm @rd,rs,n", 0,
+ "------", 15, 16, "0101 1100 ddN0 1001 0000 ssss 0000 imm4m1 address_dst", "ldm address_dst(rd),rs,n", 0,
+ "------", 14, 16, "0101 1100 0000 1001 0000 ssss 0000 imm4m1 address_dst", "ldm address_dst,rs,n", 0,
+ "------", 11, 16, "0001 1100 ssN0 0001 0000 dddd 0000 imm4m1", "ldm rd,@rs,n", 0,
+ "------", 15, 16, "0101 1100 ssN0 0001 0000 dddd 0000 imm4m1 address_src", "ldm rd,address_src(rs),n", 0,
+ "------", 14, 16, "0101 1100 0000 0001 0000 dddd 0000 imm4m1 address_src", "ldm rd,address_src,n", 0,
"CZSVDH", 12, 16, "0011 1001 ssN0 0000", "ldps @rs", 0,
"CZSVDH", 16, 16, "0111 1001 0000 0000 address_src", "ldps address_src", 0,
@@ -434,11 +434,11 @@ struct op opt[] =
"------", 0, 16, "0011 1010 ssN0 0001 0000 aaaa ddN0 0000", "sinibr @rd,@rs,ra", 0,
"CZSV--", 13, 16, "1011 0011 dddd 1001 0000 0000 imm8", "sla rd,imm8", 0,
- "CZSV--", 13, 8, "1011 0010 dddd 1001 0000 0000 imm8", "slab rbd,imm8", 0,
+ "CZSV--", 13, 8, "1011 0010 dddd 1001 iiii iiii 0000 imm4", "slab rbd,imm4", 0,
"CZSV--", 13, 32, "1011 0011 dddd 1101 0000 0000 imm8", "slal rrd,imm8", 0,
"CZS---", 13, 16, "1011 0011 dddd 0001 0000 0000 imm8", "sll rd,imm8", 0,
- "CZS---", 13, 8, "1011 0010 dddd 0001 0000 0000 imm8", "sllb rbd,imm8", 0,
+ "CZS---", 13, 8, "1011 0010 dddd 0001 iiii iiii 0000 imm4", "sllb rbd,imm4", 0,
"CZS---", 13, 32, "1011 0011 dddd 0101 0000 0000 imm8", "slll rrd,imm8", 0,
"------", 0, 16, "0011 1011 ssss 0111 imm16", "sout imm16,rs", 0,
@@ -449,11 +449,11 @@ struct op opt[] =
"------", 0, 16, "0011 1010 ssN0 0011 0000 aaaa ddN0 0000", "soutibr @rd,@rs,ra", 0,
"CZSV--", 13, 16, "1011 0011 dddd 1001 1111 1111 nim8", "sra rd,imm8", 0,
- "CZSV--", 13, 8, "1011 0010 dddd 1001 0000 0000 nim8", "srab rbd,imm8", 0,
+ "CZSV--", 13, 8, "1011 0010 dddd 1001 iiii iiii 1111 nim4", "srab rbd,imm4", 0,
"CZSV--", 13, 32, "1011 0011 dddd 1101 1111 1111 nim8", "sral rrd,imm8", 0,
"CZSV--", 13, 16, "1011 0011 dddd 0001 1111 1111 nim8", "srl rd,imm8", 0,
- "CZSV--", 13, 8, "1011 0010 dddd 0001 0000 0000 nim8", "srlb rbd,imm8", 0,
+ "CZSV--", 13, 8, "1011 0010 dddd 0001 iiii iiii 1111 nim4", "srlb rbd,imm4", 0,
"CZSV--", 13, 32, "1011 0011 dddd 0101 1111 1111 nim8", "srll rrd,imm8", 0,
"CZSV--", 7, 16, "0000 0011 ssN0 dddd", "sub rd,@rs", 0,
@@ -595,7 +595,7 @@ struct tok_struct args[] =
{"imm32", "CLASS_IMM+(ARG_IMM32)",},
{"imm4m1", "CLASS_IMM +(ARG_IMM4M1)",},
{"imm4", "CLASS_IMM +(ARG_IMM4)",},
- {"n", "CLASS_IMM + (ARG_IMMN)",},
+ {"n", "CLASS_IMM + (ARG_IMM4M1)",},
{"ctrl", "CLASS_CTRL",},
{"rba", "CLASS_REG_BYTE+(ARG_RA)",},
{"rbb", "CLASS_REG_BYTE+(ARG_RB)",},
@@ -695,6 +695,7 @@ struct tok_struct toks[] =
"imm8", "CLASS_IMM+(ARG_IMM8)", 2,
"imm16", "CLASS_IMM+(ARG_IMM16)", 4,
"imm32", "CLASS_IMM+(ARG_IMM32)", 8,
+ "nim4", "CLASS_IMM+(ARG_NIM4)", 2,
"nim8", "CLASS_IMM+(ARG_NIM8)", 2,
"0ccc", "CLASS_0CCC", 1,
"1ccc", "CLASS_1CCC", 1,
@@ -703,6 +704,8 @@ struct tok_struct toks[] =
"1disp7", "CLASS_1DISP7", 2,
"01ii", "CLASS_01II", 1,
"00ii", "CLASS_00II", 1,
+
+ "iiii", "CLASS_IGNORE", 1,
0, 0
};
@@ -992,6 +995,7 @@ gas ()
printf ("#define ARG_IMM1OR2 0x0b\n");
printf ("#define ARG_DISP12 0x0b\n");
+ printf ("#define ARG_NIM4 0x0c\n");
printf ("#define ARG_DISP8 0x0c\n");
printf ("#define ARG_IMM4M1 0x0d\n");
printf ("#define CLASS_MASK 0x1fff0\n");
@@ -1003,6 +1007,7 @@ gas ()
printf ("#define CLASS_IMM 0x60\n");
printf ("#define CLASS_CC 0x70\n");
printf ("#define CLASS_CTRL 0x80\n");
+ printf ("#define CLASS_IGNORE 0x90\n");
printf ("#define CLASS_ADDRESS 0xd0\n");
printf ("#define CLASS_0CCC 0xe0\n");
printf ("#define CLASS_1CCC 0xf0\n");