Back to index

cell-binutils  2.17cvs20070401
s390.h
Go to the documentation of this file.
00001 /* s390.h -- Header file for S390 opcode table
00002    Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
00003    Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
00004 
00005    This file is part of BFD, the Binary File Descriptor library.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
00020    02110-1301, USA.  */
00021 
00022 #ifndef S390_H
00023 #define S390_H
00024 
00025 /* List of instruction sets variations. */
00026 
00027 enum s390_opcode_mode_val
00028   {
00029     S390_OPCODE_ESA = 0,
00030     S390_OPCODE_ZARCH
00031   };
00032 
00033 enum s390_opcode_cpu_val
00034   {
00035     S390_OPCODE_G5 = 0,
00036     S390_OPCODE_G6,
00037     S390_OPCODE_Z900,
00038     S390_OPCODE_Z990,
00039     S390_OPCODE_Z9_109,
00040     S390_OPCODE_Z9_EC
00041   };
00042 
00043 /* The opcode table is an array of struct s390_opcode.  */
00044 
00045 struct s390_opcode
00046   {
00047     /* The opcode name.  */
00048     const char * name;
00049 
00050     /* The opcode itself.  Those bits which will be filled in with
00051        operands are zeroes.  */
00052     unsigned char opcode[6];
00053 
00054     /* The opcode mask.  This is used by the disassembler.  This is a
00055        mask containing ones indicating those bits which must match the
00056        opcode field, and zeroes indicating those bits which need not
00057        match (and are presumably filled in by operands).  */
00058     unsigned char mask[6];
00059 
00060     /* The opcode length in bytes. */
00061     int oplen;
00062 
00063     /* An array of operand codes.  Each code is an index into the
00064        operand table.  They appear in the order which the operands must
00065        appear in assembly code, and are terminated by a zero.  */
00066     unsigned char operands[6];
00067 
00068     /* Bitmask of execution modes this opcode is available for.  */
00069     unsigned int modes;
00070 
00071     /* First cpu this opcode is available for.  */
00072     enum s390_opcode_cpu_val min_cpu;
00073   };
00074 
00075 /* The table itself is sorted by major opcode number, and is otherwise
00076    in the order in which the disassembler should consider
00077    instructions.  */
00078 extern const struct s390_opcode s390_opcodes[];
00079 extern const int                s390_num_opcodes;
00080 
00081 /* A opcode format table for the .insn pseudo mnemonic.  */
00082 extern const struct s390_opcode s390_opformats[];
00083 extern const int                s390_num_opformats;
00084 
00085 /* Values defined for the flags field of a struct powerpc_opcode.  */
00086 
00087 /* The operands table is an array of struct s390_operand.  */
00088 
00089 struct s390_operand
00090   {
00091     /* The number of bits in the operand.  */
00092     int bits;
00093 
00094     /* How far the operand is left shifted in the instruction.  */
00095     int shift;
00096 
00097     /* One bit syntax flags.  */
00098     unsigned long flags;
00099   };
00100 
00101 /* Elements in the table are retrieved by indexing with values from
00102    the operands field of the powerpc_opcodes table.  */
00103 
00104 extern const struct s390_operand s390_operands[];
00105 
00106 /* Values defined for the flags field of a struct s390_operand.  */
00107 
00108 /* This operand names a register.  The disassembler uses this to print
00109    register names with a leading 'r'.  */
00110 #define S390_OPERAND_GPR 0x1
00111 
00112 /* This operand names a floating point register.  The disassembler
00113    prints these with a leading 'f'. */
00114 #define S390_OPERAND_FPR 0x2
00115 
00116 /* This operand names an access register.  The disassembler
00117    prints these with a leading 'a'.  */
00118 #define S390_OPERAND_AR 0x4
00119 
00120 /* This operand names a control register.  The disassembler
00121    prints these with a leading 'c'.  */
00122 #define S390_OPERAND_CR 0x8
00123 
00124 /* This operand is a displacement.  */
00125 #define S390_OPERAND_DISP 0x10
00126 
00127 /* This operand names a base register.  */
00128 #define S390_OPERAND_BASE 0x20
00129 
00130 /* This operand names an index register, it can be skipped.  */
00131 #define S390_OPERAND_INDEX 0x40
00132 
00133 /* This operand is a relative branch displacement.  The disassembler
00134    prints these symbolically if possible.  */
00135 #define S390_OPERAND_PCREL 0x80
00136 
00137 /* This operand takes signed values.  */
00138 #define S390_OPERAND_SIGNED 0x100
00139 
00140 /* This operand is a length.  */
00141 #define S390_OPERAND_LENGTH 0x200
00142 
00143 /* This operand is optional. Only a single operand at the end of
00144    the instruction may be optional.  */
00145 #define S390_OPERAND_OPTIONAL 0x400
00146 
00147        #endif /* S390_H */