Go to the documentation of this file.
41 #ifndef __ARCH_ARM_INSTS_STATICINST_HH__
42 #define __ARCH_ARM_INSTS_STATICINST_HH__
67 uint32_t
type, uint32_t cfval)
const;
69 uint32_t
type, uint32_t cfval)
const;
72 uint32_t
type, uint32_t cfval)
const;
74 uint32_t
type, uint32_t cfval)
const;
79 uint64_t shiftAmt, uint8_t
width)
const;
83 saturateOp(int32_t &res, int64_t op1, int64_t op2,
bool sub=
false)
85 int64_t midRes = sub ? (op1 - op2) : (op1 + op2);
88 res = (
LL(1) << (
width - 1)) - 1;
116 uSaturateOp(uint32_t &res, int64_t op1, int64_t op2,
bool sub=
false)
118 int64_t midRes = sub ? (op1 - op2) : (op1 + op2);
119 if (midRes >= (
LL(1) <<
width)) {
122 }
else if (midRes < 0) {
161 uint8_t opWidth = 0)
const;
164 bool isSveVecReg =
false)
const;
169 const std::string &suffix =
"",
170 bool withPred =
true,
171 bool withCond64 =
false,
176 bool noImplicit=
false)
const;
178 const std::string &prefix,
const Addr addr,
179 const std::string &suffix)
const;
181 bool immShift, uint32_t shiftAmt,
185 int64_t shiftAmt)
const;
210 static inline uint32_t
214 bool privileged = (cpsr.mode !=
MODE_USER);
218 uint32_t bitMask = 0;
220 if (affectState && byteMask==0xF){
223 if (
bits(byteMask, 3)) {
224 unsigned lowIdx = affectState ? 24 : 27;
225 bitMask = bitMask |
mask(31, lowIdx);
227 if (
bits(byteMask, 2)) {
228 bitMask = bitMask |
mask(19, 16);
230 if (
bits(byteMask, 1)) {
231 unsigned highIdx = affectState ? 15 : 9;
232 unsigned lowIdx = (privileged && (
isSecure || scr.aw || haveVirt))
234 bitMask = bitMask |
mask(highIdx, lowIdx);
236 if (
bits(byteMask, 0)) {
239 if ( (!
nmfi || !((
val >> 6) & 0x1)) &&
240 (
isSecure || scr.fw || haveVirt) ) {
247 bool validModeChange =
true;
253 validModeChange =
false;
255 validModeChange =
false;
258 if (scr.ns == 0 && newMode ==
MODE_HYP)
259 validModeChange =
false;
263 validModeChange =
false;
267 validModeChange =
false;
269 if (!opModeIs64(oldMode) && opModeIs64(newMode))
270 validModeChange =
false;
274 if (validModeChange) {
275 bitMask = bitMask |
mask(5);
277 warn_once(
"Illegal change to CPSR mode attempted\n");
280 warn_once(
"Ignoring write of bad mode to CPSR.\n");
284 bitMask = bitMask | (1 << 5);
287 return ((uint32_t)cpsr & ~bitMask) | (
val & bitMask);
290 static inline uint32_t
292 uint8_t byteMask,
bool affectState)
294 uint32_t bitMask = 0;
296 if (
bits(byteMask, 3))
297 bitMask = bitMask |
mask(31, 24);
298 if (
bits(byteMask, 2))
299 bitMask = bitMask |
mask(19, 16);
300 if (
bits(byteMask, 1))
301 bitMask = bitMask |
mask(15, 8);
302 if (
bits(byteMask, 0))
303 bitMask = bitMask |
mask(7, 0);
305 return ((spsr & ~bitMask) | (
val & bitMask));
333 template<
class T,
class E>
337 const unsigned count =
sizeof(T) /
sizeof(
E);
344 for (
unsigned i = 0;
i <
count;
i++) {
345 conv.eVals[
i] =
letobe(conv.eVals[
i]);
348 for (
unsigned i = 0;
i <
count;
i++) {
349 conv.eVals[
i] = conv.eVals[
i];
352 return letoh(conv.tVal);
377 return std::make_shared<UndefinedInstruction>(
machInst,
false,
422 CPSR cpsr, CPACR cpacr)
const;
431 CPSR cpsr, CPACR cpacr,
432 NSACR nsacr, FPEXC fpexc,
433 bool fpexc_check,
bool advsimd)
const;
566 #endif //__ARCH_ARM_INSTS_STATICINST_HH__
static Addr readPC(ExecContext *xc)
static bool saturateOp(int32_t &res, int64_t op1, int64_t op2, bool sub=false)
Bitfield< 23, 20 > advsimd
#define LL(N)
int64_t constant
static unsigned getCurSveVecLen(ThreadContext *tc)
void printCCReg(std::ostream &os, RegIndex reg_idx) const
bool isWFxTrapping(ThreadContext *tc, ExceptionLevel targetEL, bool isWfe) const
Base, ISA-independent static instruction class.
Fault checkForWFxTrap64(ThreadContext *tc, ExceptionLevel tgtEl, bool isWfe) const
Check if WFE/WFI instruction execution in aarch64 should be trapped.
Fault sveAccessTrap(ExceptionLevel el) const
Trap an access to SVE registers due to access control bits.
void advancePC(PCState &pcState) const override
Fault checkFPAdvSIMDEnabled64(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const
Check an Advaned SIMD access against CPACR_EL1, CPTR_EL2, and CPTR_EL3.
Fault advSIMDFPAccessTrap64(ExceptionLevel el) const
Trap an access to Advanced SIMD or FP registers due to access control bits.
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).
int64_t shiftReg64(uint64_t base, uint64_t shiftAmt, ArmShiftType type, uint8_t width) const
int32_t shift_rm_imm(uint32_t base, uint32_t shamt, uint32_t type, uint32_t cfval) const
void printShiftOperand(std::ostream &os, IntRegIndex rm, bool immShift, uint32_t shiftAmt, IntRegIndex rs, ArmShiftType type) const
void printMemSymbol(std::ostream &os, const Loader::SymbolTable *symtab, const std::string &prefix, const Addr addr, const std::string &suffix) const
bool haveVirtualization() const
Returns true if this system implements the virtualization Extensions.
virtual PCState pcState() const =0
bool shift_carry_imm(uint32_t base, uint32_t shamt, uint32_t type, uint32_t cfval) const
Fault softwareBreakpoint32(ExecContext *xc, uint16_t imm) const
Trigger a Software Breakpoint.
Fault checkForWFxTrap32(ThreadContext *tc, ExceptionLevel tgtEl, bool isWfe) const
Check if WFE/WFI instruction execution in aarch32 should be trapped.
void printExtendOperand(bool firstOperand, std::ostream &os, IntRegIndex rm, ArmExtendType type, int64_t shiftAmt) const
Fault checkSETENDEnabled(ThreadContext *tc, CPSR cpsr) const
Check if SETEND instruction execution in aarch32 should be trapped.
int64_t extendReg64(uint64_t base, ArmExtendType type, uint64_t shiftAmt, uint8_t width) const
static bool uSaturateOp(uint32_t &res, int64_t op1, int64_t op2, bool sub=false)
ThreadContext is the external interface to all thread state for anything outside of the CPU.
static T cSwap(T val, bool big)
static unsigned getCurSveVecLenInBits(ThreadContext *tc)
std::shared_ptr< FaultBase > Fault
virtual void annotateFault(ArmFault *fault)
static void setAIWNextPC(ExecContext *xc, Addr val)
Fault undefinedFault32(ThreadContext *tc, ExceptionLevel el) const
UNDEFINED behaviour in AArch32.
static uint32_t spsrWriteByInstr(uint32_t spsr, uint32_t val, uint8_t byteMask, bool affectState)
void printMiscReg(std::ostream &os, RegIndex reg_idx) const
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
static bool satInt(int32_t &res, int64_t op, int width)
uint8_t getIntWidth() const
bool shift_carry_rs(uint32_t base, uint32_t shamt, uint32_t type, uint32_t cfval) const
const char * mnemonic
Base mnemonic (e.g., "add").
TheISA::ExtMachInst ExtMachInst
Binary extended machine instruction type.
Fault checkFPAdvSIMDTrap64(ThreadContext *tc, CPSR cpsr) const
Check an Advaned SIMD access against CPTR_EL2 and CPTR_EL3.
static void setIWNextPC(ExecContext *xc, Addr val)
void printCondition(std::ostream &os, unsigned code, bool noImplicit=false) const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static unsigned getCurSveVecLenInQWords(ThreadContext *tc)
void printVecPredReg(std::ostream &os, RegIndex reg_idx) const
void printVecReg(std::ostream &os, RegIndex reg_idx, bool isSveVecReg=false) const
SelfDebug * getSelfDebug() const
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.
void printFloatReg(std::ostream &os, RegIndex reg_idx) const
size_t simpleAsBytes(void *buf, size_t max_size, const T &t)
bool generalExceptionsToAArch64(ThreadContext *tc, ExceptionLevel pstateEL) const
Return true if exceptions normally routed to EL1 are being handled at an Exception level using AArch6...
void printDataInst(std::ostream &os, bool withImm) const
MachInst encoding() const
Returns the real encoding of the instruction: the machInst field is in fact always 64 bit wide and co...
static bool uSatInt(int32_t &res, int64_t op, int width)
const ExtMachInst machInst
The binary machine instruction.
GenericISA::DelaySlotPCState< MachInst > PCState
Fault trapWFx(ThreadContext *tc, CPSR cpsr, SCR scr, bool isWfe) const
WFE/WFI trapping helper function.
void printMnemonic(std::ostream &os, const std::string &suffix="", bool withPred=true, bool withCond64=false, ConditionCode cond64=COND_UC) const
ssize_t instSize() const
Returns the byte size of current instruction.
std::string generateDisassembly(Addr pc, const Loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
CPSR getPSTATEFromPSR(ThreadContext *tc, CPSR cpsr, CPSR spsr) const
Get the new PSTATE from a SPSR register in preparation for an exception return.
static void setNextPC(ExecContext *xc, Addr val)
ArmStaticInst(const char *mnem, ExtMachInst _machInst, OpClass __opClass)
Fault checkSveEnabled(ThreadContext *tc, CPSR cpsr, CPACR cpacr) const
Check an SVE access against CPACR_EL1, CPTR_EL2, and CPTR_EL3.
void printTarget(std::ostream &os, Addr target, const Loader::SymbolTable *symtab) const
int32_t shift_rm_rs(uint32_t base, uint32_t shamt, uint32_t type, uint32_t cfval) const
void printPFflags(std::ostream &os, int flag) 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 T cSwap(T val, bool big)
bool badMode(ThreadContext *tc, OperatingMode mode)
badMode is checking if the execution mode provided as an argument is valid and implemented.
static void activateBreakpoint(ThreadContext *tc)
Fault undefinedFault64(ThreadContext *tc, ExceptionLevel el) const
UNDEFINED behaviour in AArch64.
bool isSecure(ThreadContext *tc)
Fault disabledFault() const
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
static uint32_t cpsrWriteByInstr(CPSR cpsr, uint32_t val, SCR scr, NSACR nsacr, uint8_t byteMask, bool affectState, bool nmfi, ThreadContext *tc)
Generated on Wed Sep 30 2020 14:02:00 for gem5 by doxygen 1.8.17