1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
/* mmix.h -- Header file for MMIX opcode table
Copyright (C) 2001-2019 Free Software Foundation, Inc.
Written by Hans-Peter Nilsson (hp@bitrange.com)
This file is part of GDB, GAS, and the GNU binutils.
GDB, GAS, and the GNU binutils are free software; you can redistribute
them and/or modify them under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 3,
or (at your option) any later version.
GDB, GAS, and the GNU binutils are distributed in the hope that they
will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this file; see the file COPYING3. If not, write to the Free
Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/* We could have just a char*[] table indexed by the register number, but
that would not allow for synonyms. The table is terminated with an
entry with a NULL name. */
struct mmix_spec_reg
{
const char *name;
unsigned int number;
};
/* General indication of the type of instruction. */
enum mmix_insn_type
{
mmix_type_pseudo,
mmix_type_normal,
mmix_type_branch,
mmix_type_condbranch,
mmix_type_memaccess_octa,
mmix_type_memaccess_tetra,
mmix_type_memaccess_wyde,
mmix_type_memaccess_byte,
mmix_type_memaccess_block,
mmix_type_jsr
};
/* Type of operands an instruction takes. Use when parsing assembly code
and disassembling. */
enum mmix_operands_type
{
mmix_operands_none = 0,
/* All operands are registers: "$X,$Y,$Z". */
mmix_operands_regs,
/* "$X,YZ", like SETH. */
mmix_operands_reg_yz,
/* The regular "$X,$Y,$Z|Z".
The Z is optional; if only "$X,$Y" is given, then "$X,$Y,0" is
assumed. */
mmix_operands_regs_z_opt,
/* The regular "$X,$Y,$Z|Z". */
mmix_operands_regs_z,
/* "Address"; only JMP. Zero operands allowed unless GNU syntax. */
mmix_operands_jmp,
/* "$X|X,$Y,$Z|Z": PUSHGO; like "3", but X can be expressed as an
integer. */
mmix_operands_pushgo,
/* Two registers or a register and a byte, like FLOT, possibly with
rounding: "$X,$Z|Z" or "$X,ROUND_MODE,$Z|Z". */
mmix_operands_roundregs_z,
/* "X,YZ", POP. Unless GNU syntax, zero or one operand is allowed. */
mmix_operands_pop,
/* Two registers, possibly with rounding: "$X,$Z" or
"$X,ROUND_MODE,$Z". */
mmix_operands_roundregs,
/* "XYZ", like SYNC. */
mmix_operands_sync,
/* "X,$Y,$Z|Z", like SYNCD. */
mmix_operands_x_regs_z,
/* "$X,Y,$Z|Z", like NEG and NEGU. The Y field is optional, default 0. */
mmix_operands_neg,
/* "$X,Address, like GETA or branches. */
mmix_operands_regaddr,
/* "$X|X,Address, like PUSHJ. */
mmix_operands_pushj,
/* "$X,spec_reg"; GET. */
mmix_operands_get,
/* "spec_reg,$Z|Z"; PUT. */
mmix_operands_put,
/* Two registers, "$X,$Y". */
mmix_operands_set,
/* "$X,0"; SAVE. */
mmix_operands_save,
/* "0,$Z"; UNSAVE. */
mmix_operands_unsave,
/* "X,Y,Z"; like SWYM or TRAP. Zero (or 1 if GNU syntax) to three
operands, interpreted as 0; XYZ; X, YZ and X, Y, Z. */
mmix_operands_xyz_opt,
/* Just "Z", like RESUME. Unless GNU syntax, the operand can be omitted
and will then be assumed zero. */
mmix_operands_resume,
/* These are specials to handle that pseudo-directives are specified
like ordinary insns when being mmixal-compatible. They signify the
specific pseudo-directive rather than the operands type. */
/* LOC. */
mmix_operands_loc,
/* PREFIX. */
mmix_operands_prefix,
/* BYTE. */
mmix_operands_byte,
/* WYDE. */
mmix_operands_wyde,
/* TETRA. */
mmix_operands_tetra,
/* OCTA. */
mmix_operands_octa,
/* LOCAL. */
mmix_operands_local,
/* BSPEC. */
mmix_operands_bspec,
/* ESPEC. */
mmix_operands_espec,
};
struct mmix_opcode
{
const char *name;
unsigned long match;
unsigned long lose;
enum mmix_operands_type operands;
/* This is used by the disassembly function. */
enum mmix_insn_type type;
};
/* Declare the actual tables. */
extern const struct mmix_opcode mmix_opcodes[];
/* This one is terminated with an entry with a NULL name. */
extern const struct mmix_spec_reg mmix_spec_regs[];
/* Some insn values we use when padding and synthesizing address loads. */
#define IMM_OFFSET_BIT 1
#define COND_INV_BIT 0x8
#define PRED_INV_BIT 0x10
#define PUSHGO_INSN_BYTE 0xbe
#define GO_INSN_BYTE 0x9e
#define SETL_INSN_BYTE 0xe3
#define INCML_INSN_BYTE 0xe6
#define INCMH_INSN_BYTE 0xe5
#define INCH_INSN_BYTE 0xe4
#define SWYM_INSN_BYTE 0xfd
#define JMP_INSN_BYTE 0xf0
/* We can have 256 - 32 (local registers) - 1 ($255 is not allocatable)
global registers. */
#define MAX_GREGS 223
|