From 3c25c5f6e8cec6d81e1576e2680767e30a17518f Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Thu, 25 Apr 2002 10:59:24 +0000 Subject: [PATCH] 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. --- bfd/ChangeLog | 6 ++ bfd/coff-z8k.c | 23 +++++- binutils/ChangeLog | 4 + binutils/MAINTAINERS | 3 +- gas/ChangeLog | 7 ++ gas/config/tc-z8k.c | 25 ++++--- opcodes/ChangeLog | 21 ++++++ opcodes/z8k-dis.c | 171 +++++++++++++++++++++++-------------------- opcodes/z8k-opc.h | 70 +++++++++--------- opcodes/z8kgen.c | 57 ++++++++------- 10 files changed, 234 insertions(+), 153 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bb7e6bbec36..19a70477bd5 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2002-04-24 Christian Groessler + + * coff-z8k.c (extra_case): Fix R_IMM32 relocations: The + addresses are 23bit with a special layout, not plain 32bit + values. Prevent relocation of immediate values. + 2002-04-24 Chris G. Demetriou * elfxx-mips.c (_bfd_mips_elf_print_private_bfd_data): If MDMX or diff --git a/bfd/coff-z8k.c b/bfd/coff-z8k.c index c626cd75257..c1d6a88fbbb 100644 --- a/bfd/coff-z8k.c +++ b/bfd/coff-z8k.c @@ -185,10 +185,25 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr) break; case R_IMM32: - bfd_put_32 (in_abfd, - /* 0x80000000 indicates a long segmented address. */ - bfd_coff_reloc16_get_value (reloc, link_info, input_section) | 0x80000000, - data + *dst_ptr); + /* If no flags are set, assume immediate value. */ + if (! (*reloc->sym_ptr_ptr)->section->flags) + { + bfd_put_32 (in_abfd, + bfd_coff_reloc16_get_value (reloc, link_info, + input_section), + data + *dst_ptr); + } + else + { + bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info, + input_section); + /* Adresses are 23 bit, and the layout of those in a 32-bit + value is as follows: + 1AAAAAAA xxxxxxxx AAAAAAAA AAAAAAAA + (A - address bits, x - ignore). */ + dst = (dst & 0xffff) | ((dst & 0xff0000) << 8) | 0x80000000; + bfd_put_32 (in_abfd, dst, data + *dst_ptr); + } (*dst_ptr) += 4; (*src_ptr) += 4; break; diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 0886c7c3ab7..f64efaadc61 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,7 @@ +2002-04-24 Christian Groessler + + * MAINTAINERS: Changed my email address. + 2002-04-17 Thiemo Seufer * arparse.y: Fix syntax warning. diff --git a/binutils/MAINTAINERS b/binutils/MAINTAINERS index 80a6be2a76e..e35ac1d608a 100644 --- a/binutils/MAINTAINERS +++ b/binutils/MAINTAINERS @@ -79,7 +79,8 @@ responsibility among the other maintainers. SH Alexandre Oliva SPARC Jakub Jelinek TIC54X Timothy Wall - z8k Christian Groessler + z8k Christian Groessler + --------- CGEN Maintainers ------------- diff --git a/gas/ChangeLog b/gas/ChangeLog index 4940d129702..8e498885faa 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2002-04-24 Christian Groessler + + * config/tc-z8k.c (build_bytes): Add support for new cases: + CLASS_IGNORE and ARG_NIM4. + (md_assemble): Prevent destruction of input_line_pointer if + get_operands returns failure. + 2002-04-24 Chris G. Demetriou * config/tc-mips.c (macro_build): Do _not_ allow MIPS-3D diff --git a/gas/config/tc-z8k.c b/gas/config/tc-z8k.c index f5b05a632f9..78a666c8216 100644 --- a/gas/config/tc-z8k.c +++ b/gas/config/tc-z8k.c @@ -1,5 +1,5 @@ /* tc-z8k.c -- Assemble code for the Zilog Z800n - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001 + Copyright 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. @@ -1081,6 +1081,7 @@ build_bytes (this_try, operand) case CLASS_FLAGS: *output_ptr++ = the_flags; break; + case CLASS_IGNORE: case CLASS_BIT: *output_ptr++ = c & 0xf; break; @@ -1116,6 +1117,9 @@ build_bytes (this_try, operand) nib = 0; switch (c & ARG_MASK) { + case ARG_NIM4: + imm_operand->X_add_number = -imm_operand->X_add_number; + /* Drop through. */ case ARG_IMM4: output_ptr = apply_fix (output_ptr, R_IMM4L, imm_operand, 1); break; @@ -1205,14 +1209,13 @@ md_assemble (str) if (opcode->opcode == 250) { - /* Was really a pseudo op. */ - pseudo_typeS *p; char oc; - char *old = input_line_pointer; *op_end = c; + /* Was really a pseudo op. */ + input_line_pointer = op_end; oc = *old; @@ -1227,7 +1230,11 @@ md_assemble (str) } else { - input_line_pointer = get_operands (opcode, op_end, operand); + char *new_input_line_pointer; + + new_input_line_pointer = get_operands (opcode, op_end, operand); + if (new_input_line_pointer) + input_line_pointer = new_input_line_pointer; prev_opcode = opcode; opcode = get_specific (opcode, operand); @@ -1335,9 +1342,10 @@ md_atof (type, litP, sizeP) CONST char *md_shortopts = "z:"; -struct option md_longopts[] = { - {NULL, no_argument, NULL, 0} -}; +struct option md_longopts[] = + { + {NULL, no_argument, NULL, 0} + }; size_t md_longopts_size = sizeof (md_longopts); @@ -1401,7 +1409,6 @@ md_section_align (seg, size) { return ((size + (1 << section_alignment[(int) seg]) - 1) & (-1 << section_alignment[(int) seg])); - } void 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 + + * 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 * 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 -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] = { - "", - "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] = + { + "", + "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 #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"); -- 2.30.2