gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
static_inst.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010-2013,2016-2018, 2022, 2025 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 * Copyright (c) 2007-2008 The Florida State University
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 */
40
41#ifndef __ARCH_ARM_INSTS_STATICINST_HH__
42#define __ARCH_ARM_INSTS_STATICINST_HH__
43
44#include <memory>
45
46#include "arch/arm/faults.hh"
47#include "arch/arm/utility.hh"
48#include "arch/arm/isa.hh"
49#include "arch/arm/pcstate.hh"
51#include "arch/arm/system.hh"
52#include "base/trace.hh"
53#include "cpu/exec_context.hh"
54#include "cpu/static_inst.hh"
55#include "cpu/thread_context.hh"
56#include "sim/byteswap.hh"
57#include "sim/full_system.hh"
58
59namespace gem5
60{
61
62namespace ArmISA
63{
64
66{
67 protected:
68 bool aarch64;
69 uint8_t intWidth;
70
71 int32_t shift_rm_imm(uint32_t base, uint32_t shamt,
72 uint32_t type, uint32_t cfval) const;
73 int32_t shift_rm_rs(uint32_t base, uint32_t shamt,
74 uint32_t type, uint32_t cfval) const;
75
76 bool shift_carry_imm(uint32_t base, uint32_t shamt,
77 uint32_t type, uint32_t cfval) const;
78 bool shift_carry_rs(uint32_t base, uint32_t shamt,
79 uint32_t type, uint32_t cfval) const;
80
81 int64_t shiftReg64(uint64_t base, uint64_t shiftAmt,
82 ArmShiftType type, uint8_t width) const;
83 int64_t extendReg64(uint64_t base, ArmExtendType type,
84 uint64_t shiftAmt, uint8_t width) const;
85
86 template<int width>
87 static inline bool
88 saturateOp(int32_t &res, int64_t op1, int64_t op2, bool sub=false)
89 {
90 int64_t midRes = sub ? (op1 - op2) : (op1 + op2);
91 if (bits(midRes, width) != bits(midRes, width - 1)) {
92 if (midRes > 0)
93 res = (1LL << (width - 1)) - 1;
94 else
95 res = -(1LL << (width - 1));
96 return true;
97 } else {
98 res = midRes;
99 return false;
100 }
101 }
102
103 static inline bool
104 satInt(int32_t &res, int64_t op, int width)
105 {
106 width--;
107 if (op >= (1LL << width)) {
108 res = (1LL << width) - 1;
109 return true;
110 } else if (op < -(1LL << width)) {
111 res = -(1LL << width);
112 return true;
113 } else {
114 res = op;
115 return false;
116 }
117 }
118
119 template<int width>
120 static inline bool
121 uSaturateOp(uint32_t &res, int64_t op1, int64_t op2, bool sub=false)
122 {
123 int64_t midRes = sub ? (op1 - op2) : (op1 + op2);
124 if (midRes >= (1LL << width)) {
125 res = (1LL << width) - 1;
126 return true;
127 } else if (midRes < 0) {
128 res = 0;
129 return true;
130 } else {
131 res = midRes;
132 return false;
133 }
134 }
135
136 static inline bool
137 uSatInt(int32_t &res, int64_t op, int width)
138 {
139 if (op >= (1LL << width)) {
140 res = (1LL << width) - 1;
141 return true;
142 } else if (op < 0) {
143 res = 0;
144 return true;
145 } else {
146 res = op;
147 return false;
148 }
149 }
150
152
153 // Constructor
154 ArmStaticInst(const char *mnem, ExtMachInst _machInst,
155 OpClass __opClass)
156 : StaticInst(mnem, __opClass), machInst(_machInst)
157 {
158 aarch64 = machInst.aarch64;
159 if (bits(machInst, 28, 24) == 0x10)
160 intWidth = 64; // Force 64-bit width for ADR/ADRP
161 else
162 intWidth = (aarch64 && bits(machInst, 31)) ? 64 : 32;
163 }
164
167 void printIntReg(std::ostream &os, RegIndex reg_idx,
168 uint8_t opWidth = 0) const;
169 void printFloatReg(std::ostream &os, RegIndex reg_idx) const;
170 void printVecReg(std::ostream &os, RegIndex reg_idx,
171 bool isSveVecReg = false) const;
172 void printVecPredReg(std::ostream &os, RegIndex reg_idx,
173 bool is_png = false) const;
174 void printCCReg(std::ostream &os, RegIndex reg_idx) const;
175 void printMiscReg(std::ostream &os, RegIndex reg_idx) const;
176 void printMnemonic(std::ostream &os,
177 const std::string &suffix = "",
178 bool withPred = true,
179 bool withCond64 = false,
180 ConditionCode cond64 = COND_UC) const;
181 void printTarget(std::ostream &os, Addr target,
182 const loader::SymbolTable *symtab) const;
183 void printCondition(std::ostream &os, unsigned code,
184 bool noImplicit=false) const;
185 void printMemSymbol(std::ostream &os, const loader::SymbolTable *symtab,
186 const std::string &prefix, const Addr addr,
187 const std::string &suffix) const;
188 void printShiftOperand(std::ostream &os, RegIndex rm,
189 bool immShift, uint32_t shiftAmt,
190 RegIndex rs, ArmShiftType type) const;
191 void printExtendOperand(bool firstOperand, std::ostream &os,
193 int64_t shiftAmt) const;
194 void printPFflags(std::ostream &os, int flag) const;
195
196 void printDataInst(std::ostream &os, bool withImm) const;
197 void printDataInst(std::ostream &os, bool withImm, bool immShift, bool s,
199 RegIndex rs, uint32_t shiftAmt, ArmShiftType type,
200 uint64_t imm) const;
201
202 void
203 advancePC(PCStateBase &pcState) const override
204 {
205 pcState.as<PCState>().advance();
206 }
207
208 void
209 advancePC(ThreadContext *tc) const override
210 {
211 PCState pc = tc->pcState().as<PCState>();
212 pc.advance();
213 tc->pcState(pc);
214 }
215
216 uint64_t getEMI() const override { return machInst; }
217
218 std::unique_ptr<PCStateBase>
219 buildRetPC(const PCStateBase &cur_pc,
220 const PCStateBase &call_pc) const override
221 {
222 PCStateBase *ret_pc = call_pc.clone();
223 ret_pc->as<PCState>().uEnd();
224 return std::unique_ptr<PCStateBase>{ret_pc};
225 }
226
227 std::string generateDisassembly(
228 Addr pc, const loader::SymbolTable *symtab) const override;
229
230 static void
232 {
234 sd->activateDebug();
235 }
236
237 static inline uint32_t
238 cpsrWriteByInstr(CPSR cpsr, uint32_t val, SCR scr, NSACR nsacr,
239 uint8_t byteMask, bool affectState, bool nmfi, ThreadContext *tc)
240 {
241 bool privileged = (cpsr.mode != MODE_USER);
242 bool haveVirt = ArmSystem::haveEL(tc, EL2);
243 bool isSecure = ArmISA::isSecure(tc);
244
245 uint32_t bitMask = 0;
246
247 if (affectState && byteMask==0xF){
249 }
250 if (bits(byteMask, 3)) {
251 unsigned lowIdx = affectState ? 24 : 27;
252 bitMask = bitMask | mask(31, lowIdx);
253 }
254 if (bits(byteMask, 2)) {
255 bitMask = bitMask | mask(19, 16);
256 }
257 if (bits(byteMask, 1)) {
258 unsigned highIdx = affectState ? 15 : 9;
259 unsigned lowIdx = (privileged && (isSecure || scr.aw || haveVirt))
260 ? 8 : 9;
261 bitMask = bitMask | mask(highIdx, lowIdx);
262 }
263 if (bits(byteMask, 0)) {
264 if (privileged) {
265 bitMask |= 1 << 7;
266 if ( (!nmfi || !((val >> 6) & 0x1)) &&
267 (isSecure || scr.fw || haveVirt) ) {
268 bitMask |= 1 << 6;
269 }
270 // Now check the new mode is allowed
271 OperatingMode newMode = (OperatingMode) (val & mask(5));
272 OperatingMode oldMode = (OperatingMode)(uint32_t)cpsr.mode;
273 if (!badMode(tc, newMode)) {
274 bool validModeChange = true;
275 // Check for attempts to enter modes only permitted in
276 // Secure state from Non-secure state. These are Monitor
277 // mode ('10110'), and FIQ mode ('10001') if the Security
278 // Extensions have reserved it.
279 if (!isSecure && newMode == MODE_MON)
280 validModeChange = false;
281 if (!isSecure && newMode == MODE_FIQ && nsacr.rfr == '1')
282 validModeChange = false;
283 // There is no Hyp mode ('11010') in Secure state, so that
284 // is UNPREDICTABLE
285 if (scr.ns == 0 && newMode == MODE_HYP)
286 validModeChange = false;
287 // Cannot move into Hyp mode directly from a Non-secure
288 // PL1 mode
289 if (!isSecure && oldMode != MODE_HYP && newMode == MODE_HYP)
290 validModeChange = false;
291 // Cannot move out of Hyp mode with this function except
292 // on an exception return
293 if (oldMode == MODE_HYP && newMode != MODE_HYP && !affectState)
294 validModeChange = false;
295 // Must not change to 64 bit when running in 32 bit mode
296 if (!opModeIs64(oldMode) && opModeIs64(newMode))
297 validModeChange = false;
298
299 // If we passed all of the above then set the bit mask to
300 // copy the mode accross
301 if (validModeChange) {
302 bitMask = bitMask | mask(5);
303 } else {
304 warn_once("Illegal change to CPSR mode attempted\n");
305 }
306 } else {
307 warn_once("Ignoring write of bad mode to CPSR.\n");
308 }
309 }
310 if (affectState)
311 bitMask = bitMask | (1 << 5);
312 }
313
314 return ((uint32_t)cpsr & ~bitMask) | (val & bitMask);
315 }
316
317 static inline uint32_t
318 spsrWriteByInstr(uint32_t spsr, uint32_t val,
319 uint8_t byteMask, bool affectState)
320 {
321 uint32_t bitMask = 0;
322
323 if (bits(byteMask, 3))
324 bitMask = bitMask | mask(31, 24);
325 if (bits(byteMask, 2))
326 bitMask = bitMask | mask(19, 16);
327 if (bits(byteMask, 1))
328 bitMask = bitMask | mask(15, 8);
329 if (bits(byteMask, 0))
330 bitMask = bitMask | mask(7, 0);
331
332 return ((spsr & ~bitMask) | (val & bitMask));
333 }
334
335 static inline Addr
337 {
338 return xc->pcState().as<PCState>().instPC();
339 }
340
341 static inline void
343 {
344 PCState pc = xc->pcState().as<PCState>();
345 pc.instNPC(val);
346 xc->pcState(pc);
347 }
348
349 template<class T>
350 static inline T
351 cSwap(T val, bool big)
352 {
353 if (big) {
354 return letobe(val);
355 } else {
356 return val;
357 }
358 }
359
360 template<class T, class E>
361 static inline T
362 cSwap(T val, bool big)
363 {
364 const unsigned count = sizeof(T) / sizeof(E);
365 union
366 {
367 T tVal;
368 E eVals[count];
369 } conv;
370 conv.tVal = htole(val);
371 if (big) {
372 for (unsigned i = 0; i < count; i++) {
373 conv.eVals[i] = letobe(conv.eVals[i]);
374 }
375 } else {
376 for (unsigned i = 0; i < count; i++) {
377 conv.eVals[i] = conv.eVals[i];
378 }
379 }
380 return letoh(conv.tVal);
381 }
382
383 // Perform an interworking branch.
384 static inline void
386 {
387 PCState pc = xc->pcState().as<PCState>();
388 pc.instIWNPC(val);
389 xc->pcState(pc);
390 }
391
392 // Perform an interworking branch in ARM mode, a regular branch
393 // otherwise.
394 static inline void
396 {
397 PCState pc = xc->pcState().as<PCState>();
398 pc.instAIWNPC(val);
399 xc->pcState(pc);
400 }
401
402 inline Fault disabledFault() const { return undefined(true); }
403
404 // Utility function used by checkForWFxTrap32 and checkForWFxTrap64
405 // Returns true if processor has to trap a WFI/WFE instruction.
407 ExceptionLevel targetEL, bool isWfe) const;
408
415 Fault softwareBreakpoint32(ExecContext *xc, uint16_t imm) const;
416
427
428
435 Fault checkFPAdvSIMDTrap64(ThreadContext *tc, CPSR cpsr) const;
436
445 CPSR cpsr, CPACR cpacr) const;
446
454 CPSR cpsr, CPACR cpacr,
455 NSACR nsacr, FPEXC fpexc,
456 bool fpexc_check, bool advsimd) const;
457
465 ExceptionLevel tgtEl, bool isWfe) const;
466
474 ExceptionLevel tgtEl, bool isWfe) const;
475
479 Fault trapWFx(ThreadContext *tc, CPSR cpsr, SCR scr, bool isWfe) const;
480
487 Fault checkSETENDEnabled(ThreadContext *tc, CPSR cpsr) const;
488
496
504
511
515 Fault checkSveEnabled(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const;
516
517
524 Fault smeAccessTrap(ExceptionLevel el, uint32_t iss = 0) const;
525
530 Fault checkSmeEnabled(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const;
531
538 Fault checkSmeAccess(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const;
539
544 Fault checkSveSmeEnabled(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const;
545
553 CPSR getPSTATEFromPSR(ThreadContext *tc, CPSR cpsr, CPSR spsr) const;
554
564 ExceptionLevel pstateEL) const;
565
566 public:
567 virtual void
569
570 uint8_t
572 {
573 return intWidth;
574 }
575
577 ssize_t
578 instSize() const
579 {
580 return (!machInst.thumb || machInst.bigThumb) ? 4 : 2;
581 }
582
590 encoding() const
591 {
592 return static_cast<MachInst>(machInst & (mask(instSize() * 8)));
593 }
594
595 size_t
596 asBytes(void *buf, size_t max_size) override
597 {
598 return simpleAsBytes(buf, max_size, machInst);
599 }
600
601 static unsigned getCurSveVecLenInBits(ThreadContext *tc);
602
603 static unsigned
605 {
606 return getCurSveVecLenInBits(tc) >> 6;
607 }
608
609 template<typename T>
610 static unsigned
612 {
613 return getCurSveVecLenInBits(tc) / (8 * sizeof(T));
614 }
615
616 static unsigned getCurSmeVecLenInBits(ThreadContext *tc);
617
618 static unsigned
620 {
621 return getCurSmeVecLenInBits(tc) >> 6;
622 }
623
624 template<typename T>
625 static unsigned
627 {
628 return getCurSmeVecLenInBits(tc) / (8 * sizeof(T));
629 }
630
631 inline Fault
632 undefined(bool disabled=false) const
633 {
634 return std::make_shared<UndefinedInstruction>(
635 machInst, false, mnemonic, disabled);
636 }
637
638 Fault
640 ArmISA::ExceptionClass ec, uint32_t iss) const;
641};
642
643template <>
644inline __uint128_t
645ArmStaticInst::cSwap<__uint128_t>(__uint128_t val, bool big)
646{
647 if (big) {
648 uint64_t high64 = letobe(static_cast<uint64_t>(val));
649 uint64_t low64 = letobe(static_cast<uint64_t>(val >> 64));
650 return ((__uint128_t)high64 << 64) | (__uint128_t)low64;
651 } else {
652 return val;
653 }
654}
655
656} // namespace ArmISA
657} // namespace gem5
658
659#endif //__ARCH_ARM_INSTS_STATICINST_HH__
void printMiscReg(std::ostream &os, RegIndex reg_idx) const
int64_t extendReg64(uint64_t base, ArmExtendType type, uint64_t shiftAmt, uint8_t width) const
Fault checkSveSmeEnabled(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const
Check an SVE access against CPACR_EL1, CPTR_EL2, and CPTR_EL3, but choosing the correct set of traps ...
void printExtendOperand(bool firstOperand, std::ostream &os, RegIndex rm, ArmExtendType type, int64_t shiftAmt) const
Fault softwareBreakpoint32(ExecContext *xc, uint16_t imm) const
Trigger a Software Breakpoint.
bool shift_carry_imm(uint32_t base, uint32_t shamt, uint32_t type, uint32_t cfval) const
void advancePC(ThreadContext *tc) const override
ArmStaticInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
void printCondition(std::ostream &os, unsigned code, bool noImplicit=false) const
void printMnemonic(std::ostream &os, const std::string &suffix="", bool withPred=true, bool withCond64=false, ConditionCode cond64=COND_UC) const
void printCCReg(std::ostream &os, RegIndex reg_idx) const
void printVecPredReg(std::ostream &os, RegIndex reg_idx, bool is_png=false) const
bool generalExceptionsToAArch64(ThreadContext *tc, ExceptionLevel pstateEL) const
Return true if exceptions normally routed to EL1 are being handled at an Exception level using AArch6...
Fault checkSveEnabled(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const
Check an SVE access against CPACR_EL1, CPTR_EL2, and CPTR_EL3.
static unsigned getCurSveVecLen(ThreadContext *tc)
void printMemSymbol(std::ostream &os, const loader::SymbolTable *symtab, const std::string &prefix, const Addr addr, const std::string &suffix) const
Fault undefinedFault32(ThreadContext *tc, ExceptionLevel el) const
UNDEFINED behaviour in AArch32.
ssize_t instSize() const
Returns the byte size of current instruction.
static void setIWNextPC(ExecContext *xc, Addr val)
static unsigned getCurSmeVecLenInBits(ThreadContext *tc)
Fault checkForWFxTrap64(ThreadContext *tc, ExceptionLevel tgtEl, bool isWfe) const
Check if WFE/WFI instruction execution in aarch64 should be trapped.
static void activateBreakpoint(ThreadContext *tc)
Fault undefined(bool disabled=false) const
static unsigned getCurSveVecLenInBits(ThreadContext *tc)
bool isWFxTrapping(ThreadContext *tc, ExceptionLevel targetEL, bool isWfe) const
Fault generateTrap(ArmISA::ExceptionLevel el, ArmISA::ExceptionClass ec, uint32_t iss) const
Fault smeAccessTrap(ExceptionLevel el, uint32_t iss=0) const
Trap an access to SME registers due to access control bits.
int64_t shiftReg64(uint64_t base, uint64_t shiftAmt, ArmShiftType type, uint8_t width) const
static bool uSaturateOp(uint32_t &res, int64_t op1, int64_t op2, bool sub=false)
Fault checkAdvSIMDOrFPEnabled32(ThreadContext *tc, CPSR cpsr, CPACR cpacr, NSACR nsacr, FPEXC fpexc, bool fpexc_check, bool advsimd) const
Check if a VFP/SIMD access from aarch32 should be allowed.
int32_t shift_rm_rs(uint32_t base, uint32_t shamt, uint32_t type, uint32_t cfval) const
void printDataInst(std::ostream &os, bool withImm) const
size_t asBytes(void *buf, size_t max_size) override
Instruction classes can override this function to return a a representation of themselves as a blob o...
static void setNextPC(ExecContext *xc, Addr val)
void advancePC(PCStateBase &pcState) const override
CPSR getPSTATEFromPSR(ThreadContext *tc, CPSR cpsr, CPSR spsr) const
Get the new PSTATE from a SPSR register in preparation for an exception return.
void printPFflags(std::ostream &os, int flag) const
Fault trapWFx(ThreadContext *tc, CPSR cpsr, SCR scr, bool isWfe) const
WFE/WFI trapping helper function.
Fault checkSmeEnabled(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const
Check if SME is enabled by checking the SME and FP bits of CPACR_EL1, CPTR_EL2, and CPTR_EL3.
Fault undefinedFault64(ThreadContext *tc, ExceptionLevel el) const
UNDEFINED behaviour in AArch64.
void printVecReg(std::ostream &os, RegIndex reg_idx, bool isSveVecReg=false) const
void printIntReg(std::ostream &os, RegIndex reg_idx, uint8_t opWidth=0) const
Print a register name for disassembly given the unique dependence tag number (FP or int).
static uint32_t cpsrWriteByInstr(CPSR cpsr, uint32_t val, SCR scr, NSACR nsacr, uint8_t byteMask, bool affectState, bool nmfi, ThreadContext *tc)
void printShiftOperand(std::ostream &os, RegIndex rm, bool immShift, uint32_t shiftAmt, RegIndex rs, ArmShiftType type) const
uint64_t getEMI() const override
Fault advSIMDFPAccessTrap64(ExceptionLevel el) const
Trap an access to Advanced SIMD or FP registers due to access control bits.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::unique_ptr< PCStateBase > buildRetPC(const PCStateBase &cur_pc, const PCStateBase &call_pc) const override
static void setAIWNextPC(ExecContext *xc, Addr val)
static unsigned getCurSmeVecLenInQWords(ThreadContext *tc)
static Addr readPC(ExecContext *xc)
virtual void annotateFault(ArmFault *fault)
Fault checkSmeAccess(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const
Check an SME access against CPACR_EL1, CPTR_EL2, and CPTR_EL3.
static bool saturateOp(int32_t &res, int64_t op1, int64_t op2, bool sub=false)
static bool uSatInt(int32_t &res, int64_t op, int width)
void printFloatReg(std::ostream &os, RegIndex reg_idx) const
static bool satInt(int32_t &res, int64_t op, int width)
Fault checkFPAdvSIMDTrap64(ThreadContext *tc, CPSR cpsr) const
Check an Advaned SIMD access against CPTR_EL2 and CPTR_EL3.
MachInst encoding() const
Returns the real encoding of the instruction: the machInst field is in fact always 64 bit wide and co...
bool shift_carry_rs(uint32_t base, uint32_t shamt, uint32_t type, uint32_t cfval) const
static unsigned getCurSveVecLenInQWords(ThreadContext *tc)
Fault checkForWFxTrap32(ThreadContext *tc, ExceptionLevel tgtEl, bool isWfe) const
Check if WFE/WFI instruction execution in aarch32 should be trapped.
static T cSwap(T val, bool big)
Fault sveAccessTrap(ExceptionLevel el) const
Trap an access to SVE registers due to access control bits.
static uint32_t spsrWriteByInstr(uint32_t spsr, uint32_t val, uint8_t byteMask, bool affectState)
Fault checkFPAdvSIMDEnabled64(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const
Check an Advaned SIMD access against CPACR_EL1, CPTR_EL2, and CPTR_EL3.
int32_t shift_rm_imm(uint32_t base, uint32_t shamt, uint32_t type, uint32_t cfval) const
static T cSwap(T val, bool big)
void printTarget(std::ostream &os, Addr target, const loader::SymbolTable *symtab) const
Fault checkSETENDEnabled(ThreadContext *tc, CPSR cpsr) const
Check if SETEND instruction execution in aarch32 should be trapped.
static unsigned getCurSmeVecLen(ThreadContext *tc)
SelfDebug * getSelfDebug() const
Definition isa.hh:182
static bool haveEL(ThreadContext *tc, ArmISA::ExceptionLevel el)
Return true if the system implements a specific exception level.
Definition system.cc:133
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
virtual const PCStateBase & pcState() const =0
Target & as()
Definition pcstate.hh:73
virtual PCStateBase * clone() const =0
StaticInst(const char *_mnemonic, OpClass op_class)
Constructor.
size_t simpleAsBytes(void *buf, size_t max_size, const T &t)
const char * mnemonic
Base mnemonic (e.g., "add").
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual const PCStateBase & pcState() const =0
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Definition bitfield.hh:79
#define warn_once(...)
Definition logging.hh:292
bool badMode(ThreadContext *tc, OperatingMode mode)
badMode is checking if the execution mode provided as an argument is valid and implemented.
Definition utility.cc:407
Bitfield< 15, 12 > rd
Definition types.hh:114
Bitfield< 3, 0 > mask
Definition pcstate.hh:63
Bitfield< 4 > width
Definition misc_types.hh:72
bool isSecure(ThreadContext *tc)
Definition utility.cc:74
Bitfield< 3, 0 > rm
Definition types.hh:118
Bitfield< 7, 0 > imm
Definition types.hh:132
Bitfield< 23, 20 > advsimd
Bitfield< 4 > s
Bitfield< 7 > i
Definition misc_types.hh:67
Bitfield< 9, 8 > rs
Bitfield< 19, 16 > rn
Definition types.hh:113
uint32_t MachInst
Definition types.hh:55
ConditionCode
Definition cc.hh:104
@ COND_UC
Definition cc.hh:120
Bitfield< 27 > nmfi
Bitfield< 24, 0 > iss
Bitfield< 4 > sd
Bitfield< 3, 2 > el
Definition misc_types.hh:73
Bitfield< 4 > pc
Bitfield< 31, 0 > E
Definition int.hh:56
Bitfield< 17 > os
Definition misc.hh:838
Bitfield< 4 > op
Definition types.hh:83
Bitfield< 63 > val
Definition misc.hh:804
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
uint16_t RegIndex
Definition types.hh:176
std::shared_ptr< FaultBase > Fault
Definition types.hh:249
T letoh(T value)
Definition byteswap.hh:173
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
T htole(T value)
Definition byteswap.hh:172
T letobe(T value)
Definition byteswap.hh:166

Generated on Mon Oct 27 2025 04:13:01 for gem5 by doxygen 1.14.0