gem5  v20.0.0.2
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 
38 #ifndef __ARCH_ARM_INSTS_MISC_HH__
39 #define __ARCH_ARM_INSTS_MISC_HH__
40 
42 
43 class MrsOp : public PredOp
44 {
45  protected:
47 
48  MrsOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
49  IntRegIndex _dest) :
50  PredOp(mnem, _machInst, __opClass), dest(_dest)
51  {}
52 
53  std::string generateDisassembly(
54  Addr pc, const Loader::SymbolTable *symtab) const override;
55 };
56 
57 class MsrBase : public PredOp
58 {
59  protected:
60  uint8_t byteMask;
61 
62  MsrBase(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
63  uint8_t _byteMask) :
64  PredOp(mnem, _machInst, __opClass), byteMask(_byteMask)
65  {}
66 
67  void printMsrBase(std::ostream &os) const;
68 };
69 
70 class MsrImmOp : public MsrBase
71 {
72  protected:
73  uint32_t imm;
74 
75  MsrImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
76  uint32_t _imm, uint8_t _byteMask) :
77  MsrBase(mnem, _machInst, __opClass, _byteMask), imm(_imm)
78  {}
79 
80  std::string generateDisassembly(
81  Addr pc, const Loader::SymbolTable *symtab) const override;
82 };
83 
84 class MsrRegOp : public MsrBase
85 {
86  protected:
88 
89  MsrRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
90  IntRegIndex _op1, uint8_t _byteMask) :
91  MsrBase(mnem, _machInst, __opClass, _byteMask), op1(_op1)
92  {}
93 
94  std::string generateDisassembly(
95  Addr pc, const Loader::SymbolTable *symtab) const override;
96 };
97 
98 class MrrcOp : public PredOp
99 {
100  protected:
104  uint32_t imm;
105 
106  MrrcOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
107  MiscRegIndex _op1, IntRegIndex _dest, IntRegIndex _dest2,
108  uint32_t _imm) :
109  PredOp(mnem, _machInst, __opClass), op1(_op1), dest(_dest),
110  dest2(_dest2), imm(_imm)
111  {}
112 
113  std::string generateDisassembly(
114  Addr pc, const Loader::SymbolTable *symtab) const override;
115 };
116 
117 class McrrOp : public PredOp
118 {
119  protected:
123  uint32_t imm;
124 
125  McrrOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
126  IntRegIndex _op1, IntRegIndex _op2, MiscRegIndex _dest,
127  uint32_t _imm) :
128  PredOp(mnem, _machInst, __opClass), op1(_op1), op2(_op2),
129  dest(_dest), imm(_imm)
130  {}
131 
132  std::string generateDisassembly(
133  Addr pc, const Loader::SymbolTable *symtab) const override;
134 };
135 
136 class ImmOp : public PredOp
137 {
138  protected:
139  uint64_t imm;
140 
141  ImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
142  uint64_t _imm) :
143  PredOp(mnem, _machInst, __opClass), imm(_imm)
144  {}
145 
146  std::string generateDisassembly(
147  Addr pc, const Loader::SymbolTable *symtab) const override;
148 };
149 
150 class RegImmOp : public PredOp
151 {
152  protected:
154  uint64_t imm;
155 
156  RegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
157  IntRegIndex _dest, uint64_t _imm) :
158  PredOp(mnem, _machInst, __opClass), dest(_dest), imm(_imm)
159  {}
160 
161  std::string generateDisassembly(
162  Addr pc, const Loader::SymbolTable *symtab) const override;
163 };
164 
165 class RegRegOp : public PredOp
166 {
167  protected:
170 
171  RegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
172  IntRegIndex _dest, IntRegIndex _op1) :
173  PredOp(mnem, _machInst, __opClass), dest(_dest), op1(_op1)
174  {}
175 
176  std::string generateDisassembly(
177  Addr pc, const Loader::SymbolTable *symtab) const override;
178 };
179 
180 class RegOp : public PredOp
181 {
182  protected:
184 
185  RegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
186  IntRegIndex _dest) :
187  PredOp(mnem, _machInst, __opClass), dest(_dest)
188  {}
189 
190  std::string generateDisassembly(
191  Addr pc, const Loader::SymbolTable *symtab) const override;
192 };
193 
194 class RegImmRegOp : public PredOp
195 {
196  protected:
198  uint64_t imm;
200 
201  RegImmRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
202  IntRegIndex _dest, uint64_t _imm, IntRegIndex _op1) :
203  PredOp(mnem, _machInst, __opClass),
204  dest(_dest), imm(_imm), op1(_op1)
205  {}
206 
207  std::string generateDisassembly(
208  Addr pc, const Loader::SymbolTable *symtab) const override;
209 };
210 
211 class RegRegRegImmOp : public PredOp
212 {
213  protected:
217  uint64_t imm;
218 
219  RegRegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
220  IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2,
221  uint64_t _imm) :
222  PredOp(mnem, _machInst, __opClass),
223  dest(_dest), op1(_op1), op2(_op2), imm(_imm)
224  {}
225 
226  std::string generateDisassembly(
227  Addr pc, const Loader::SymbolTable *symtab) const override;
228 };
229 
230 class RegRegRegRegOp : public PredOp
231 {
232  protected:
237 
238  RegRegRegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
239  IntRegIndex _dest, IntRegIndex _op1,
240  IntRegIndex _op2, IntRegIndex _op3) :
241  PredOp(mnem, _machInst, __opClass),
242  dest(_dest), op1(_op1), op2(_op2), op3(_op3)
243  {}
244 
245  std::string generateDisassembly(
246  Addr pc, const Loader::SymbolTable *symtab) const override;
247 };
248 
249 class RegRegRegOp : public PredOp
250 {
251  protected:
255 
256  RegRegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
257  IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2) :
258  PredOp(mnem, _machInst, __opClass),
259  dest(_dest), op1(_op1), op2(_op2)
260  {}
261 
262  std::string generateDisassembly(
263  Addr pc, const Loader::SymbolTable *symtab) const override;
264 };
265 
266 class RegRegImmOp : public PredOp
267 {
268  protected:
271  uint64_t imm;
272 
273  RegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
274  IntRegIndex _dest, IntRegIndex _op1,
275  uint64_t _imm) :
276  PredOp(mnem, _machInst, __opClass),
277  dest(_dest), op1(_op1), imm(_imm)
278  {}
279 
280  std::string generateDisassembly(
281  Addr pc, const Loader::SymbolTable *symtab) const override;
282 };
283 
284 class MiscRegRegImmOp : public PredOp
285 {
286  protected:
289  uint64_t imm;
290 
291  MiscRegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
292  MiscRegIndex _dest, IntRegIndex _op1,
293  uint64_t _imm) :
294  PredOp(mnem, _machInst, __opClass),
295  dest(_dest), op1(_op1), imm(_imm)
296  {}
297 
298  std::string generateDisassembly(
299  Addr pc, const Loader::SymbolTable *symtab) const override;
300 };
301 
302 class RegMiscRegImmOp : public PredOp
303 {
304  protected:
307  uint64_t imm;
308 
309  RegMiscRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
310  IntRegIndex _dest, MiscRegIndex _op1,
311  uint64_t _imm) :
312  PredOp(mnem, _machInst, __opClass),
313  dest(_dest), op1(_op1), imm(_imm)
314  {}
315 
316  std::string generateDisassembly(
317  Addr pc, const Loader::SymbolTable *symtab) const override;
318 };
319 
320 class RegImmImmOp : public PredOp
321 {
322  protected:
324  uint64_t imm1;
325  uint64_t imm2;
326 
327  RegImmImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
328  IntRegIndex _dest, uint64_t _imm1, uint64_t _imm2) :
329  PredOp(mnem, _machInst, __opClass),
330  dest(_dest), imm1(_imm1), imm2(_imm2)
331  {}
332 
333  std::string generateDisassembly(
334  Addr pc, const Loader::SymbolTable *symtab) const override;
335 };
336 
337 class RegRegImmImmOp : public PredOp
338 {
339  protected:
342  uint64_t imm1;
343  uint64_t imm2;
344 
345  RegRegImmImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
346  IntRegIndex _dest, IntRegIndex _op1,
347  uint64_t _imm1, uint64_t _imm2) :
348  PredOp(mnem, _machInst, __opClass),
349  dest(_dest), op1(_op1), imm1(_imm1), imm2(_imm2)
350  {}
351 
352  std::string generateDisassembly(
353  Addr pc, const Loader::SymbolTable *symtab) const override;
354 };
355 
356 class RegImmRegShiftOp : public PredOp
357 {
358  protected:
360  uint64_t imm;
362  int32_t shiftAmt;
364 
365  RegImmRegShiftOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass,
366  IntRegIndex _dest, uint64_t _imm, IntRegIndex _op1,
367  int32_t _shiftAmt, ArmShiftType _shiftType) :
368  PredOp(mnem, _machInst, __opClass),
369  dest(_dest), imm(_imm), op1(_op1),
370  shiftAmt(_shiftAmt), shiftType(_shiftType)
371  {}
372 
373  std::string generateDisassembly(
374  Addr pc, const Loader::SymbolTable *symtab) const override;
375 };
376 
377 class UnknownOp : public PredOp
378 {
379  protected:
380 
381  UnknownOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
382  PredOp(mnem, _machInst, __opClass)
383  {}
384 
385  std::string generateDisassembly(
386  Addr pc, const Loader::SymbolTable *symtab) const override;
387 };
388 
396 {
397  protected:
398  uint64_t iss;
400 
401  public:
402  McrMrcMiscInst(const char *_mnemonic, ExtMachInst _machInst,
403  uint64_t _iss, MiscRegIndex _miscReg);
404 
406  Trace::InstRecord *traceData) const override;
407 
408  std::string generateDisassembly(
409  Addr pc, const Loader::SymbolTable *symtab) const override;
410 
411 };
412 
418 {
419  public:
420  McrMrcImplDefined(const char *_mnemonic, ExtMachInst _machInst,
421  uint64_t _iss, MiscRegIndex _miscReg);
422 
424  Trace::InstRecord *traceData) const override;
425 
426  std::string generateDisassembly(
427  Addr pc, const Loader::SymbolTable *symtab) const override;
428 
429 };
430 
431 #endif
IntRegIndex op1
Definition: misc.hh:361
MiscRegIndex
Definition: miscregs.hh:56
uint64_t imm
Definition: misc.hh:360
IntRegIndex op1
Definition: misc.hh:270
IntRegIndex op2
Definition: misc.hh:235
IntRegIndex
Definition: intregs.hh:51
MsrBase(const char *mnem, ExtMachInst _machInst, OpClass __opClass, uint8_t _byteMask)
Definition: misc.hh:62
Definition: misc.hh:180
uint64_t iss
Definition: misc.hh:398
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc.cc:44
IntRegIndex dest
Definition: misc.hh:233
IntRegIndex dest2
Definition: misc.hh:103
IntRegIndex op1
Definition: misc.hh:120
uint64_t imm2
Definition: misc.hh:343
IntRegIndex dest
Definition: misc.hh:102
Definition: misc.hh:57
ImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, uint64_t _imm)
Definition: misc.hh:141
uint64_t imm2
Definition: misc.hh:325
MrrcOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, MiscRegIndex _op1, IntRegIndex _dest, IntRegIndex _dest2, uint32_t _imm)
Definition: misc.hh:106
uint32_t imm
Definition: misc.hh:104
IntRegIndex op2
Definition: misc.hh:216
Base class for predicated integer operations.
Definition: pred_inst.hh:210
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:309
IntRegIndex dest
Definition: misc.hh:252
uint32_t imm
Definition: misc.hh:73
UnknownOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: misc.hh:381
Bitfield< 19 > pc
Definition: misc.hh:805
IntRegIndex op1
Definition: misc.hh:253
IntRegIndex dest
Definition: misc.hh:168
Bitfield< 17 > os
Definition: misc.hh:803
IntRegIndex dest
Definition: misc.hh:323
Definition: misc.hh:70
Definition: misc.hh:84
Definition: misc.hh:98
IntRegIndex dest
Definition: misc.hh:46
IntRegIndex op1
Definition: misc.hh:199
Definition: misc.hh:136
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:70
This class is also used for IMPLEMENTATION DEFINED registers, whose mcr/mrc behaviour is trappable ev...
Definition: misc.hh:417
MiscRegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, MiscRegIndex _dest, IntRegIndex _op1, uint64_t _imm)
Definition: misc.hh:291
RegImmImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, uint64_t _imm1, uint64_t _imm2)
Definition: misc.hh:327
MiscRegIndex op1
Definition: misc.hh:306
MrsOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest)
Definition: misc.hh:48
IntRegIndex op1
Definition: misc.hh:341
RegRegImmImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, uint64_t _imm1, uint64_t _imm2)
Definition: misc.hh:345
uint64_t imm
Definition: misc.hh:271
IntRegIndex op1
Definition: misc.hh:234
IntRegIndex dest
Definition: misc.hh:359
RegImmRegShiftOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, uint64_t _imm, IntRegIndex _op1, int32_t _shiftAmt, ArmShiftType _shiftType)
Definition: misc.hh:365
RegRegRegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, IntRegIndex _op3)
Definition: misc.hh:238
IntRegIndex dest
Definition: misc.hh:214
IntRegIndex op1
Definition: misc.hh:87
uint64_t imm
Definition: misc.hh:198
IntRegIndex dest
Definition: misc.hh:153
MiscRegIndex dest
Definition: misc.hh:122
uint64_t imm1
Definition: misc.hh:342
IntRegIndex op1
Definition: misc.hh:169
uint64_t imm
Definition: misc.hh:307
RegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, uint64_t _imm)
Definition: misc.hh:156
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
uint64_t imm
Definition: misc.hh:154
IntRegIndex op2
Definition: misc.hh:254
RegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, uint64_t _imm)
Definition: misc.hh:273
RegImmRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, uint64_t _imm, IntRegIndex _op1)
Definition: misc.hh:201
IntRegIndex op1
Definition: misc.hh:215
IntRegIndex dest
Definition: misc.hh:183
uint64_t imm
Definition: misc.hh:139
IntRegIndex op3
Definition: misc.hh:236
uint8_t byteMask
Definition: misc.hh:60
uint64_t imm1
Definition: misc.hh:324
IntRegIndex dest
Definition: misc.hh:197
Certain mrc/mcr instructions act as nops or flush the pipe based on what register the instruction is ...
Definition: misc.hh:395
Definition: misc.hh:117
MiscRegIndex op1
Definition: misc.hh:101
IntRegIndex dest
Definition: misc.hh:269
MiscRegIndex dest
Definition: misc.hh:287
IntRegIndex dest
Definition: misc.hh:305
IntRegIndex dest
Definition: misc.hh:340
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:89
MiscRegIndex miscReg
Definition: misc.hh:399
RegRegRegImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, uint64_t _imm)
Definition: misc.hh:219
int32_t shiftAmt
Definition: misc.hh:362
RegRegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2)
Definition: misc.hh:256
ArmShiftType shiftType
Definition: misc.hh:363
MsrImmOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, uint32_t _imm, uint8_t _byteMask)
Definition: misc.hh:75
uint64_t imm
Definition: misc.hh:217
uint64_t imm
Definition: misc.hh:289
MsrRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _op1, uint8_t _byteMask)
Definition: misc.hh:89
RegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest)
Definition: misc.hh:185
RegRegOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1)
Definition: misc.hh:171
std::shared_ptr< FaultBase > Fault
Definition: types.hh:238
Definition: misc.hh:43
uint32_t imm
Definition: misc.hh:123
ArmShiftType
Definition: types.hh:529
IntRegIndex op1
Definition: misc.hh:288
McrrOp(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _op1, IntRegIndex _op2, MiscRegIndex _dest, uint32_t _imm)
Definition: misc.hh:125
IntRegIndex op2
Definition: misc.hh:121

Generated on Mon Jun 8 2020 15:34:39 for gem5 by doxygen 1.8.13