46using namespace ArmISA;
117 (misc_reg.
crm << 1) |
119 (misc_reg.
crn << 10) |
120 (misc_reg.
op1 << 14) |
121 (misc_reg.
op2 << 17) |
122 (misc_reg.
op0 << 20);
137 return std::make_shared<SupervisorTrap>(
getEMI(),
iss,
ec);
139 return std::make_shared<HypervisorTrap>(
getEMI(),
iss,
ec);
141 return std::make_shared<SecureMonitorTrap>(
getEMI(),
iss,
ec);
154 return (
imm & 0x1) << 22;
156 return (
imm & 0x1) << 23;
158 panic(
"Not a valid PSTATE field register\n");
166 std::stringstream
ss;
178 std::stringstream
ss;
190 assert(misc_reg.has_value());
191 return _iss(misc_reg.value(),
op1);
198 std::stringstream
ss;
210 assert(misc_reg.has_value());
211 return _iss(misc_reg.value(),
dest);
242 std::stringstream
ss;
264 TLBIVMALL tlbi_op(regime, secure, stage2);
279 auto asid = asid_16bits ?
bits(value, 63, 48) :
282 TLBIMVA tlbi_op(regime, secure,
static_cast<Addr>(
bits(value, 43, 0)) << 12,
290 TLBIMVAA tlbi_op(regime, secure,
static_cast<Addr>(
bits(value, 43, 0)) << 12, last_level);
303 TLBIMVAA tlbi_op(regime, secure,
static_cast<Addr>(
bits(value, 43, 0)) << 12, last_level);
316 auto asid = asid_16bits ?
bits(value, 63, 48) :
336 bool secure = release->has(ArmExtension::SECURITY) &&
337 !scr.ns && !
bits(value, 63);
341 TLBIIPA tlbi_op(TranslationRegime::EL10, secure,
342 static_cast<Addr>(
bits(value, top_bit, 0)) << 12,
357 TLBIRMVAA tlbi_op(regime, secure, value, last_level);
372 auto asid = asid_16bits ?
bits(value, 63, 48) :
375 TLBIRMVA tlbi_op(regime, secure, value,
asid, last_level);
382 tlbiRvaa(tc, value, secure, regime, shareable, last_level);
394 bool secure = release->has(ArmExtension::SECURITY) &&
395 !scr.ns && !
bits(value, 63);
397 TLBIRIPA tlbi_op(TranslationRegime::EL10, secure, value, last_level);
412 TranslationRegime::EL3,
421 TranslationRegime::EL3,
430 TranslationRegime::EL3,
438 TranslationRegime::EL20 : TranslationRegime::EL2;
450 TranslationRegime::EL20 : TranslationRegime::EL2;
462 TranslationRegime::EL20 : TranslationRegime::EL2;
475 TranslationRegime::EL10,
484 TranslationRegime::EL10,
493 TranslationRegime::EL10,
501 TranslationRegime::EL20 : TranslationRegime::EL10;
518 TranslationRegime::EL20 : TranslationRegime::EL10;
530 TranslationRegime::EL20 : TranslationRegime::EL10;
543 TranslationRegime::EL10,
553 TranslationRegime::EL10,
563 TranslationRegime::EL10,
573 TranslationRegime::EL3,
583 TranslationRegime::EL3,
593 TranslationRegime::EL3,
603 TranslationRegime::EL3,
613 TranslationRegime::EL3,
623 TranslationRegime::EL3,
632 TranslationRegime::EL20 : TranslationRegime::EL2;
646 TranslationRegime::EL2,
656 TranslationRegime::EL2,
665 TranslationRegime::EL20 : TranslationRegime::EL2;
678 TranslationRegime::EL20 : TranslationRegime::EL2;
691 TranslationRegime::EL20 : TranslationRegime::EL2;
704 TranslationRegime::EL20 : TranslationRegime::EL10;
722 TranslationRegime::EL20 : TranslationRegime::EL10;
735 TranslationRegime::EL20 : TranslationRegime::EL10;
748 TranslationRegime::EL20 : TranslationRegime::EL10;
761 TranslationRegime::EL20 : TranslationRegime::EL10;
774 TranslationRegime::EL20 : TranslationRegime::EL10;
787 TranslationRegime::EL20 : TranslationRegime::EL10;
804 TranslationRegime::EL20 : TranslationRegime::EL10;
816 TranslationRegime::EL20 : TranslationRegime::EL10;
828 TranslationRegime::EL20 : TranslationRegime::EL10;
846 TranslationRegime::EL20 : TranslationRegime::EL10;
859 TranslationRegime::EL20 : TranslationRegime::EL10;
872 TranslationRegime::EL20 : TranslationRegime::EL10;
890 TranslationRegime::EL20 : TranslationRegime::EL10;
903 TranslationRegime::EL20 : TranslationRegime::EL10;
917 TranslationRegime::EL10,
927 TranslationRegime::EL10,
937 TranslationRegime::EL10,
947 TranslationRegime::EL10,
957 TranslationRegime::EL10,
967 TranslationRegime::EL10,
976 TranslationRegime::EL20 : TranslationRegime::EL10;
994 TranslationRegime::EL20 : TranslationRegime::EL10;
1007 TranslationRegime::EL20 : TranslationRegime::EL10;
1020 TranslationRegime::EL20 : TranslationRegime::EL10;
1038 TranslationRegime::EL20 : TranslationRegime::EL10;
1051 TranslationRegime::EL20 : TranslationRegime::EL10;
1064 TranslationRegime::EL20 : TranslationRegime::EL10;
1082 TranslationRegime::EL20 : TranslationRegime::EL10;
1095 TranslationRegime::EL20 : TranslationRegime::EL10;
1108 TranslationRegime::EL20 : TranslationRegime::EL10;
1126 TranslationRegime::EL20 : TranslationRegime::EL10;
1139 TranslationRegime::EL20 : TranslationRegime::EL10;
1153 TranslationRegime::EL10,
1163 TranslationRegime::EL10,
1173 TranslationRegime::EL10,
1183 TranslationRegime::EL10,
1193 TranslationRegime::EL10,
1203 TranslationRegime::EL10,
1212 TranslationRegime::EL20 : TranslationRegime::EL2;
1225 TranslationRegime::EL20 : TranslationRegime::EL2;
1238 TranslationRegime::EL20 : TranslationRegime::EL2;
1251 TranslationRegime::EL20 : TranslationRegime::EL2;
1264 TranslationRegime::EL20 : TranslationRegime::EL2;
1277 TranslationRegime::EL20 : TranslationRegime::EL2;
1291 TranslationRegime::EL3,
1301 TranslationRegime::EL3,
1311 TranslationRegime::EL3,
1321 TranslationRegime::EL3,
1331 TranslationRegime::EL3,
1341 TranslationRegime::EL3,
1354 it->second(tc, value);
1356 panic(
"Invalid TLBI\n");
void printMiscReg(std::ostream &os, RegIndex reg_idx) const
void printMnemonic(std::ostream &os, const std::string &suffix="", bool withPred=true, bool withCond64=false, ConditionCode cond64=COND_UC) 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).
uint64_t getEMI() const override
MachInst encoding() const
Returns the real encoding of the instruction: the machInst field is in fact always 64 bit wide and co...
const ArmRelease * getRelease() const
static bool hasUnprivRegime(TranslationRegime regime)
Implementaton of AArch64 TLBI ALLE(1,2,3)(IS) instructions.
TLB Invalidate by ASID match.
TLB Invalidate by Intermediate Physical Address.
TLB Invalidate by VA, All ASID.
void broadcast(ThreadContext *tc)
Broadcast the TLB Invalidate operation to all TLBs in the Arm system.
TLB Range Invalidate by VA, All ASIDs.
TLB Range Invalidate by VA, All ASIDs.
TLB Range Invalidate by VA.
Implementaton of AArch64 TLBI VMALLE1(IS)/VMALLS112E1(IS) instructions.
uint8_t physAddrRange() const
Returns the supported physical address range in bits.
bool haveLargeAsid64() const
Returns true if ASID is 16 bits in AArch64 (ARMv8)
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
virtual ThreadContext * tcBase() const =0
Returns a pointer to the ThreadContext.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
RegVal miscRegImm() const
Returns the "register view" of the immediate field.
ArmISA::MiscRegIndex dest
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
const ArmISA::MiscRegNum64 miscReg
const std::string fullMnemonic
uint32_t iss() const override
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
Fault execute(ExecContext *xc, trace::InstRecord *traceData) const override
uint32_t _iss(const ArmISA::MiscRegNum64 &misc_reg, RegIndex int_index) const
Fault generateTrap(ArmISA::ExceptionLevel el) const
virtual uint32_t iss() const
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
ArmISA::MiscRegIndex dest
uint32_t iss() const override
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
uint32_t iss() const override
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
virtual RegVal readMiscReg(RegIndex misc_reg)=0
virtual BaseISA * getIsaPtr() const =0
static void tlbiAll(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable)
static void tlbiRva(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
static void tlbiAsid(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable)
static void tlbiIpaS2(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
static void tlbiVa(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
static void tlbiRipaS2(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
static std::unordered_map< ArmISA::MiscRegIndex, TlbiFunc > tlbiOps
static void tlbiRvaa(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
void performTlbi(ExecContext *xc, ArmISA::MiscRegIndex idx, RegVal value) const
static void tlbiVaa(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool last_level)
static void tlbiVmall(ThreadContext *tc, RegVal value, bool secure, ArmISA::TranslationRegime regime, bool shareable, bool stage2=false)
std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const override
Internal function to generate disassembly string.
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
#define panic(...)
This implements a cprintf based panic() function.
bool ELIsInHost(ThreadContext *tc, ExceptionLevel el)
Returns true if the current exception level el is executing a Host OS or an application of a Host OS ...
ExceptionLevel currEL(const ThreadContext *tc)
Returns the current Exception Level (EL) of the provided ThreadContext.
Fault checkFaultAccessAArch64SysReg(MiscRegIndex reg, CPSR cpsr, ThreadContext *tc, const MiscRegOp64 &inst)
bool EL2Enabled(ThreadContext *tc)
ExceptionLevel translationEl(TranslationRegime regime)
@ MISCREG_TLBI_IPAS2LE1IS
@ MISCREG_TLBI_VMALLS12E1OS
@ MISCREG_TLBI_VMALLS12E1
@ MISCREG_TLBI_VMALLS12E1IS
@ MISCREG_TLBI_RIPAS2E1IS
@ MISCREG_TLBI_RIPAS2LE1IS
@ MISCREG_TLBI_RIPAS2E1OS
@ MISCREG_TLBI_RIPAS2LE1OS
@ MISCREG_TLBI_IPAS2LE1OS
std::optional< MiscRegNum64 > encodeAArch64SysReg(MiscRegIndex misc_reg)
bool isSecureAtEL(ThreadContext *tc, ExceptionLevel el)
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
std::string csprintf(const char *format, const Args &...args)
void ccprintf(cp::Print &print)
The file contains the definition of a set of TLB Invalidate Instructions.