gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
misc64.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2013,2017-2019 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  * Giacomo Travaglini
39  */
40 
41 #ifndef __ARCH_ARM_INSTS_MISC64_HH__
42 #define __ARCH_ARM_INSTS_MISC64_HH__
43 
45 
46 class ImmOp64 : public ArmStaticInst
47 {
48  protected:
49  uint64_t imm;
50 
51  ImmOp64(const char *mnem, ExtMachInst _machInst,
52  OpClass __opClass, uint64_t _imm) :
53  ArmStaticInst(mnem, _machInst, __opClass), imm(_imm)
54  {}
55 
56  std::string generateDisassembly(
57  Addr pc, const SymbolTable *symtab) const override;
58 };
59 
61 {
62  protected:
65  uint64_t imm1;
66  uint64_t imm2;
67 
68  RegRegImmImmOp64(const char *mnem, ExtMachInst _machInst,
69  OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1,
70  uint64_t _imm1, uint64_t _imm2) :
71  ArmStaticInst(mnem, _machInst, __opClass),
72  dest(_dest), op1(_op1), imm1(_imm1), imm2(_imm2)
73  {}
74 
75  std::string generateDisassembly(
76  Addr pc, const SymbolTable *symtab) const override;
77 };
78 
80 {
81  protected:
85  uint64_t imm;
86 
87  RegRegRegImmOp64(const char *mnem, ExtMachInst _machInst,
88  OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1,
89  IntRegIndex _op2, uint64_t _imm) :
90  ArmStaticInst(mnem, _machInst, __opClass),
91  dest(_dest), op1(_op1), op2(_op2), imm(_imm)
92  {}
93 
94  std::string generateDisassembly(
95  Addr pc, const SymbolTable *symtab) const override;
96 };
97 
98 class UnknownOp64 : public ArmStaticInst
99 {
100  protected:
101 
102  UnknownOp64(const char *mnem, ExtMachInst _machInst, OpClass __opClass) :
103  ArmStaticInst(mnem, _machInst, __opClass)
104  {}
105 
106  std::string generateDisassembly(
107  Addr pc, const SymbolTable *symtab) const override;
108 };
109 
122 {
123  protected:
124  bool miscRead;
125 
126  MiscRegOp64(const char *mnem, ExtMachInst _machInst,
127  OpClass __opClass, bool misc_read) :
128  ArmStaticInst(mnem, _machInst, __opClass),
129  miscRead(misc_read)
130  {}
131 
132  Fault trap(ThreadContext *tc, MiscRegIndex misc_reg,
133  ExceptionLevel el, uint32_t immediate) const;
134  private:
135  bool checkEL1Trap(ThreadContext *tc, const MiscRegIndex misc_reg,
137  uint32_t &immediate) const;
138 
139  bool checkEL2Trap(ThreadContext *tc, const MiscRegIndex misc_reg,
141  uint32_t &immediate) const;
142 
143  bool checkEL3Trap(ThreadContext *tc, const MiscRegIndex misc_reg,
145  uint32_t &immediate) const;
146 
147 };
148 
150 {
151  protected:
153  uint32_t imm;
154 
155  MiscRegImmOp64(const char *mnem, ExtMachInst _machInst,
156  OpClass __opClass, MiscRegIndex _dest,
157  uint32_t _imm) :
158  MiscRegOp64(mnem, _machInst, __opClass, false),
159  dest(_dest), imm(_imm)
160  {}
161 
167  RegVal miscRegImm() const;
168 
169  std::string generateDisassembly(
170  Addr pc, const SymbolTable *symtab) const override;
171 };
172 
174 {
175  protected:
178  uint32_t imm;
179 
180  MiscRegRegImmOp64(const char *mnem, ExtMachInst _machInst,
181  OpClass __opClass, MiscRegIndex _dest,
182  IntRegIndex _op1, uint32_t _imm) :
183  MiscRegOp64(mnem, _machInst, __opClass, false),
184  dest(_dest), op1(_op1), imm(_imm)
185  {}
186 
187  std::string generateDisassembly(
188  Addr pc, const SymbolTable *symtab) const override;
189 };
190 
192 {
193  protected:
196  uint32_t imm;
197 
198  RegMiscRegImmOp64(const char *mnem, ExtMachInst _machInst,
199  OpClass __opClass, IntRegIndex _dest,
200  MiscRegIndex _op1, uint32_t _imm) :
201  MiscRegOp64(mnem, _machInst, __opClass, true),
202  dest(_dest), op1(_op1), imm(_imm)
203  {}
204 
205  std::string generateDisassembly(
206  Addr pc, const SymbolTable *symtab) const override;
207 };
208 
210 {
211  protected:
212  const std::string fullMnemonic;
214  const uint32_t imm;
215  const bool warning;
216 
217  public:
218  MiscRegImplDefined64(const char *mnem, ExtMachInst _machInst,
219  MiscRegIndex misc_reg, bool misc_read,
220  uint32_t _imm, const std::string full_mnem,
221  bool _warning) :
222  MiscRegOp64(mnem, _machInst, No_OpClass, misc_read),
223  fullMnemonic(full_mnem), miscReg(misc_reg), imm(_imm),
224  warning(_warning)
225  {
226  assert(miscReg == MISCREG_IMPDEF_UNIMPL);
227  }
228 
229  protected:
231  Trace::InstRecord *traceData) const override;
232 
233  std::string generateDisassembly(
234  Addr pc, const SymbolTable *symtab) const override;
235 };
236 
237 #endif
MiscRegIndex
Definition: miscregs.hh:57
IntRegIndex op2
Definition: misc64.hh:84
IntRegIndex
Definition: intregs.hh:53
uint32_t imm
Definition: misc64.hh:178
IntRegIndex dest
Definition: misc64.hh:194
ImmOp64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, uint64_t _imm)
Definition: misc64.hh:51
virtual Fault execute(ExecContext *xc, Trace::InstRecord *traceData) const =0
uint64_t RegVal
Definition: types.hh:168
MiscRegOp64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, bool misc_read)
Definition: misc64.hh:126
This class is implementing the Base class for a generic AArch64 instruction which is making use of sy...
Definition: misc64.hh:121
RegMiscRegImmOp64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, MiscRegIndex _op1, uint32_t _imm)
Definition: misc64.hh:198
MiscRegIndex dest
Definition: misc64.hh:152
std::string generateDisassembly(Addr pc, const SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition: misc64.cc:45
ThreadContext is the external interface to all thread state for anything outside of the CPU...
ExceptionLevel
Definition: types.hh:585
IntRegIndex op1
Definition: misc64.hh:177
Bitfield< 3, 2 > el
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:73
Bitfield< 4 > pc
uint64_t imm
Definition: misc64.hh:85
MiscRegImmOp64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, MiscRegIndex _dest, uint32_t _imm)
Definition: misc64.hh:155
uint64_t imm2
Definition: misc64.hh:66
IntRegIndex op1
Definition: misc64.hh:83
const MiscRegIndex miscReg
Definition: misc64.hh:213
IntRegIndex dest
Definition: misc64.hh:63
RegRegRegImmOp64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, uint64_t _imm)
Definition: misc64.hh:87
const bool warning
Definition: misc64.hh:215
MiscRegImplDefined64(const char *mnem, ExtMachInst _machInst, MiscRegIndex misc_reg, bool misc_read, uint32_t _imm, const std::string full_mnem, bool _warning)
Definition: misc64.hh:218
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
uint32_t imm
Definition: misc64.hh:153
uint32_t imm
Definition: misc64.hh:196
ExceptionClass
Definition: types.hh:612
MiscRegIndex op1
Definition: misc64.hh:195
RegRegImmImmOp64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, IntRegIndex _dest, IntRegIndex _op1, uint64_t _imm1, uint64_t _imm2)
Definition: misc64.hh:68
uint64_t imm
Definition: misc64.hh:49
UnknownOp64(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Definition: misc64.hh:102
MiscRegRegImmOp64(const char *mnem, ExtMachInst _machInst, OpClass __opClass, MiscRegIndex _dest, IntRegIndex _op1, uint32_t _imm)
Definition: misc64.hh:180
uint64_t imm1
Definition: misc64.hh:65
IntRegIndex dest
Definition: misc64.hh:82
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Definition: static_inst.hh:87
MiscRegIndex dest
Definition: misc64.hh:176
const uint32_t imm
Definition: misc64.hh:214
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
const std::string fullMnemonic
Definition: misc64.hh:212
IntRegIndex op1
Definition: misc64.hh:64
bool miscRead
Definition: misc64.hh:124

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