aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2001-10-30 15:20:14 +0000
committerNick Clifton <nickc@redhat.com>2001-10-30 15:20:14 +0000
commit3c3bdf30e42268e6193693acd1dc66d2d1792536 (patch)
tree8f6b2752d885c3e71d0bef5717e981faac396928 /include
parentf5ffc9190a633d0f8eb1632a64a28eda75206b55 (diff)
downloadgdb-3c3bdf30e42268e6193693acd1dc66d2d1792536.zip
gdb-3c3bdf30e42268e6193693acd1dc66d2d1792536.tar.gz
gdb-3c3bdf30e42268e6193693acd1dc66d2d1792536.tar.bz2
Add MMIX support
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog4
-rw-r--r--include/dis-asm.h33
-rw-r--r--include/elf/ChangeLog4
-rw-r--r--include/elf/mmix.h151
-rw-r--r--include/opcode/ChangeLog4
-rw-r--r--include/opcode/mmix.h185
6 files changed, 365 insertions, 16 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 3ca7b8d..ab0ef90 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * dis-asm.h (print_insn_mmix): Add prototype.
+
2001-10-24 Neil Booth <neil@daikokuya.demon.co.uk>
* include/safe-ctype.h (_sch_isbasic, IS_ISOBASIC): New.
diff --git a/include/dis-asm.h b/include/dis-asm.h
index c1bd5ce..539a73a 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -145,8 +145,7 @@ typedef struct disassemble_info {
enum bfd_endian display_endian;
/* Number of octets per incremented target address
- Normally one, but some DSPs have byte sizes of 16 or 32 bits
- */
+ Normally one, but some DSPs have byte sizes of 16 or 32 bits. */
unsigned int octets_per_byte;
/* Results from instruction decoders. Not all decoders yet support
@@ -192,41 +191,43 @@ extern int print_insn_h8300h PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_h8300s PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_h8500 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_alpha PARAMS ((bfd_vma, disassemble_info*));
-extern disassembler_ftype arc_get_disassembler PARAMS ((void *));
extern int print_insn_big_arm PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_little_arm PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_sparc PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_big_a29k PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_little_a29k PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_avr PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_d10v PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_d30v PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_fr30 PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_hppa PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_i860 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_i960 PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_sh PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_shl PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_hppa PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_fr30 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_m32r PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_m88k PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_mcore PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_mmix PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_mn10200 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_mn10300 PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_ns32k PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_openrisc PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_pdp11 PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_pj PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_big_powerpc PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_little_powerpc PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_rs6000 PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_w65 PARAMS ((bfd_vma, disassemble_info*));
-extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *));
-extern int print_insn_d10v PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_d30v PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_v850 PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_s390 PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_sh PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_shl PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_tic30 PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_vax PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_tic54x PARAMS ((bfd_vma, disassemble_info*));
extern int print_insn_tic80 PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_pj PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_avr PARAMS ((bfd_vma, disassemble_info*));
-extern int print_insn_s390 PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_v850 PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_vax PARAMS ((bfd_vma, disassemble_info*));
+extern int print_insn_w65 PARAMS ((bfd_vma, disassemble_info*));
+
+extern disassembler_ftype arc_get_disassembler PARAMS ((void *));
+extern disassembler_ftype cris_get_disassembler PARAMS ((bfd *));
extern void print_arm_disassembler_options PARAMS ((FILE *));
extern void parse_arm_disassembler_option PARAMS ((char *));
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index 46e5eb5..41b5e95 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * mmix.h: New file.
+
2001-10-23 Alan Modra <amodra@bigpond.net.au>
* internal.h: White space changes to keep lines under 80 chars.
diff --git a/include/elf/mmix.h b/include/elf/mmix.h
new file mode 100644
index 0000000..fa367e5
--- /dev/null
+++ b/include/elf/mmix.h
@@ -0,0 +1,151 @@
+/* MMIX support for BFD.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of BFD, the Binary File Descriptor library.
+
+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.
+
+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 file holds definitions specific to the MMIX ELF ABI. */
+#ifndef ELF_MMIX_H
+#define ELF_MMIX_H
+
+#include "elf/reloc-macros.h"
+
+/* Relocations. */
+START_RELOC_NUMBERS (elf_mmix_reloc_type)
+ RELOC_NUMBER (R_MMIX_NONE, 0)
+
+ /* Standard absolute relocations. */
+ RELOC_NUMBER (R_MMIX_8, 1)
+ RELOC_NUMBER (R_MMIX_16, 2)
+ RELOC_NUMBER (R_MMIX_24, 3)
+ RELOC_NUMBER (R_MMIX_32, 4)
+ RELOC_NUMBER (R_MMIX_64, 5)
+
+ /* Standard relative relocations. */
+ RELOC_NUMBER (R_MMIX_PC_8, 6)
+ RELOC_NUMBER (R_MMIX_PC_16, 7)
+ RELOC_NUMBER (R_MMIX_PC_24, 8)
+ RELOC_NUMBER (R_MMIX_PC_32, 9)
+ RELOC_NUMBER (R_MMIX_PC_64, 10)
+
+ /* GNU extensions for C++ vtables. */
+ RELOC_NUMBER (R_MMIX_GNU_VTINHERIT, 11)
+ RELOC_NUMBER (R_MMIX_GNU_VTENTRY, 12)
+
+ /* A GETA instruction. */
+ RELOC_NUMBER (R_MMIX_GETA, 13)
+ RELOC_NUMBER (R_MMIX_GETA_1, 14)
+ RELOC_NUMBER (R_MMIX_GETA_2, 15)
+ RELOC_NUMBER (R_MMIX_GETA_3, 16)
+
+ /* A conditional branch instruction. */
+ RELOC_NUMBER (R_MMIX_CBRANCH, 17)
+ RELOC_NUMBER (R_MMIX_CBRANCH_J, 18)
+ RELOC_NUMBER (R_MMIX_CBRANCH_1, 19)
+ RELOC_NUMBER (R_MMIX_CBRANCH_2, 20)
+ RELOC_NUMBER (R_MMIX_CBRANCH_3, 21)
+
+ /* A PUSHJ instruction. */
+ RELOC_NUMBER (R_MMIX_PUSHJ, 22)
+ RELOC_NUMBER (R_MMIX_PUSHJ_1, 23)
+ RELOC_NUMBER (R_MMIX_PUSHJ_2, 24)
+ RELOC_NUMBER (R_MMIX_PUSHJ_3, 25)
+
+ /* A JMP instruction. */
+ RELOC_NUMBER (R_MMIX_JMP, 26)
+ RELOC_NUMBER (R_MMIX_JMP_1, 27)
+ RELOC_NUMBER (R_MMIX_JMP_2, 28)
+ RELOC_NUMBER (R_MMIX_JMP_3, 29)
+
+ /* A relative address such as in a GETA or a branch. */
+ RELOC_NUMBER (R_MMIX_ADDR19, 30)
+
+ /* A relative address such as in a JMP (only). */
+ RELOC_NUMBER (R_MMIX_ADDR27, 31)
+
+ /* A general register or a number 0..255. */
+ RELOC_NUMBER (R_MMIX_REG_OR_BYTE, 32)
+
+ /* A general register. */
+ RELOC_NUMBER (R_MMIX_REG, 33)
+
+ /* A global register and an offset, equivalent of the expression. */
+ RELOC_NUMBER (R_MMIX_BASE_PLUS_OFFSET, 34)
+
+ /* A LOCAL assertion. */
+ RELOC_NUMBER (R_MMIX_LOCAL, 35)
+END_RELOC_NUMBERS (R_MMIX_max)
+
+
+/* Section Attributes. */
+/* A section containing necessary information for relaxation. */
+#define SHF_MMIX_CANRELAX 0x80000000
+
+/* Symbol attributes. */
+/* A symbol with this section-index is a register. */
+#define SHN_REGISTER SHN_LOPROC
+
+/* This section holds contents for each initialized register, at VMA
+ regno*8. A symbol relative to this section will be transformed to an
+ absolute symbol with the value corresponding to the register number at
+ final link time. A symbol with a value outside the inclusive range
+ 32*8 .. 254*8 is an error. It is highly recommended to only use an
+ upper bound of 253*8 or lower as specified in the (currently
+ unspecified) ABI. */
+#define MMIX_REG_CONTENTS_SECTION_NAME ".MMIX.reg_contents"
+
+/* This is a faked section holding symbols with SHN_REGISTER. Don't
+ confuse it with MMIX_REG_CONTENTS_SECTION_NAME; this one has no
+ contents, just values. It is an error for a value in this section to
+ be outside the range 32..255 and it must never become an actual section
+ in an object file. */
+#define MMIX_REG_SECTION_NAME "*REG*"
+
+/* Appended with a number N=0..65535, this is a representation of the
+ mmixal "BSPEC N" ... "ESPEC" directive pair; the contents go into an
+ ELF section by name ".MMIX.spec_data.N". */
+#define MMIX_OTHER_SPEC_SECTION_PREFIX ".MMIX.spec_data."
+
+/* A section SECNAME is noted to start at "__.MMIX.start.SECNAME" by the
+ presence of this symbol. Currently only implemented for ".text"
+ through the symbol "__.MMIX.start..text". */
+#define MMIX_LOC_SECTION_START_SYMBOL_PREFIX "__.MMIX.start."
+
+/* This symbol is always a function. */
+#define MMIX_START_SYMBOL_NAME "Main"
+
+
+/* We smuggle in a few MMO specifics here. We don't make a specific MMO
+ file, since we can't reasonably support MMO without ELF; we have to
+ include this file anyway. */
+
+#define MMO_TEXT_SECTION_NAME ".text"
+#define MMO_DATA_SECTION_NAME ".data"
+
+/* A definition for the flags we put in spec data in files. A copy of our
+ own of some flags to keep immune to BFD flag changes. See section.c of
+ 2001-07-18 for flag documentation. */
+#define MMO_SEC_ALLOC 0x001
+#define MMO_SEC_LOAD 0x002
+#define MMO_SEC_RELOC 0x004
+#define MMO_SEC_READONLY 0x010
+#define MMO_SEC_CODE 0x020
+#define MMO_SEC_DATA 0x040
+#define MMO_SEC_NEVER_LOAD 0x400
+#define MMO_SEC_IS_COMMON 0x8000
+#define MMO_SEC_DEBUGGING 0x10000
+
+#endif /* ELF_MMIX_H */
diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog
index 583f742..73dd9c6 100644
--- a/include/opcode/ChangeLog
+++ b/include/opcode/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-30 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * mmix.h: New file.
+
2001-10-18 Chris Demetriou <cgd@broadcom.com>
* mips.h (OPCODE_IS_MEMBER): Add a no-op term to the end
diff --git a/include/opcode/mmix.h b/include/opcode/mmix.h
new file mode 100644
index 0000000..825eb0e
--- /dev/null
+++ b/include/opcode/mmix.h
@@ -0,0 +1,185 @@
+/* mmix.h -- Header file for MMIX opcode table
+ Copyright (C) 2001 Free Software Foundation, Inc.
+ Written by Hans-Peter Nilsson (hp@bitrange.com)
+
+This file is part of GDB, GAS, and the GNU binutils.
+
+GDB, GAS, and the GNU binutils are free software; you can redistribute
+them and/or modify them under the terms of the GNU General Public
+License as published by the Free Software Foundation; either version 2,
+or (at your option) any later version.
+
+GDB, GAS, and the GNU binutils are distributed in the hope that they
+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 file; see the file COPYING. If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+/* We could have just a char*[] table indexed by the register number, but
+ that would not allow for synonyms. The table is terminated with an
+ entry with a NULL name. */
+struct mmix_spec_reg
+{
+ const char *name;
+ unsigned int number;
+};
+
+/* General indication of the type of instruction. */
+enum mmix_insn_type
+ {
+ mmix_type_pseudo,
+ mmix_type_normal,
+ mmix_type_branch,
+ mmix_type_condbranch,
+ mmix_type_memaccess_octa,
+ mmix_type_memaccess_tetra,
+ mmix_type_memaccess_wyde,
+ mmix_type_memaccess_byte,
+ mmix_type_memaccess_block,
+ mmix_type_jsr
+ };
+
+/* Type of operands an instruction takes. Use when parsing assembly code
+ and disassembling. */
+enum mmix_operands_type
+ {
+ mmix_operands_none = 0,
+
+ /* All operands are registers: "$X,$Y,$Z". */
+ mmix_operands_regs,
+
+ /* "$X,YZ", like SETH. */
+ mmix_operands_reg_yz,
+
+ /* The regular "$X,$Y,$Z|Z".
+ The Z is optional; if only "$X,$Y" is given, then "$X,$Y,0" is
+ assumed. */
+ mmix_operands_regs_z_opt,
+
+ /* The regular "$X,$Y,$Z|Z". */
+ mmix_operands_regs_z,
+
+ /* "Address"; only JMP. Zero operands allowed unless GNU syntax. */
+ mmix_operands_jmp,
+
+ /* "$X|X,$Y,$Z|Z": PUSHGO; like "3", but X can be expressed as an
+ integer. */
+ mmix_operands_pushgo,
+
+ /* Two registers or a register and a byte, like FLOT, possibly with
+ rounding: "$X,$Z|Z" or "$X,ROUND_MODE,$Z|Z". */
+ mmix_operands_roundregs_z,
+
+ /* "X,YZ", POP. Unless GNU syntax, zero or one operand is allowed. */
+ mmix_operands_pop,
+
+ /* Two registers, possibly with rounding: "$X,$Z" or
+ "$X,ROUND_MODE,$Z". */
+ mmix_operands_roundregs,
+
+ /* "XYZ", like SYNC. */
+ mmix_operands_sync,
+
+ /* "X,$Y,$Z|Z", like SYNCD. */
+ mmix_operands_x_regs_z,
+
+ /* "$X,Y,$Z|Z", like NEG and NEGU. The Y field is optional, default 0. */
+ mmix_operands_neg,
+
+ /* "$X,Address, like GETA or branches. */
+ mmix_operands_regaddr,
+
+ /* "$X|X,Address, like PUSHJ. */
+ mmix_operands_pushj,
+
+ /* "$X,spec_reg"; GET. */
+ mmix_operands_get,
+
+ /* "spec_reg,$Z|Z"; PUT. */
+ mmix_operands_put,
+
+ /* Two registers, "$X,$Y". */
+ mmix_operands_set,
+
+ /* "$X,0"; SAVE. */
+ mmix_operands_save,
+
+ /* "0,$Z"; UNSAVE. */
+ mmix_operands_unsave,
+
+ /* "X,Y,Z"; like SWYM or TRAP. Zero (or 1 if GNU syntax) to three
+ operands, interpreted as 0; XYZ; X, YZ and X, Y, Z. */
+ mmix_operands_xyz_opt,
+
+ /* Just "Z", like RESUME. Unless GNU syntax, the operand can be omitted
+ and will then be assumed zero. */
+ mmix_operands_resume,
+
+ /* These are specials to handle that pseudo-directives are specified
+ like ordinary insns when being mmixal-compatible. They signify the
+ specific pseudo-directive rather than the operands type. */
+
+ /* LOC. */
+ mmix_operands_loc,
+
+ /* PREFIX. */
+ mmix_operands_prefix,
+
+ /* BYTE. */
+ mmix_operands_byte,
+
+ /* WYDE. */
+ mmix_operands_wyde,
+
+ /* TETRA. */
+ mmix_operands_tetra,
+
+ /* OCTA. */
+ mmix_operands_octa,
+
+ /* LOCAL. */
+ mmix_operands_local,
+
+ /* BSPEC. */
+ mmix_operands_bspec,
+
+ /* ESPEC. */
+ mmix_operands_espec,
+ };
+
+struct mmix_opcode
+ {
+ const char *name;
+ unsigned long match;
+ unsigned long lose;
+ enum mmix_operands_type operands;
+
+ /* This is used by the disassembly function. */
+ enum mmix_insn_type type;
+ };
+
+/* Declare the actual tables. */
+extern const struct mmix_opcode mmix_opcodes[];
+
+/* This one is terminated with an entry with a NULL name. */
+extern const struct mmix_spec_reg mmix_spec_regs[];
+
+/* Some insn values we use when padding and synthesizing address loads. */
+#define IMM_OFFSET_BIT 1
+#define COND_INV_BIT 0x8
+#define PRED_INV_BIT 0x10
+
+#define PUSHGO_INSN_BYTE 0xbe
+#define GO_INSN_BYTE 0x9e
+#define SETL_INSN_BYTE 0xe3
+#define INCML_INSN_BYTE 0xe6
+#define INCMH_INSN_BYTE 0xe5
+#define INCH_INSN_BYTE 0xe4
+#define SWYM_INSN_BYTE 0xfd
+
+/* We can have 256 - 32 (local registers) - 1 ($255 is not allocatable)
+ global registers. */
+#define MAX_GREGS 223