Rev 5191 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5191 | serge | 1 | /* s390.h -- Header file for S390 opcode table |
6324 | serge | 2 | Copyright (C) 2000-2015 Free Software Foundation, Inc. |
5191 | serge | 3 | Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
4 | |||
5 | This file is part of BFD, the Binary File Descriptor library. |
||
6 | |||
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 3 of the License, or |
||
10 | (at your option) any later version. |
||
11 | |||
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. |
||
16 | |||
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. */ |
||
21 | |||
22 | #ifndef S390_H |
||
23 | #define S390_H |
||
24 | |||
25 | /* List of instruction sets variations. */ |
||
26 | |||
27 | enum s390_opcode_mode_val |
||
28 | { |
||
29 | S390_OPCODE_ESA = 0, |
||
30 | S390_OPCODE_ZARCH |
||
31 | }; |
||
32 | |||
33 | enum s390_opcode_cpu_val |
||
34 | { |
||
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, |
||
42 | S390_OPCODE_Z196, |
||
43 | S390_OPCODE_ZEC12, |
||
6324 | serge | 44 | S390_OPCODE_Z13, |
5191 | serge | 45 | S390_OPCODE_MAXCPU |
46 | }; |
||
47 | |||
6324 | serge | 48 | /* Instruction specific flags. */ |
49 | #define S390_INSTR_FLAG_OPTPARM 0x1 |
||
50 | #define S390_INSTR_FLAG_HTM 0x2 |
||
51 | #define S390_INSTR_FLAG_VX 0x4 |
||
52 | #define S390_INSTR_FLAG_FACILITY_MASK 0x6 |
||
53 | |||
5191 | serge | 54 | /* The opcode table is an array of struct s390_opcode. */ |
55 | |||
56 | struct s390_opcode |
||
57 | { |
||
58 | /* The opcode name. */ |
||
59 | const char * name; |
||
60 | |||
61 | /* The opcode itself. Those bits which will be filled in with |
||
62 | operands are zeroes. */ |
||
63 | unsigned char opcode[6]; |
||
64 | |||
65 | /* The opcode mask. This is used by the disassembler. This is a |
||
66 | mask containing ones indicating those bits which must match the |
||
67 | opcode field, and zeroes indicating those bits which need not |
||
68 | match (and are presumably filled in by operands). */ |
||
69 | unsigned char mask[6]; |
||
70 | |||
71 | /* The opcode length in bytes. */ |
||
72 | int oplen; |
||
73 | |||
74 | /* An array of operand codes. Each code is an index into the |
||
75 | operand table. They appear in the order which the operands must |
||
76 | appear in assembly code, and are terminated by a zero. */ |
||
77 | unsigned char operands[6]; |
||
78 | |||
79 | /* Bitmask of execution modes this opcode is available for. */ |
||
80 | unsigned int modes; |
||
81 | |||
82 | /* First cpu this opcode is available for. */ |
||
83 | enum s390_opcode_cpu_val min_cpu; |
||
6324 | serge | 84 | |
85 | /* Instruction specific flags. */ |
||
86 | unsigned int flags; |
||
5191 | serge | 87 | }; |
88 | |||
89 | /* The table itself is sorted by major opcode number, and is otherwise |
||
90 | in the order in which the disassembler should consider |
||
91 | instructions. */ |
||
92 | extern const struct s390_opcode s390_opcodes[]; |
||
93 | extern const int s390_num_opcodes; |
||
94 | |||
95 | /* A opcode format table for the .insn pseudo mnemonic. */ |
||
96 | extern const struct s390_opcode s390_opformats[]; |
||
97 | extern const int s390_num_opformats; |
||
98 | |||
6324 | serge | 99 | /* Values defined for the flags field of a struct s390_opcode. */ |
5191 | serge | 100 | |
101 | /* The operands table is an array of struct s390_operand. */ |
||
102 | |||
103 | struct s390_operand |
||
104 | { |
||
105 | /* The number of bits in the operand. */ |
||
106 | int bits; |
||
107 | |||
108 | /* How far the operand is left shifted in the instruction. */ |
||
109 | int shift; |
||
110 | |||
111 | /* One bit syntax flags. */ |
||
112 | unsigned long flags; |
||
113 | }; |
||
114 | |||
115 | /* Elements in the table are retrieved by indexing with values from |
||
6324 | serge | 116 | the operands field of the s390_opcodes table. */ |
5191 | serge | 117 | |
118 | extern const struct s390_operand s390_operands[]; |
||
119 | |||
120 | /* Values defined for the flags field of a struct s390_operand. */ |
||
121 | |||
122 | /* This operand names a register. The disassembler uses this to print |
||
123 | register names with a leading 'r'. */ |
||
124 | #define S390_OPERAND_GPR 0x1 |
||
125 | |||
126 | /* This operand names a floating point register. The disassembler |
||
127 | prints these with a leading 'f'. */ |
||
128 | #define S390_OPERAND_FPR 0x2 |
||
129 | |||
130 | /* This operand names an access register. The disassembler |
||
131 | prints these with a leading 'a'. */ |
||
132 | #define S390_OPERAND_AR 0x4 |
||
133 | |||
134 | /* This operand names a control register. The disassembler |
||
135 | prints these with a leading 'c'. */ |
||
136 | #define S390_OPERAND_CR 0x8 |
||
137 | |||
138 | /* This operand is a displacement. */ |
||
139 | #define S390_OPERAND_DISP 0x10 |
||
140 | |||
141 | /* This operand names a base register. */ |
||
142 | #define S390_OPERAND_BASE 0x20 |
||
143 | |||
144 | /* This operand names an index register, it can be skipped. */ |
||
145 | #define S390_OPERAND_INDEX 0x40 |
||
146 | |||
147 | /* This operand is a relative branch displacement. The disassembler |
||
148 | prints these symbolically if possible. */ |
||
149 | #define S390_OPERAND_PCREL 0x80 |
||
150 | |||
151 | /* This operand takes signed values. */ |
||
152 | #define S390_OPERAND_SIGNED 0x100 |
||
153 | |||
154 | /* This operand is a length. */ |
||
155 | #define S390_OPERAND_LENGTH 0x200 |
||
156 | |||
157 | /* This operand is optional. Only a single operand at the end of |
||
158 | the instruction may be optional. */ |
||
159 | #define S390_OPERAND_OPTIONAL 0x400 |
||
160 | |||
161 | /* The operand needs to be a valid GP or FP register pair. */ |
||
162 | #define S390_OPERAND_REG_PAIR 0x800 |
||
163 | |||
6324 | serge | 164 | /* This operand names a vector register. The disassembler uses this |
165 | to print register names with a leading 'v'. */ |
||
166 | #define S390_OPERAND_VR 0x1000 |
||
167 | |||
168 | #define S390_OPERAND_CP16 0x2000 |
||
169 | |||
170 | #define S390_OPERAND_OR1 0x4000 |
||
171 | #define S390_OPERAND_OR2 0x8000 |
||
172 | #define S390_OPERAND_OR8 0x10000 |
||
173 | |||
174 | #endif /* S390_H */ |