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