arm: Make sure UndefinedInstructions are properly initialized
This commit is contained in:
parent
a00b44ebe8
commit
dbaf43394b
3 changed files with 17 additions and 12 deletions
|
@ -257,9 +257,9 @@ class UndefinedInstruction : public ArmFaultVals<UndefinedInstruction>
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
bool unknown;
|
bool unknown;
|
||||||
const char *mnemonic;
|
|
||||||
bool disabled;
|
bool disabled;
|
||||||
ExceptionClass overrideEc;
|
ExceptionClass overrideEc;
|
||||||
|
const char *mnemonic;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UndefinedInstruction(ExtMachInst _machInst,
|
UndefinedInstruction(ExtMachInst _machInst,
|
||||||
|
@ -267,12 +267,14 @@ class UndefinedInstruction : public ArmFaultVals<UndefinedInstruction>
|
||||||
const char *_mnemonic = NULL,
|
const char *_mnemonic = NULL,
|
||||||
bool _disabled = false) :
|
bool _disabled = false) :
|
||||||
ArmFaultVals<UndefinedInstruction>(_machInst),
|
ArmFaultVals<UndefinedInstruction>(_machInst),
|
||||||
unknown(_unknown), mnemonic(_mnemonic), disabled(_disabled),
|
unknown(_unknown), disabled(_disabled),
|
||||||
overrideEc(EC_INVALID)
|
overrideEc(EC_INVALID), mnemonic(_mnemonic)
|
||||||
{}
|
{}
|
||||||
UndefinedInstruction(ExtMachInst _machInst, uint32_t _iss, ExceptionClass _overrideEc) :
|
UndefinedInstruction(ExtMachInst _machInst, uint32_t _iss,
|
||||||
|
ExceptionClass _overrideEc, const char *_mnemonic = NULL) :
|
||||||
ArmFaultVals<UndefinedInstruction>(_machInst, _iss),
|
ArmFaultVals<UndefinedInstruction>(_machInst, _iss),
|
||||||
overrideEc(_overrideEc)
|
unknown(false), disabled(true), overrideEc(_overrideEc),
|
||||||
|
mnemonic(_mnemonic)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void invoke(ThreadContext *tc,
|
void invoke(ThreadContext *tc,
|
||||||
|
|
|
@ -294,7 +294,8 @@ let {{
|
||||||
flat_idx == MISCREG_DC_CVAC_Xt ||
|
flat_idx == MISCREG_DC_CVAC_Xt ||
|
||||||
flat_idx == MISCREG_DC_CIVAC_Xt
|
flat_idx == MISCREG_DC_CIVAC_Xt
|
||||||
)
|
)
|
||||||
return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64);
|
return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64,
|
||||||
|
mnemonic);
|
||||||
return new UndefinedInstruction(machInst, false, mnemonic);
|
return new UndefinedInstruction(machInst, false, mnemonic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +397,8 @@ let {{
|
||||||
if (!canWriteAArch64SysReg(
|
if (!canWriteAArch64SysReg(
|
||||||
(MiscRegIndex) xc->tcBase()->flattenMiscIndex(dest),
|
(MiscRegIndex) xc->tcBase()->flattenMiscIndex(dest),
|
||||||
Scr64, Cpsr, xc->tcBase())) {
|
Scr64, Cpsr, xc->tcBase())) {
|
||||||
return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64);
|
return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64,
|
||||||
|
mnemonic);
|
||||||
}
|
}
|
||||||
CPSR cpsr = Cpsr;
|
CPSR cpsr = Cpsr;
|
||||||
cpsr.daif = cpsr.daif | imm;
|
cpsr.daif = cpsr.daif | imm;
|
||||||
|
@ -407,7 +409,8 @@ let {{
|
||||||
if (!canWriteAArch64SysReg(
|
if (!canWriteAArch64SysReg(
|
||||||
(MiscRegIndex) xc->tcBase()->flattenMiscIndex(dest),
|
(MiscRegIndex) xc->tcBase()->flattenMiscIndex(dest),
|
||||||
Scr64, Cpsr, xc->tcBase())) {
|
Scr64, Cpsr, xc->tcBase())) {
|
||||||
return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64);
|
return new UndefinedInstruction(machInst, 0, EC_TRAPPED_MSR_MRS_64,
|
||||||
|
mnemonic);
|
||||||
}
|
}
|
||||||
CPSR cpsr = Cpsr;
|
CPSR cpsr = Cpsr;
|
||||||
cpsr.daif = cpsr.daif & ~imm;
|
cpsr.daif = cpsr.daif & ~imm;
|
||||||
|
|
|
@ -49,7 +49,7 @@ let {{
|
||||||
CPSR cpsrEnCheck = Cpsr;
|
CPSR cpsrEnCheck = Cpsr;
|
||||||
if (cpsrEnCheck.mode == MODE_HYP) {
|
if (cpsrEnCheck.mode == MODE_HYP) {
|
||||||
return new UndefinedInstruction(machInst, issEnCheck,
|
return new UndefinedInstruction(machInst, issEnCheck,
|
||||||
EC_TRAPPED_HCPTR);
|
EC_TRAPPED_HCPTR, mnemonic);
|
||||||
} else {
|
} else {
|
||||||
if (!inSecureState(Scr, Cpsr)) {
|
if (!inSecureState(Scr, Cpsr)) {
|
||||||
return new HypervisorTrap(machInst, issEnCheck,
|
return new HypervisorTrap(machInst, issEnCheck,
|
||||||
|
@ -96,7 +96,7 @@ let {{
|
||||||
CPSR cpsrEnCheck = Cpsr;
|
CPSR cpsrEnCheck = Cpsr;
|
||||||
if (cpsrEnCheck.mode == MODE_HYP) {
|
if (cpsrEnCheck.mode == MODE_HYP) {
|
||||||
return new UndefinedInstruction(machInst, issEnCheck,
|
return new UndefinedInstruction(machInst, issEnCheck,
|
||||||
EC_TRAPPED_HCPTR);
|
EC_TRAPPED_HCPTR, mnemonic);
|
||||||
} else {
|
} else {
|
||||||
if (!inSecureState(Scr, Cpsr)) {
|
if (!inSecureState(Scr, Cpsr)) {
|
||||||
return new HypervisorTrap(machInst, issEnCheck,
|
return new HypervisorTrap(machInst, issEnCheck,
|
||||||
|
@ -122,7 +122,7 @@ let {{
|
||||||
CPSR cpsrEnCheck = Cpsr;
|
CPSR cpsrEnCheck = Cpsr;
|
||||||
if (cpsrEnCheck.mode == MODE_HYP) {
|
if (cpsrEnCheck.mode == MODE_HYP) {
|
||||||
return new UndefinedInstruction(machInst, issEnCheck,
|
return new UndefinedInstruction(machInst, issEnCheck,
|
||||||
EC_TRAPPED_HCPTR);
|
EC_TRAPPED_HCPTR, mnemonic);
|
||||||
} else {
|
} else {
|
||||||
if (!inSecureState(Scr, Cpsr)) {
|
if (!inSecureState(Scr, Cpsr)) {
|
||||||
return new HypervisorTrap(machInst, issEnCheck,
|
return new HypervisorTrap(machInst, issEnCheck,
|
||||||
|
@ -142,7 +142,7 @@ let {{
|
||||||
CPSR cpsrEnCheck = Cpsr;
|
CPSR cpsrEnCheck = Cpsr;
|
||||||
if (cpsrEnCheck.mode == MODE_HYP) {
|
if (cpsrEnCheck.mode == MODE_HYP) {
|
||||||
return new UndefinedInstruction(machInst, issEnCheck,
|
return new UndefinedInstruction(machInst, issEnCheck,
|
||||||
EC_TRAPPED_HCPTR);
|
EC_TRAPPED_HCPTR, mnemonic);
|
||||||
} else {
|
} else {
|
||||||
if (!inSecureState(Scr, Cpsr)) {
|
if (!inSecureState(Scr, Cpsr)) {
|
||||||
return new HypervisorTrap(machInst, issEnCheck,
|
return new HypervisorTrap(machInst, issEnCheck,
|
||||||
|
|
Loading…
Reference in a new issue