Commit | Line | Data |
---|---|---|
a85d7ed0 | 1 | /* s390.h -- Header file for S390 opcode table |
4f1d9bd8 | 2 | Copyright 2000, 2001 Free Software Foundation, Inc. |
a85d7ed0 NC |
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 2 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., 59 Temple Place - Suite 330, Boston, MA | |
20 | 02111-1307, USA. */ | |
21 | ||
22 | #ifndef S390_H | |
23 | #define S390_H | |
24 | ||
25 | /* List of instruction sets variations. */ | |
26 | ||
1bd490c4 | 27 | enum s390_opcode_mode_val |
a85d7ed0 NC |
28 | { |
29 | S390_OPCODE_ESA = 0, | |
1bd490c4 MS |
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 | |
a85d7ed0 NC |
38 | }; |
39 | ||
40 | /* The opcode table is an array of struct s390_opcode. */ | |
41 | ||
42 | struct s390_opcode | |
43 | { | |
44 | /* The opcode name. */ | |
45 | const char * name; | |
46 | ||
47 | /* The opcode itself. Those bits which will be filled in with | |
48 | operands are zeroes. */ | |
49 | unsigned char opcode[6]; | |
50 | ||
51 | /* The opcode mask. This is used by the disassembler. This is a | |
52 | mask containing ones indicating those bits which must match the | |
53 | opcode field, and zeroes indicating those bits which need not | |
54 | match (and are presumably filled in by operands). */ | |
55 | unsigned char mask[6]; | |
56 | ||
57 | /* The opcode length in bytes. */ | |
58 | int oplen; | |
59 | ||
60 | /* An array of operand codes. Each code is an index into the | |
61 | operand table. They appear in the order which the operands must | |
62 | appear in assembly code, and are terminated by a zero. */ | |
63 | unsigned char operands[6]; | |
64 | ||
1bd490c4 MS |
65 | /* Bitmask of execution modes this opcode is available for. */ |
66 | unsigned int modes; | |
67 | ||
68 | /* First cpu this opcode is available for. */ | |
69 | enum s390_opcode_cpu_val min_cpu; | |
a85d7ed0 NC |
70 | }; |
71 | ||
72 | /* The table itself is sorted by major opcode number, and is otherwise | |
73 | in the order in which the disassembler should consider | |
74 | instructions. */ | |
75 | extern const struct s390_opcode s390_opcodes[]; | |
76 | extern const int s390_num_opcodes; | |
77 | ||
78 | /* A opcode format table for the .insn pseudo mnemonic. */ | |
79 | extern const struct s390_opcode s390_opformats[]; | |
80 | extern const int s390_num_opformats; | |
81 | ||
82 | /* Values defined for the flags field of a struct powerpc_opcode. */ | |
83 | ||
84 | /* The operands table is an array of struct s390_operand. */ | |
85 | ||
86 | struct s390_operand | |
87 | { | |
88 | /* The number of bits in the operand. */ | |
89 | int bits; | |
90 | ||
91 | /* How far the operand is left shifted in the instruction. */ | |
92 | int shift; | |
93 | ||
94 | /* One bit syntax flags. */ | |
95 | unsigned long flags; | |
96 | }; | |
97 | ||
98 | /* Elements in the table are retrieved by indexing with values from | |
99 | the operands field of the powerpc_opcodes table. */ | |
100 | ||
101 | extern const struct s390_operand s390_operands[]; | |
102 | ||
103 | /* Values defined for the flags field of a struct s390_operand. */ | |
104 | ||
105 | /* This operand names a register. The disassembler uses this to print | |
106 | register names with a leading 'r'. */ | |
107 | #define S390_OPERAND_GPR 0x1 | |
108 | ||
109 | /* This operand names a floating point register. The disassembler | |
110 | prints these with a leading 'f'. */ | |
111 | #define S390_OPERAND_FPR 0x2 | |
112 | ||
113 | /* This operand names an access register. The disassembler | |
114 | prints these with a leading 'a'. */ | |
115 | #define S390_OPERAND_AR 0x4 | |
116 | ||
117 | /* This operand names a control register. The disassembler | |
118 | prints these with a leading 'c'. */ | |
119 | #define S390_OPERAND_CR 0x8 | |
120 | ||
121 | /* This operand is a displacement. */ | |
122 | #define S390_OPERAND_DISP 0x10 | |
123 | ||
124 | /* This operand names a base register. */ | |
125 | #define S390_OPERAND_BASE 0x20 | |
126 | ||
127 | /* This operand names an index register, it can be skipped. */ | |
128 | #define S390_OPERAND_INDEX 0x40 | |
129 | ||
130 | /* This operand is a relative branch displacement. The disassembler | |
131 | prints these symbolically if possible. */ | |
132 | #define S390_OPERAND_PCREL 0x80 | |
133 | ||
134 | /* This operand takes signed values. */ | |
135 | #define S390_OPERAND_SIGNED 0x100 | |
136 | ||
137 | /* This operand is a length. */ | |
138 | #define S390_OPERAND_LENGTH 0x200 | |
139 | ||
140 | #endif /* S390_H */ |