gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
misc.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010, 2012-2013, 2017-2018 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  * Authors: Gabe Black
38  */
39 
40 #ifndef __ARCH_ARM_INSTS_MISC_HH__
41 #define __ARCH_ARM_INSTS_MISC_HH__
42 
44 
45 class MrsOp : public PredOp
46 {
47  protected:
49 
50  MrsOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
51  IntRegIndex _dest) :
52  PredOp(mnem, _machInst, __opClass), dest(_dest)
53  {}
54 
55  std::string generateDisassembly(
56  Addr pc, const SymbolTable *symtab) const override;
57 };
58 
59 class MsrBase : public PredOp
60 {
61  protected:
62  uint8_t byteMask;
63 
64  MsrBase(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
65  uint8_t _byteMask) :
66  PredOp(mnem, _machInst, __opClass), byteMask(_byteMask)
67  {}
68 
69  void printMsrBase(std::ostream &os) const;
70 };
71 
72 class MsrImmOp : public MsrBase
73 {
74  protected:
75  uint32_t imm;
76 
77  MsrImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
78  uint32_t _imm, uint8_t _byteMask) :
79  MsrBase(mnem, _machInst, __opClass, _byteMask), imm(_imm)
80  {}
81 
82  std::string generateDisassembly(
83  Addr pc, const SymbolTable *symtab) const override;
84 };
85 
86 class MsrRegOp : public MsrBase
87 {
88  protected:
90 
91  MsrRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
92  IntRegIndex _op1, uint8_t _byteMask) :
93  MsrBase(mnem, _machInst, __opClass, _byteMask), op1(_op1)
94  {}
95 
96  std::string generateDisassembly(
97  Addr pc, const SymbolTable *symtab) const override;
98 };
99 
100 class MrrcOp : public PredOp
101 {
102  protected:
106  uint32_t imm;
107 
108  MrrcOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
109  MiscRegIndex _op1, IntRegIndex _dest, IntRegIndex _dest2,
110  uint32_t _imm) :
111  PredOp(mnem, _machInst, __opClass), op1(_op1), dest(_dest),
112  dest2(_dest2), imm(_imm)
113  {}
114 
115  std::string generateDisassembly(
116  Addr pc, const SymbolTable *symtab) const override;
117 };
118 
119 class McrrOp : public PredOp
120 {
121  protected:
125  uint32_t imm;
126 
127  McrrOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
128  IntRegIndex _op1, IntRegIndex _op2, MiscRegIndex _dest,
129  uint32_t _imm) :
130  PredOp(mnem, _machInst, __opClass), op1(_op1), op2(_op2),
131  dest(_dest), imm(_imm)
132  {}
133 
134  std::string generateDisassembly(
135  Addr pc, const SymbolTable *symtab) const override;
136 };
137 
138 class ImmOp : public PredOp
139 {
140  protected:
141  uint64_t imm;
142 
143  ImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
144  uint64_t _imm) :
145  PredOp(mnem, _machInst, __opClass), imm(_imm)
146  {}
147 
148  std::string generateDisassembly(
149  Addr pc, const SymbolTable *symtab) const override;
150 };
151 
152 class RegImmOp : public PredOp
153 {
154  protected:
156  uint64_t imm;
157 
158  RegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
159  IntRegIndex _dest, uint64_t _imm) :
160  PredOp(mnem, _machInst, __opClass), dest(_dest), imm(_imm)
161  {}
162 
163  std::string generateDisassembly(
164  Addr pc, const SymbolTable *symtab) const override;
165 };
166 
167 class RegRegOp : public PredOp
168 {
169  protected:
172 
173  RegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
174  IntRegIndex _dest, IntRegIndex _op1) :
175  PredOp(mnem, _machInst, __opClass), dest(_dest), op1(_op1)
176  {}
177 
178  std::string generateDisassembly(
179  Addr pc, const SymbolTable *symtab) const override;
180 };
181 
182 class RegOp : public PredOp
183 {
184  protected:
186 
187  RegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
188  IntRegIndex _dest) :
189  PredOp(mnem, _machInst, __opClass), dest(_dest)
190  {}
191 
192  std::string generateDisassembly(
193  Addr pc, const SymbolTable *symtab) const override;
194 };
195 
196 class RegImmRegOp : public PredOp
197 {
198  protected:
200  uint64_t imm;
202 
203  RegImmRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
204  IntRegIndex _dest, uint64_t _imm, IntRegIndex _op1) :
205  PredOp(mnem, _machInst, __opClass),
206  dest(_dest), imm(_imm), op1(_op1)
207  {}
208 
209  std::string generateDisassembly(
210  Addr pc, const SymbolTable *symtab) const override;
211 };
212 
213 class RegRegRegImmOp : public PredOp
214 {
215  protected:
219  uint64_t imm;
220 
221  RegRegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
222  IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2,
223  uint64_t _imm) :
224  PredOp(mnem, _machInst, __opClass),
225  dest(_dest), op1(_op1), op2(_op2), imm(_imm)
226  {}
227 
228  std::string generateDisassembly(
229  Addr pc, const SymbolTable *symtab) const override;
230 };
231 
232 class RegRegRegRegOp : public PredOp
233 {
234  protected:
239 
240  RegRegRegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
241  IntRegIndex _dest, IntRegIndex _op1,
242  IntRegIndex _op2, IntRegIndex _op3) :
243  PredOp(mnem, _machInst, __opClass),
244  dest(_dest), op1(_op1), op2(_op2), op3(_op3)
245  {}
246 
247  std::string generateDisassembly(
248  Addr pc, const SymbolTable *symtab) const override;
249 };
250 
251 class RegRegRegOp : public PredOp
252 {
253  protected:
257 
258  RegRegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
259  IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2) :
260  PredOp(mnem, _machInst, __opClass),
261  dest(_dest), op1(_op1), op2(_op2)
262  {}
263 
264  std::string generateDisassembly(
265  Addr pc, const SymbolTable *symtab) const override;
266 };
267 
268 class RegRegImmOp : public PredOp
269 {
270  protected:
273  uint64_t imm;
274 
275  RegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
276  IntRegIndex _dest, IntRegIndex _op1,
277  uint64_t _imm) :
278  PredOp(mnem, _machInst, __opClass),
279  dest(_dest), op1(_op1), imm(_imm)
280  {}
281 
282  std::string generateDisassembly(
283  Addr pc, const SymbolTable *symtab) const override;
284 };
285 
286 class MiscRegRegImmOp : public PredOp
287 {
288  protected:
291  uint64_t imm;
292 
293  MiscRegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
294  MiscRegIndex _dest, IntRegIndex _op1,
295  uint64_t _imm) :
296  PredOp(mnem, _machInst, __opClass),
297  dest(_dest), op1(_op1), imm(_imm)
298  {}
299 
300  std::string generateDisassembly(
301  Addr pc, const SymbolTable *symtab) const override;
302 };
303 
304 class RegMiscRegImmOp : public PredOp
305 {
306  protected:
309  uint64_t imm;
310 
311  RegMiscRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
312  IntRegIndex _dest, MiscRegIndex _op1,
313  uint64_t _imm) :
314  PredOp(mnem, _machInst, __opClass),
315  dest(_dest), op1(_op1), imm(_imm)
316  {}
317 
318  std::string generateDisassembly(
319  Addr pc, const SymbolTable *symtab) const override;
320 };
321 
322 class RegImmImmOp : public PredOp
323 {
324  protected:
326  uint64_t imm1;
327  uint64_t imm2;
328 
329  RegImmImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
330  IntRegIndex _dest, uint64_t _imm1, uint64_t _imm2) :
331  PredOp(mnem, _machInst, __opClass),
332  dest(_dest), imm1(_imm1), imm2(_imm2)
333  {}
334 
335  std::string generateDisassembly(
336  Addr pc, const SymbolTable *symtab) const override;
337 };
338 
339 class RegRegImmImmOp : public PredOp
340 {
341  protected:
344  uint64_t imm1;
345  uint64_t imm2;
346 
347  RegRegImmImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
348  IntRegIndex _dest, IntRegIndex _op1,
349  uint64_t _imm1, uint64_t _imm2) :
350  PredOp(mnem, _machInst, __opClass),
351  dest(_dest), op1(_op1), imm1(_imm1), imm2(_imm2)
352  {}
353 
354  std::string generateDisassembly(
355  Addr pc, const SymbolTable *symtab) const override;
356 };
357 
358 class RegImmRegShiftOp : public PredOp
359 {
360  protected:
362  uint64_t imm;
364  int32_t shiftAmt;
366 
367  RegImmRegShiftOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
368  IntRegIndex _dest, uint64_t _imm, IntRegIndex _op1,
369  int32_t _shiftAmt, ArmShiftType _shiftType) :
370  PredOp(mnem, _machInst, __opClass),
371  dest(_dest), imm(_imm), op1(_op1),
372  shiftAmt(_shiftAmt), shiftType(_shiftType)
373  {}
374 
375  std::string generateDisassembly(
376  Addr pc, const SymbolTable *symtab) const override;
377 };
378 
379 class UnknownOp : public PredOp
380 {
381  protected:
382 
383  UnknownOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
384  PredOp(mnem, _machInst, __opClass)
385  {}
386 
387  std::string generateDisassembly(
388  Addr pc, const SymbolTable *symtab) const override;
389 };
390 
398 {
399  protected:
400  uint64_t iss;
402 
403  public:
404  McrMrcMiscInst(const char *_mnemonic, ExtMachInst _machInst,
405  uint64_t _iss, MiscRegIndex _miscReg);
406 
408  Trace::InstRecord *traceData) const override;
409 
410  std::string generateDisassembly(
411  Addr pc, const SymbolTable *symtab) const override;
412 
413 };
414 
420 {
421  public:
422  McrMrcImplDefined(const char *_mnemonic, ExtMachInst _machInst,
423  uint64_t _iss, MiscRegIndex _miscReg);
424 
426  Trace::InstRecord *traceData) const override;
427 
428  std::string generateDisassembly(
429  Addr pc, const SymbolTable *symtab) const override;
430 
431 };
432 
433 #endif
IntRegIndex op1
Definition: misc.hh:363
MiscRegIndex
Definition: miscregs.hh:57
uint64_t imm
Definition: misc.hh:362
IntRegIndex op1
Definition: misc.hh:272
IntRegIndex op2
Definition: misc.hh:237
IntRegIndex
Definition: intregs.hh:53
MsrBase(const char *mnem, ExtMachInst _machInst, OpClass __opClass, uint8_t _byteMask)
Definition: misc.hh:64
Definition: misc.hh:182
uint64_t iss
Definition: misc.hh:400
IntRegIndex dest
Definition: misc.hh:235
IntRegIndex dest2
Definition: misc.hh:105
IntRegIndex op1
Definition: misc.hh:122
uint64_t imm2
Definition: misc.hh:345
IntRegIndex dest
Definition: misc.hh:104
Definition: misc.hh:59
ImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, uint64_t _imm)
Definition: misc.hh:143
uint64_t imm2
Definition: misc.hh:327
MrrcOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, MiscRegIndex _op1, IntRegIndex _dest, IntRegIndex _dest2, uint32_t _imm)
Definition: misc.hh:108
uint32_t imm
Definition: misc.hh:106
IntRegIndex op2
Definition: misc.hh:218
Base class for predicated integer operations.
Definition: pred_inst.hh:211
virtual Fault execute(ExecContext *xc, Trace::InstRecord *traceData) const =0
RegMiscRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, MiscRegIndex _op1, uint64_t _imm)
Definition: misc.hh:311
IntRegIndex dest
Definition: misc.hh:254
uint32_t imm
Definition: misc.hh:75
UnknownOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: misc.hh:383
Bitfield< 19 > pc
Definition: misc.hh:807
IntRegIndex op1
Definition: misc.hh:255
IntRegIndex dest
Definition: misc.hh:170
Bitfield< 17 > os
Definition: misc.hh:805
IntRegIndex dest
Definition: misc.hh:325
Definition: misc.hh:72
Definition: misc.hh:86
Definition: misc.hh:100
IntRegIndex dest
Definition: misc.hh:48
IntRegIndex op1
Definition: misc.hh:201
Definition: misc.hh:138
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:73
This class is also used for IMPLEMENTATION DEFINED registers, whose mcr/mrc behaviour is trappable ev...
Definition: misc.hh:419
MiscRegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, MiscRegIndex _dest, IntRegIndex _op1, uint64_t _imm)
Definition: misc.hh:293
RegImmImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, uint64_t _imm1, uint64_t _imm2)
Definition: misc.hh:329
MiscRegIndex op1
Definition: misc.hh:308
MrsOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest)
Definition: misc.hh:50
IntRegIndex op1
Definition: misc.hh:343
RegRegImmImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, uint64_t _imm1, uint64_t _imm2)
Definition: misc.hh:347
uint64_t imm
Definition: misc.hh:273
IntRegIndex op1
Definition: misc.hh:236
IntRegIndex dest
Definition: misc.hh:361
RegImmRegShiftOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, uint64_t _imm, IntRegIndex _op1, int32_t _shiftAmt, ArmShiftType _shiftType)
Definition: misc.hh:367
RegRegRegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, IntRegIndex _op3)
Definition: misc.hh:240
IntRegIndex dest
Definition: misc.hh:216
IntRegIndex op1
Definition: misc.hh:89
uint64_t imm
Definition: misc.hh:200
IntRegIndex dest
Definition: misc.hh:155
MiscRegIndex dest
Definition: misc.hh:124
uint64_t imm1
Definition: misc.hh:344
IntRegIndex op1
Definition: misc.hh:171
uint64_t imm
Definition: misc.hh:309
RegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, uint64_t _imm)
Definition: misc.hh:158
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
uint64_t imm
Definition: misc.hh:156
IntRegIndex op2
Definition: misc.hh:256
RegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, uint64_t _imm)
Definition: misc.hh:275
RegImmRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, uint64_t _imm, IntRegIndex _op1)
Definition: misc.hh:203
IntRegIndex op1
Definition: misc.hh:217
IntRegIndex dest
Definition: misc.hh:185
uint64_t imm
Definition: misc.hh:141
IntRegIndex op3
Definition: misc.hh:238
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc.cc:46
uint8_t byteMask
Definition: misc.hh:62
uint64_t imm1
Definition: misc.hh:326
IntRegIndex dest
Definition: misc.hh:199
Certain mrc/mcr instructions act as nops or flush the pipe based on what register the instruction is ...
Definition: misc.hh:397
Definition: misc.hh:119
MiscRegIndex op1
Definition: misc.hh:103
IntRegIndex dest
Definition: misc.hh:271
MiscRegIndex dest
Definition: misc.hh:289
IntRegIndex dest
Definition: misc.hh:307
IntRegIndex dest
Definition: misc.hh:342
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:87
MiscRegIndex miscReg
Definition: misc.hh:401
RegRegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, uint64_t _imm)
Definition: misc.hh:221
int32_t shiftAmt
Definition: misc.hh:364
RegRegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2)
Definition: misc.hh:258
ArmShiftType shiftType
Definition: misc.hh:365
MsrImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, uint32_t _imm, uint8_t _byteMask)
Definition: misc.hh:77
uint64_t imm
Definition: misc.hh:219
uint64_t imm
Definition: misc.hh:291
MsrRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _op1, uint8_t _byteMask)
Definition: misc.hh:91
RegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest)
Definition: misc.hh:187
RegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1)
Definition: misc.hh:173
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
Definition: misc.hh:45
uint32_t imm
Definition: misc.hh:125
ArmShiftType
Definition: types.hh:531
IntRegIndex op1
Definition: misc.hh:290
McrrOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _op1, IntRegIndex _op2, MiscRegIndex _dest, uint32_t _imm)
Definition: misc.hh:127
IntRegIndex op2
Definition: misc.hh:123

Generated on Fri Feb 28 2020 16:26:57 for gem5 by doxygen 1.8.13