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