info[MISCREG_BANKED] = v;
return *this;
}
+ chain banked64(bool v = true) const {
+ info[MISCREG_BANKED64] = v;
+ return *this;
+ }
chain bankedChild(bool v = true) const {
info[MISCREG_BANKED_CHILD] = v;
return *this;
inSecureState(miscRegs[MISCREG_SCR],
miscRegs[MISCREG_CPSR]);
flat_idx += secureReg ? 2 : 1;
+ } else {
+ flat_idx = snsBankedIndex64((MiscRegIndex)reg,
+ !inSecureState(miscRegs[MISCREG_SCR],
+ miscRegs[MISCREG_CPSR]));
}
}
return flat_idx;
}
+ int
+ snsBankedIndex64(MiscRegIndex reg, bool ns) const
+ {
+ int reg_as_int = static_cast<int>(reg);
+ if (miscRegInfo[reg][MISCREG_BANKED64]) {
+ reg_as_int += (haveSecurity && !ns) ? 2 : 1;
+ }
+ return reg_as_int;
+ }
+
std::pair<int,int> getMiscIndices(int misc_reg) const
{
// Note: indexes of AArch64 registers are left unchanged
'''
msr_check_code = '''
+ auto pre_flat = (MiscRegIndex)snsBankedIndex64(dest, xc->tcBase());
MiscRegIndex flat_idx = (MiscRegIndex) xc->tcBase()->
- flattenRegId(RegId(MiscRegClass, dest)).index();
+ flattenRegId(RegId(MiscRegClass, pre_flat)).index();
CPSR cpsr = Cpsr;
ExceptionLevel el = (ExceptionLevel) (uint8_t) cpsr.el;
%s
''' % (msrMrs64EnabledCheckCode % ('Write'),)
mrs_check_code = '''
+ auto pre_flat = (MiscRegIndex)snsBankedIndex64(op1, xc->tcBase());
MiscRegIndex flat_idx = (MiscRegIndex) xc->tcBase()->
- flattenRegId(RegId(MiscRegClass, op1)).index();
+ flattenRegId(RegId(MiscRegClass, pre_flat)).index();
CPSR cpsr = Cpsr;
ExceptionLevel el = (ExceptionLevel) (uint8_t) cpsr.el;
%s
def buildMsrImmInst(mnem, inst_name, code):
global header_output, decoder_output, exec_output
msrImmPermission = '''
- auto misc_index = (MiscRegIndex) xc->tcBase()->flattenRegId(
- RegId(MiscRegClass, dest)).index();
+ auto pre_flat =
+ (MiscRegIndex)snsBankedIndex64(dest, xc->tcBase());
+ MiscRegIndex misc_index = (MiscRegIndex) xc->tcBase()->
+ flattenRegId(RegId(MiscRegClass, pre_flat)).index();
if (!miscRegInfo[misc_index][MISCREG_IMPLEMENTED]) {
return std::make_shared<UndefinedInstruction>(
return reg_as_int;
}
+int
+snsBankedIndex64(MiscRegIndex reg, ThreadContext *tc)
+{
+ SCR scr = tc->readMiscReg(MISCREG_SCR);
+ return tc->getIsaPtr()->snsBankedIndex64(reg, scr.ns);
+}
/**
* If the reg is a child reg of a banked set, then the parent is the last
MISCREG_BANKED, // True if the register is banked between the two
// security states, and this is the parent node of the
// two banked registers
+ MISCREG_BANKED64, // True if the register is banked between the two
+ // security states, and this is the parent node of
+ // the two banked registers. Used in AA64 only.
MISCREG_BANKED_CHILD, // The entry is one of the child registers that
// forms a banked set of regs (along with the
// other child regs)
int
snsBankedIndex(MiscRegIndex reg, ThreadContext *tc, bool ns);
+ int
+ snsBankedIndex64(MiscRegIndex reg, ThreadContext *tc);
+
// Takes a misc reg index and returns the root reg if its one of a set of
// banked registers
void