gem5 v24.0.0.0
Loading...
Searching...
No Matches
misc64.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2013,2017-2019, 2021-2022, 2024 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_MISC64_HH__
39#define __ARCH_ARM_INSTS_MISC64_HH__
40
42#include "arch/arm/types.hh"
43
44namespace gem5
45{
46
48{
49 protected:
50 uint64_t imm;
51
52 ImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
53 OpClass __opClass, uint64_t _imm) :
54 ArmISA::ArmStaticInst(mnem, _machInst, __opClass), imm(_imm)
55 {}
56
57 std::string generateDisassembly(
58 Addr pc, const loader::SymbolTable *symtab) const override;
59};
60
62{
63 protected:
65
66 RegOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
67 OpClass __opClass, RegIndex _op1) :
68 ArmISA::ArmStaticInst(mnem, _machInst, __opClass), op1(_op1)
69 {}
70
71 std::string generateDisassembly(
72 Addr pc, const loader::SymbolTable *symtab) const override;
73};
74
76{
77 protected:
79 uint64_t imm1;
80 uint64_t imm2;
81
82 RegImmImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
83 OpClass __opClass, RegIndex _op1,
84 uint64_t _imm1, uint64_t _imm2) :
85 ArmISA::ArmStaticInst(mnem, _machInst, __opClass),
86 op1(_op1), imm1(_imm1), imm2(_imm2)
87 {}
88
89 std::string generateDisassembly(
90 Addr pc, const loader::SymbolTable *symtab) const override;
91};
92
94{
95 protected:
98 uint64_t imm1;
99 uint64_t imm2;
100
101 RegRegImmImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
102 OpClass __opClass, RegIndex _dest,
103 RegIndex _op1, uint64_t _imm1,
104 int64_t _imm2) :
105 ArmISA::ArmStaticInst(mnem, _machInst, __opClass),
106 dest(_dest), op1(_op1), imm1(_imm1), imm2(_imm2)
107 {}
108
109 std::string generateDisassembly(
110 Addr pc, const loader::SymbolTable *symtab) const override;
111};
112
114{
115 protected:
119 uint64_t imm;
120
121 RegRegRegImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
122 OpClass __opClass, RegIndex _dest,
123 RegIndex _op1, RegIndex _op2,
124 uint64_t _imm) :
125 ArmISA::ArmStaticInst(mnem, _machInst, __opClass),
126 dest(_dest), op1(_op1), op2(_op2), imm(_imm)
127 {}
128
129 std::string generateDisassembly(
130 Addr pc, const loader::SymbolTable *symtab) const override;
131};
132
134{
135 protected:
136
137 UnknownOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
138 OpClass __opClass) :
139 ArmISA::ArmStaticInst(mnem, _machInst, __opClass)
140 {}
141
142 std::string generateDisassembly(
143 Addr pc, const loader::SymbolTable *symtab) const override;
144};
145
158{
159 protected:
161
162 MiscRegOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
163 OpClass __opClass, bool misc_read) :
164 ArmISA::ArmStaticInst(mnem, _machInst, __opClass),
165 _miscRead(misc_read)
166 {}
167
168 uint32_t _iss(const ArmISA::MiscRegNum64 &misc_reg,
169 RegIndex int_index) const;
170
171 public:
172 virtual uint32_t iss() const { return 0; }
173
174 bool miscRead() const { return _miscRead; }
175
178 ArmISA::ExceptionClass ec, uint32_t iss) const;
179};
180
182{
183 protected:
185 uint32_t imm;
186
187 MiscRegImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
188 OpClass __opClass, ArmISA::MiscRegIndex _dest,
189 uint32_t _imm) :
190 MiscRegOp64(mnem, _machInst, __opClass, false),
191 dest(_dest), imm(_imm)
192 {}
193
199 RegVal miscRegImm() const;
200
201 std::string generateDisassembly(
202 Addr pc, const loader::SymbolTable *symtab) const override;
203};
204
206{
207 protected:
210
211 MiscRegRegImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
212 OpClass __opClass, ArmISA::MiscRegIndex _dest,
213 RegIndex _op1) :
214 MiscRegOp64(mnem, _machInst, __opClass, false),
215 dest(_dest), op1(_op1)
216 {}
217
218 std::string generateDisassembly(
219 Addr pc, const loader::SymbolTable *symtab) const override;
220
221 uint32_t iss() const override;
222};
223
225{
226 protected:
229
230 RegMiscRegImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
231 OpClass __opClass, RegIndex _dest,
233 MiscRegOp64(mnem, _machInst, __opClass, true),
234 dest(_dest), op1(_op1)
235 {}
236
237 std::string generateDisassembly(
238 Addr pc, const loader::SymbolTable *symtab) const override;
239
240 uint32_t iss() const override;
241};
242
244{
245 protected:
246 const std::string fullMnemonic;
249
250 public:
251 MiscRegImplDefined64(const char *mnem, ArmISA::ExtMachInst _machInst,
252 ArmISA::MiscRegNum64 &&misc_reg, RegIndex int_reg,
253 bool misc_read, const std::string full_mnem) :
254 MiscRegOp64(mnem, _machInst, No_OpClass, misc_read),
255 fullMnemonic(full_mnem), miscReg(misc_reg), intReg(int_reg)
256 {
258 }
259
260 protected:
262 trace::InstRecord *traceData) const override;
263
264 std::string generateDisassembly(
265 Addr pc, const loader::SymbolTable *symtab) const override;
266
267 uint32_t iss() const override;
268};
269
271{
272 protected:
274
275 RegNone(const char *mnem, ArmISA::ExtMachInst _machInst,
276 OpClass __opClass, RegIndex _dest) :
277 ArmISA::ArmStaticInst(mnem, _machInst, __opClass),
278 dest(_dest)
279 {}
280
281 std::string generateDisassembly(
282 Addr pc, const loader::SymbolTable *symtab) const;
283};
284
286{
287 protected:
288 using TlbiFunc = std::function<void(ThreadContext*,RegVal)>;
289
290 static std::unordered_map<ArmISA::MiscRegIndex, TlbiFunc> tlbiOps;
291
292 static void tlbiAll(ThreadContext *tc, RegVal value,
293 bool secure, ArmISA::TranslationRegime regime, bool shareable);
294
295 static void tlbiVmall(ThreadContext *tc, RegVal value,
296 bool secure, ArmISA::TranslationRegime regime, bool shareable,
297 bool stage2=false);
298
299 static void tlbiVa(ThreadContext *tc, RegVal value,
300 bool secure, ArmISA::TranslationRegime regime, bool shareable,
301 bool last_level);
302
303 static void tlbiVaa(ThreadContext *tc, RegVal value,
304 bool secure, ArmISA::TranslationRegime regime, bool shareable,
305 bool last_level);
306
307 static void tlbiAsid(ThreadContext *tc, RegVal value,
308 bool secure, ArmISA::TranslationRegime regime, bool shareable);
309
310 static void tlbiIpaS2(ThreadContext *tc, RegVal value,
311 bool secure, ArmISA::TranslationRegime regime, bool shareable,
312 bool last_level);
313
314 static void tlbiRvaa(ThreadContext *tc, RegVal value,
315 bool secure, ArmISA::TranslationRegime regime, bool shareable,
316 bool last_level);
317
318 static void tlbiRva(ThreadContext *tc, RegVal value,
319 bool secure, ArmISA::TranslationRegime regime, bool shareable,
320 bool last_level);
321
322 static void tlbiRipaS2(ThreadContext *tc, RegVal value,
323 bool secure, ArmISA::TranslationRegime regime, bool shareable,
324 bool last_level);
325
326 protected:
327 TlbiOp64(const char *mnem, ArmISA::ExtMachInst _machInst,
328 OpClass __opClass, ArmISA::MiscRegIndex _dest,
329 RegIndex _op1) :
330 MiscRegRegImmOp64(mnem, _machInst, __opClass, _dest, _op1)
331 {}
332
333 void performTlbi(ExecContext *xc,
334 ArmISA::MiscRegIndex idx, RegVal value) const;
335};
336
337} // namespace gem5
338
339#endif
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
ImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, uint64_t _imm)
Definition misc64.hh:52
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition misc64.cc:49
uint64_t imm
Definition misc64.hh:50
RegVal miscRegImm() const
Returns the "register view" of the immediate field.
Definition misc64.cc:148
ArmISA::MiscRegIndex dest
Definition misc64.hh:184
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition misc64.cc:163
MiscRegImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, ArmISA::MiscRegIndex _dest, uint32_t _imm)
Definition misc64.hh:187
const ArmISA::MiscRegNum64 miscReg
Definition misc64.hh:247
const std::string fullMnemonic
Definition misc64.hh:246
uint32_t iss() const override
Definition misc64.cc:233
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition misc64.cc:226
Fault execute(ExecContext *xc, trace::InstRecord *traceData) const override
Definition misc64.cc:215
const RegIndex intReg
Definition misc64.hh:248
MiscRegImplDefined64(const char *mnem, ArmISA::ExtMachInst _machInst, ArmISA::MiscRegNum64 &&misc_reg, RegIndex int_reg, bool misc_read, const std::string full_mnem)
Definition misc64.hh:251
This class is implementing the Base class for a generic AArch64 instruction which is making use of sy...
Definition misc64.hh:158
uint32_t _iss(const ArmISA::MiscRegNum64 &misc_reg, RegIndex int_index) const
Definition misc64.cc:114
MiscRegOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, bool misc_read)
Definition misc64.hh:162
Fault generateTrap(ArmISA::ExceptionLevel el) const
Definition misc64.cc:126
virtual uint32_t iss() const
Definition misc64.hh:172
bool miscRead() const
Definition misc64.hh:174
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition misc64.cc:175
ArmISA::MiscRegIndex dest
Definition misc64.hh:208
uint32_t iss() const override
Definition misc64.cc:187
MiscRegRegImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, ArmISA::MiscRegIndex _dest, RegIndex _op1)
Definition misc64.hh:211
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition misc64.cc:67
RegImmImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, RegIndex _op1, uint64_t _imm1, uint64_t _imm2)
Definition misc64.hh:82
uint32_t iss() const override
Definition misc64.cc:207
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition misc64.cc:195
ArmISA::MiscRegIndex op1
Definition misc64.hh:228
RegMiscRegImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, ArmISA::MiscRegIndex _op1)
Definition misc64.hh:230
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const
Internal function to generate disassembly string.
Definition misc64.cc:239
RegNone(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, RegIndex _dest)
Definition misc64.hh:275
RegIndex dest
Definition misc64.hh:273
RegOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, RegIndex _op1)
Definition misc64.hh:66
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition misc64.cc:58
RegIndex op1
Definition misc64.hh:64
RegRegImmImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _op1, uint64_t _imm1, int64_t _imm2)
Definition misc64.hh:101
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition misc64.cc:79
RegRegRegImmOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, RegIndex _dest, RegIndex _op1, RegIndex _op2, uint64_t _imm)
Definition misc64.hh:121
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition misc64.cc:92
ThreadContext is the external interface to all thread state for anything outside of the CPU.
static void tlbiAll(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable)
Definition misc64.cc:249
static void tlbiRva(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
Definition misc64.cc:366
static void tlbiAsid(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable)
Definition misc64.cc:312
static void tlbiIpaS2(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
Definition misc64.cc:328
static void tlbiVa(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
Definition misc64.cc:273
static void tlbiRipaS2(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
Definition misc64.cc:387
TlbiOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass, ArmISA::MiscRegIndex _dest, RegIndex _op1)
Definition misc64.hh:327
static std::unordered_map< ArmISA::MiscRegIndex, TlbiFunc > tlbiOps
Definition misc64.hh:290
static void tlbiRvaa(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
Definition misc64.cc:354
void performTlbi(ExecContext *xc, ArmISA::MiscRegIndex idx, RegVal value) const
Definition misc64.cc:1349
static void tlbiVaa(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
Definition misc64.cc:300
static void tlbiVmall(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool stage2=false)
Definition misc64.cc:261
std::function< void(ThreadContext *, RegVal)> TlbiFunc
Definition misc64.hh:288
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Definition misc64.cc:107
UnknownOp64(const char *mnem, ArmISA::ExtMachInst _machInst, OpClass __opClass)
Definition misc64.hh:137
MiscRegIndex decodeAArch64SysReg(unsigned op0, unsigned op1, unsigned crn, unsigned crm, unsigned op2)
Definition misc.cc:2749
@ MISCREG_IMPDEF_UNIMPL
Definition misc.hh:1178
Bitfield< 3, 2 > el
Definition misc_types.hh:73
Bitfield< 4 > pc
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint16_t RegIndex
Definition types.hh:176
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
uint64_t RegVal
Definition types.hh:173
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147

Generated on Tue Jun 18 2024 16:23:56 for gem5 by doxygen 1.11.0