Revision 402ce448
b/s390-dis.c | ||
---|---|---|
1 |
/* opcodes/s390-dis.c revision 1.12 */ |
|
1 | 2 |
/* s390-dis.c -- Disassemble S390 instructions |
2 | 3 |
Copyright 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. |
3 | 4 |
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
... | ... | |
15 | 16 |
GNU General Public License for more details. |
16 | 17 |
|
17 | 18 |
You should have received a copy of the GNU General Public License |
18 |
along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
|
19 |
along with this program; if not, write to the Free Software |
|
20 |
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA |
|
21 |
02110-1301, USA. */ |
|
19 | 22 |
|
20 |
#include <stdio.h>
|
|
23 |
#include "qemu-common.h"
|
|
21 | 24 |
#include "dis-asm.h" |
22 | 25 |
|
26 |
/* include/opcode/s390.h revision 1.9 */ |
|
23 | 27 |
/* s390.h -- Header file for S390 opcode table |
24 | 28 |
Copyright 2000, 2001, 2003 Free Software Foundation, Inc. |
25 | 29 |
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
... | ... | |
37 | 41 |
GNU General Public License for more details. |
38 | 42 |
|
39 | 43 |
You should have received a copy of the GNU General Public License |
40 |
along with this program; if not, see <http://www.gnu.org/licenses/>. */ |
|
44 |
along with this program; if not, write to the Free Software |
|
45 |
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA |
|
46 |
02110-1301, USA. */ |
|
41 | 47 |
|
42 | 48 |
#ifndef S390_H |
43 | 49 |
#define S390_H |
... | ... | |
57 | 63 |
S390_OPCODE_Z900, |
58 | 64 |
S390_OPCODE_Z990, |
59 | 65 |
S390_OPCODE_Z9_109, |
60 |
S390_OPCODE_Z9_EC |
|
66 |
S390_OPCODE_Z9_EC, |
|
67 |
S390_OPCODE_Z10 |
|
61 | 68 |
}; |
62 | 69 |
|
63 | 70 |
/* The opcode table is an array of struct s390_opcode. */ |
... | ... | |
95 | 102 |
/* The table itself is sorted by major opcode number, and is otherwise |
96 | 103 |
in the order in which the disassembler should consider |
97 | 104 |
instructions. */ |
98 |
extern const struct s390_opcode s390_opcodes[]; |
|
99 |
extern const int s390_num_opcodes; |
|
105 |
/* QEMU: Mark these static. */ |
|
106 |
static const struct s390_opcode s390_opcodes[]; |
|
107 |
static const int s390_num_opcodes; |
|
100 | 108 |
|
101 | 109 |
/* A opcode format table for the .insn pseudo mnemonic. */ |
102 |
extern const struct s390_opcode s390_opformats[];
|
|
103 |
extern const int s390_num_opformats;
|
|
110 |
static const struct s390_opcode s390_opformats[];
|
|
111 |
static const int s390_num_opformats;
|
|
104 | 112 |
|
105 | 113 |
/* Values defined for the flags field of a struct powerpc_opcode. */ |
106 | 114 |
|
... | ... | |
121 | 129 |
/* Elements in the table are retrieved by indexing with values from |
122 | 130 |
the operands field of the powerpc_opcodes table. */ |
123 | 131 |
|
124 |
extern const struct s390_operand s390_operands[];
|
|
132 |
static const struct s390_operand s390_operands[];
|
|
125 | 133 |
|
126 | 134 |
/* Values defined for the flags field of a struct s390_operand. */ |
127 | 135 |
|
... | ... | |
164 | 172 |
the instruction may be optional. */ |
165 | 173 |
#define S390_OPERAND_OPTIONAL 0x400 |
166 | 174 |
|
167 |
#endif /* S390_H */ |
|
168 |
|
|
175 |
#endif /* S390_H */ |
|
169 | 176 |
|
170 | 177 |
static int init_flag = 0; |
171 | 178 |
static int opc_index[256]; |
172 |
static int current_arch_mask = 0; |
|
179 |
|
|
180 |
/* QEMU: We've disabled the architecture check below. */ |
|
181 |
/* static int current_arch_mask = 0; */ |
|
173 | 182 |
|
174 | 183 |
/* Set up index table for first opcode byte. */ |
175 | 184 |
|
... | ... | |
188 | 197 |
(opcode[1].opcode[0] == opcode->opcode[0])) |
189 | 198 |
opcode++; |
190 | 199 |
} |
191 |
// switch (info->mach) |
|
192 |
// { |
|
193 |
// case bfd_mach_s390_31: |
|
200 |
|
|
201 |
#ifdef QEMU_DISABLE |
|
202 |
switch (info->mach) |
|
203 |
{ |
|
204 |
case bfd_mach_s390_31: |
|
194 | 205 |
current_arch_mask = 1 << S390_OPCODE_ESA; |
195 |
// break; |
|
196 |
// case bfd_mach_s390_64: |
|
197 |
// current_arch_mask = 1 << S390_OPCODE_ZARCH; |
|
198 |
// break; |
|
199 |
// default: |
|
200 |
// abort (); |
|
201 |
// } |
|
206 |
break; |
|
207 |
case bfd_mach_s390_64: |
|
208 |
current_arch_mask = 1 << S390_OPCODE_ZARCH; |
|
209 |
break; |
|
210 |
default: |
|
211 |
abort (); |
|
212 |
} |
|
213 |
#endif /* QEMU_DISABLE */ |
|
214 |
|
|
202 | 215 |
init_flag = 1; |
203 | 216 |
} |
204 | 217 |
|
... | ... | |
297 | 310 |
const struct s390_operand *operand; |
298 | 311 |
const unsigned char *opindex; |
299 | 312 |
|
313 |
#ifdef QEMU_DISABLE |
|
300 | 314 |
/* Check architecture. */ |
301 | 315 |
if (!(opcode->modes & current_arch_mask)) |
302 | 316 |
continue; |
317 |
#endif /* QEMU_DISABLE */ |
|
318 |
|
|
303 | 319 |
/* Check signature of the opcode. */ |
304 | 320 |
if ((buffer[1] & opcode->mask[1]) != opcode->opcode[1] |
305 | 321 |
|| (buffer[2] & opcode->mask[2]) != opcode->opcode[2] |
... | ... | |
392 | 408 |
return 1; |
393 | 409 |
} |
394 | 410 |
} |
411 |
|
|
412 |
/* opcodes/s390-opc.c revision 1.16 */ |
|
395 | 413 |
/* s390-opc.c -- S390 opcode list |
396 | 414 |
Copyright 2000, 2001, 2003 Free Software Foundation, Inc. |
397 | 415 |
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com). |
... | ... | |
409 | 427 |
GNU General Public License for more details. |
410 | 428 |
|
411 | 429 |
You should have received a copy of the GNU General Public License |
412 |
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
|
413 |
|
|
414 |
#include <stdio.h>
|
|
430 |
along with this program; if not, write to the Free Software
|
|
431 |
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA |
|
432 |
02110-1301, USA. */
|
|
415 | 433 |
|
416 | 434 |
/* This file holds the S390 opcode table. The opcode table |
417 | 435 |
includes almost all of the extended instruction mnemonics. This |
... | ... | |
427 | 445 |
/* The operands table. |
428 | 446 |
The fields are bits, shift, insert, extract, flags. */ |
429 | 447 |
|
430 |
const struct s390_operand s390_operands[] = |
|
448 |
static const struct s390_operand s390_operands[] =
|
|
431 | 449 |
{ |
432 | 450 |
#define UNUSED 0 |
433 | 451 |
{ 0, 0, 0 }, /* Indicates the end of the operand list */ |
... | ... | |
739 | 757 |
|
740 | 758 |
/* The opcode formats table (blueprints for .insn pseudo mnemonic). */ |
741 | 759 |
|
742 |
const struct s390_opcode s390_opformats[] = |
|
760 |
static const struct s390_opcode s390_opformats[] =
|
|
743 | 761 |
{ |
744 | 762 |
{ "e", OP8(0x00LL), MASK_E, INSTR_E, 3, 0 }, |
745 | 763 |
{ "ri", OP8(0x00LL), MASK_RI_RI, INSTR_RI_RI, 3, 0 }, |
... | ... | |
765 | 783 |
{ "ssf", OP8(0x00LL), MASK_SSF_RRDRD, INSTR_SSF_RRDRD,3, 0 }, |
766 | 784 |
}; |
767 | 785 |
|
768 |
const int s390_num_opformats = |
|
786 |
static const int s390_num_opformats =
|
|
769 | 787 |
sizeof (s390_opformats) / sizeof (s390_opformats[0]); |
770 | 788 |
|
789 |
/* include "s390-opc.tab" generated from opcodes/s390-opc.txt rev 1.17 */ |
|
771 | 790 |
/* The opcode table. This file was generated by s390-mkopc. |
772 | 791 |
|
773 | 792 |
The format of the opcode table is: |
... | ... | |
783 | 802 |
The disassembler reads the table in order and prints the first |
784 | 803 |
instruction which matches. */ |
785 | 804 |
|
786 |
const struct s390_opcode s390_opcodes[] = |
|
805 |
static const struct s390_opcode s390_opcodes[] =
|
|
787 | 806 |
{ |
788 | 807 |
{ "dp", OP8(0xfdLL), MASK_SS_LLRDRD, INSTR_SS_LLRDRD, 3, 0}, |
789 | 808 |
{ "mp", OP8(0xfcLL), MASK_SS_LLRDRD, INSTR_SS_LLRDRD, 3, 0}, |
... | ... | |
1700 | 1719 |
{ "pr", OP16(0x0101LL), MASK_E, INSTR_E, 3, 0} |
1701 | 1720 |
}; |
1702 | 1721 |
|
1703 |
const int s390_num_opcodes = |
|
1722 |
static const int s390_num_opcodes =
|
|
1704 | 1723 |
sizeof (s390_opcodes) / sizeof (s390_opcodes[0]); |
Also available in: Unified diff