64 static Fault reset = std::make_shared<Reset>();
72 panic(
"getArgument() only implemented for full system mode.\n");
77 panic(
"getArgument(): Floating point arguments not implemented\n");
80 if (size == (uint16_t)(-1))
81 size =
sizeof(uint64_t);
86 panic(
"getArgument(): No support reading stack args for AArch64\n");
89 if (size == (uint16_t)(-1))
96 if (size ==
sizeof(uint64_t)) {
97 if ((number % 2) != 0)
112 if (size ==
sizeof(uint64_t)) {
114 if ((number % 2) != 0)
116 arg = vp.
read<uint64_t>(sp +
121 arg = vp.
read<uint32_t>(sp +
127 panic(
"getArgument() should always return\n");
212 assert((0 <= tc->
cpuId()) && (tc->
cpuId() < 256));
246 panic(
"must haveSecurity(tc)");
255 panic(
"Invalid exception level");
273 panic(
"Invalid exception level");
285 if (
bits(addr, 55, 48) == 0xFF && tcr.tbi1)
286 return addr |
mask(63, 55);
287 else if (!
bits(addr, 55, 48) && tcr.tbi0)
288 return bits(addr,55, 0);
294 return addr &
mask(56);
299 return addr &
mask(56);
302 panic(
"Invalid exception level");
318 if (
bits(addr, 55, 48) == 0xFF && tcr.tbi1)
319 return addr |
mask(63, 55);
320 else if (!
bits(addr, 55, 48) && tcr.tbi0)
321 return bits(addr,55, 0);
327 return addr &
mask(56);
333 return addr &
mask(56);
336 panic(
"Invalid exception level");
357 HDCR hdcr, HSTR hstr, HCPTR hcptr, uint32_t iss)
365 bool trapToHype =
false;
370 trapToHype = ((uint32_t) hstr) & (1 << crn);
371 trapToHype |= hdcr.tpm && (crn == 9) && (crm >= 12);
372 trapToHype |= hcr.tidcp && (
373 ((crn == 9) && ((crm <= 2) || ((crm >= 5) && (crm <= 8)))) ||
374 ((crn == 10) && ((crm <= 1) || (crm == 4) || (crm == 8))) ||
375 ((crn == 11) && ((crm <= 8) || (crm == 15))) );
380 trapToHype = hcptr.tcpac;
386 trapToHype = hcr.tid1;
392 trapToHype = hcr.tid2;
408 trapToHype = hcr.tid3;
413 trapToHype = hcr.tsw;
418 trapToHype = hcr.tpc;
424 trapToHype = hcr.tpu;
440 trapToHype = hcr.ttlb;
443 trapToHype = hcr.tac;
461 trapToHype = hcr.tvm & !isRead;
464 trapToHype = hdcr.tpmcr;
478 HDCR hdcr, HSTR hstr, HCPTR hcptr, uint32_t iss)
486 bool trapToHype =
false;
490 inform(
"trap check M:%x N:%x 1:%x 2:%x hdcr %x, hcptr %x, hstr %x\n",
491 crm, crn, opc1, opc2, hdcr, hcptr, hstr);
492 trapToHype = hdcr.tda && (opc1 == 0);
493 trapToHype |= hcptr.tta && (opc1 == 1);
500 trapToHype = hdcr.tdosa;
504 trapToHype = hdcr.tdra;
507 trapToHype = hcr.tid0;
511 trapToHype = hstr.tjdbx;
515 trapToHype = hstr.ttee;
528 HCR hcr, uint32_t iss)
536 bool trapToHype =
false;
543 trapToHype = ((uint32_t) hstr) & (1 << crm);
563 trapToHype = hcr.tvm & !isRead;
578 bool trapToSup =
false;
583 if ((el ==
EL0 && cpacr.fpen != 0x3) ||
584 (el ==
EL1 && !(cpacr.fpen & 0x1)))
601 bool trapToHyp =
false;
609 trapToHyp = cptr.tfp;
614 trapToHyp = cptr.tcpac && el ==
EL1;
628 trapToHyp = ((hcr.trvm && isRead) || (hcr.tvm && !isRead))
644 trapToHyp = hcr.ttlb && el ==
EL1;
651 trapToHyp = hcr.tpu && el <=
EL1;
657 trapToHyp = hcr.tpc && el <=
EL1;
663 trapToHyp = hcr.tsw && el ==
EL1;
667 trapToHyp = hcr.tacr && el ==
EL1;
702 trapToHyp = hcr.tid3 && el ==
EL1;
709 trapToHyp = hcr.tid2 && el <=
EL1;
715 trapToHyp = hcr.tid1 && el ==
EL1;
727 bool trapToMon =
false;
735 trapToMon = cptr.tfp;
741 trapToMon = cptr.tcpac;
746 trapToMon = cptr.tcpac;
757 CPSR cpsr, SCR scr, NSACR nsacr,
bool checkSecurity)
802 int sysM4To3 =
bits(sysM, 4, 3);
807 }
else if (sysM4To3 == 1) {
810 }
else if (sysM4To3 == 3) {
811 if (
bits(sysM, 1) == 0) {
816 if (
bits(sysM, 0) == 1) {
824 int sysM2 =
bits(sysM, 2);
825 int sysM1 =
bits(sysM, 1);
829 ((sysM2 && !sysM1) << 2) |
830 ((sysM2 && sysM1) << 3) |
835 ok &= mode != cpsr.mode;
840 if (ok && checkSecurity && mode != cpsr.mode) {
848 ok &= (mode !=
MODE_MON) || !scr.ns;
852 ok &= (mode !=
MODE_FIQ) || !nsacr.rfr;
860 ok &= (mode !=
MODE_MON) || !scr.ns;
861 ok &= (mode !=
MODE_FIQ) || !nsacr.rfr;
867 panic(
"unknown Mode 0x%x\n", cpsr.mode);
887 panic(
"Invalid exception level");
911 panic(
"Invalid phys. address range encoding");
932 panic(
"Invalid phys. address range");
A TranslatingPortProxy in FS mode translates a virtual address to a physical address and then calls t...
virtual CCReg readCCReg(int reg_idx)=0
virtual void setFloatRegFlat(int idx, FloatReg val)=0
ExceptionLevel highestEL() const
Returns the highest implemented exception level.
virtual uint64_t readIntRegFlat(int idx)=0
Flat register interfaces.
virtual MiscReg readMiscRegNoEffect(int misc_reg) const =0
bool FullSystem
The FullSystem variable can be used to determine the current mode of simulation.
virtual void setMiscReg(int misc_reg, const MiscReg &val)=0
virtual void setIntRegFlat(int idx, uint64_t val)=0
virtual TheISA::PCState pcState()=0
bool mcrMrc14TrapToHyp(const MiscRegIndex miscReg, HCR hcr, CPSR cpsr, SCR scr, HDCR hdcr, HSTR hstr, HCPTR hcptr, uint32_t iss)
ThreadContext is the external interface to all thread state for anything outside of the CPU...
int decodePhysAddrRange64(uint8_t pa_enc)
Returns the n.
virtual void setCCReg(int reg_idx, CCReg val)=0
bool ELIs64(ThreadContext *tc, ExceptionLevel el)
bool isBigEndian64(ThreadContext *tc)
uint8_t encodePhysAddrRange64(int pa_size)
Returns the encoding corresponding to the specified n.
static OperatingMode currOpMode(ThreadContext *tc)
virtual uint64_t readIntReg(int reg_idx)=0
int unflattenMiscReg(int reg)
bool haveLPAE() const
Returns true if this system implements the Large Physical Address Extension.
const int ReturnAddressReg
virtual int cpuId() const =0
bool multiProc
true if this a multiprocessor system
virtual void pcStateNoRecord(const TheISA::PCState &val)=0
uint64_t getArgument(ThreadContext *tc, int &number, uint16_t size, bool fp)
virtual TheISA::TLB * getDTBPtr()=0
const int StackPointerReg
bool mcrrMrrc15TrapToHyp(const MiscRegIndex miscReg, CPSR cpsr, SCR scr, HSTR hstr, HCR hcr, uint32_t iss)
bool SPAlignmentCheckEnabled(ThreadContext *tc)
static ExceptionLevel opModeToEL(OperatingMode mode)
T read(Addr address) const
Read sizeof(T) bytes from address and return as object T.
bool highestELIs64() const
Returns true if the register width of the highest implemented exception level is 64 bits (ARMv8) ...
const int NumArgumentRegs
bool haveSecurity() const
Returns true if this system implements the Security Extensions.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Addr roundPage(Addr addr)
#define ULL(N)
uint64_t constant
Addr truncPage(Addr addr)
bool msrMrs64TrapToMon(const MiscRegIndex miscReg, CPTR cptr, ExceptionLevel el, bool *isVfpNeon)
void skipFunction(ThreadContext *tc)
bool decodeMrsMsrBankedReg(uint8_t sysM, bool r, bool &isIntReg, int ®Idx, CPSR cpsr, SCR scr, NSACR nsacr, bool checkSecurity)
bool msrMrs64TrapToSup(const MiscRegIndex miscReg, ExceptionLevel el, CPACR cpacr)
virtual MiscReg readMiscReg(int misc_reg)=0
virtual FSTranslatingPortProxy & getVirtProxy()=0
virtual CheckerCPU * getCheckerCpuPtr()=0
virtual FloatReg readFloatRegFlat(int idx)=0
bool longDescFormatInUse(ThreadContext *tc)
bool haveVirtualization() const
Returns true if this system implements the virtualization Extensions.
GenericISA::SimplePCState< MachInst > PCState
static void mcrMrcIssExtract(uint32_t iss, bool &isRead, uint32_t &crm, IntRegIndex &rt, uint32_t &crn, uint32_t &opc1, uint32_t &opc2)
virtual int contextId() const =0
void initCPU(ThreadContext *tc, int cpuId)
TranslatingPortProxy Object Declaration for FS.
virtual uint32_t socketId() const =0
Addr purifyTaggedAddr(Addr addr, ThreadContext *tc, ExceptionLevel el, TTBCR tcr)
Removes the tag from tagged addresses if that mode is enabled.
bool mcrMrc15TrapToHyp(const MiscRegIndex miscReg, HCR hcr, CPSR cpsr, SCR scr, HDCR hdcr, HSTR hstr, HCPTR hcptr, uint32_t iss)
bool inAArch64(ThreadContext *tc)
uint32_t getMPIDR(ArmSystem *arm_sys, ThreadContext *tc)
bool msrMrs64TrapToHyp(const MiscRegIndex miscReg, ExceptionLevel el, bool isRead, CPTR cptr, HCR hcr, bool *isVfpNeon)
bool inSecureState(ThreadContext *tc)
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
virtual void setMiscRegNoEffect(int misc_reg, const MiscReg &val)=0
void copyRegs(ThreadContext *src, ThreadContext *dest)
std::shared_ptr< FaultBase > Fault
virtual TheISA::TLB * getITBPtr()=0
static int intRegInMode(OperatingMode mode, int reg)