diff options
author | Nick Clifton <nickc@redhat.com> | 2002-01-31 17:33:08 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2002-01-31 17:33:08 +0000 |
commit | 3b16e843f2a75ccf8e7ecc5102e1217a122a05ad (patch) | |
tree | 683e5fc887a3f4f43c06e85a8e1f6c68c0a63f92 /include | |
parent | 6d9c411afd0301f0262ff63d6dc59dac38f58e63 (diff) | |
download | gdb-3b16e843f2a75ccf8e7ecc5102e1217a122a05ad.zip gdb-3b16e843f2a75ccf8e7ecc5102e1217a122a05ad.tar.gz gdb-3b16e843f2a75ccf8e7ecc5102e1217a122a05ad.tar.bz2 |
Add support for OpenRISC 32-bit embedded processor
Diffstat (limited to 'include')
-rw-r--r-- | include/ChangeLog | 32 | ||||
-rw-r--r-- | include/coff/ChangeLog | 9 | ||||
-rw-r--r-- | include/coff/or32.h | 287 | ||||
-rw-r--r-- | include/dis-asm.h | 4 | ||||
-rw-r--r-- | include/elf/ChangeLog | 32 | ||||
-rw-r--r-- | include/elf/common.h | 3 | ||||
-rw-r--r-- | include/elf/or32.h | 62 | ||||
-rw-r--r-- | include/opcode/ChangeLog | 19 | ||||
-rw-r--r-- | include/opcode/or32.h | 188 |
9 files changed, 600 insertions, 36 deletions
diff --git a/include/ChangeLog b/include/ChangeLog index a21e0c7..fc8c94e 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,6 +1,6 @@ -2002-01-28 Jason Merrill <jason@redhat.com> +2002-01-31 Ivan Guzvinec <ivang@opencores.org> - * elf/dwarf2.h: Sync with gcc version. + * dis-asm.h : Add support for or32 targets 2002-01-28 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> @@ -10,11 +10,6 @@ * cgen.h (BFD_VERSION): Use BFD_VERSION_DATE instead. -2002-01-15 Richard Earnshaw <rearnsha@arm.com> - - * coff/arm.h (F_VFP_FLOAT): Define. - * elf/arm.h (F_VFP_FLOAT, EF_ARM_VFP_FLOAT): Define. - 2001-12-14 Nick Clifton <nickc@cambridge.redhat.com> * dis-asm.h (INIT_DISASSEMBLE_INFO_NO_ARCH): Initialise the @@ -22,7 +17,6 @@ 2001-12-13 Jakub Jelinek <jakub@redhat.com> - * elf/common.h (PT_GNU_EH_FRAME): Define. * bfdlink.h (struct bfd_link_info): Add eh_frame_hdr field. 2001-12-07 Geoffrey Keating <geoffk@redhat.com> @@ -48,7 +42,7 @@ 2001-10-24 Neil Booth <neil@daikokuya.demon.co.uk> - * include/safe-ctype.h (_sch_isbasic, IS_ISOBASIC): New. + * safe-ctype.h (_sch_isbasic, IS_ISOBASIC): New. 2001-10-22 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> @@ -160,12 +154,6 @@ * libiberty.h (lbasename): Change function declaration to return a const char pointer. -2001-08-10 Richard Sandiford <rsandifo@redhat.com> - - * opcode/mips.h (INSN_GP32): Remove. - (OPCODE_IS_MEMBER): Remove gp32 parameter. - (M_MOVE): New macro identifier. - 2001-08-02 Mark Kettenis <kettenis@gnu.org> * xregex.h (_REGEX_RE_COMP): Define. @@ -177,19 +165,10 @@ * bfdlink.h (struct bfd_link_info): add new boolean field pei386_auto_import. -2001-08-01 Aldy Hernandez <aldyh@redhat.com> - - * opcode/mips.h (INSN_ISA_MASK): Nuke bits 12-15. - 2001-07-18 Andreas Jaeger <aj@suse.de> * xregex2.h: Place under LGPL version 2.1. -2001-07-12 Jeff Johnston <jjohnstn@redhat.com> - - * opcode/cgen.h (CGEN_INSN): Add regex support. - (build_insn_regex): Declare. - 2001-07-10 Jeff Johnston <jjohnstn@redhat.com> * xregex.h: New file to support libiberty regex. @@ -207,11 +186,6 @@ * ansidecl.h (NULL_PTR): Delete. -2001-05-11 Jakub Jelinek <jakub@redhat.com> - - * elf/ia64.h (ELF_STRING_ia64_unwind_once): Define. - (ELF_STRING_ia64_unwind_info_once): Define. - 2001-05-07 Zack Weinberg <zackw@stanford.edu> * demangle.h: Use PARAMS for all prototypes. diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index b8882bc..7aced13 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,7 @@ +2002-01-31 Ivan Guzvinec <ivang@opencores.org> + + * or32.h: New file. + 2001-12-24 Tom Rix <trix@redhat.com> * xcoff.h (xcoff_big_format_p): Make <bigaf> the default archive @@ -5,7 +9,6 @@ (XCOFFARMAG_ELEMENT_SIZE, XCOFFARMAGBIG_ELEMENT_SIZE): Define for archive header ascii elements. - 2001-12-17 Tom Rix <trix@redhat.com> * xcoff.h : Add .except and .typchk section string and styp flags. @@ -15,6 +18,10 @@ * xcoff.h : Clean up formatting. +2002-01-15 Richard Earnshaw <rearnsha@arm.com> + + * arm.h (F_VFP_FLOAT): Define. + 2001-11-11 Timothy Wall <twall@alum.mit.edu> * ti.h: Move arch-specific stuff from here... diff --git a/include/coff/or32.h b/include/coff/or32.h new file mode 100644 index 0000000..c2797aa --- /dev/null +++ b/include/coff/or32.h @@ -0,0 +1,287 @@ +/* COFF specification for OpenRISC 1000. + Copyright (C) 1993-2000, 2002 Free Software Foundation, Inc. + Contributed by David Wood @ New York University. + Modified by Johan Rydberg, <johan.rydberg@netinsight.se> + + 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. */ + +#ifndef OR32 +# define OR32 +#endif + +/* File Header and related definitions. */ +struct external_filehdr +{ + char f_magic[2]; /* magic number */ + char f_nscns[2]; /* number of sections */ + char f_timdat[4]; /* time & date stamp */ + char f_symptr[4]; /* file pointer to symtab */ + char f_nsyms[4]; /* number of symtab entries */ + char f_opthdr[2]; /* sizeof(optional hdr) */ + char f_flags[2]; /* flags */ +}; + +#define FILHDR struct external_filehdr +#define FILHSZ 20 + +/* Magic numbers for OpenRISC 1000. As it is know we use the + numbers for Am29000. + + (AT&T will assign the "real" magic number). */ +#define SIPFBOMAGIC 0572 /* Am29000 (Byte 0 is MSB). */ +#define SIPRBOMAGIC 0573 /* Am29000 (Byte 0 is LSB). */ + +#define OR32_MAGIC_BIG SIPFBOMAGIC +#define OR32_MAGIC_LITTLE SIPRBOMAGIC +#define OR32BADMAG(x) (((x).f_magic!=OR32_MAGIC_BIG) && \ + ((x).f_magic!=OR32_MAGIC_LITTLE)) + +#define OMAGIC OR32_MAGIC_BIG + +/* Optional (a.out) header. */ +typedef struct external_aouthdr +{ + char magic[2]; /* type of file */ + char vstamp[2]; /* version stamp */ + char tsize[4]; /* text size in bytes, padded to FW bdry */ + char dsize[4]; /* initialized data " " */ + char bsize[4]; /* uninitialized data " " */ + char entry[4]; /* entry pt. */ + char text_start[4]; /* base of text used for this file */ + char data_start[4]; /* base of data used for this file */ +} AOUTHDR; + +#define AOUTSZ 28 +#define AOUTHDRSZ 28 + +/* aouthdr magic numbers. */ +#define NMAGIC 0410 /* separate i/d executable. */ +#define SHMAGIC 0406 /* NYU/Ultra3 shared data executable + (writable text). */ + +#define _ETEXT "_etext" + +/* Section header and related definitions. */ +struct external_scnhdr +{ + char s_name[8]; /* section name */ + char s_paddr[4]; /* physical address, aliased s_nlib */ + char s_vaddr[4]; /* virtual address */ + char s_size[4]; /* section size */ + char s_scnptr[4]; /* file ptr to raw data for section */ + char s_relptr[4]; /* file ptr to relocation */ + char s_lnnoptr[4]; /* file ptr to line numbers */ + char s_nreloc[2]; /* number of relocation entries */ + char s_nlnno[2]; /* number of line number entries */ + char s_flags[4]; /* flags */ +}; + +#define SCNHDR struct external_scnhdr +#define SCNHSZ 40 + +/* Names of "special" sections: */ +#define _TEXT ".text" +#define _DATA ".data" +#define _BSS ".bss" +#define _LIT ".lit" + +/* Section types - with additional section type for global + registers which will be relocatable for the OpenRISC 1000. + + In instances where it is necessary for a linker to produce an + output file which contains text or data not based at virtual + address 0, e.g. for a ROM, then the linker should accept + address base information as command input and use PAD sections + to skip over unused addresses. */ +#define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */ +#define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */ +#define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */ + +/* Relocation information declaration and related definitions: */ +struct external_reloc +{ + char r_vaddr[4]; /* (virtual) address of reference */ + char r_symndx[4]; /* index into symbol table */ + char r_type[2]; /* relocation type */ +}; + +#define RELOC struct external_reloc +#define RELSZ 10 /* sizeof (RELOC) */ + +/* Relocation types for the OpenRISC 1000: */ + +#define R_ABS 0 /* reference is absolute */ +#define R_IREL 030 /* instruction relative (jmp/call) */ +#define R_IABS 031 /* instruction absolute (jmp/call) */ +#define R_ILOHALF 032 /* instruction low half (const) */ +#define R_IHIHALF 033 /* instruction high half (consth) part 1 */ +#define R_IHCONST 034 /* instruction high half (consth) part 2 */ + /* constant offset of R_IHIHALF relocation */ +#define R_BYTE 035 /* relocatable byte value */ +#define R_HWORD 036 /* relocatable halfword value */ +#define R_WORD 037 /* relocatable word value */ + +#define R_IGLBLRC 040 /* instruction global register RC */ +#define R_IGLBLRA 041 /* instruction global register RA */ +#define R_IGLBLRB 042 /* instruction global register RB */ + +/* + NOTE: + All the "I" forms refer to 29000 instruction formats. The linker is + expected to know how the numeric information is split and/or aligned + within the instruction word(s). R_BYTE works for instructions, too. + + If the parameter to a CONSTH instruction is a relocatable type, two + relocation records are written. The first has an r_type of R_IHIHALF + (33 octal) and a normal r_vaddr and r_symndx. The second relocation + record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which + is redundant), and an r_symndx containing the 32-bit constant offset + to the relocation instead of the actual symbol table index. This + second record is always written, even if the constant offset is zero. + The constant fields of the instruction are set to zero. */ + +/* Line number entry declaration and related definitions: */ +struct external_lineno +{ + union + { + char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ + char l_paddr[4]; /* (physical) address of line number */ + } + l_addr; + + char l_lnno[2]; /* line number */ +}; + +#define LINENO struct external_lineno +#define LINESZ 6 /* sizeof (LINENO) */ + +/* Symbol entry declaration and related definitions: */ +#define E_SYMNMLEN 8 /* Number of characters in a symbol name */ + +struct external_syment +{ + union + { + char e_name[E_SYMNMLEN]; + struct + { + char e_zeroes[4]; + char e_offset[4]; + } + e; + } + e; + + char e_value[4]; + char e_scnum[2]; + char e_type[2]; + char e_sclass[1]; + char e_numaux[1]; +}; + +#define SYMENT struct external_syment +#define SYMESZ 18 + +/* Storage class definitions - new classes for global registers: */ +#define C_GLBLREG 19 /* global register */ +#define C_EXTREG 20 /* external global register */ +#define C_DEFREG 21 /* ext. def. of global register */ + +/* Derived symbol mask/shifts: */ +#define N_BTMASK (0xf) +#define N_BTSHFT (4) +#define N_TMASK (0x30) +#define N_TSHIFT (2) + +/* Auxiliary symbol table entry declaration and related + definitions. */ +#define E_FILNMLEN 14 /* # characters in a file name */ +#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ + +union external_auxent +{ + struct + { + char x_tagndx[4]; /* str, un, or enum tag indx */ + union + { + struct + { + char x_lnno[2]; /* declaration line number */ + char x_size[2]; /* str/union/array size */ + } + x_lnsz; + + char x_fsize[4]; /* size of function */ + } + x_misc; + + union + { + struct /* if ISFCN, tag, or .bb */ + { + char x_lnnoptr[4]; /* ptr to fcn line # */ + char x_endndx[4]; /* entry ndx past block end */ + } + x_fcn; + + struct /* if ISARY, up to 4 dimen. */ + { + char x_dimen[E_DIMNUM][2]; + } + x_ary; + } + x_fcnary; + + char x_tvndx[2]; /* tv index */ + } + x_sym; + + union + { + char x_fname[E_FILNMLEN]; + + struct + { + char x_zeroes[4]; + char x_offset[4]; + } + x_n; + } + x_file; + + struct + { + char x_scnlen[4]; /* section length */ + char x_nreloc[2]; /* # relocation entries */ + char x_nlinno[2]; /* # line numbers */ + } + x_scn; + + struct + { + char x_tvfill[4]; /* tv fill value */ + char x_tvlen[2]; /* length of .tv */ + char x_tvran[2][2]; /* tv range */ + } + x_tv; /* info about .tv section + (in auxent of symbol .tv)) */ +}; + +#define AUXENT union external_auxent +#define AUXESZ 18 diff --git a/include/dis-asm.h b/include/dis-asm.h index 4e16ed3..8cd848d 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -1,6 +1,6 @@ /* Interface between the opcode library and its callers. - Copyright 2001 Free Software Foundation, Inc. + Copyright 2001, 2002 Free Software Foundation, Inc. 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 @@ -212,6 +212,8 @@ 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_big_or32 PARAMS ((bfd_vma, disassemble_info*)); +extern int print_insn_little_or32 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*)); diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog index a0b4f71..10c05d8 100644 --- a/include/elf/ChangeLog +++ b/include/elf/ChangeLog @@ -1,7 +1,20 @@ +2002-01-31 Ivan Guzvinec <ivang@opencores.org> + + * or32.h: New file. + * common.h: Add support for or32 targets. + +2002-01-28 Jason Merrill <jason@redhat.com> + + * dwarf2.h: Sync with gcc version. + 2002-01-16 Alan Modra <amodra@bigpond.net.au> * ppc.h (DT_PPC64_GLINK): Define. +2002-01-15 Richard Earnshaw <rearnsha@arm.com> + + * arm.h (F_VFP_FLOAT, EF_ARM_VFP_FLOAT): Define. + 2002-01-09 Jason Thorpe <thorpej@wasabisystems.com> * common.h: Update copyright years. @@ -24,6 +37,10 @@ unsigned int. * common.h (SHN_BAD): Define. +2001-12-13 Jakub Jelinek <jakub@redhat.com> + + * elf/common.h (PT_GNU_EH_FRAME): Define. + 2001-12-11 Alan Modra <amodra@bigpond.net.au> * common.h (SHN_XINDEX): Comment typo fix. @@ -90,7 +107,7 @@ (E_H8_MACH_H8300, E_H8_MACH_H8300H, E_H8_MACH_H8300S): New machine types. -Tue Aug 26 23:32:34 2001 J"orn Rennecke <amylaar@redhat.com> +2001-08-26 J"orn Rennecke <amylaar@redhat.com> * h8.h: New file. @@ -118,6 +135,11 @@ Tue Aug 26 23:32:34 2001 J"orn Rennecke <amylaar@redhat.com> * common.h: Remove definition of EM_MIPS_RS4_BE. The constant was never in active use and is used otherwise by the ABI. +2001-05-11 Jakub Jelinek <jakub@redhat.com> + + * ia64.h (ELF_STRING_ia64_unwind_once): Define. + (ELF_STRING_ia64_unwind_info_once): Define. + 2001-05-07 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> * external.h: Fix typo. @@ -390,8 +412,8 @@ Tue Aug 26 23:32:34 2001 J"orn Rennecke <amylaar@redhat.com> (ELFOSABI_MODESTO): Defined. (ELFOSABI_OPENBSD): Likewise. -Fri Apr 21 13:20:53 2000 Richard Henderson <rth@cygnus.com> - David Mosberger <davidm@hpl.hp.com> +2000-04-21 Richard Henderson <rth@cygnus.com> + David Mosberger <davidm@hpl.hp.com> * ia64.h: New file. @@ -425,7 +447,7 @@ Fri Apr 21 13:20:53 2000 Richard Henderson <rth@cygnus.com> (PF_ARM_PI): Define. (PF_ARM_ABS): Define. -Wed Apr 5 22:08:59 2000 J"orn Rennecke <amylaar@cygnus.co.uk> +2000-04-05 J"orn Rennecke <amylaar@cygnus.co.uk> * sh.h (R_SH_LOOP_START, R_SH_LOOP_END): New RELOC_NUMBERs. @@ -454,7 +476,7 @@ Wed Apr 5 22:08:59 2000 J"orn Rennecke <amylaar@cygnus.co.uk> * common.h (ELFOSABI_LINUX): Define. -Thu Feb 17 00:18:33 2000 J"orn Rennecke <amylaar@cygnus.co.uk> +2000-02-17 J"orn Rennecke <amylaar@cygnus.co.uk> * sh.h: (EF_SH_MACH_MASK, EF_SH_UNKNOWN, EF_SH1, EF_SH2): New macros. (EF_SH3, EF_SH_HAS_DSP, EF_SH_DSP, EF_SH3_DSP): Likewise. diff --git a/include/elf/common.h b/include/elf/common.h index 289d3f2..d6e45fc 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -199,6 +199,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Old version of PowerPC, this should be removed shortly. */ #define EM_PPC_OLD 17 +/* (Depreciated) Temporary number for the OpenRISC processor. */ +#define EM_OR32 0x8472 + /* Cygnus M32R ELF backend. Written in the absence of an ABI. */ #define EM_CYGNUS_M32R 0x9041 diff --git a/include/elf/or32.h b/include/elf/or32.h new file mode 100644 index 0000000..14884f3 --- /dev/null +++ b/include/elf/or32.h @@ -0,0 +1,62 @@ +/* OR1K ELF support for BFD. Derived from ppc.h. + Copyright (C) 2002 Free Software Foundation, Inc. + Contributed by Ivan Guzvinec <ivang@opencores.org> + + 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. */ + +#ifndef _ELF_OR1K_H +#define _ELF_OR1K_H + +#include "elf/reloc-macros.h" + +/* Relocations. */ +START_RELOC_NUMBERS (elf_or32_reloc_type) + RELOC_NUMBER (R_OR32_NONE, 0) + RELOC_NUMBER (R_OR32_32, 1) + RELOC_NUMBER (R_OR32_16, 2) + RELOC_NUMBER (R_OR32_8, 3) + RELOC_NUMBER (R_OR32_CONST, 4) + RELOC_NUMBER (R_OR32_CONSTH, 5) + RELOC_NUMBER (R_OR32_JUMPTARG, 6) + RELOC_NUMBER (R_OR32_GNU_VTENTRY, 7) + RELOC_NUMBER (R_OR32_GNU_VTINHERIT, 8) +END_RELOC_NUMBERS (R_OR32_max) + +/* Four bit OR32 machine type field. */ +#define EF_OR32_MACH 0x0000000f + +/* Various CPU types. */ +#define E_OR32_MACH_BASE 0x00000000 +#define E_OR32_MACH_UNUSED1 0x00000001 +#define E_OR32_MACH_UNUSED2 0x00000002 +#define E_OR32_MACH_UNUSED4 0x00000003 + +/* Processor specific section headers, sh_type field */ +#define SHT_ORDERED SHT_HIPROC /* Link editor is to sort the \ + entries in this section \ + based on the address \ + specified in the associated \ + symbol table entry. */ + +/* Processor specific section flags, sh_flags field */ +#define SHF_EXCLUDE 0x80000000 /* Link editor is to exclude \ + this section from executable \ + and shared objects that it \ + builds when those objects \ + are not to be furhter \ + relocated. */ +#endif /* _ELF_OR1K_H */ diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index dcde56b..3c367d3 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,7 @@ +2002-01-31 Ivan Guzvinec <ivang@opencores.org> + + * or32.h: New file. + 2002-01-22 Graydon Hoare <graydon@redhat.com> * cgen.h (CGEN_MAYBE_MULTI_IFLD): New structure. @@ -118,11 +122,26 @@ Mon Dec 31 16:45:41 2001 Jeffrey A Law (law@cygnus.com) * ppc.h: Revert 2001-08-08. +2001-08-10 Richard Sandiford <rsandifo@redhat.com> + + * mips.h (INSN_GP32): Remove. + (OPCODE_IS_MEMBER): Remove gp32 parameter. + (M_MOVE): New macro identifier. + 2001-08-08 Alan Modra <amodra@one.net.au> 1999-10-25 Torbjorn Granlund <tege@swox.com> * ppc.h (struct powerpc_operand): New field `reloc'. +2001-08-01 Aldy Hernandez <aldyh@redhat.com> + + * mips.h (INSN_ISA_MASK): Nuke bits 12-15. + +2001-07-12 Jeff Johnston <jjohnstn@redhat.com> + + * cgen.h (CGEN_INSN): Add regex support. + (build_insn_regex): Declare. + 2001-07-11 Frank Ch. Eigler <fche@redhat.com> * cgen.h (CGEN_MACH): Add insn_chunk_bitsize field. diff --git a/include/opcode/or32.h b/include/opcode/or32.h new file mode 100644 index 0000000..05c5326 --- /dev/null +++ b/include/opcode/or32.h @@ -0,0 +1,188 @@ +/* Table of opcodes for the OpenRISC 1000 ISA. + Copyright 2002 Free Software Foundation, Inc. + Contributed by Damjan Lampret (lampret@opencores.org). + + This file is part of or1k_gen_isa, or1ksim, GDB and GAS. + + 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. */ + +/* We treat all letters the same in encode/decode routines so + we need to assign some characteristics to them like signess etc. */ + +#ifndef OR32_H_ISA +#define OR32_H_ISA + +#define NUM_UNSIGNED (0) +#define NUM_SIGNED (1) + +#ifndef PARAMS +#define PARAMS(x) x +#endif + +#ifndef CONST +#define CONST const +#endif + +#define MAX_GPRS 32 +#define PAGE_SIZE 4096 +#undef __HALF_WORD_INSN__ + +#define OPERAND_DELIM (',') + +#define OR32_IF_DELAY (1) +#define OR32_W_FLAG (2) +#define OR32_R_FLAG (4) + +struct or32_letter +{ + char letter; + int sign; + /* int reloc; relocation per letter ?? */ +}; + +/* Main instruction specification array. */ +struct or32_opcode +{ + /* Name of the instruction. */ + char *name; + + /* A string of characters which describe the operands. + Valid characters are: + ,() Itself. Characters appears in the assembly code. + rA Register operand. + rB Register operand. + rD Register operand. + I An immediate operand, range -32768 to 32767. + J An immediate operand, range . (unused) + K An immediate operand, range 0 to 65535. + L An immediate operand, range 0 to 63. + M An immediate operand, range . (unused) + N An immediate operand, range -33554432 to 33554431. + O An immediate operand, range . (unused). */ + char *args; + + /* Opcode and operand encoding. */ + char *encoding; + void (*exec) PARAMS ((void)); + unsigned int flags; +}; + +#define OPTYPE_LAST (0x80000000) +#define OPTYPE_OP (0x40000000) +#define OPTYPE_REG (0x20000000) +#define OPTYPE_SIG (0x10000000) +#define OPTYPE_DIS (0x08000000) +#define OPTYPE_DST (0x04000000) +#define OPTYPE_SBIT (0x00001F00) +#define OPTYPE_SHR (0x0000001F) +#define OPTYPE_SBIT_SHR (8) + +/* MM: Data how to decode operands. */ +extern struct insn_op_struct +{ + unsigned long type; + unsigned long data; +} **op_start; + +#ifdef HAS_EXECUTION +extern void l_invalid PARAMS ((void)); +extern void l_sfne PARAMS ((void)); +extern void l_bf PARAMS ((void)); +extern void l_add PARAMS ((void)); +extern void l_sw PARAMS ((void)); +extern void l_sb PARAMS ((void)); +extern void l_sh PARAMS ((void)); +extern void l_lwz PARAMS ((void)); +extern void l_lbs PARAMS ((void)); +extern void l_lbz PARAMS ((void)); +extern void l_lhs PARAMS ((void)); +extern void l_lhz PARAMS ((void)); +extern void l_movhi PARAMS ((void)); +extern void l_and PARAMS ((void)); +extern void l_or PARAMS ((void)); +extern void l_xor PARAMS ((void)); +extern void l_sub PARAMS ((void)); +extern void l_mul PARAMS ((void)); +extern void l_div PARAMS ((void)); +extern void l_divu PARAMS ((void)); +extern void l_sll PARAMS ((void)); +extern void l_sra PARAMS ((void)); +extern void l_srl PARAMS ((void)); +extern void l_j PARAMS ((void)); +extern void l_jal PARAMS ((void)); +extern void l_jalr PARAMS ((void)); +extern void l_jr PARAMS ((void)); +extern void l_rfe PARAMS ((void)); +extern void l_nop PARAMS ((void)); +extern void l_bnf PARAMS ((void)); +extern void l_sfeq PARAMS ((void)); +extern void l_sfgts PARAMS ((void)); +extern void l_sfges PARAMS ((void)); +extern void l_sflts PARAMS ((void)); +extern void l_sfles PARAMS ((void)); +extern void l_sfgtu PARAMS ((void)); +extern void l_sfgeu PARAMS ((void)); +extern void l_sfltu PARAMS ((void)); +extern void l_sfleu PARAMS ((void)); +extern void l_mtspr PARAMS ((void)); +extern void l_mfspr PARAMS ((void)); +extern void l_sys PARAMS ((void)); +extern void l_trap PARAMS ((void)); /* CZ 21/06/01. */ +extern void l_macrc PARAMS ((void)); +extern void l_mac PARAMS ((void)); +extern void l_msb PARAMS ((void)); +extern void l_invalid PARAMS ((void)); +extern void l_cust1 PARAMS ((void)); +extern void l_cust2 PARAMS ((void)); +extern void l_cust3 PARAMS ((void)); +extern void l_cust4 PARAMS ((void)); +#endif +extern void l_none PARAMS ((void)); + +extern const struct or32_letter or32_letters[]; + +extern const struct or32_opcode or32_opcodes[]; + +extern const unsigned int or32_num_opcodes; + +/* Calculates instruction length in bytes. Always 4 for OR32. */ +extern int insn_len PARAMS ((int)); + +/* Is individual insn's operand signed or unsigned? */ +extern int letter_signed PARAMS ((char)); + +/* Number of letters in the individual lettered operand. */ +extern int letter_range PARAMS ((char)); + +/* MM: Returns index of given instruction name. */ +extern int insn_index PARAMS ((char *)); + +/* MM: Returns instruction name from index. */ +extern const char *insn_name PARAMS ((int)); + +/* MM: Constructs new FSM, based on or32_opcodes. */ +extern void build_automata PARAMS ((void)); + +/* MM: Destructs FSM. */ +extern void destruct_automata PARAMS ((void)); + +/* MM: Decodes instruction using FSM. Call build_automata first. */ +extern int insn_decode PARAMS ((unsigned int)); + +/* Disassemble one instruction from insn to disassemble. + Return the size of the instruction. */ +int disassemble_insn PARAMS ((unsigned long)); + +#endif |