1*3d8817e4Smiod /* s390.h -- Header file for S390 opcode table 2*3d8817e4Smiod Copyright 2000, 2001, 2003 Free Software Foundation, Inc. 3*3d8817e4Smiod Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). 4*3d8817e4Smiod 5*3d8817e4Smiod This file is part of BFD, the Binary File Descriptor library. 6*3d8817e4Smiod 7*3d8817e4Smiod This program is free software; you can redistribute it and/or modify 8*3d8817e4Smiod it under the terms of the GNU General Public License as published by 9*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or 10*3d8817e4Smiod (at your option) any later version. 11*3d8817e4Smiod 12*3d8817e4Smiod This program is distributed in the hope that it will be useful, 13*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of 14*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*3d8817e4Smiod GNU General Public License for more details. 16*3d8817e4Smiod 17*3d8817e4Smiod You should have received a copy of the GNU General Public License 18*3d8817e4Smiod along with this program; if not, write to the Free Software 19*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 20*3d8817e4Smiod 02110-1301, USA. */ 21*3d8817e4Smiod 22*3d8817e4Smiod #ifndef S390_H 23*3d8817e4Smiod #define S390_H 24*3d8817e4Smiod 25*3d8817e4Smiod /* List of instruction sets variations. */ 26*3d8817e4Smiod 27*3d8817e4Smiod enum s390_opcode_mode_val 28*3d8817e4Smiod { 29*3d8817e4Smiod S390_OPCODE_ESA = 0, 30*3d8817e4Smiod S390_OPCODE_ZARCH 31*3d8817e4Smiod }; 32*3d8817e4Smiod 33*3d8817e4Smiod enum s390_opcode_cpu_val 34*3d8817e4Smiod { 35*3d8817e4Smiod S390_OPCODE_G5 = 0, 36*3d8817e4Smiod S390_OPCODE_G6, 37*3d8817e4Smiod S390_OPCODE_Z900, 38*3d8817e4Smiod S390_OPCODE_Z990, 39*3d8817e4Smiod S390_OPCODE_Z9_109 40*3d8817e4Smiod }; 41*3d8817e4Smiod 42*3d8817e4Smiod /* The opcode table is an array of struct s390_opcode. */ 43*3d8817e4Smiod 44*3d8817e4Smiod struct s390_opcode 45*3d8817e4Smiod { 46*3d8817e4Smiod /* The opcode name. */ 47*3d8817e4Smiod const char * name; 48*3d8817e4Smiod 49*3d8817e4Smiod /* The opcode itself. Those bits which will be filled in with 50*3d8817e4Smiod operands are zeroes. */ 51*3d8817e4Smiod unsigned char opcode[6]; 52*3d8817e4Smiod 53*3d8817e4Smiod /* The opcode mask. This is used by the disassembler. This is a 54*3d8817e4Smiod mask containing ones indicating those bits which must match the 55*3d8817e4Smiod opcode field, and zeroes indicating those bits which need not 56*3d8817e4Smiod match (and are presumably filled in by operands). */ 57*3d8817e4Smiod unsigned char mask[6]; 58*3d8817e4Smiod 59*3d8817e4Smiod /* The opcode length in bytes. */ 60*3d8817e4Smiod int oplen; 61*3d8817e4Smiod 62*3d8817e4Smiod /* An array of operand codes. Each code is an index into the 63*3d8817e4Smiod operand table. They appear in the order which the operands must 64*3d8817e4Smiod appear in assembly code, and are terminated by a zero. */ 65*3d8817e4Smiod unsigned char operands[6]; 66*3d8817e4Smiod 67*3d8817e4Smiod /* Bitmask of execution modes this opcode is available for. */ 68*3d8817e4Smiod unsigned int modes; 69*3d8817e4Smiod 70*3d8817e4Smiod /* First cpu this opcode is available for. */ 71*3d8817e4Smiod enum s390_opcode_cpu_val min_cpu; 72*3d8817e4Smiod }; 73*3d8817e4Smiod 74*3d8817e4Smiod /* The table itself is sorted by major opcode number, and is otherwise 75*3d8817e4Smiod in the order in which the disassembler should consider 76*3d8817e4Smiod instructions. */ 77*3d8817e4Smiod extern const struct s390_opcode s390_opcodes[]; 78*3d8817e4Smiod extern const int s390_num_opcodes; 79*3d8817e4Smiod 80*3d8817e4Smiod /* A opcode format table for the .insn pseudo mnemonic. */ 81*3d8817e4Smiod extern const struct s390_opcode s390_opformats[]; 82*3d8817e4Smiod extern const int s390_num_opformats; 83*3d8817e4Smiod 84*3d8817e4Smiod /* Values defined for the flags field of a struct powerpc_opcode. */ 85*3d8817e4Smiod 86*3d8817e4Smiod /* The operands table is an array of struct s390_operand. */ 87*3d8817e4Smiod 88*3d8817e4Smiod struct s390_operand 89*3d8817e4Smiod { 90*3d8817e4Smiod /* The number of bits in the operand. */ 91*3d8817e4Smiod int bits; 92*3d8817e4Smiod 93*3d8817e4Smiod /* How far the operand is left shifted in the instruction. */ 94*3d8817e4Smiod int shift; 95*3d8817e4Smiod 96*3d8817e4Smiod /* One bit syntax flags. */ 97*3d8817e4Smiod unsigned long flags; 98*3d8817e4Smiod }; 99*3d8817e4Smiod 100*3d8817e4Smiod /* Elements in the table are retrieved by indexing with values from 101*3d8817e4Smiod the operands field of the powerpc_opcodes table. */ 102*3d8817e4Smiod 103*3d8817e4Smiod extern const struct s390_operand s390_operands[]; 104*3d8817e4Smiod 105*3d8817e4Smiod /* Values defined for the flags field of a struct s390_operand. */ 106*3d8817e4Smiod 107*3d8817e4Smiod /* This operand names a register. The disassembler uses this to print 108*3d8817e4Smiod register names with a leading 'r'. */ 109*3d8817e4Smiod #define S390_OPERAND_GPR 0x1 110*3d8817e4Smiod 111*3d8817e4Smiod /* This operand names a floating point register. The disassembler 112*3d8817e4Smiod prints these with a leading 'f'. */ 113*3d8817e4Smiod #define S390_OPERAND_FPR 0x2 114*3d8817e4Smiod 115*3d8817e4Smiod /* This operand names an access register. The disassembler 116*3d8817e4Smiod prints these with a leading 'a'. */ 117*3d8817e4Smiod #define S390_OPERAND_AR 0x4 118*3d8817e4Smiod 119*3d8817e4Smiod /* This operand names a control register. The disassembler 120*3d8817e4Smiod prints these with a leading 'c'. */ 121*3d8817e4Smiod #define S390_OPERAND_CR 0x8 122*3d8817e4Smiod 123*3d8817e4Smiod /* This operand is a displacement. */ 124*3d8817e4Smiod #define S390_OPERAND_DISP 0x10 125*3d8817e4Smiod 126*3d8817e4Smiod /* This operand names a base register. */ 127*3d8817e4Smiod #define S390_OPERAND_BASE 0x20 128*3d8817e4Smiod 129*3d8817e4Smiod /* This operand names an index register, it can be skipped. */ 130*3d8817e4Smiod #define S390_OPERAND_INDEX 0x40 131*3d8817e4Smiod 132*3d8817e4Smiod /* This operand is a relative branch displacement. The disassembler 133*3d8817e4Smiod prints these symbolically if possible. */ 134*3d8817e4Smiod #define S390_OPERAND_PCREL 0x80 135*3d8817e4Smiod 136*3d8817e4Smiod /* This operand takes signed values. */ 137*3d8817e4Smiod #define S390_OPERAND_SIGNED 0x100 138*3d8817e4Smiod 139*3d8817e4Smiod /* This operand is a length. */ 140*3d8817e4Smiod #define S390_OPERAND_LENGTH 0x200 141*3d8817e4Smiod 142*3d8817e4Smiod /* This operand is optional. Only a single operand at the end of 143*3d8817e4Smiod the instruction may be optional. */ 144*3d8817e4Smiod #define S390_OPERAND_OPTIONAL 0x400 145*3d8817e4Smiod 146*3d8817e4Smiod #endif /* S390_H */ 147