Subversion Repositories Kolibri OS

Rev

Rev 5191 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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