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