199461Sobrien/* s390.h -- Header file for S390 opcode table 2218822Sdim Copyright 2000, 2001, 2003 Free Software Foundation, Inc. 399461Sobrien Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). 499461Sobrien 599461Sobrien This file is part of BFD, the Binary File Descriptor library. 699461Sobrien 799461Sobrien This program is free software; you can redistribute it and/or modify 899461Sobrien it under the terms of the GNU General Public License as published by 999461Sobrien the Free Software Foundation; either version 2 of the License, or 1099461Sobrien (at your option) any later version. 1199461Sobrien 1299461Sobrien This program is distributed in the hope that it will be useful, 1399461Sobrien but WITHOUT ANY WARRANTY; without even the implied warranty of 1499461Sobrien MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1599461Sobrien GNU General Public License for more details. 1699461Sobrien 1799461Sobrien You should have received a copy of the GNU General Public License 1899461Sobrien along with this program; if not, write to the Free Software 19218822Sdim Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 20218822Sdim 02110-1301, USA. */ 2199461Sobrien 2299461Sobrien#ifndef S390_H 2399461Sobrien#define S390_H 2499461Sobrien 2599461Sobrien/* List of instruction sets variations. */ 2699461Sobrien 27130561Sobrienenum s390_opcode_mode_val 2899461Sobrien { 2999461Sobrien S390_OPCODE_ESA = 0, 30130561Sobrien S390_OPCODE_ZARCH 3199461Sobrien }; 3299461Sobrien 33130561Sobrienenum s390_opcode_cpu_val 34130561Sobrien { 35130561Sobrien S390_OPCODE_G5 = 0, 36130561Sobrien S390_OPCODE_G6, 37130561Sobrien S390_OPCODE_Z900, 38218822Sdim S390_OPCODE_Z990, 39218822Sdim S390_OPCODE_Z9_109, 40218822Sdim S390_OPCODE_Z9_EC 41130561Sobrien }; 42130561Sobrien 4399461Sobrien/* The opcode table is an array of struct s390_opcode. */ 4499461Sobrien 4599461Sobrienstruct s390_opcode 4699461Sobrien { 4799461Sobrien /* The opcode name. */ 4899461Sobrien const char * name; 4999461Sobrien 5099461Sobrien /* The opcode itself. Those bits which will be filled in with 5199461Sobrien operands are zeroes. */ 5299461Sobrien unsigned char opcode[6]; 5399461Sobrien 5499461Sobrien /* The opcode mask. This is used by the disassembler. This is a 5599461Sobrien mask containing ones indicating those bits which must match the 5699461Sobrien opcode field, and zeroes indicating those bits which need not 5799461Sobrien match (and are presumably filled in by operands). */ 5899461Sobrien unsigned char mask[6]; 5999461Sobrien 6099461Sobrien /* The opcode length in bytes. */ 6199461Sobrien int oplen; 6299461Sobrien 6399461Sobrien /* An array of operand codes. Each code is an index into the 6499461Sobrien operand table. They appear in the order which the operands must 6599461Sobrien appear in assembly code, and are terminated by a zero. */ 6699461Sobrien unsigned char operands[6]; 6799461Sobrien 68130561Sobrien /* Bitmask of execution modes this opcode is available for. */ 69130561Sobrien unsigned int modes; 70130561Sobrien 71130561Sobrien /* First cpu this opcode is available for. */ 72130561Sobrien enum s390_opcode_cpu_val min_cpu; 7399461Sobrien }; 7499461Sobrien 7599461Sobrien/* The table itself is sorted by major opcode number, and is otherwise 7699461Sobrien in the order in which the disassembler should consider 7799461Sobrien instructions. */ 7899461Sobrienextern const struct s390_opcode s390_opcodes[]; 7999461Sobrienextern const int s390_num_opcodes; 8099461Sobrien 8199461Sobrien/* A opcode format table for the .insn pseudo mnemonic. */ 8299461Sobrienextern const struct s390_opcode s390_opformats[]; 8399461Sobrienextern const int s390_num_opformats; 8499461Sobrien 8599461Sobrien/* Values defined for the flags field of a struct powerpc_opcode. */ 8699461Sobrien 8799461Sobrien/* The operands table is an array of struct s390_operand. */ 8899461Sobrien 8999461Sobrienstruct s390_operand 9099461Sobrien { 9199461Sobrien /* The number of bits in the operand. */ 9299461Sobrien int bits; 9399461Sobrien 9499461Sobrien /* How far the operand is left shifted in the instruction. */ 9599461Sobrien int shift; 9699461Sobrien 9799461Sobrien /* One bit syntax flags. */ 9899461Sobrien unsigned long flags; 9999461Sobrien }; 10099461Sobrien 10199461Sobrien/* Elements in the table are retrieved by indexing with values from 10299461Sobrien the operands field of the powerpc_opcodes table. */ 10399461Sobrien 10499461Sobrienextern const struct s390_operand s390_operands[]; 10599461Sobrien 10699461Sobrien/* Values defined for the flags field of a struct s390_operand. */ 10799461Sobrien 10899461Sobrien/* This operand names a register. The disassembler uses this to print 10999461Sobrien register names with a leading 'r'. */ 11099461Sobrien#define S390_OPERAND_GPR 0x1 11199461Sobrien 11299461Sobrien/* This operand names a floating point register. The disassembler 11399461Sobrien prints these with a leading 'f'. */ 11499461Sobrien#define S390_OPERAND_FPR 0x2 11599461Sobrien 11699461Sobrien/* This operand names an access register. The disassembler 11799461Sobrien prints these with a leading 'a'. */ 11899461Sobrien#define S390_OPERAND_AR 0x4 11999461Sobrien 12099461Sobrien/* This operand names a control register. The disassembler 12199461Sobrien prints these with a leading 'c'. */ 12299461Sobrien#define S390_OPERAND_CR 0x8 12399461Sobrien 12499461Sobrien/* This operand is a displacement. */ 12599461Sobrien#define S390_OPERAND_DISP 0x10 12699461Sobrien 12799461Sobrien/* This operand names a base register. */ 12899461Sobrien#define S390_OPERAND_BASE 0x20 12999461Sobrien 13099461Sobrien/* This operand names an index register, it can be skipped. */ 13199461Sobrien#define S390_OPERAND_INDEX 0x40 13299461Sobrien 13399461Sobrien/* This operand is a relative branch displacement. The disassembler 13499461Sobrien prints these symbolically if possible. */ 13599461Sobrien#define S390_OPERAND_PCREL 0x80 13699461Sobrien 13799461Sobrien/* This operand takes signed values. */ 13899461Sobrien#define S390_OPERAND_SIGNED 0x100 13999461Sobrien 14099461Sobrien/* This operand is a length. */ 14199461Sobrien#define S390_OPERAND_LENGTH 0x200 14299461Sobrien 143218822Sdim/* This operand is optional. Only a single operand at the end of 144218822Sdim the instruction may be optional. */ 145218822Sdim#define S390_OPERAND_OPTIONAL 0x400 146218822Sdim 147218822Sdim #endif /* S390_H */ 148